CN117119189A - Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding - Google Patents
Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding Download PDFInfo
- Publication number
- CN117119189A CN117119189A CN202311265833.6A CN202311265833A CN117119189A CN 117119189 A CN117119189 A CN 117119189A CN 202311265833 A CN202311265833 A CN 202311265833A CN 117119189 A CN117119189 A CN 117119189A
- Authority
- CN
- China
- Prior art keywords
- coefficient
- quantization
- bit width
- transformation
- transform
- 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.)
- Pending
Links
- 238000013139 quantization Methods 0.000 title claims abstract description 349
- 238000000034 method Methods 0.000 title claims abstract description 115
- 239000011159 matrix material Substances 0.000 claims abstract description 210
- 230000009466 transformation Effects 0.000 claims abstract description 132
- 238000012545 processing Methods 0.000 claims abstract description 56
- 230000008569 process Effects 0.000 claims abstract description 37
- 230000006835 compression Effects 0.000 claims description 5
- 238000007906 compression Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 239000007787 solid Substances 0.000 description 3
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 230000035945 sensitivity Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000002349 favourable effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods 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/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/17—Methods 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/172—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/50—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The embodiment of the application discloses a quantization and inverse quantization method, a quantization and inverse quantization device and quantization equipment applied to video coding and decoding, and belongs to the technical field of video coding and decoding. The method comprises the following steps: determining a transformation coefficient matrix corresponding to a size block in a video frame, wherein the transformation coefficient matrix comprises transformation coefficients corresponding to different frequency domain positions in the size block; determining the bit width of the quantized coefficient corresponding to each transform coefficient based on the frequency domain position of each transform coefficient in the transform coefficient matrix, wherein the bit width of the quantized coefficient corresponding to the transform coefficient in a low frequency range is larger than the bit width of the quantized coefficient corresponding to the transform coefficient in a high frequency range; based on the bit width of the quantization coefficient corresponding to each transformation coefficient, carrying out quantization processing on the transformation coefficient matrix to obtain a quantization coefficient matrix corresponding to the size block in the video frame; the occupancy rate of the quantized bit width in the video coding and decoding process is optimized, and the video coding and decoding efficiency is improved.
Description
Technical Field
The embodiment of the application relates to the technical field of video coding and decoding, in particular to a quantization and inverse quantization method, a quantization and inverse quantization device and quantization equipment applied to video coding and decoding.
Background
Quantization refers to the process of mapping a continuous value (or a large number of possible discrete values) of a signal to a finite number of discrete magnitudes, implementing a many-to-one mapping of signal values. In video coding, the value of the transformation coefficient of a predicted and transformed digital video signal has a large dynamic range, and the value space of the signal can be effectively reduced by quantizing the transformation coefficient so as to save code rate.
In the related art, in the process of quantizing a transform coefficient, the transform coefficient is generally quantized only according to a quantized coefficient bit width specified in a video codec standard, and since there are significant low-frequency signals and high-frequency signals in the transform coefficient, the low-frequency signals may require a larger coefficient bit width to reduce distortion, and the high-frequency signals may not require a larger coefficient bit width.
Therefore, based on the digital width of the quantized coefficient in the video coding and decoding standard, the unified quantization processing is performed on the transform coefficient, so that the quantized coefficient needs to occupy more bandwidth, and the coding efficiency is reduced.
Disclosure of Invention
The embodiment of the application provides a quantization and inverse quantization method, a quantization and inverse quantization device and a quantization and inverse quantization device applied to video coding and decoding, which can reduce the occupation rate of quantization bit width in the video coding and decoding process and improve the video coding and decoding efficiency. The technical scheme is as follows:
In one aspect, an embodiment of the present application provides a quantization method applied to video coding, the method including:
determining a transformation coefficient matrix corresponding to a size block in a video frame, wherein the transformation coefficient matrix comprises transformation coefficients corresponding to different frequency domain positions in the size block, and the size block is obtained by dividing the video frame and performing frequency domain transformation;
determining the bit width of the quantized coefficient corresponding to each transform coefficient based on the frequency domain position of each transform coefficient in the transform coefficient matrix, wherein the bit width of the quantized coefficient corresponding to the transform coefficient in a low frequency range is larger than the bit width of the quantized coefficient corresponding to the transform coefficient in a high frequency range;
and carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
Optionally, the determining, based on the frequency domain position where each transform coefficient in the transform coefficient matrix is located, the quantized coefficient bit width corresponding to each transform coefficient includes:
determining a scanning number corresponding to each transformation coefficient in the transformation coefficient matrix corresponding to the size block based on a scanning mode;
And determining the bit width of the quantized coefficient corresponding to each transform coefficient in the transform coefficient matrix based on the scan number.
Optionally, the determining, based on the scanning manner, a scanning number corresponding to each transform coefficient in the transform coefficient matrix corresponding to the size block includes:
determining a direct current component coefficient in the transformation coefficient matrix, wherein the frequency domain range corresponding to the direct current component coefficient is lower than the frequency domain range corresponding to other transformation coefficients;
scanning the transformation coefficient matrix by taking the frequency domain position of the direct current component coefficient as a starting point;
and determining a scanning number corresponding to each transformation coefficient in the transformation coefficient matrix based on the scanning mode and the scanning sequence, wherein the scanning mode is one of diagonal scanning, horizontal scanning and vertical scanning.
Optionally, the determining, based on the scan number, a quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix includes:
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
in the case where the scan number is not smaller than the first number threshold, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as a second coefficient bit width, which is different from the first coefficient bit width.
Optionally, the first coefficient bit width is a standard bit width specified in the coding standard, and the second coefficient bit width is another coefficient bit width smaller than the standard bit width.
Optionally, the determining, based on the scan number, a quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix further includes:
determining at least two numbering thresholds, wherein the ith numbering threshold is smaller than the (i+1) th numbering threshold;
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
and determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as an i+1th coefficient bit width, wherein the i+1th coefficient bit width is smaller than the i+1th coefficient bit width, when the scan number is not smaller than the i number threshold and smaller than the i+1th number threshold.
Optionally, the determining, based on the scan number, a quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix further includes:
determining at least one number set, wherein the number set comprises at least one preset scanning number, and different number sets correspond to different quantization coefficient bit widths;
When the scan number belongs to the i-th number set, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as the i-th coefficient bit width.
Optionally, the method further comprises:
under the condition of carrying out symbol bit hiding processing on the transformation coefficient, acquiring a coefficient adjustment value in the process of symbol bit hiding processing;
determining a quantization coefficient range corresponding to each transformation coefficient based on the quantization coefficient bit width corresponding to the transformation coefficient and the coefficient adjustment value;
the quantization coefficient matrix based on the bit width of the quantization coefficient corresponding to each transformation coefficient, performing quantization processing on the transformation coefficient matrix to obtain a quantization coefficient matrix corresponding to the size block in the video frame, including:
and carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width and the quantization coefficient range corresponding to each transformation coefficient to obtain the quantization coefficient matrix corresponding to the size block in the video frame.
Optionally, in the case of using an implicit codec, the bit widths of quantized coefficients corresponding to the transform coefficients in the transform coefficient matrix are agreed by the video encoding end and the video decoding end through the implicit codec.
Optionally, the method further comprises:
after obtaining the quantized coefficient bit width corresponding to each transformation coefficient in the transformation coefficient matrix, writing the quantized coefficient bit width corresponding to each transformation coefficient into a video frame parameter set, and obtaining the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix by a video decoding end based on the video frame parameter set;
the writing mode comprises writing the quantization coefficient bit width, or writing a bit width difference value between the quantization coefficient bit width and a default bit width of a parameter set, or writing at least one of the bit width difference values after encoding compression.
In another aspect, an embodiment of the present application provides an inverse quantization method applied to video decoding, the method including:
determining a quantization coefficient matrix corresponding to a size block in a video frame based on a video code stream corresponding to the video frame, wherein the quantization coefficient matrix comprises quantization coefficients corresponding to different frequency domain positions in the size block;
and performing inverse quantization processing on the quantized coefficient matrix based on the bit width of the quantized coefficient corresponding to each quantized coefficient in the quantized coefficient matrix to obtain a transformation coefficient matrix corresponding to the size block in the video frame.
Optionally, before performing inverse quantization processing on the quantized coefficient matrix based on the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix to obtain the transform coefficient matrix corresponding to the size block in the video frame, the method further includes:
under the condition of adopting an implicit coding and decoding protocol, acquiring the bit width of the quantization coefficient corresponding to each quantization coefficient in the quantization coefficient matrix from the implicit coding and decoding protocol;
in the case of an explicit codec protocol, the quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix is determined based on a video frame parameter set.
In another aspect, an embodiment of the present application provides a quantization apparatus applied to video coding, the apparatus including:
the first determining module is used for determining a transformation coefficient matrix corresponding to a size block in a video frame, wherein the transformation coefficient matrix comprises transformation coefficients corresponding to different frequency domain positions in the size block, and the size block is obtained by dividing the video frame and performing frequency domain transformation;
a second determining module, configured to determine, based on a frequency domain position where each transform coefficient in the transform coefficient matrix is located, a quantization coefficient bit width corresponding to each transform coefficient, where the quantization coefficient bit width corresponding to the transform coefficient in a low frequency range is greater than the quantization coefficient bit width corresponding to the transform coefficient in a high frequency range;
And the quantization module is used for carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
In another aspect, an embodiment of the present application provides an inverse quantization apparatus applied to video decoding, the apparatus comprising:
the first determining module is used for determining a quantization coefficient matrix corresponding to a size block in a video frame based on a video code stream corresponding to the video frame, wherein the quantization coefficient matrix comprises quantization coefficients corresponding to different frequency domain positions in the size block;
and the inverse quantization module is used for performing inverse quantization processing on the quantization coefficient matrix based on the quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix to obtain a transformation coefficient matrix corresponding to the size block in the video frame.
In another aspect, embodiments of the present application provide a video encoder including an integrated circuit therein for implementing a quantization method applied to video encoding as described in the above aspect.
In another aspect, embodiments of the present application provide a video decoder including an integrated circuit therein for implementing the dequantization method applied to video decoding as described in the above aspect.
In another aspect, an embodiment of the present application provides a computer device including a processor and a memory; the memory stores at least one instruction for execution by the processor to implement a quantization method as described in the above aspect applied to video encoding or an inverse quantization method as described in the above aspect applied to video decoding.
In another aspect, embodiments of the present application provide a computer readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a quantization method applied to video encoding as described in the above aspect, or an inverse quantization method applied to video decoding as described in the above aspect.
In another aspect, embodiments of the present application provide a computer program product comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the quantization method applied to video encoding as described in the above aspect, or the inverse quantization method applied to video decoding as described in the above aspect.
In the embodiment of the application, after the transformation coefficient matrix corresponding to each size block in a video frame is determined in the video coding process, the transformation coefficient matrix is not quantized according to the standard quantization coefficient bit width in the coding standard, but the quantization coefficient bit width corresponding to each transformation coefficient is determined according to the frequency domain position of each transformation coefficient in the transformation coefficient matrix, so that the quantization coefficient bit width corresponding to the transformation coefficient in a low frequency range is larger than the quantization coefficient bit width corresponding to the transformation coefficient in a high frequency range, and then the transformation coefficient matrix is quantized according to the quantization coefficient bit width corresponding to each transformation coefficient, so as to obtain the quantization coefficient matrix corresponding to each size block in the video frame; by adopting the scheme provided by the embodiment of the application, the occupancy rate of the quantized bit width can be optimized and the video coding and decoding efficiency can be improved while the quantized distortion of the low-frequency region is reduced in the video coding and decoding process.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, 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 application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of video encoding and decoding according to an embodiment of the present application;
fig. 2 shows a flowchart of a quantization method applied to video coding according to an exemplary embodiment of the present application;
fig. 3 shows a flowchart of a quantization method applied to video coding according to another exemplary embodiment of the present application;
FIG. 4 is a schematic diagram of a scan sequence corresponding to different scan modes according to an exemplary embodiment of the present application;
FIG. 5 is a schematic diagram of determining scan numbers corresponding to transform coefficients using a diagonal scan method according to an exemplary embodiment of the present application;
FIG. 6 is a schematic diagram of determining quantization coefficient bit widths based on a set of numbers according to an exemplary embodiment of the present application;
fig. 7 shows a flowchart of an inverse quantization method applied to video decoding according to an exemplary embodiment of the present application;
fig. 8 is a schematic flow chart of video encoding and decoding according to another embodiment of the present application;
fig. 9 is a block diagram illustrating a quantization apparatus applied to video coding according to an exemplary embodiment of the present application;
fig. 10 is a block diagram illustrating an inverse quantization apparatus applied to video decoding according to an exemplary embodiment of the present application;
Fig. 11 is a schematic diagram showing the structure of a computer device according to an exemplary embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Video Coding (Coding) and video decoding (Encoding) are widely used in digital video applications such as broadcast digital TV, video transmission via the internet and mobile networks, real-time session applications such as video chat and video conferencing, DVD and blu-ray discs, video content acquisition and editing systems, and camcorders for security applications.
Illustratively, as shown in fig. 1, the process of video encoding mainly includes prediction, transformation, quantization, and entropy encoding, while the process of video decoding mainly includes entropy decoding, inverse quantization, inverse transformation, and prediction.
In the video coding process, a coding end can obtain a prediction block by performing prediction coding on a coding block of an image, calculate a residual signal according to the current coding block and the prediction block, map the residual signal of the image to a transformation domain through transformation to obtain a transformation coefficient matrix, so that the energy of the image in the transformation domain is more concentrated, the frequency domain correlation of the signal is removed, further map a coefficient to be coded in the transformation coefficient matrix into a codeword through quantization, and convert a codeword index corresponding to the codeword or other information for indicating the codeword into a binary code stream through entropy coding, thereby generating a video code stream.
Predictive coding (Predictive Coding): the method comprises the following steps of intra-frame prediction, inter-frame prediction and the like, and the original video signal is predicted by the selected reconstructed video signal to obtain a residual video signal. The coding end needs to decide which predictive coding mode to select for the current coding block and informs the decoding end, wherein the intra-frame prediction refers to that a predicted signal comes from a region which is already coded and rebuilt in the same image; inter prediction refers to a predicted signal from an already encoded picture (referred to as a reference picture) other than the current picture.
Transform & Quantization): the residual video signal is subjected to transformation operations such as DFT (Discrete Fourier Transform ), DCT (Discrete Cosine Transform, discrete cosine transform), etc., and then the signal is converted into a transform domain, which is called a transform coefficient. The transformation coefficient is further subjected to lossy quantization operation, and certain information is lost, so that the quantized signal is favorable for compression expression. In some video coding standards, there may be more than one transform mode to choose, so the coding end also needs to choose one of the transform modes for the current coding block and inform the decoding end. The degree of refinement of quantization is usually determined by the quantization parameter (Quantization Parameter, QP), with larger QP values, coefficients representing a larger range of values being quantized to the same output, thus usually resulting in greater distortion and lower code rate; conversely, a smaller QP value will represent a smaller range of coefficients to be quantized to the same output, and therefore will typically result in less distortion, while corresponding to a higher code rate.
Entropy Coding (Entropy Coding) or statistical Coding: the quantized transform domain signal is subjected to statistical compression coding according to the occurrence frequency of each value, and finally a binary (0 or 1) compressed code stream is output. Meanwhile, encoding generates other information, such as a selected encoding mode, motion vector data, etc., and entropy encoding is also required to reduce the code rate. The statistical coding is a lossless coding mode, which can effectively reduce the code rate required for expressing the same signal, and common statistical coding modes are variable length coding (Variable Length Coding, VLC) or context-based binary arithmetic coding (Content Adaptive Binary Arithmetic Coding, CABAC).
In the related art, in the video encoding process, after the encoding end obtains the transform coefficient matrix corresponding to each size block in the video frame through the transform process, in the process of quantizing the transform coefficient matrix based on the quantization parameter, the quantization coefficient is required only by referring to the quantization coefficient bit width specified in the encoding standard, for example, the h.266 standard defines the bit width of the quantization coefficient as 16 bits, and the h.265 standard defines the bit width of the quantization coefficient as 8 bits. After the transformation, most of the energy of the residual signal is mainly concentrated in the low frequency region, and the value range of the high frequency signal is smaller, so that the transformation coefficient matrix is quantized only according to the quantization coefficient bit width defined by the standard, and the low frequency coefficient and the high frequency coefficient adopt a unified bit width standard, so that the quantized bit width occupancy rate is higher.
Therefore, in the embodiment of the application, after the transformation coefficient matrix corresponding to each size block in the video frame is obtained, the transformation coefficient matrix is not directly quantized according to the quantization parameter, but the coefficient bit width corresponding to each transformation coefficient is adaptively determined according to the frequency domain range corresponding to the transformation coefficient in the transformation coefficient matrix, and further the transformation coefficient matrix is quantized according to the coefficient bit width, so that the signal in the low frequency range can adopt a larger bit width to keep the precision of the low frequency signal, and the signal in the high frequency range adopts a smaller bit width to save the cost of the coefficient bandwidth.
Referring to fig. 2, a flowchart of a quantization method applied to video coding according to an exemplary embodiment of the present application is shown, where the method is used for a video coding end as an example, and the method includes the following steps:
step 201, determining a transformation coefficient matrix corresponding to a size block in a video frame, where the transformation coefficient matrix includes transformation coefficients corresponding to different frequency domain positions in the size block, where the size block is obtained by dividing the video frame and performing frequency domain transformation.
In some embodiments, the encoding end firstly divides the video frame to obtain each image block corresponding to the video frame, so as to perform predictive coding on each image block to obtain a corresponding coding block and a prediction block, and further perform frequency domain transformation processing on a residual signal obtained by the predictive coding to obtain a size block after frequency domain transformation, namely determining a transformation coefficient matrix corresponding to each size block in the video frame.
Alternatively, the frequency domain transform may be DFT transform, DCT transform, or the like, which is not limited by the embodiment of the present application.
Optionally, the transform coefficient matrix includes transform coefficients corresponding to different frequency domain positions in the size block, where the values of the low-frequency coefficients are generally larger and concentrated in the upper left corner of the transform coefficient matrix, and the number of high-frequency coefficients is greater, but the values of the high-frequency coefficients are generally smaller.
Step 202, determining the quantization coefficient bit width corresponding to each transform coefficient based on the frequency domain position of each transform coefficient in the transform coefficient matrix, wherein the quantization coefficient bit width corresponding to the transform coefficient in the low frequency range is larger than the quantization coefficient bit width corresponding to the transform coefficient in the high frequency range.
In the embodiment of the application, in order to reduce the occupancy rate of the quantized bit width while guaranteeing the quantization precision of the low-frequency signal, the encoding end can firstly determine the frequency domain position of each transform coefficient in the transform coefficient matrix, thereby determining the quantized coefficient bit width corresponding to each transform coefficient according to the frequency domain position of each transform coefficient.
In some embodiments, considering that the sensitivity of human eyes to high-frequency information is low, and the sensitivity to low-frequency information is high, that is, in the quantization process, the encoding end needs to preferentially ensure the precision of the low-frequency signal to reduce quantization distortion, so that in order to ensure the quantization precision of the low-frequency signal while reducing the occupation rate of quantization bit width as much as possible, the encoding end can use a larger quantization coefficient bit width for the transform coefficients in the low-frequency range and a smaller quantization coefficient bit width for the transform coefficients in the high-frequency range.
In an illustrative example, the encoding side may employ a 16-bit quantized coefficient bit width for several transform coefficients located in the upper left corner of the transform coefficient matrix and less than 16-bit other quantized coefficient bit widths for other transform coefficients located in the transform coefficient matrix.
And 203, carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
In some embodiments, after determining the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix, the encoding end may perform quantization processing on the transform coefficient matrix according to the quantization coefficient bit width corresponding to each transform coefficient, so as to obtain a quantization coefficient matrix corresponding to each size block in the video frame.
In one possible implementation manner, the encoding end first determines a quantization parameter, and in the process of performing quantization processing on the transform coefficient matrix through the quantization parameter, the quantization coefficient is simultaneously required according to the bit width of the quantization coefficient, so as to obtain quantization coefficients corresponding to each transform coefficient, and thus, the quantization coefficient matrix is obtained.
In an illustrative example, the encoding end determines quantization parameters (the quantization step length is 10), so that each transformation coefficient is quantized based on the quantization step length, namely, the transformation coefficient is divided by 10 and then rounded to the nearest integer, and meanwhile, the requirement of the bit width of the quantization coefficient is increased, so that the bit width of the quantization coefficient corresponding to the low-frequency transformation coefficient is 16 bits, the bit width of the quantization coefficient corresponding to the high-frequency transformation coefficient is 8 bits, and the obtained quantization coefficient in the low-frequency range in the quantization coefficient matrix has larger bit width, and the precision of the low-frequency signal is ensured; quantized coefficients in the high frequency range have smaller bit widths, saving coefficient bandwidth.
In summary, in the embodiment of the present application, after determining the transform coefficient matrix corresponding to each size block in the video frame in the video encoding process, instead of performing quantization processing on the transform coefficient matrix according to the standard quantization coefficient bit width in the encoding standard, the quantization coefficient bit width corresponding to each transform coefficient is determined according to the frequency domain position where each transform coefficient in the transform coefficient matrix is located, so that the quantization coefficient bit width corresponding to the transform coefficient in the low frequency range is greater than the quantization coefficient bit width corresponding to the transform coefficient in the high frequency range, and then performing quantization processing on the transform coefficient matrix according to the quantization coefficient bit width corresponding to each transform coefficient, to obtain the quantization coefficient matrix corresponding to each size block in the video frame; by adopting the scheme provided by the embodiment of the application, the occupancy rate of the quantized bit width can be optimized and the video coding and decoding efficiency can be improved while the quantized distortion of the low-frequency region is reduced in the video coding and decoding process.
In some embodiments, in order to more reasonably determine the quantized coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix, the video encoding end may further number each transform coefficient according to the coefficient scan, so as to set the quantized coefficient bit width corresponding to each transform coefficient according to the number.
Referring to fig. 3, a flowchart of a quantization method applied to video coding according to another exemplary embodiment of the present application is shown, where the method is used for a video coding end as an example, and the method includes the following steps:
step 301, determining a transformation coefficient matrix corresponding to a size block in a video frame, where the transformation coefficient matrix includes transformation coefficients corresponding to different frequency domain positions in the size block, where the size block is obtained by dividing the video frame and performing frequency domain transformation.
Reference may be made to step 201 for the specific implementation of this step, and this embodiment is not described here in detail.
Step 302, determining a scan number corresponding to each transform coefficient in the transform coefficient matrix corresponding to the size block based on the scan mode.
In some embodiments, in order to more reasonably determine the bit width of the quantized coefficient corresponding to each transform coefficient in the transform coefficient matrix, the encoding end may further determine the scan number corresponding to each transform coefficient according to the scan mode by performing coefficient scan on the transform coefficient in the transform coefficient matrix while increasing the occupancy rate of the quantized bit width and reducing quantization distortion.
Alternatively, the coefficient scanning method may be one of diagonal scanning, horizontal scanning, and vertical scanning. Schematically, as shown in fig. 4, a scanning sequence corresponding to different scanning modes is shown.
In one possible implementation manner, in order to improve the numbering efficiency, the encoding end may determine the direct current component coefficient (DC coefficient) in the transform coefficient matrix, where the frequency domain range corresponding to the direct current component coefficient is lower than the frequency domain range corresponding to other transform coefficients, further scan the transform coefficient matrix with the frequency domain position where the direct current component coefficient is located as a starting point, and determine the scan number corresponding to each transform coefficient in the transform coefficient matrix according to the scan mode and the scan order.
In a possible implementation manner, the encoding end scans the transform coefficient matrix from the DC coefficient located at the upper left corner of the transform coefficient matrix by means of diagonal scanning, so as to determine that the scan number of the DC coefficient is 0, and determines the scan number corresponding to each transform coefficient according to the scan sequence and so on.
Schematically, as shown in fig. 5, it shows the scan numbers corresponding to the respective transform coefficients in the transform coefficient matrix in the case of using diagonal scan, where the size block 501 uses an 8×8 diagonal scan method and the size block 502 uses a diagonal scan method for every 2×2 units.
Step 303, based on the scan number, determining the quantized coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix.
In some embodiments, after determining the scan number corresponding to each transform coefficient in the transform coefficient matrix, the encoding end may determine the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix according to the scan number, for example, the smaller the scan number, the larger the quantization coefficient bit width.
In some embodiments, the encoding end may further set a number threshold, and determine, according to the scan number and the number threshold, a quantization coefficient bit width corresponding to each transform coefficient.
In one possible implementation manner, the encoding end determines the quantization coefficient bit width corresponding to each transform coefficient according to the scan number and the first number threshold. Under the condition that the scanning number is smaller than the first number threshold, the encoding end determines the quantization coefficient bit width of the transformation coefficient corresponding to the scanning number as the first coefficient bit width; under the condition that the scanning number is not smaller than the first number threshold, the encoding end determines the quantization coefficient bit width of the transformation coefficient corresponding to the scanning number as a second coefficient bit width, wherein the second coefficient bit width is different from the first coefficient bit width.
In a possible implementation manner, in the case of determining the scan number of each transform coefficient by taking the direct current component coefficient as the scan start point, the encoding end may set the first coefficient bit width to be larger than the second coefficient bit width, and optionally, the first coefficient bit width may be a standard bit width specified in the encoding standard, for example, a quantized coefficient bit width 16bit defined by the h.266 standard, and a quantized coefficient bit width 8bit defined by the h.265 standard; alternatively, the second coefficient bit width may be other coefficient bit widths smaller than the standard bit width, for example, the second coefficient bit width is 6 bits, 0 bits, or the like.
Illustratively, as shown in fig. 5, when the transform coefficient matrix is scanned by adopting a diagonal scanning manner, a scan number corresponding to each transform coefficient in the transform coefficient matrix can be determined, and the scan number ranges from 0 to 63, wherein, for the size block 501, when the first number threshold is 15, the encoding end can determine the quantized coefficient bit width of the transform coefficient corresponding to the scan number from 0 to 14 as 16 bits, and the quantized coefficient bit width of the transform coefficient corresponding to the scan number from 15 to 63 as 0bit; for the size block 502, when the first number threshold is 16, the encoding end may determine the quantized coefficient bit width of the transform coefficients corresponding to scan numbers 0 to 15 as 16 bits, determine the quantized coefficient bit width of the transform coefficients corresponding to scan numbers 16 to 63 as 0 bits, and determine the quantized coefficient bit width of the transform coefficients in the upper left corner 4×4 region as 16 bits.
In one possible implementation, to further save the coefficient bandwidth, the encoding end may also set only the quantized coefficient bit width of the DC coefficient to the standard bit width specified in the encoding standard, and the quantized coefficient bit widths of the other alternating current component coefficients (AC coefficients) are all set to other coefficient bit widths smaller than the standard bit width. For example, in the case of using the h.266 coding standard, the coding end may set only the quantized coefficient bit width of the DC coefficient at the (0, 0) point in the transform coefficient matrix to 16 bits, and the quantized coefficient bit width of the other AC coefficients to Abit, where a is smaller than 16.
In some embodiments, in order to reduce quantization distortion as much as possible while saving coefficient bandwidth, the encoding end may further set a plurality of numbering thresholds, and divide the transform coefficients to refine the quantization coefficient bit widths corresponding to the transform coefficients in different frequency domain ranges.
In one possible implementation manner, the encoding end determines at least two number thresholds, and the i-th number threshold is smaller than the i+1-th number threshold, so that in the case that the scan number is smaller than the first number threshold, the encoding end determines the quantized coefficient bit width of the transform coefficient corresponding to the scan number as the first coefficient bit width; in the case that the scan number is not less than the i-th number threshold and is less than the i+1-th number threshold, the encoding end determines the quantized coefficient bit width of the transform coefficient corresponding to the scan number as the i+1-th coefficient bit width, and the i+1-th coefficient bit width is less than the i-th coefficient bit width.
In an illustrative example, when the range of the scan numbers is 0 to 63, the encoding end may set the first number threshold to 15 and the second number threshold to 49, so as to determine the quantized coefficient bit width corresponding to the transform coefficients of the corresponding scan numbers of 0 to 14 as 16 bits, the quantized coefficient bit width corresponding to the transform coefficients of the corresponding scan numbers of 15 to 48 as 8 bits, and the quantized coefficient bit width corresponding to the transform coefficients of the corresponding scan numbers of 49 to 63 as 0 bits.
Considering that the scan numbers of the transform coefficients determined by the scan method are continuous, but the frequency domain positions where the transform coefficients in the transform coefficient matrix are located may not have continuity, so that the division of the transform coefficients only according to the number threshold has a certain limitation, so in some embodiments, the encoding end may also divide the transform coefficients in the transform coefficient matrix by setting a number set.
In a possible implementation manner, the encoding end may determine at least one number set, where the number set includes at least one preset scan number, and different number sets correspond to different quantized coefficient bit widths, so that the encoding end may determine, according to the scan numbers corresponding to the respective transform coefficients, the number set in which the respective scan numbers are located, and in a case that the scan numbers belong to the ith number set, the encoding end determines the quantized coefficient bit width of the transform coefficient corresponding to the scan number as the ith coefficient bit width.
In an illustrative example, in the case of using diagonal scan with a range of scan numbers from 0 to 63, the encoding end determines a number set including 16 scan numbers, which may be represented as {0,1,2,3,4,5,6,7,8,9,11,12,13,17,18,24}, so that the encoding end may set the quantized coefficient bit width of the transform coefficient corresponding to each scan number in the number set to 16 bits and the quantized coefficient bit widths of the transform coefficients corresponding to other scan numbers to 0bit. Illustratively, as shown in fig. 6, the frequency domain position corresponding to the number set {0,1,2,3,4,5,6,7,8,9,11,12,13,17,18,24} is the upper left 4×4 region, i.e., the encoding end sets the quantization coefficient bit width of the transform coefficient in the frequency domain position to 16 bits.
And 304, carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
In some embodiments, after determining the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix, the encoding end further needs to perform quantization processing on the transform coefficient matrix according to the quantization coefficient bit width corresponding to each transform coefficient and in combination with the quantization step length, so as to obtain a quantization coefficient matrix corresponding to each size block in the video frame.
In some embodiments, considering that the encoding end may apply other encoding techniques during quantization processing, which may cause the quantization coefficient bit width to change, for example, the Sign-bit concealment (Sign concealment) technique requires that, for a coefficient group that satisfies a certain condition, the symbol of the first non-zero coefficient along the scan path is not explicitly transmitted in the bitstream, but is inferred from the parity of the sum of all non-zero coefficients in the coefficient group at the decoding end, so that in the case of the Sign-bit concealment technique, the encoding end needs to involve adjusting the size of the quantization coefficient.
In one possible implementation manner, when the symbol bit hiding process is performed on the transform coefficient, the encoding end may first obtain a coefficient adjustment value in the symbol bit hiding process, so as to determine a quantization coefficient range corresponding to each transform coefficient according to a quantization coefficient bit width and a coefficient adjustment value corresponding to the transform coefficient, and then quantize the transform coefficient matrix according to the quantization coefficient bit width and the quantization coefficient range corresponding to each transform coefficient, to obtain a quantization coefficient matrix corresponding to each size block in the video frame.
In one possible implementation, the coefficient adjustment value in the sign bit hiding process is B, and the quantization coefficient bit width corresponding to the transform coefficient is Abit, so that it can be determined that the quantization coefficient range is [ -2 A +B,2 A -B-1]For example, if the coefficient adjustment value in the process of hiding the sign bit is 1 and the quantized coefficient bit width is 12 bits, the effective range of the quantized coefficient is [ -4095,4094]。
In the above embodiment, the coefficient scanning is performed on the transform coefficient matrix to determine the scan number corresponding to each transform coefficient, so that the transform coefficients are divided according to the scan numbers, so that the transform coefficients corresponding to different frequency domain ranges correspond to different quantized coefficient bit widths, thereby saving quantization bandwidth, reducing quantization distortion, improving quantization precision, and optimizing video coding efficiency.
In some embodiments, in order to improve the efficiency of video decoding, the video decoding end also needs to perform inverse quantization processing according to the coefficient bit width corresponding to each quantized coefficient in the process of performing inverse quantization processing, and considering that different encoding and decoding protocols may be adopted between the video encoding end and the video decoding end in the video encoding and decoding process, for example, in the case of adopting an implicit encoding and decoding protocol, the quantized coefficient bit width corresponding to each transform coefficient is pre-agreed by the encoding end and the decoding end before encoding and decoding; under the condition of adopting an explicit coding and decoding protocol, the quantization coefficient bit width corresponding to each transformation coefficient needs to be transmitted by the coding end through the parameter set corresponding to the video frame.
In a possible implementation manner, in the case of using an implicit codec protocol, the bit width of the quantized coefficient corresponding to each transform coefficient in the transform coefficient matrix is agreed by the video encoding end and the video decoding end through the implicit codec protocol.
In another possible implementation manner, after the video encoding end determines the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix, the video encoding end writes the quantization coefficient bit width corresponding to each transform coefficient in the video frame parameter set, so that the video decoding end obtains the quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix according to the video frame parameter set in the inverse quantization process.
Alternatively, the writing of the quantization system bit width may include at least one of writing the quantization system bit width, or writing a bit width difference between the quantization system bit width and a default bit width of the parameter set, or writing a coded compressed bit width difference.
In one possible implementation manner, the video encoding end may directly write the quantized coefficient bit width corresponding to each transform coefficient into the parameter set according to the scan number sequence determined by the scan manner, for example, the parameter set is indicated by a syntax element num_delta_bits_quant_coeff.
In another possible implementation, in the case of using SPS (Sequence Parameter Set )/PPS (Picture Parameter Set, picture parameter set) to deliver the corresponding syntax element, the video encoding end may further indicate a bit width difference between the quantization coefficient bit width corresponding to each transform coefficient and the default bit width in the parameter set by using the syntax element num_delta_bits_quat_coeff.
In one possible implementation manner, in order to improve the data transmission efficiency, the video encoding end may further encode the bit width, for example, encode the coefficient bit width corresponding to each transform coefficient by adopting a prediction encoding manner or a differential encoding manner.
In one possible implementation manner, considering that the bit width of the quantized coefficient corresponding to a certain transform coefficient may occur during the data transmission process is not transmitted through the syntax element, in order to improve the decoding efficiency of the video decoding end, the video decoding end may further perform inverse quantization processing according to the default bit width in the parameter set.
The above embodiments mainly describe quantization methods applied to video encoding, and correspondingly, the embodiments of the present application describe inverse quantization methods applied to video decoding by the following embodiments.
Referring to fig. 7, a flowchart of an inverse quantization method applied to video decoding according to an exemplary embodiment of the present application is shown, where the method is used at a video decoding end as an example, and the method includes the following steps:
step 701, determining a quantization coefficient matrix corresponding to a size block in a video frame based on a video code stream corresponding to the video frame, wherein the quantization coefficient matrix comprises quantization coefficients corresponding to different frequency domain positions in the size block.
In some embodiments, the video frames are converted into corresponding video code streams after video encoding, so that the decoding end needs to perform entropy decoding, dequantization, inverse transformation and prediction on the video code streams to obtain each video frame.
In one possible implementation manner, the decoding end may obtain a quantization coefficient matrix corresponding to each size block in the video frame by performing entropy decoding on the video code stream, where the quantization coefficient matrix includes quantization coefficients corresponding to different frequency domain positions in the size block.
Step 702, performing inverse quantization processing on the quantized coefficient matrix based on the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix, to obtain a transform coefficient matrix corresponding to the size block in the video frame.
In the embodiment of the application, the decoding end also needs to perform inverse quantization processing on the quantized coefficient matrix according to the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix, so as to obtain a variable coefficient matrix corresponding to the size block in the video frame.
In one possible implementation manner, after obtaining the quantized coefficient matrix corresponding to the size block, the decoding end adjusts the quantized coefficient based on the bit width of the quantized coefficient corresponding to each quantized coefficient, and further performs dequantization processing on the quantized coefficient according to the quantization step length, so as to obtain the transform coefficient matrix corresponding to the size block.
In summary, in the embodiment of the present application, after the quantization coefficient matrix corresponding to each size block is determined in the video decoding process, instead of directly performing inverse quantization processing on the quantization coefficient matrix according to the quantization parameter, the inverse quantization processing is performed on the quantization coefficient matrix by combining the quantization coefficient bit widths corresponding to each quantization coefficient in the quantization coefficient matrix, thereby improving the accuracy of the inverse quantization processing in the video decoding process and improving the video coding and decoding efficiency.
In some embodiments, considering that different coding and decoding protocols may be adopted between the video coding end and the video decoding end in the video coding and decoding process, for example, in the case of adopting an implicit coding and decoding protocol, the bit width of a quantization coefficient corresponding to each quantization coefficient is pre-agreed by the coding end and the decoding end before coding and decoding; under the condition of adopting an explicit coding and decoding protocol, the bit width of the quantization coefficient corresponding to each quantization coefficient needs to be acquired by a decoding end according to a parameter set corresponding to the video frame transmitted by the encoding end.
In a possible implementation manner, under the condition that an implicit coding and decoding protocol is adopted, a decoding end obtains a quantization coefficient bit width corresponding to each quantization coefficient in a quantization coefficient matrix from the implicit coding and decoding protocol; in the case of an explicit codec, the decoding end may determine, based on the video frame parameter set, a quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix.
In one possible implementation, in the case that the encoding end directly uses the syntax element num_delta_bits_quant_coeff to indicate the quantization coefficient bit width corresponding to each quantization coefficient in the parameter set, the decoding end directly obtains the quantization coefficient bit width corresponding to each quantization coefficient.
In another possible embodiment, in the case that the encoding end indicates, in the parameter set, a bit width difference value between a quantization coefficient bit width corresponding to each quantization coefficient and a default bit width in the parameter set by using a syntax element num_delta_bits_quant_coeff, the decoding end needs to calculate the quantization coefficient bit width corresponding to each quantization coefficient according to the parameter set default bit width and the bit width difference value.
In one possible implementation, in the case that the encoding end performs predictive encoding or differential encoding on the quantized coefficient bit width and then transmits the quantized coefficient bit width, the decoding end needs to determine the quantized coefficient bit width corresponding to each quantized coefficient through a corresponding decoding manner.
In one possible implementation manner, considering that the bit width of the quantized coefficient corresponding to a certain quantized coefficient may occur during the data transmission process, the video decoding end may further perform inverse quantization processing according to the default bit width in the parameter set in order to improve the decoding efficiency of the video decoding end.
Fig. 8 is a schematic flow chart of video encoding and decoding according to another embodiment of the application. Illustratively, as shown in fig. 8, first, in the case of determining an image frame 801, a video encoder divides the image frame 801 to obtain 4 encoded blocks 802, and further, predictive-encodes each encoded block 802 to obtain corresponding predicted blocks 803, and further, each predicted block 803 is subtracted from the encoded block 802 to obtain each residual block 804, and thus, DCT-transformed size blocks 805 are obtained by DCT-transforming the residual blocks 804.
In the case of quantization based on the coding standard h.266, a quantized size block 806 can be obtained, and as can be seen from fig. 8, since the bit width of each coefficient in the quantized size block 806 is 16 bits, there are other ac component coefficients than the dc component coefficient that are not 0, and the bit width occupation of each quantized coefficient in the quantized size block 806 is 16 bits by entropy coding.
In the scheme provided by the embodiment of the application, under the condition that the bit width of the quantized coefficient is determined based on the frequency domain position where each transform coefficient is located, for example, the bit width of the quantized coefficient corresponding to the DC coefficient is 16 bits, the bit width of the quantized coefficient corresponding to other AC coefficients is 0bit, so that a quantized size block 807 can be obtained, as shown in fig. 8, only the quantized coefficient at the (0, 0) position is not 0, and the other frequency domain positions are 0 bits because the quantized coefficient bit width is 0bit, therefore, under the condition of entropy coding, the video encoder can only encode the quantized coefficient at the (0, 0) position and does not need to encode the coefficients at other frequency domain positions, so that the decoding end can directly determine the quantized coefficient at other frequency domain positions to be 0 according to the determined bit width of the quantized coefficient corresponding to each quantized coefficient, thereby reducing the quantized bit width occupation rate in the video encoding and decoding process.
Referring to fig. 9, a block diagram of a quantization apparatus applied to video coding according to an exemplary embodiment of the present application is shown, the apparatus comprising:
a first determining module 901, configured to determine a transform coefficient matrix corresponding to a size block in a video frame, where the transform coefficient matrix includes transform coefficients corresponding to different frequency domain positions in the size block, where the size block is obtained by dividing the video frame and performing frequency domain transformation;
a second determining module 902, configured to determine, based on a frequency domain position where each transform coefficient in the transform coefficient matrix is located, a quantized coefficient bit width corresponding to each transform coefficient, where the quantized coefficient bit width corresponding to the transform coefficient in a low frequency range is greater than the quantized coefficient bit width corresponding to the transform coefficient in a high frequency range;
the quantization module 903 is configured to perform quantization processing on the transform coefficient matrix based on the quantization coefficient bit width corresponding to each transform coefficient, so as to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
Optionally, the second determining module 902 includes:
a number determining unit, configured to determine a scan number corresponding to each transform coefficient in the transform coefficient matrix corresponding to the size block based on a scan manner;
And the bit width determining unit is used for determining the bit width of the quantization coefficient corresponding to each transformation coefficient in the transformation coefficient matrix based on the scanning number.
Optionally, the number determining unit is configured to:
determining a direct current component coefficient in the transformation coefficient matrix, wherein the frequency domain range corresponding to the direct current component coefficient is lower than the frequency domain range corresponding to other transformation coefficients;
scanning the transformation coefficient matrix by taking the frequency domain position of the direct current component coefficient as a starting point;
and determining a scanning number corresponding to each transformation coefficient in the transformation coefficient matrix based on the scanning mode and the scanning sequence, wherein the scanning mode is one of diagonal scanning, horizontal scanning and vertical scanning.
Optionally, the bit width determining unit is configured to:
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
in the case where the scan number is not smaller than the first number threshold, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as a second coefficient bit width, which is different from the first coefficient bit width.
Optionally, the first coefficient bit width is a standard bit width specified in the coding standard, and the second coefficient bit width is another coefficient bit width smaller than the standard bit width.
Optionally, the bit width determining unit is further configured to:
determining at least two numbering thresholds, wherein the ith numbering threshold is smaller than the (i+1) th numbering threshold;
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
and determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as an i+1th coefficient bit width, wherein the i+1th coefficient bit width is smaller than the i+1th coefficient bit width, when the scan number is not smaller than the i number threshold and smaller than the i+1th number threshold.
Optionally, the bit width determining unit is further configured to:
determining at least one number set, wherein the number set comprises at least one preset scanning number, and different number sets correspond to different quantization coefficient bit widths;
when the scan number belongs to the i-th number set, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as the i-th coefficient bit width.
Optionally, the apparatus further includes:
the acquisition module is used for acquiring a coefficient adjustment value in the process of the sign bit hiding process under the condition of carrying out the sign bit hiding process on the transformation coefficient;
a third determining module, configured to determine a quantization coefficient range corresponding to each transform coefficient based on the quantization coefficient bit width corresponding to the transform coefficient and the coefficient adjustment value;
the quantization module 903 is configured to:
and carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width and the quantization coefficient range corresponding to each transformation coefficient to obtain the quantization coefficient matrix corresponding to the size block in the video frame.
Optionally, in the case of using an implicit codec, the bit widths of quantized coefficients corresponding to the transform coefficients in the transform coefficient matrix are agreed by the video encoding end and the video decoding end through the implicit codec.
Optionally, the apparatus further includes:
the writing module is used for writing the quantized coefficient bit width corresponding to each transformation coefficient into a video frame parameter set after obtaining the quantized coefficient bit width corresponding to each transformation coefficient in the transformation coefficient matrix, and the video decoding end obtains the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix based on the video frame parameter set; the writing mode comprises writing the quantization coefficient bit width, or writing a bit width difference value between the quantization coefficient bit width and a default bit width of a parameter set, or writing at least one of the bit width difference values after encoding compression.
In summary, in the embodiment of the present application, after determining the transform coefficient matrix corresponding to each size block in the video frame in the video encoding process, instead of performing quantization processing on the transform coefficient matrix according to the standard quantization coefficient bit width in the encoding standard, the quantization coefficient bit width corresponding to each transform coefficient is determined according to the frequency domain position where each transform coefficient in the transform coefficient matrix is located, so that the quantization coefficient bit width corresponding to the transform coefficient in the low frequency range is greater than the quantization coefficient bit width corresponding to the transform coefficient in the high frequency range, and then performing quantization processing on the transform coefficient matrix according to the quantization coefficient bit width corresponding to each transform coefficient, to obtain the quantization coefficient matrix corresponding to each size block in the video frame; by adopting the scheme provided by the embodiment of the application, the occupancy rate of the quantized bit width can be optimized and the video coding and decoding efficiency can be improved while the quantized distortion of the low-frequency region is reduced in the video coding and decoding process.
Referring to fig. 10, there is shown a block diagram of an inverse quantization apparatus applied to video decoding according to an exemplary embodiment of the present application, the apparatus including:
a first determining module 1001, configured to determine, based on a video code stream corresponding to a video frame, a quantization coefficient matrix corresponding to a size block in the video frame, where the quantization coefficient matrix includes quantization coefficients corresponding to different frequency domain positions in the size block;
And an inverse quantization module 1002, configured to perform inverse quantization processing on the quantized coefficient matrix based on the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix, so as to obtain a transform coefficient matrix corresponding to the size block in the video frame.
Optionally, before performing inverse quantization processing on the quantized coefficient matrix based on the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix to obtain the transform coefficient matrix corresponding to the size block in the video frame, the apparatus further includes:
the bit width acquisition module is used for acquiring the bit width of the quantization coefficient corresponding to each quantization coefficient in the quantization coefficient matrix from the implicit coding and decoding protocol under the condition of adopting the implicit coding and decoding protocol;
and the bit width determining module is used for determining the bit width of the quantization coefficient corresponding to each quantization coefficient in the quantization coefficient matrix based on the video frame parameter set under the condition of adopting an explicit coding and decoding protocol.
In summary, in the embodiment of the present application, after the quantization coefficient matrix corresponding to each size block is determined in the video decoding process, instead of directly performing inverse quantization processing on the quantization coefficient matrix according to the quantization parameter, the inverse quantization processing is performed on the quantization coefficient matrix by combining the quantization coefficient bit widths corresponding to each quantization coefficient in the quantization coefficient matrix, thereby improving the accuracy of the inverse quantization processing in the video decoding process and improving the video coding and decoding efficiency.
It should be noted that: the apparatus provided in the above embodiment is only exemplified by the division of the above functional modules, and in practical application, the above functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules, so as to perform all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and detailed implementation processes of the method embodiments are described in the method embodiments, which are not repeated herein.
The above embodiments are described by taking application to a video encoding side and a video decoding side as examples. Alternatively, the encoding end and the decoding end may be a software video codec or a hardware video codec.
An embodiment of the present application provides a video encoder including an integrated circuit for implementing the quantization method applied to video encoding as described in the above embodiment.
An embodiment of the present application provides a video decoder, which includes an integrated circuit therein, where the integrated circuit is configured to implement the dequantization method applied to video decoding according to the above embodiment.
Alternatively, where the above embodiments are implemented by a software video codec, the software video codec may be a processor in a computer device.
Referring to fig. 11, a schematic structural diagram of a computer device according to an exemplary embodiment of the present application is shown. Specifically, the present application relates to a method for manufacturing a semiconductor device. The computer device 1100 includes a central processing unit (Central Processing Unit, CPU) 1101, a system memory 1104 including a random access memory 1102 and a read only memory 1103, and a system bus 1105 connecting the system memory 1104 and the central processing unit 1101. The computer device 1100 also includes a basic Input/Output system (I/O) 1106, which helps to transfer information between the various devices within the computer, and a mass storage device 1107 for storing an operating system 1113, application programs 1114, and other program modules 1115.
The basic input/output system 1106 includes a display 1108 for displaying information and an input device 1109, such as a mouse, keyboard, etc., for a user to input information. Wherein the display 1108 and the input device 1109 are both coupled to the central processing unit 1101 through an input-output controller 1110 coupled to the system bus 1105. The basic input/output system 1106 may also include an input/output controller 1110 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input output controller 1110 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 1107 is connected to the central processing unit 1101 through a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer-readable media provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include a computer-readable medium (not shown), such as a hard disk or drive.
The computer readable medium may include computer storage media and communication media without loss of generality. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes random access Memory (RAM, random Access Memory), read Only Memory (ROM), flash Memory or other solid state Memory technology, compact disk (CD-ROM), digital versatile disk (Digital Versatile Disc, DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage medium is not limited to the one described above. The system memory 1104 and mass storage device 1107 described above may be collectively referred to as memory.
The memory stores one or more programs configured to be executed by the one or more central processing units 1101, the one or more programs containing instructions for implementing the methods described above, the central processing unit 1101 executing the one or more programs to implement the methods provided by the various method embodiments described above.
The computer device 1100 may also operate in accordance with various embodiments of the present application, through a network, such as the internet, to remote computers connected to the network. I.e., the computer device 1100 may be connected to the network 1111 via a network interface unit 1112 coupled to the system bus 1105, or may be connected to other types of networks or remote computer systems (not shown) using the network interface unit 1112.
The embodiment of the present application further provides a computer readable storage medium, where at least one instruction is stored, where at least one instruction is loaded and executed by a processor to implement the quantization method applied to video encoding according to the above embodiment, or the inverse quantization method applied to video decoding according to the above embodiment.
Alternatively, the computer-readable storage medium may include: ROM, RAM, solid state disk (SSD, solid State Drives), or optical disk, etc. The RAM may include, among other things, resistive random access memory (ReRAM, resistance Random Access Memory) and dynamic random access memory (DRAM, dynamic Random Access Memory).
Embodiments of the present application provide a computer program product comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the quantization method applied to video encoding as described in the above embodiment, or the inverse quantization method applied to video decoding as described in the above embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the present application is not intended to limit the application, but is intended to cover all modifications, equivalents, alternatives, and improvements falling within the spirit and principles of the application.
Claims (17)
1. A quantization method applied to video coding, the method comprising:
Determining a transformation coefficient matrix corresponding to a size block in a video frame, wherein the transformation coefficient matrix comprises transformation coefficients corresponding to different frequency domain positions in the size block, and the size block is obtained by dividing the video frame and performing frequency domain transformation;
determining the bit width of the quantized coefficient corresponding to each transform coefficient based on the frequency domain position of each transform coefficient in the transform coefficient matrix, wherein the bit width of the quantized coefficient corresponding to the transform coefficient in a low frequency range is larger than the bit width of the quantized coefficient corresponding to the transform coefficient in a high frequency range;
and carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
2. The method of claim 1, wherein determining the quantized coefficient bit width corresponding to each transform coefficient based on the frequency domain location of each transform coefficient in the transform coefficient matrix comprises:
determining a scanning number corresponding to each transformation coefficient in the transformation coefficient matrix corresponding to the size block based on a scanning mode;
and determining the bit width of the quantized coefficient corresponding to each transform coefficient in the transform coefficient matrix based on the scan number.
3. The method according to claim 2, wherein determining, based on the scan pattern, a scan number corresponding to each transform coefficient in the transform coefficient matrix corresponding to the size block includes:
determining a direct current component coefficient in the transformation coefficient matrix, wherein the frequency domain range corresponding to the direct current component coefficient is lower than the frequency domain range corresponding to other transformation coefficients;
scanning the transformation coefficient matrix by taking the frequency domain position of the direct current component coefficient as a starting point;
and determining a scanning number corresponding to each transformation coefficient in the transformation coefficient matrix based on the scanning mode and the scanning sequence, wherein the scanning mode is one of diagonal scanning, horizontal scanning and vertical scanning.
4. The method according to claim 2, wherein determining a quantized coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix based on the scan number comprises:
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
in the case where the scan number is not smaller than the first number threshold, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as a second coefficient bit width, which is different from the first coefficient bit width.
5. The method of claim 4, wherein the first coefficient bit width is a standard bit width specified in a coding standard and the second coefficient bit width is other coefficient bit widths less than the standard bit width.
6. The method of claim 2, wherein determining the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix based on the scan number further comprises:
determining at least two numbering thresholds, wherein the ith numbering threshold is smaller than the (i+1) th numbering threshold;
determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as a first coefficient bit width when the scan number is smaller than a first number threshold;
and determining the quantized coefficient bit width of the transform coefficient corresponding to the scan number as an i+1th coefficient bit width, wherein the i+1th coefficient bit width is smaller than the i+1th coefficient bit width, when the scan number is not smaller than the i number threshold and smaller than the i+1th number threshold.
7. The method of claim 2, wherein determining the quantization coefficient bit width corresponding to each transform coefficient in the transform coefficient matrix based on the scan number further comprises:
Determining at least one number set, wherein the number set comprises at least one preset scanning number, and different number sets correspond to different quantization coefficient bit widths;
when the scan number belongs to the i-th number set, the quantization coefficient bit width of the transform coefficient corresponding to the scan number is determined as the i-th coefficient bit width.
8. The method according to any one of claims 1 to 7, further comprising:
under the condition of carrying out symbol bit hiding processing on the transformation coefficient, acquiring a coefficient adjustment value in the process of symbol bit hiding processing;
determining a quantization coefficient range corresponding to each transformation coefficient based on the quantization coefficient bit width corresponding to the transformation coefficient and the coefficient adjustment value;
the quantization coefficient matrix based on the bit width of the quantization coefficient corresponding to each transformation coefficient, performing quantization processing on the transformation coefficient matrix to obtain a quantization coefficient matrix corresponding to the size block in the video frame, including:
and carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width and the quantization coefficient range corresponding to each transformation coefficient to obtain the quantization coefficient matrix corresponding to the size block in the video frame.
9. The method of claim 1, wherein in the case of using an implicit codec protocol, the quantized coefficient bit widths corresponding to the respective transform coefficients in the transform coefficient matrix are agreed by a video encoding side and a video decoding side through the implicit codec protocol.
10. The method according to claim 1, wherein the method further comprises:
after obtaining the quantized coefficient bit width corresponding to each transformation coefficient in the transformation coefficient matrix, writing the quantized coefficient bit width corresponding to each transformation coefficient into a video frame parameter set, and obtaining the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix by a video decoding end based on the video frame parameter set;
the writing mode comprises writing the quantization coefficient bit width, or writing a bit width difference value between the quantization coefficient bit width and a default bit width of a parameter set, or writing at least one of the bit width difference values after encoding compression.
11. An inverse quantization method applied to video decoding, the method comprising:
determining a quantization coefficient matrix corresponding to a size block in a video frame based on a video code stream corresponding to the video frame, wherein the quantization coefficient matrix comprises quantization coefficients corresponding to different frequency domain positions in the size block;
And performing inverse quantization processing on the quantized coefficient matrix based on the bit width of the quantized coefficient corresponding to each quantized coefficient in the quantized coefficient matrix to obtain a transformation coefficient matrix corresponding to the size block in the video frame.
12. The method according to claim 11, wherein before performing inverse quantization processing on the quantized coefficient matrix based on the quantized coefficient bit width corresponding to each quantized coefficient in the quantized coefficient matrix to obtain the transform coefficient matrix corresponding to the size block in the video frame, the method further comprises:
under the condition of adopting an implicit coding and decoding protocol, acquiring the bit width of the quantization coefficient corresponding to each quantization coefficient in the quantization coefficient matrix from the implicit coding and decoding protocol;
in the case of an explicit codec protocol, the quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix is determined based on a video frame parameter set.
13. A quantization apparatus applied to video coding, the apparatus comprising:
the first determining module is used for determining a transformation coefficient matrix corresponding to a size block in a video frame, wherein the transformation coefficient matrix comprises transformation coefficients corresponding to different frequency domain positions in the size block, and the size block is obtained by dividing the video frame and performing frequency domain transformation;
A second determining module, configured to determine, based on a frequency domain position where each transform coefficient in the transform coefficient matrix is located, a quantization coefficient bit width corresponding to each transform coefficient, where the quantization coefficient bit width corresponding to the transform coefficient in a low frequency range is greater than the quantization coefficient bit width corresponding to the transform coefficient in a high frequency range;
and the quantization module is used for carrying out quantization processing on the transformation coefficient matrix based on the quantization coefficient bit width corresponding to each transformation coefficient to obtain a quantization coefficient matrix corresponding to the size block in the video frame.
14. An inverse quantization apparatus applied to video decoding, the apparatus comprising:
the first determining module is used for determining a quantization coefficient matrix corresponding to a size block in a video frame based on a video code stream corresponding to the video frame, wherein the quantization coefficient matrix comprises quantization coefficients corresponding to different frequency domain positions in the size block;
and the inverse quantization module is used for performing inverse quantization processing on the quantization coefficient matrix based on the quantization coefficient bit width corresponding to each quantization coefficient in the quantization coefficient matrix to obtain a transformation coefficient matrix corresponding to the size block in the video frame.
15. A video encoder comprising an integrated circuit for implementing a quantization method as claimed in any one of claims 1 to 10 for video encoding.
16. A video decoder comprising an integrated circuit for implementing the dequantization method according to any one of claims 11 to 12 applied to video decoding.
17. A computer device, the computer device comprising a processor and a memory; the memory stores at least one instruction for execution by the processor to implement a quantization method applied to video coding as claimed in any one of claims 1 to 10 or an inverse quantization method applied to video decoding as claimed in any one of claims 11 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311265833.6A CN117119189A (en) | 2023-09-27 | 2023-09-27 | Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311265833.6A CN117119189A (en) | 2023-09-27 | 2023-09-27 | Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117119189A true CN117119189A (en) | 2023-11-24 |
Family
ID=88800232
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311265833.6A Pending CN117119189A (en) | 2023-09-27 | 2023-09-27 | Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117119189A (en) |
-
2023
- 2023-09-27 CN CN202311265833.6A patent/CN117119189A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10103746B2 (en) | Methods and devices for coding and decoding the position of the last significant coefficient | |
JP5027936B2 (en) | Method, recording medium, program and processing device for adaptive scan ordering. | |
KR101571618B1 (en) | Methods and devices for coding and decoding the position of the last significant coefficient | |
EP1768415A1 (en) | Adaptive scan order of DCT coefficients and its signaling | |
US20230024834A1 (en) | Video decoding method, video encoding method, and related apparatuses | |
WO2006098226A1 (en) | Encoding device and dynamic image recording system having the encoding device | |
CN112543337B (en) | Video decoding method, device, computer readable medium and electronic equipment | |
GB2496201A (en) | Context adaptive data encoding and decoding | |
US20230097724A1 (en) | Video encoding method and apparatus, video decoding method and apparatus, computer-readable medium, and electronic device | |
US20230053118A1 (en) | Video decoding method, video coding method, and related apparatus | |
CN116982262A (en) | State transition for dependent quantization in video coding | |
CN117119189A (en) | Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding | |
CN112449185B (en) | Video decoding method, video encoding device, video encoding medium, and electronic apparatus | |
WO2022174637A1 (en) | Video encoding and decoding method, video encoding and decoding apparatus, computer-readable medium and electronic device | |
JP7483029B2 (en) | VIDEO DECODING METHOD, VIDEO ENCODING METHOD, DEVICE, MEDIUM, AND ELECTRONIC APPARATUS | |
US20230065748A1 (en) | Video decoding method and apparatus, readable medium, electronic device, and program product | |
TWI829424B (en) | Decoding method, encoding method and apparatus | |
WO2022217442A1 (en) | Coefficient encoding/decoding method, encoder, decoder, and computer storage medium | |
WO2022063040A1 (en) | Video coding/decoding method, apparatus, and device | |
JP4934081B2 (en) | Encoding apparatus, code processing apparatus, encoding method, code processing method, computer program, and recording medium | |
JP2022548685A (en) | Encoding and decoding image data | |
KR100234239B1 (en) | Method and apparatus of quantizing for decreasing blocking effect | |
CN116998150A (en) | State transition for grid quantization in video coding and decoding | |
CN115209146A (en) | Video encoding and decoding method and device, computer readable medium and electronic equipment | |
JP2003018014A (en) | Coding method, decoding method, coder, decoder, coding program, decoding program and programs recording medium for them |
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 |