CN113660487B - Parameter determination method and device for distributing corresponding bit number for frame image - Google Patents

Parameter determination method and device for distributing corresponding bit number for frame image Download PDF

Info

Publication number
CN113660487B
CN113660487B CN202110752337.8A CN202110752337A CN113660487B CN 113660487 B CN113660487 B CN 113660487B CN 202110752337 A CN202110752337 A CN 202110752337A CN 113660487 B CN113660487 B CN 113660487B
Authority
CN
China
Prior art keywords
frame image
current frame
image
bit number
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110752337.8A
Other languages
Chinese (zh)
Other versions
CN113660487A (en
Inventor
邹文欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Allwinner Technology Co Ltd filed Critical Allwinner Technology Co Ltd
Priority to CN202110752337.8A priority Critical patent/CN113660487B/en
Publication of CN113660487A publication Critical patent/CN113660487A/en
Application granted granted Critical
Publication of CN113660487B publication Critical patent/CN113660487B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/107Selection of coding mode or of prediction mode between spatial and temporal predictive coding, e.g. picture refresh
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/14Coding unit complexity, e.g. amount of activity or edge presence estimation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a parameter determination method and a device for distributing corresponding bit numbers for frame images, wherein the method directly executes coding operation on the current frame image of a video of a current scene, and according to the data of the current frame image after the coding operation is executed, the method comprises the following steps: the motion vector of the macro block of the P frame image and the bit number of the I frame image calculate the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image so as to accurately distribute the bit number of the next frame image of the current frame image, namely, the next frame image is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene can be accurately distributed, the delay of a video transmission channel can be reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video channel are saved, the application cost is reduced, and the scheme has universality and is easy to popularize and apply, and the user experience of a coded product is improved.

Description

Parameter determination method and device for distributing corresponding bit number for frame image
Technical Field
The present invention relates to the field of video coding technologies, and in particular, to a method and apparatus for determining parameters for allocating a corresponding number of bits to a frame image.
Background
In real-time video communication (such as video monitoring, video conference, etc.), how to transmit clear images in a limited bandwidth is always a hotspot in video coding research, wherein a video coding rate control algorithm is a key technology for improving the utilization rate of transmission bandwidth, and an encoder without the rate control technology is difficult to be applied in real-time video communication.
In practical applications, the conventional rate control algorithm includes CBR (Constant Bit Rate constant bit rate) and VBR (Variable Bit Rate dynamic bit rate). The CBR rate control technique keeps the number of bits output by the encoder constant in any scene, but the rate control technique is generally only applicable to a constant encoding scene, and is not applicable to a complex and changeable scene in real-time communication. The code rate of VBR coding fluctuates along with the scene information such as image complexity, image motion intensity and the like, the overall average code rate still remains basically unchanged, the code rate is properly reduced when the image is simple and the image motion intensity is low so as to save the bit number, and the code rate is properly increased to maintain the image definition when the image is complex and the image motion intensity is high so as to prevent serious mosaic from occurring after the image coding. One key point of implementing VBR rate control is how to efficiently and accurately judge the scene of the current image, so that the encoder can allocate a reasonable number of encoding bits to the current image according to the scene characteristics. In order to accurately determine the scene of the current image, the image needs to be preprocessed to obtain the scene information of the image before video encoding, for example: the absolute error sum of the current frame and the previous frame is used for measuring the coding complexity, and then the proper coding bit number is calculated according to the complexity; or inputting the image into an image scene classifier to obtain scene classification, and then calculating a proper coding bit number, wherein the scene classifier needs to store a few frames and reference frames of the input image as a classification judgment buffer area so as to calculate image motion or still information, and the texture complexity is obtained by adopting a method for calculating image gradient amplitude; or dividing the image into a plurality of areas with different scenes and different complexity through a specific video image processing algorithm, and respectively setting different coding bit numbers for the areas. However, it has been found in practice that performing preprocessing operations on the images increases the delay of the video transmission path, reducing the real-time nature of the video transmission.
Disclosure of Invention
The invention aims to solve the technical problem of providing a parameter determining method and a device for distributing corresponding bit numbers for frame images, which can reduce the delay of a video transmission path and improve the real-time performance of video transmission.
To solve the above technical problem, a first aspect of an embodiment of the present invention discloses a parameter determining method for allocating a corresponding number of bits to a frame image, the method including:
performing coding operation on the acquired current frame image of the current scene to obtain data of the current frame image;
determining an allocation parameter for allocating a corresponding bit number for a next frame image of the current frame image according to the data of the current frame image;
when the type of the current frame image is an I frame image type, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameter corresponding to the current frame image comprises the image complexity of the current frame image; when the type of the current frame image is the P frame image type, the data of the current frame image comprise the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprise the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image.
In a first aspect of the present invention, when the type of the current frame image is the I frame image type, the performing an encoding operation on the acquired current frame image of the current scene to obtain data of the current frame image includes:
performing coding operation on the current frame image based on the determined first parameter for detecting the scene complexity to obtain the bit number of the current frame image;
wherein the determining, according to the data of the current frame image, an allocation parameter for allocating a corresponding bit number to the current frame image includes:
and calculating the image complexity for distributing the corresponding bit number for the current frame image based on the bit number of the current frame image and the determined second parameter.
As an optional implementation manner, in the first aspect of the present invention, when the type of the current frame image is the P frame image type, the determining, according to the data of the current frame image, an allocation parameter for allocating a corresponding bit number to the current frame image includes:
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the content included in the data of all the macro blocks of the current frame image.
As an optional implementation manner, in the first aspect of the present invention, the calculating, according to contents included in data of all the macro blocks of the current frame image, an image motion intensity for allocating a corresponding bit number to the current frame image includes:
determining the duty ratio of a first macro block with the motion vector of zero and the duty ratio of a second macro block with the motion vector of non-zero from all the macro blocks according to the motion vectors of all the macro blocks of the current frame image;
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block.
As an optional implementation manner, in the first aspect of the present invention, the data of each of the macro blocks of the current frame image further includes a prediction type of each of the macro blocks, and the prediction type of each of the macro blocks includes an inter prediction type or an intra prediction type;
the method further comprises the steps of:
determining a duty ratio of a third macroblock of which the prediction type is the intra prediction type from among all the macroblocks when the prediction type of all the macroblocks includes the intra prediction type;
wherein the calculating the image motion intensity for allocating the corresponding bit number to the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block includes:
And calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block, the duty ratio of the second macro block and the duty ratio of the third macro block.
As an optional implementation manner, in the first aspect of the present invention, the encoding operation is performed on the current frame image by the determined encoder;
and, the method further comprises:
and in the process of executing the encoding operation on the current frame image in the current scene, inserting a reference I frame image into the encoder at intervals of preset time length to obtain the bit number corresponding to the reference I frame image, and calculating the image complexity of the current scene based on the bit number corresponding to the reference I frame image.
As an alternative embodiment, in the first aspect of the present invention, the method further includes:
distributing the corresponding frame bit number for the next frame image according to the distribution parameters corresponding to the current frame image and the determined distribution parameters matched with the previous frame image corresponding to the current frame image;
wherein the allocating the corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the determined allocation parameter matched with the previous frame image corresponding to the current frame image includes:
Calculating an adjusting coefficient of the next frame image according to the distribution parameter corresponding to the current frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
and distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the adjustment coefficient and the determined current frame image.
As an alternative embodiment, in the first aspect of the invention,
the calculation formula of the bit number corresponding to the current frame image is as follows:
T=S*T 0
S=a*cf+b*mf+c;
wherein, the T is the corresponding bit number allocated to the next frame of image; the T is 0 The reference bit number corresponding to the current frame image is obtained; the S is an adjusting coefficient of the next frame of image; the a, the b and the c are constants, and the types of the current frame images are different, and the a, the b and the c are also different; when the type of the current frame image is the I frame image type, the cf allocates the image complexity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image motion intensity corresponding to the previous frame image; when the type of the current frame image is the P frame image type, the cf allocates the image motion intensity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image complexity corresponding to the previous frame image.
A second aspect of the embodiment of the present invention discloses a parameter determining apparatus for allocating a corresponding number of bits to a frame image, the parameter determining apparatus including:
the encoding module is used for executing encoding operation on the acquired current frame image of the current scene to obtain data of the current frame image;
the determining module is used for determining an allocation parameter for allocating corresponding bit numbers for a next frame image of the current frame image according to the data of the current frame image;
when the type of the current frame image is an I frame image type, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameter corresponding to the current frame image comprises the image complexity of the current frame image; when the type of the current frame image is the P frame image type, the data of the current frame image comprise the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprise the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image.
In a second aspect of the present invention, when the type of the current frame image is the I frame image type, the encoding module performs an encoding operation on the acquired current frame image of the current scene to obtain data of the current frame image specifically:
Performing coding operation on the current frame image based on the determined first parameter for detecting the scene complexity to obtain the bit number of the current frame image;
wherein the determining, according to the data of the current frame image, an allocation parameter for allocating a corresponding bit number to the current frame image includes:
and calculating the image complexity for distributing the corresponding bit number for the current frame image based on the bit number of the current frame image and the determined second parameter.
As an optional implementation manner, in the second aspect of the present invention, when the type of the current frame image is the P frame image type, the determining module includes:
and the calculating sub-module is used for calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the content included in the data of all the macro blocks of the current frame image.
As an alternative embodiment, in a second aspect of the present invention, the computing submodule includes:
a determining unit configured to determine, from all the macroblocks of the current frame image, a duty ratio of a first macroblock whose motion vector is zero and a duty ratio of a second macroblock whose motion vector is non-zero, based on motion vectors of all the macroblocks;
And the calculating unit is used for calculating the image motion intensity for distributing the corresponding bit number to the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block.
As an optional implementation manner, in the second aspect of the present invention, the data of each of the macro blocks of the current frame image further includes a prediction type of each of the macro blocks, and the prediction type of each of the macro blocks includes an inter prediction type or an intra prediction type;
the determining unit is further configured to determine, when the prediction types of all the macroblocks include the intra prediction type, a duty ratio of a third macroblock whose prediction type is the intra prediction type from all the macroblocks;
the method for calculating the image motion intensity for distributing the corresponding bit number to the current frame image by the determining unit according to the duty ratio of the first macro block and the duty ratio of the second macro block specifically comprises the following steps:
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block, the duty ratio of the second macro block and the duty ratio of the third macro block.
As an optional implementation manner, in the second aspect of the present invention, the encoding operation is performed on the current frame image by the determined encoder;
And, the apparatus further comprises:
the inserting module is used for inserting a reference I frame image into the encoder at intervals of preset duration in the process of executing the encoding operation on the current frame image in the current scene by the encoding module so as to obtain the bit number corresponding to the reference I frame image;
and the calculating module is used for calculating the image complexity of the current scene based on the bit number corresponding to the reference I frame image.
As an alternative embodiment, in the second aspect of the present invention, the apparatus further includes:
the allocation module is used for allocating the corresponding frame bit number for the next frame image according to the allocation parameters corresponding to the current frame image and the determined allocation parameters matched with the previous frame image corresponding to the current frame image;
the mode that the allocation module allocates the corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the determined allocation parameter matched with the previous frame image corresponding to the current frame image specifically comprises the following steps:
calculating an adjusting coefficient of the next frame image according to the distribution parameter corresponding to the current frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
And distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the adjustment coefficient and the determined current frame image.
As an optional implementation manner, in the second aspect of the present invention, a calculation formula of the number of bits corresponding to the current frame image is as follows:
T=S*T 0
S=a*cf+b*mf+c;
wherein, the T is the corresponding bit number allocated to the next frame of image; the T is 0 The reference bit number corresponding to the current frame image is obtained; the S is an adjusting coefficient of the next frame of image; the a, the b and the c are constants, and the types of the current frame images are different, and the a, the b and the c are also different; when the type of the current frame image is the I frame image type, the cf allocates the image complexity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image motion intensity corresponding to the previous frame image; when the type of the current frame image is the P frame image type, the cf allocates the image motion intensity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image complexity corresponding to the previous frame image.
The third aspect of the present invention discloses another bluetooth on control device, which comprises:
a memory storing executable program code;
a processor coupled to the memory;
the processor invokes the executable program code stored in the memory to perform the operations of the bluetooth on control method disclosed in the first aspect of the present invention.
A fourth aspect of the present invention discloses a computer-readable storage medium storing computer instructions that, when invoked, are operable to perform the operations of the bluetooth on control method disclosed in the first aspect of the present invention.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
the embodiment of the invention discloses a parameter determination method and a device for distributing corresponding bit numbers for frame images, wherein the method is implemented by directly executing coding operation on the current frame image of a video of a current scene, and according to the data of the current frame image after the coding operation is implemented, the method comprises the following steps: the motion vector of the macro block of the P frame image and the bit number of the I frame image calculate the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image so as to accurately distribute the bit number of the next frame image of the current frame image, namely, the next frame image is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene can be accurately distributed, the delay of a video transmission channel can be reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video channel are saved, the application cost is reduced, and the scheme has universality and is easy to popularize and apply, and the user experience of a coded product is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a parameter determining method for allocating a corresponding number of bits to a frame image according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for determining parameters for assigning corresponding bit numbers to frame images according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a parameter determining apparatus for allocating a corresponding number of bits to a frame image according to an embodiment of the present invention;
fig. 4 is a schematic diagram of another configuration of a parameter determination apparatus for assigning a corresponding number of bits to a frame image according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a configuration of a parameter determination apparatus for allocating a corresponding number of bits to a frame image according to still another embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims and in the above-described figures are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or elements but may, in the alternative, include other steps or elements not expressly listed or inherent to such process, method, article, or device.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The invention discloses a parameter determination method and a device for distributing corresponding bit numbers for frame images, which can directly execute coding operation on the current frame image of a video of a current scene and can be used for processing data of the current frame image after the coding operation is executed, such as: the motion vector of the macro block of the P frame image and the bit number of the I frame image calculate the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image so as to accurately distribute the bit number of the next frame image of the current frame image, namely, the next frame image is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene can be accurately distributed, the delay of a video transmission channel can be reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video channel are saved, the application cost is reduced, and the scheme has universality and is easy to popularize and apply, and the user experience of a coded product is improved. The following will describe in detail.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a parameter determining method for allocating a corresponding bit number to a frame image according to an embodiment of the present invention. As shown in fig. 1, the parameter determining method for allocating a corresponding number of bits to a frame image may be applied to real-time video application scenarios such as video surveillance, video conference, video live broadcast, etc., and the parameter determining method for allocating a corresponding number of bits to a frame image may include the following operations:
101. and executing coding operation on the acquired current frame image of the current scene to obtain data of the current frame image.
In the embodiment of the invention, optionally, an encoder can be used for executing the encoding operation on the acquired current frame image, and an encoding algorithm can also be used for executing the encoding operation on the acquired current frame image, so that the encoder is preferentially used for executing the encoding operation on the current frame image. The encoder may be an encoder whose internal parameters may be modified, or may be an encoder whose internal parameters may not be modified (e.g., a third party encoder or a hardware-cured encoder inside the SOC).
102. And determining an allocation parameter for allocating a corresponding bit number for a next frame image of the current frame image according to the data of the current frame image.
In the embodiment of the invention, if the type of the current frame image is the I frame image type, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameters corresponding to the current frame image comprise the image complexity of the current frame image; if the type of the current frame image is the P frame image type, the data of the current frame image comprises the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprises the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image.
It can be seen that implementing the parameter determining method for allocating a corresponding bit number to a frame image described in fig. 1, by directly performing an encoding operation on a current frame image of a video of a current scene, and according to data of the current frame image after performing the encoding operation, for example: the motion vector of the macro block of the P frame image and the bit number of the I frame image calculate the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image so as to accurately distribute the bit number of the next frame image of the current frame image, namely, the next frame image is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene can be accurately distributed, the delay of a video transmission channel can be reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video channel are saved, the application cost is reduced, and the scheme has universality and is easy to popularize and apply, and the user experience of a coded product is improved.
In an alternative embodiment, if the type of the current frame image is an I frame image type, performing an encoding operation on the collected current frame image of the current scene to obtain data of the current frame image, including:
performing coding operation on the current frame image based on the determined first parameter for detecting the scene complexity to obtain the bit number of the current frame image;
wherein, determining an allocation parameter for allocating a corresponding bit number for the current frame image according to the data of the current frame image comprises:
and calculating the image complexity for distributing the corresponding bit number for the current frame image based on the bit number of the current frame image and the determined second parameter.
In this alternative embodiment, the first parameter may alternatively be a fixed qp value when the encoder is employed to perform the encoding operation on the current frame image. The encoder is set to a fixed qp value encoding mode and qp values are input to the encoder. Optionally, in the encoding process, the code rate control function of the encoder is turned off, so that the qp value of each block in the encoding process is kept consistent, and all blocks have the same comparison standard, so that the distribution accuracy of the bit number is improved.
In this optional embodiment, optionally, a calculation formula of the image complexity corresponding to the current frame image is:
cf=a 0 *C+b 0
wherein cf is the image complexity corresponding to the current frame image, C is the bit number of the current frame image, a 0 Is a first constant, b 0 Is a second constant. The second parameter comprises a first constant and a second constant, and the second parameter is a modulated parameter.
In this alternative embodiment, because the video continuity does not change too much in the image complexity within a period of time (e.g. 2 s), the image complexity of the current scene can be calculated at intervals of a preset time (e.g. 5 s), so that the resource and memory overhead can be further reduced, and the real-time performance of video communication can be improved.
Therefore, in the alternative embodiment, the image complexity of the current frame image is calculated by combining the bit number obtained by performing the encoding operation on the frame image of the current scene with other parameters, so that the calculation efficiency and accuracy of the image complexity of the current frame image can be improved, and the distribution accuracy and efficiency of the bit number of the current frame image are improved.
In another optional embodiment, if the type of the current frame image is a P frame image type, determining an allocation parameter for allocating a corresponding bit number to the current frame image according to the data of the current frame image includes:
And calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the content included in the data of all macro blocks of the current frame image.
In this optional embodiment, optionally, calculating, according to content included in data of all macro blocks of the current frame image, an image motion intensity for allocating a corresponding bit number to the current frame image includes:
determining the duty ratio of a first macro block with the motion vector of zero and the duty ratio of a second macro block with the motion vector of non-zero from all macro blocks according to the motion vectors of all macro blocks of the current frame image;
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block.
In this alternative embodiment, the duty cycle of the first macroblock is calculated as follows:
z r =z 0 /n 0
wherein z is r For the duty cycle of the first macroblock, z 0 Is the number of macroblocks of which the horizontal component and the vertical component of the motion vector are zero in all macroblocks of the current frame image, n 0 Is the number of all macroblocks of the current frame image.
The duty cycle of the second macroblock is calculated as follows:
m v =(s x +s y )/n 1
wherein m is v For the duty cycle of the second macroblock, s x S is the number of macro blocks with non-zero horizontal component of motion vector in all macro blocks of the current frame image y Vertical for motion vectors in all macroblocks of the current frame imageNumber of macro blocks with non-zero component, n 1 The number of macroblocks for which the horizontal component of the motion vector is non-zero or the vertical component is non-zero in all macroblocks of the current frame image.
In the alternative embodiment, in the process of encoding the current frame image, when the current macro block of the current frame image is encoded, searching an area matched with the same position of the current macro block in the reference frame image (such as a previous frame I frame image or a previous frame three frame image) of the current frame image, and determining a block with the similarity greater than or equal to a preset similarity threshold value in the area as a reference block of the current macro block so as to eliminate inter-frame redundancy for encoding compression. Wherein the size of the motion vector of each macro block is used to represent the size of the spatial distance between each macro block and the reference block of the macro block, and the larger the absolute value of the size of the motion vector of the macro block is, the farther the distance between the macro block and the reference block is, the larger the image motion amplitude contained in the macro block is, namely, the more intense the motion is, namely, the larger the image motion intensity is.
It can be seen that this alternative embodiment can improve the accuracy and reliability of the calculation of the image motion intensity by determining the duty ratio of the macro block with the motion vector of zero and the duty ratio of the macro block with the motion vector of non-zero respectively, and further calculating the image motion intensity of the current frame image based on the two duty ratios.
In yet another alternative embodiment, optionally, the data of each macroblock of the current frame image further includes a prediction type of each macroblock, and the prediction type of each macroblock includes an inter prediction type or an intra prediction type. Optionally, the method further comprises the steps of:
determining a duty ratio of a third macroblock of which the prediction type is the intra prediction type from among all macroblocks when the prediction type of all macroblocks includes the intra prediction type;
wherein calculating the image motion intensity for allocating the corresponding number of bits to the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block, comprises:
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block, the duty ratio of the second macro block and the duty ratio of the third macro block.
In this alternative embodiment, the duty cycle of the third macro block is used to represent the motion intensity of the image in the current frame image, wherein the larger the duty cycle of the third macro block, the greater the motion intensity of the image in the current frame image.
In this alternative embodiment, optionally, the method further comprises the steps of:
determining a first pixel value of an area where a current block of a current frame image is located, and determining a second pixel value of an area pointed by a motion vector to the area where the current block of the current frame image is located on a reference frame image of the current frame image;
Calculating a pixel difference value between the first pixel value and the second pixel value, judging whether the pixel difference value is larger than or equal to the determined pixel difference value threshold value, and determining that the prediction type of the current block of the current frame image is an intra-frame prediction type when the judgment result is yes; and when the judging result is negative, determining that the prediction type of the current block of the current frame image is the inter prediction type. In this way, through comparison of pixel values, a background which is originally in a state of being blocked by an object in an image or a new object appearing in a current scene can be determined as a macro block with a prediction type of intra-frame prediction type, and the determination comprehensiveness and accuracy of the macro block with the prediction type of intra-frame prediction type can be improved.
In this alternative embodiment, the duty cycle of the third macroblock is calculated as follows:
i r =i b /n b
wherein i is r For the duty cycle of the third macroblock, i b N is the number of macroblocks of intra prediction type and size n×n (n=4, 8, 16, etc.) among all macroblocks of the current frame image b The number of macro blocks of size n×n for all macro blocks of the current frame image.
In this alternative embodiment, the calculation formula of the image motion intensity corresponding to the current frame image is as follows:
mf=a 1 *m v +b 1 *i r -c 1 *z r +d 1
wherein mf is the motion intensity of the image corresponding to the current frame image, a 1 、b 1 、c 1 、d 1 Are constants and are modulated by the encoder.
In this alternative embodiment, the reference frame image of the current frame image is the previous frame image or a number of previous frame images.
Therefore, in this optional embodiment, the image motion intensity of the current frame image is calculated by combining the proportions of the macroblocks with intra-frame prediction types in all the macroblocks of the current frame image, so that the background in the current scene can be changed and/or a moving object is considered to be performed through the photographing device, and the calculation accuracy of the image motion intensity of the current frame image is improved, thereby being beneficial to improving the distribution accuracy of the bit number corresponding to the current frame image.
Example two
Referring to fig. 2, fig. 2 is a flowchart illustrating another method for determining parameters for allocating a corresponding number of bits to a frame image according to an embodiment of the present invention. As shown in fig. 2, the parameter determining method for allocating a corresponding number of bits to a frame image may be applied to real-time video application scenarios such as video surveillance, video conference, video live broadcast, etc., and the parameter determining method for allocating a corresponding number of bits to a frame image may include the following operations:
201. and executing coding operation on the acquired current frame image of the current scene to obtain data of the current frame image.
202. And determining an allocation parameter for allocating a corresponding bit number for a next frame image of the current frame image according to the data of the current frame image.
203. And distributing the corresponding frame bit number for the next frame image according to the distribution parameters corresponding to the current frame image and the determined distribution parameters matched with the previous frame image corresponding to the current frame image.
In the embodiment of the present invention, optionally, according to the allocation parameter corresponding to the current frame image and the allocation parameter matched with the determined previous frame image corresponding to the current frame image, allocating a corresponding frame bit number for the next frame image, including:
calculating an adjusting coefficient of a next frame image according to the distribution parameter corresponding to the current frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
and distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the determined current frame image by the adjusting coefficient.
In this optional embodiment, optionally, the previous frame image corresponding to the current frame image may be the previous first frame image or the previous third frame image, which is not limited.
In this optional embodiment, optionally, the reference bit number corresponding to the current frame image may be preset, or may be calculated according to the determined reference bit number and the determined frame rate. If the reference bit number corresponding to the current frame image is calculated by the determined reference bit number and the determined frame rate and the type of the current frame image is the type of the I frame image, the calculation formula of the reference bit number corresponding to the current frame image is as follows:
I s =(S s *a 3 )/(a 3 +m-1);
Wherein I is s S is the reference bit number corresponding to the current frame image s For reference number of reference bits, a 3 Is constant and m is frame rate.
If the type of the current frame image is the P frame image type, the calculation formula of the reference bit number corresponding to the current frame image is as follows:
P s =(S s )/(a 3 +m-1)
wherein P is s And the reference bit number corresponding to the current frame image.
In the embodiment of the present invention, optionally, the calculation formula of the bit number corresponding to the next frame of image is as follows:
T=S*T 0
S=a*cf+b*mf+c;
wherein, T is the corresponding bit number allocated to the next frame of image; t (T) 0 The reference bit number corresponding to the current frame image is obtained; s is the adjusting coefficient of the next frame of image;a. b and c are constants, and a, b and c are different from each other according to the type of the current frame image; if the type of the current frame image is the I frame image type, cf is the image complexity of the corresponding bit number allocated to the current frame image, mf is the allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image motion intensity corresponding to the previous frame image; if the type of the current frame image is the P frame image type, cf is the image motion intensity of the corresponding bit number allocated to the current frame image, mf is the allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image complexity corresponding to the previous frame image.
In the embodiment of the present invention, please refer to the detailed description of step 101 to step 102 in the first embodiment for the related description of step 201 and step 202, and the detailed description of the embodiment of the present invention is omitted.
Therefore, after the image complexity or the image motion intensity of the current frame image is obtained, the embodiment of the invention can further calculate the bit number adjusting coefficient of the next frame image by combining the distribution parameter (the image motion intensity or the image complexity of the previous frame image) matched with the previous frame image, and the bit number adjusting coefficient is combined with the reference bit number of the current frame image to distribute the corresponding bit number for the next frame image, so that the distribution accuracy and the distribution efficiency of the bit number corresponding to the next frame image of the current frame image can be improved, and the invention is suitable for changeable complex scenes, namely, the background in the visual field range of shooting equipment is greatly changed or the complex scene (such as starry sky at night), and the definition of the coding effect is ensured by distributing more bit numbers for the I frame image in the scene and/or distributing fewer bit numbers for the P frame image in the scene; for a static scene (namely a scene with smaller image motion intensity), as the similarity between the current frame image and the reference frame is very high, most of image contents are consistent with the reference frame, and the number of bits can be saved and the cost of resources and memory can be reduced by distributing fewer bits for the P frame image in the scene and keeping the number of bits of the I frame image stable, so that the clear video effect is obtained after the image coding is ensured; for a moving scene (especially a scene of intense movement), by distributing more bits for P-frame images and fewer bits for I-frame images in the scene, the method can ensure that the complex images can acquire clear video effects after encoding, save the cost of resources and memory even in a changeable scene, reduce the delay of video communication and improve the real-time performance of video communication.
It can be seen that implementing the parameter determining method for allocating a corresponding bit number to a frame image described in fig. 2, by directly performing an encoding operation on a current frame image of a video of a current scene, and according to data of the current frame image after performing the encoding operation, for example: the method and the device have the advantages that the motion vector of the macro block of the P frame image and the bit number of the I frame image are used for calculating the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image, so that the bit number of the next frame image of the current frame image is accurately distributed, namely, the next frame image of the current scene is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene is accurately distributed, the delay of a video transmission path is reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video path are saved, the application cost is reduced, the popularization and the application are easy, the user experience of a coded product is improved, the cost of resources and the memory is also reduced in the changeable scene, the delay of video communication is also reduced, and the instantaneity of video communication is improved.
In an alternative embodiment, the method may further comprise the steps of:
In the process of executing the encoding operation on the current frame image in the current scene, inserting a reference I frame image into the encoder at intervals of preset duration (for example, 10 s), obtaining the bit number corresponding to the reference I frame image, and calculating the image complexity of the current scene based on the bit number corresponding to the reference I frame image.
In this alternative embodiment, optionally, the preset time period may be dynamically changed, for example: the reference I-frame images may be inserted at intervals of 10s, may be inserted at intervals of 5s, or may be inserted when a detection request for the image complexity of the current scene is received.
In this alternative embodiment, optionally, the method may further comprise the steps of:
determining the real-time performance condition of the encoder;
when the real-time performance condition of the encoder is used for representing that the performance of the encoder is in a surplus state, deleting the data of the reference I frame image after calculating the image complexity of the current scene, and executing the encoding operation on the current frame image in the current scene, wherein the type of the current frame image comprises the type of the I frame image;
when the real-time performance condition of the encoder is used for indicating that the performance of the encoder is not in a surplus state or the real-time requirement of the current scene is greater than or equal to the determined real-time requirement, determining the reference I-frame image as the current I-frame image of the current scene, and executing the operation of determining the allocation parameters for allocating the corresponding bit number to the current frame image according to the data of the current frame image.
Therefore, in the alternative embodiment, the image complexity of the current scene is detected by periodically inserting the reference I-frame image, so that the image complexity of the current scene (especially, the scene complexity is lower, such as a white wall, etc.) can be detected by fully utilizing the resources of the encoder, and the corresponding bit number can be allocated to the frame image in time if the current scene changes, thereby obtaining a clear video effect after encoding; further, when the performance of the encoder is redundant, deleting the reference I frame image, so that the expenditure of resources and memory can be reduced and the instantaneity of the whole channel is not affected; when the performance of the encoder is not excessive or the real-time requirement of the current scene is high, after the image complexity of the current scene is detected based on the reference I-frame image, the encoder is directly used as a normal I-frame image to continue the subsequent operation, and the accuracy distribution of the bit number can be realized, so that the real-time performance of video communication is ensured.
Example III
Referring to fig. 3, fig. 3 is a schematic diagram of a parameter determining apparatus for allocating a corresponding bit number to a frame image according to an embodiment of the present invention. As shown in fig. 3, the parameter determining apparatus for allocating a corresponding number of bits to a frame image may be applied to real-time video application scenarios such as video surveillance, video conference, video live broadcast, etc., and the parameter determining apparatus for allocating a corresponding number of bits to a frame image may include an encoding module 301 and a determining module 302, where:
The encoding module 301 is configured to perform an encoding operation on a current frame image of the acquired current scene, to obtain data of the current frame image.
A determining module 302, configured to determine an allocation parameter for allocating a corresponding bit number to a next frame image of the current frame image according to data of the current frame image.
In the embodiment of the invention, if the type of the current frame image is the type of the I frame image, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameters corresponding to the current frame image comprise the image complexity of the current frame image; if the type of the current frame image is the P frame image type, the data of the current frame image comprises the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprises the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image.
It can be seen that implementing the parameter determining apparatus for allocating a corresponding number of bits to a frame image described in fig. 3, directly performs an encoding operation on a current frame image of a video of a current scene, and according to data of the current frame image after performing the encoding operation, for example: the motion vector of the macro block of the P frame image and the bit number of the I frame image calculate the image complexity corresponding to the current frame image or the image motion intensity corresponding to the current frame image so as to accurately distribute the bit number of the next frame image of the current frame image, namely, the next frame image is not required to be subjected to additional preprocessing operation, the bit number of the next frame image of the current scene can be accurately distributed, the delay of a video transmission channel can be reduced, the instantaneity of video transmission is improved, the computing resource cost and the memory cost of the video channel are saved, the application cost is reduced, and the scheme has universality and is easy to popularize and apply, and the user experience of a coded product is improved.
In another alternative embodiment, as shown in fig. 3, if the type of the current frame image is an I frame image type, the encoding module 301 performs an encoding operation on the collected current frame image of the current scene, and the manner of obtaining the data of the current frame image is specifically:
performing coding operation on the current frame image based on the determined first parameter for detecting the scene complexity to obtain the bit number of the current frame image;
wherein, determining an allocation parameter for allocating a corresponding bit number for the current frame image according to the data of the current frame image comprises:
and calculating the image complexity for distributing the corresponding bit number for the current frame image based on the bit number of the current frame image and the determined second parameter.
It can be seen that implementing the parameter determining apparatus for allocating a corresponding number of bits to a frame image described in fig. 3 can calculate the image complexity of the current frame image by combining the number of bits obtained by performing the encoding operation on the frame image of the current scene with other parameters, and can improve the calculation efficiency and accuracy of the image complexity of the current frame image, thereby improving the allocation accuracy and efficiency of the number of bits of the current frame image.
In another alternative embodiment, as shown in fig. 4, if the type of the current frame image is a P frame image type, the determining module 302 includes:
A calculating submodule 3021 for calculating an image motion intensity for assigning a corresponding number of bits to the current frame image based on contents included in data of all macro blocks of the current frame image.
In this alternative embodiment, as shown in fig. 4, the calculation submodule 3021 includes:
a determining unit 30211, configured to determine, from all macroblocks of the current frame image, a duty ratio of a first macroblock whose motion vector is zero and a duty ratio of a second macroblock whose motion vector is non-zero.
A calculating unit 30212 for calculating an image motion intensity for assigning a corresponding number of bits to the current frame image based on the duty ratio of the first macro block and the duty ratio of the second macro block.
It can be seen that implementing the parameter determining apparatus for allocating a corresponding number of bits to a frame image described in fig. 4 can improve the accuracy and reliability of the calculation of the image motion intensity by determining the duty ratio of the macro block whose motion vector is zero and the duty ratio of the macro block whose motion vector is non-zero, respectively, and further calculating the image motion intensity of the current frame image based on the two duty ratios.
In yet another alternative embodiment, as shown in fig. 4, the data of each macroblock of the current frame image further includes a prediction type of each macroblock, and the prediction type of each macroblock includes an inter prediction type or an intra prediction type;
The determining unit 30211 is further configured to determine, when the prediction types of all the macroblocks include the intra prediction type, a duty ratio of a third macroblock whose prediction type is the intra prediction type from among all the macroblocks.
The determining unit 30211 calculates the image motion intensity for allocating the corresponding number of bits to the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block specifically as follows:
an image motion intensity for assigning a corresponding number of bits to the frame image is calculated based on the duty ratio of the first macroblock, the duty ratio of the second macroblock, and the duty ratio of the third macroblock.
It can be seen that the parameter determining apparatus for allocating a corresponding number of bits to a frame image described in fig. 4 can calculate the image motion intensity of the current frame image by combining the proportions of the macroblocks of the intra-frame prediction type among all the macroblocks of the current frame image, and can change the background in the current scene and/or consider moving objects through the photographing apparatus, thereby improving the calculation accuracy of the image motion intensity of the current frame image, and further being beneficial to improving the allocation accuracy of the corresponding number of bits of the current frame image.
In yet another alternative embodiment, as shown in fig. 4, the apparatus further comprises:
The allocation module 303 is configured to allocate a corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the allocation parameter that matches the determined previous frame image corresponding to the current frame image.
The allocating module 303 allocates the corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the determined allocation parameter matched with the previous frame image corresponding to the current frame image specifically includes:
calculating an adjusting coefficient of the next frame image according to the distribution parameter corresponding to the next frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
and distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the determined current frame image by the adjusting coefficient.
In this alternative embodiment, the calculation formula of the bit number corresponding to the current frame image is as follows:
T=S*T 0
S=a*cf+b*mf+c;
wherein, T is the corresponding bit number allocated to the next frame of image; t (T) 0 The reference bit number corresponding to the current frame image is obtained; s is the adjusting coefficient of the next frame of image; a. b and c are constants, and a, b and c are different from each other according to the type of the current frame image; when the type of the current frame image is the I frame image type, cf is the image complexity of the corresponding bit number allocated to the current frame image, mf is the allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image motion intensity corresponding to the previous frame image; when the type of the current frame image is the P frame image type, cf is the image motion intensity of the corresponding bit number allocated to the current frame image, mf is the allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image complexity corresponding to the previous frame image.
It can be seen that, implementing the parameter determining apparatus for allocating a corresponding bit number to a frame image described in fig. 4 can further calculate a bit number adjustment coefficient of a next frame image by combining an allocation parameter (such as an image motion intensity or an image complexity of a previous frame image) matched with a previous frame image after obtaining an image complexity or an image motion intensity of a current frame image, and allocate the bit number adjustment coefficient to a corresponding bit number of the next frame image by combining a reference bit number of the current frame image, so as to improve allocation accuracy and efficiency of the corresponding bit number allocated to the next frame image of the current frame image, thereby adapting to a changeable complex scene, that is, a background in a field of view of a photographing device is changed greatly or a complex scene (such as a star sky at night), and ensuring definition of a coding effect by allocating more bit numbers to an I frame image in the scene and/or allocating fewer bit numbers to a P frame image in the scene; for a static scene (namely a scene with smaller image motion intensity), as the similarity between the current frame image and the reference frame is very high, most of image contents are consistent with the reference frame, and the number of bits can be saved and the cost of resources and memory can be reduced by distributing fewer bits to the P frame image in the scene and keeping the number of bits of the I frame image stable, so that the clear video effect is obtained after the image coding is ensured; for a moving scene (especially a scene of intense movement), by distributing more bits to P-frame images in the scene and less bits to I-frame images, the method can ensure that complex images can acquire clear video effects after encoding, save the cost of resources and memory even in a changeable scene, reduce the delay of video communication and improve the real-time performance of video communication.
In yet another alternative embodiment, the encoding operation is performed on the current frame image by the determined encoder. And, as shown in fig. 4, the apparatus further includes:
the inserting module 305 is configured to insert a reference I frame image into the encoder at a preset time interval (e.g. 10 s) in the process of performing the encoding operation on the current frame image in the current scene by the encoding module 301, so as to obtain the number of bits corresponding to the reference I frame image.
A calculating module 306, configured to calculate an image complexity of the current scene based on the number of bits corresponding to the reference I-frame image.
It can be seen that implementing the parameter determining apparatus for allocating a corresponding number of bits to a frame image as described in fig. 4 can detect the image complexity of the current scene by periodically inserting a reference I-frame image, and can fully utilize the resources of the encoder to detect the image complexity of the current scene (especially, the scene complexity is lower, such as a white wall, etc.), so that if the current scene changes, the corresponding number of bits can be allocated to the frame image in time, thereby obtaining a clear video effect after encoding.
Example five
Referring to fig. 5, fig. 5 is a schematic diagram illustrating another parameter determining apparatus for allocating a corresponding bit number to a frame image according to an embodiment of the present invention. As shown in fig. 5, the parameter determining means for allocating a corresponding number of bits to a frame image may include:
A memory 501 in which executable program codes are stored;
a processor 502 coupled to the memory 501;
further, an input interface 503 and an output interface 504 coupled to the processor 502 may also be included;
wherein the processor 502 invokes executable program code stored in the memory 501 for performing the steps of the parameter determination method for assigning a corresponding number of bits to a frame image described in embodiment one or embodiment two.
Example six
The embodiment of the invention discloses a computer-readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the steps of the parameter determination method for allocating a corresponding number of bits to a frame image described in the first or second embodiment.
Example seven
The embodiment of the invention discloses a computer program product, which comprises a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps of the parameter determining method for allocating a corresponding bit number to a frame image described in the first or second embodiment.
The apparatus embodiments described above are merely illustrative, wherein the modules illustrated as separate components may or may not be physically separate, and the components shown as modules may or may not be physical, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above detailed description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course by means of hardware. Based on such understanding, the foregoing technical solutions may be embodied essentially or in part in the form of a software product that may be stored in a computer-readable storage medium including Read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), programmable Read-Only Memory (Programmable Read-Only Memory, PROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), one-time programmable Read-Only Memory (OTPROM), electrically erasable programmable Read-Only Memory (EEPROM), compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM) or other optical disc Memory, magnetic disc Memory, tape Memory, or any other medium that can be used for computer-readable carrying or storing data.
Finally, it should be noted that: the embodiment of the invention discloses a parameter determining method and a device for allocating corresponding bit numbers for frame images, which are disclosed by the embodiment of the invention only for illustrating the technical scheme of the invention, but not limiting the technical scheme; although the invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that; the technical scheme recorded in the various embodiments can be modified or part of technical features in the technical scheme can be replaced equivalently; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (9)

1. A parameter determination method for assigning a corresponding number of bits to a frame image, the method comprising:
performing coding operation on the acquired current frame image of the current scene to obtain data of the current frame image;
determining an allocation parameter for allocating a corresponding bit number for a next frame image of the current frame image according to the data of the current frame image;
when the type of the current frame image is an I frame image type, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameter corresponding to the current frame image comprises the image complexity of the current frame image; when the type of the current frame image is a P frame image type, the data of the current frame image comprise the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprise the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image;
The method further comprises the steps of:
distributing the corresponding frame bit number for the next frame image according to the distribution parameters corresponding to the current frame image and the determined distribution parameters matched with the previous frame image corresponding to the current frame image;
wherein the allocating the corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the determined allocation parameter matched with the previous frame image corresponding to the current frame image includes:
calculating an adjusting coefficient of the next frame image according to the distribution parameter corresponding to the current frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
and distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the adjustment coefficient and the determined current frame image.
2. The parameter determining method for assigning a corresponding number of bits to a frame image according to claim 1, wherein when the type of the current frame image is the I-frame image type, the performing an encoding operation on the acquired current frame image of the current scene to obtain data of the current frame image includes:
performing coding operation on the current frame image based on the determined first parameter for detecting the scene complexity to obtain the bit number of the current frame image;
Wherein the determining, according to the data of the current frame image, an allocation parameter for allocating a corresponding bit number to the current frame image includes:
and calculating the image complexity for distributing the corresponding bit number for the current frame image based on the bit number of the current frame image and the determined second parameter.
3. The parameter determining method for allocating a corresponding number of bits to a frame picture according to claim 1, wherein when the type of the current frame picture is the P-frame picture type, the determining an allocation parameter for allocating a corresponding number of bits to the current frame picture from the data of the current frame picture includes:
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the content included in the data of all the macro blocks of the current frame image.
4. A parameter determination method for assigning a corresponding number of bits to a frame image according to claim 3, wherein said calculating an image motion intensity for assigning a corresponding number of bits to said current frame image based on contents included in data of all said macro blocks of said current frame image comprises:
Determining the duty ratio of a first macro block with the motion vector of zero and the duty ratio of a second macro block with the motion vector of non-zero from all the macro blocks according to the motion vectors of all the macro blocks of the current frame image;
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block.
5. The parameter determination method for assigning a corresponding number of bits to a frame picture according to claim 4, wherein the data of each of the macro blocks of the current frame picture further includes a prediction type of each of the macro blocks, the prediction type of each of the macro blocks including an inter prediction type or an intra prediction type;
the method further comprises the steps of:
determining a duty ratio of a third macroblock of which the prediction type is the intra prediction type from among all the macroblocks when the prediction type of all the macroblocks includes the intra prediction type;
wherein the calculating the image motion intensity for allocating the corresponding bit number to the current frame image according to the duty ratio of the first macro block and the duty ratio of the second macro block includes:
and calculating the image motion intensity for distributing the corresponding bit number for the current frame image according to the duty ratio of the first macro block, the duty ratio of the second macro block and the duty ratio of the third macro block.
6. The parameter determination method for assigning a corresponding number of bits to a frame image according to any one of claims 1 to 5, wherein an encoding operation is performed on the current frame image by the determined encoder;
and, the method further comprises:
inserting a reference I frame image into the encoder at intervals of preset time length in the process of executing coding operation on the current frame image in the current scene to obtain the bit number corresponding to the reference I frame image;
and calculating the image complexity of the current scene based on the bit number corresponding to the reference I frame image.
7. The parameter determining method for assigning a corresponding number of bits to a frame image according to any one of claims 1 to 5, wherein the calculation formula of the number of bits corresponding to the next frame image is as follows:
T=S*T 0
S=a*cf+b*mf+c;
wherein, the T is the corresponding bit number allocated to the next frame of image; the T is 0 The reference bit number corresponding to the current frame image is obtained; the S is an adjusting coefficient of the next frame of image; the a, the b and the c are constants, and the types of the current frame images are different, and the a, the b and the c are also different; when the type of the current frame image is the I frame image type, the cf allocates the image complexity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image motion intensity corresponding to the previous frame image; when the type of the current frame image is the P frame image type, the cf allocates the image motion intensity of the corresponding bit number for the current frame image, the mf is an allocation parameter matched with the previous frame image corresponding to the current frame image, and the allocation parameter matched with the previous frame image corresponding to the current frame image is the image complexity corresponding to the previous frame image.
8. A parameter determination apparatus for assigning a corresponding number of bits to a frame image, the parameter determination apparatus comprising:
the encoding module is used for executing encoding operation on the acquired current frame image of the current scene to obtain data of the current frame image;
the determining module is used for determining an allocation parameter for allocating corresponding bit numbers for a next frame image of the current frame image according to the data of the current frame image;
when the type of the current frame image is an I frame image type, the data of the current frame image comprises the bit number of the current frame image, and the distribution parameter corresponding to the current frame image comprises the image complexity of the current frame image; when the type of the current frame image is a P frame image type, the data of the current frame image comprise the data of all macro blocks of the current frame image, the data of each macro block of the current frame image comprise the motion vector of each macro block, and the distribution parameters corresponding to the current frame image comprise the image motion intensity of the current frame image;
the apparatus further comprises:
the allocation module is used for allocating the corresponding frame bit number for the next frame image according to the allocation parameters corresponding to the current frame image and the determined allocation parameters matched with the previous frame image corresponding to the current frame image;
The mode that the allocation module allocates the corresponding frame bit number for the next frame image according to the allocation parameter corresponding to the current frame image and the determined allocation parameter matched with the previous frame image corresponding to the current frame image specifically comprises the following steps:
calculating an adjusting coefficient of the next frame image according to the distribution parameter corresponding to the current frame image and the distribution parameter matched with the previous frame image corresponding to the current frame image;
and distributing the corresponding bit number for the next frame image according to the reference bit number corresponding to the adjustment coefficient and the determined current frame image.
9. A parameter determination apparatus for assigning a corresponding number of bits to a frame image, the parameter determination apparatus comprising:
a memory storing executable program code;
a processor coupled to the memory;
the processor invokes the executable program code stored in the memory to perform the parameter determination method for assigning a corresponding number of bits to a frame image as claimed in any one of claims 1-7.
CN202110752337.8A 2021-07-02 2021-07-02 Parameter determination method and device for distributing corresponding bit number for frame image Active CN113660487B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110752337.8A CN113660487B (en) 2021-07-02 2021-07-02 Parameter determination method and device for distributing corresponding bit number for frame image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110752337.8A CN113660487B (en) 2021-07-02 2021-07-02 Parameter determination method and device for distributing corresponding bit number for frame image

Publications (2)

Publication Number Publication Date
CN113660487A CN113660487A (en) 2021-11-16
CN113660487B true CN113660487B (en) 2024-03-19

Family

ID=78477911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110752337.8A Active CN113660487B (en) 2021-07-02 2021-07-02 Parameter determination method and device for distributing corresponding bit number for frame image

Country Status (1)

Country Link
CN (1) CN113660487B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104754335A (en) * 2015-03-09 2015-07-01 湖南国科微电子有限公司 Video coding rate control method
CN106572352A (en) * 2016-10-21 2017-04-19 浙江大华技术股份有限公司 Keyframe size control method and device
CN106657998A (en) * 2016-09-20 2017-05-10 杭州比特瑞旺电脑有限公司 KVM video coding quantization parameter range control method
CN106937112A (en) * 2017-03-31 2017-07-07 西安电子科技大学 Bit rate control method based on H.264 video compression standard
CN112073735A (en) * 2020-11-16 2020-12-11 北京世纪好未来教育科技有限公司 Video information processing method and device, electronic equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120281756A1 (en) * 2011-05-04 2012-11-08 Roncero Izquierdo Francisco J Complexity change detection for video transmission system
US20180184089A1 (en) * 2016-12-28 2018-06-28 Intel Corporation Target bit allocation for video coding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104754335A (en) * 2015-03-09 2015-07-01 湖南国科微电子有限公司 Video coding rate control method
CN106657998A (en) * 2016-09-20 2017-05-10 杭州比特瑞旺电脑有限公司 KVM video coding quantization parameter range control method
CN106572352A (en) * 2016-10-21 2017-04-19 浙江大华技术股份有限公司 Keyframe size control method and device
CN106937112A (en) * 2017-03-31 2017-07-07 西安电子科技大学 Bit rate control method based on H.264 video compression standard
CN112073735A (en) * 2020-11-16 2020-12-11 北京世纪好未来教育科技有限公司 Video information processing method and device, electronic equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A novel rate control scheme for H.264/SVC base layer;Tao Zhu;《2009 International Conference on Wireless Communications & Signal Processing》;全文 *
一种对R-Lambda码率控制模型的改进算法;王朋;《应用科学学报》;全文 *
一种新的面向H.264低比特流的码率控制方法;贺建新;曹岳辉;;中国图象图形学报(06);全文 *

Also Published As

Publication number Publication date
CN113660487A (en) 2021-11-16

Similar Documents

Publication Publication Date Title
US20200322619A1 (en) Systems and Methods of Encoding Multiple Video Streams for Adaptive Bitrate Streaming
KR102307771B1 (en) Video encoding method, computer device and storage medium
WO2021244341A1 (en) Picture coding method and apparatus, electronic device and computer readable storage medium
US11412229B2 (en) Method and apparatus for video encoding and decoding
CN108737825B (en) Video data encoding method, apparatus, computer device and storage medium
RU2377737C2 (en) Method and apparatus for encoder assisted frame rate up conversion (ea-fruc) for video compression
KR102266213B1 (en) Code rate allocation method for intra frame coded frames, computer equipment, and storage medium
KR100298416B1 (en) Method and apparatus for block classification and adaptive bit allocation
CN111010495B (en) Video denoising processing method and device
US20140241421A1 (en) Systems and Methods of Encoding Multiple Video Streams with Adaptive Quantization for Adaptive Bitrate Streaming
CN108012163B (en) Code rate control method and device for video coding
CN108810545B (en) Method, apparatus, computer readable medium and electronic device for video encoding
CN110876060B (en) Code rate adjusting method and device in coding process
WO2014190308A1 (en) Systems and methods of encoding multiple video streams with adaptive quantization for adaptive bitrate streaming
CN112672149B (en) Video processing method and device, storage medium and server
WO2020248715A1 (en) Coding management method and apparatus based on high efficiency video coding
CN112449182A (en) Video encoding method, device, equipment and storage medium
CN113660487B (en) Parameter determination method and device for distributing corresponding bit number for frame image
WO2023061129A1 (en) Video encoding method and apparatus, device, and storage medium
US10652538B2 (en) Video encoding method and system
CN116998148A (en) Coding method and device
CN108184114B (en) Method for rapidly judging Intra prediction mode in P frame based on Support Vector Machine (SVM)
CN111050175A (en) Method and apparatus for video encoding
CN116708933B (en) Video coding method and device
CA2862701A1 (en) Video encoding method, device, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant