The invention relates to a method and to an apparatus for controlling the encoder output bit rate in a block-based video encoder, e.g. an MPEG4-AVC encoder.
Constant-bitrate (CBR) rate control is very useful for real-time video transmission. However, it is difficult to realize a good CBR rate control in an MPEG4-AVC (ISO/IEC 14496-10) video codec. Generally, in an MPEG4-AVC codec both, bitrate and distortion depend on a quantization parameter QP that controls the degree of quantisation. By adjusting QP one can get a trade-off between rate-QP and distortion-QP. However, most rate control algorithms either do not achieve a good visual quality or suffer from rather large controlling errors. In the Joint Video Team (JVT) reference source codes, use of the rate control algorithms proposed by Z. Li, W. Gao, F. Pan, S. Ma, K. P. Lin, G. Feng, X. Lin, S. Rahardja, H. Lu and Y. Lu, “Adaptive Rate Control with HRD Consideration”, document JVT-H014, 8th meeting, Geneva, May 2003, denoted. [1], and by Z. G. Li, F. Pan, K. P. Lim, X. Lin and S. Rahardja, “Adaptive Rate Control for H.264”, ICIP, 2004, denoted [2], has been recommended by the JVT committee.
Zhihai He has proposed in “ρ-Domain Rate-Distortion Analysis and Rate Control for Visual Coding and Communication”, PhD Dissertation, University of California, Santa Barbara, June 2001, denoted [3], a new model that achieves a good performance for H.263 and MPEG4-2 (ISO/IEC 14496-2) codecs. The parameter ‘ρ’ represents the percentage of zeros among the quantized transform coefficients. He found a basically linear relationship between the value ‘ρ’ and the real bit rate because the percentage of zeros plays an important role in determining the final bit rate. He assumed that the distribution of residual coefficients complies with either Gaussian distribution or Laplace distribution, so that the linear relationship or model can be derived as follows: The Laplace distribution for the residual image is
R(ρ)=2*log2e(1−ρ)+O([1−ρ]3) (1)
wherein ‘O’ is the higher-order infinite small.
The Gaussian distribution for the original image is
and where ‘a’ and ‘b’ are statistical parameters of the original image.
The relation between bitrate R and percentage ρ of quantized transform zero values can be approximated by:
R(ρ)=Θ*(100−ρ) (3)
wherein ρ is expressed in a % value and Θ is a constant representing the slope of the linear relationship.
The final goal is to find the relation between the percentage ρ of zero coefficients P and the quantization parameter QP. According to Z.He, there is a one-to-one mapping between QP and ρ. Therefore the rate/distortion functions R(QP) and D(QP) in the QP-domain can be mapped in the ρ-domain denoted as R(ρ) and D(ρ), respectively.
For the H.263 video compression the relation between the percentage ρ of zero coefficients P and the quantization parameter QP it is given by:
This linear p-domain model has a good performance with respect to controlling errors and visual quality in MPEG4-2.
A good rate control provides good coding/decoding properties such as small controlling errors and a good visual quality, which both are important for practical MPEG4-AVC applications. However, the quantization processing and the percentage ρ of zeros among the quantized transform or DCT transform (discrete cosine transform) coefficients in MPEG4-AVC is different from that used in MPEG4-2. The original Z.He ρ-domain model cannot be used for an MPEG4-AVC codec because of the conflict between rate/distortion optimization (RDO) and rate control, which both are dependent from the quantization step size.
The above-mentioned rate control algorithms [1] and [2] cause controlling errors in picture sequences including e.g. flashes or in/out fades. The visual quality is unstable because of usage of too much different QPs for different (temporally or spatially adjacent) macroblocks. Moreover, the rate control in [2] employs the information from previous units or scenes so that it is not a suitable solution for coding abrupt changes of scene content in a video sequence.
A problem to be solved by the invention is to provide an improved bit rate and/or distortion control for MPEG4-AVC applications.
According to the invention, an adapted ρ-domain processing for real-time rate control is applied, which can be directly used in practical applications. A couple of mapping tables have been designed to realize the mapping between the quantization parameters QP and the percentage of transform zero coefficients, the application of which tables does not only improve the mapping accuracy, but also shortens the computation time. The quantization parameter QP is an index or a parameter that codes or represents the quantizer step size. QP may have one of 52 levels between 0 and 51, as is true for MPEG4-AVC. For example, QP=0, 3, 6, 10, 18, 30, 48 and 51 correspond to quantization step sizes of 0.625, 0.875, 1.25, 2, 5, 20, 160 and 224, respectively.
Further, a detailed analysis of the transform level is carried out to get the slope of the (linear) relationship between the bitrate and the percentage values of the zeros. Finally, the slope of the linear model is constrained by a look-ahead procedure with respect to the neighbour frames or blocks.
Advantageously, the inventive rate control for a one-pass MPEG-4 AVC codec achieves small controlling errors and good visual quality:
Exemplary embodiments of the invention are described with reference to the accompanying drawings, which show in:
ρ-domain
According to [3], the ρ-domain control requires the knowledge of the percentage of zeros following quantization in the transform or DCT transform domain for each macroblock in a frame (if the residuum after transform complies with Gaussian or Laplace distribution, the ρ-domain can work correctly). However, the rate-distortion optimization (RDO) requires QP to consider motion estimation and mode decision, and for different modes there are different transform coefficients. According to the invention, a simple and accurate residue estimation is used. In addition, side information from the pre-analysis—such as motion vectors and transform coefficients—can be used again, and advantageously shortens the computation time in the RDO step.
Pre-processing
a) 16*16 Macroblock Pre-analysis
In practical MPEG-4 AVC encoding, following mode decision the majority (generally 60% to 90%) of (macro-)blocks has a size of 16*16 pixels before transform, whereas the transform size is 4*4. To achieve visual smoothness, the QP difference between two neighbouring macroblocks can not be too large. Therefore a frame to be encoded is pre-processed first, and is then processed according to the statistics of the current frame and its neighbour frames in order to carry out the ρ-domain rate control. The percentage of quantized zero coefficients controls the final performance of the ρ-domain mode.
For an I frame a 16*16-intra prediction only is carried out, using three modes: DC prediction, horizontal prediction and vertical prediction. For a current time instant, the reconstructed intra macroblock is unavailable. Therefore it is important to find a good estimation for the intra macroblock to be reconstructed, i.e. for computing I frame predictions. After many experiments it was found that the picture content of the original frame can be used as the reconstruction, but a modified parameter must be added for bitrate computation according to the QP of the previous macroblock. Following this intra prediction, the residual image is computed according to the best prediction direction. A transform or a DCT transform is applied to the residue of each macroblock, whereby the output transform coefficients are produced, as shown in
For a P frame a 16*16-motion estimation is carried out for each macroblock and then, after applying the motion vectors found, the residue image is transformed according to
According to
If true, a 16*16 pixel block intra prediction 16*16ITAPR is carried out on macroblocks for this frame, including a check DCHV whether DC prediction, horizontal prediction or vertical prediction is to be performed. A corresponding calculation is carried out in a DC residual getting stage GRDC, a horizontal prediction residual getting stage GRH or a vertical prediction residual getting stage GRV.
As an alternative, check DCHV is omitted and the three predictions are in each case performed in parallel in GRDC, GRH and GRV, followed by a check which one of the three results is to be processed further.
The corresponding result block is transformed into the frequency domain by an intra transform stage ITATR. Thereafter in stage RHOITATBL a mapping (see below) takes place between the transform coefficients and the quantization parameter QP in order to get the ρI-value (i.e. the number or percentage of zero transform coefficients) for the current block, using the below intra tables 1 to 3 and 7 to 9.
If not true, a 16*16 pixel block motion estimation ME16*16 is carried out on the macroblocks for this frame, followed by computing the residual block in a stage COMPR.
The corresponding result block is transformed in an inter transform stage ITEDCT. Thereafter in stage RHOITETBL a mapping (see below) takes place between the transform coefficients and the quantization parameter QP in order to get the ρP-value (i.e. the number or percentage of zero transform coefficients) for the current block, using the below inter tables 4 to 6 and 10 to 12.
The output values ρI and ρP from stages RHOITATBL and RHOITETBL are used for a subsequent rate/distortion optimization RDO.
b) Look-up Tables Mapping
In stages RHOITATBL and RHOITETBL the intra rho values ρI and the inter rho values ρP are calculated as a fraction from ‘1’ (or as a percentage value) and as a function of QP, according to below equations (5), wherein M is the number of pixels/coefficients in the current macroblock (i.e. generally the number of luminance pixel values per macroblock is 16*(4*4)=256 and the number of chrominance pixel values per macroblock (for 4:2:0 format) is two times 4*(4*4)=128, resulting in 384 pixel values per macroblock), x is the transformed coefficient at 4*4 transform block position i (0 . . . 3) and j (0 . . . 3), itable is the intra threshold to decide if the current Intra coefficient is zero, and table is the Inter threshold to decide if the current inter coefficient is zero:
The goal is to get for each set of transformed macroblock values in the video sequence the function or relationship between a candidate QP and the resulting number of zero amplitude transform coefficients following quantisation.
The current macroblock status ‘Intra’ or ‘Inter’, the current block position (0 . . . 3)(0 . . . 3) and the candidate QP (0 . . . 51) are used to address a corresponding one of tables 1 to 6 in order to get the applicable quantization threshold value for that current QP. Each table includes 52 values, i.e. the quantity of QPs useable in the encoder.
Table 1, intra quantization threshold table for block positions (0,0), (0,2), (2,0), (2,2): {2,2,3,3,3,3,4,4,5,5,6,6,7,8,9,10,11,12,14,15,18,19,22,24, 27,30,35,38,43,48,54,59,70,75,86,96,107,118,139,150,171,192, 214,235,278,299,342,384,427,470,555,598}
Table 2, intra quantization threshold table for block positions (0,1),(0,3),(1,0),(1,2),(2,1),(2,3),(3,0),(3,2): {3,3,4,4,5,5,6,6,7,8,9,10,11,12,14,16,17,20,22,24,27,31,34, 39,44,47,54,61,67,77,87,94,107,121,134,154,174,187,214,241, 267,307,347,374,427,481,534,614,694,747,854,961}
Table 3, intra quantization threshold table for block positions (1,1),(1,3),(3,1),(3,3): {5,5,6,6,7,8,9,10,11,12,14,16,17,19,21,24,27,31,34,38,42,48, 53,61,67,76,84,96,105,121,134,151,167,192,209,242,267,301, 334,384,417,484,534,601,667,767,834,967,1067,1201,1334,1534}
Table 4, inter quantization threshold table for block positions (0,0), (0,2), (2,0),(2,2): {3,3,3,3,4,4,5,5,6,6,7,8,9,10,11,12,14,15,17,19,22,24,27,30, 34,37,44,47,54,60,67, 74,87,94,107,120,134, 147,174,187,214, 240,267,294,347,374,427,480,534,587,694,747}
Table 5, inter quantization threshold table for block positions (0,1),(0,3),(1,0),(1,2),(2,1),(2,3),(3,0),(3,2): {4,4,5,5,6,6,7,8,9,10,11,12,14,15,17,19,21,24,28,30,34,38, 42,48,55,59,67,76,84,96,109,117,134,151,167,192,217,234,267, 301,334,384,434,467,534,601,667,767,867,934,1067,1201}
Table 6, inter quantization threshold table for block positions (1,1),(1,3),(3,1),(3,3): {6,6,7,8,9,10,11,12,14,15,17,19,21,24,27,30,33,38,42,47,53, 60,66,76,84,94,105,120,131,152,167,188,209,240,261,303,334, 376,417,480,521,605,667,751,834,959,1042,1209,1334,1501, 1667,1917}
These six tables are constructed as follows.
To block positions (0,0), (0,2), (2,0) and (2,2) a position factor a2 is assigned, to block positions (0,1), (0,3), (1,0), (1,2), (2,1), (2,3), (3,0) and (3,2) a position factor b2/4 is assigned, and to block positions (1,1), (1,3), (3,1) and (3,3) a position factor a*b/2 is assigned,
whereby a=½, b=√{square root over ((⅖))}, and PF is the resulting position factor.
Suppose that a candidate zero value is:
Zij=round(Wij*PF/Qstep),
wherein Wij is a transform coefficient value before quantization and Qstep is a quantization step size value.
In practise, |Zij|=|Wij|*MF+f>>qbits, wherein MF=PF/Qstep*2qbits, qbits=15+floor(QP/6), f=2qbits/3 for intra blocks, f=2qbits/6 for inter blocks.
For inter blocks, if Wij<Qstep*5/6/PF, the transform coefficient must be quantized to zero.
For intra blocks, if Wij<Qstep*2/3/PF, the transform coefficient must be quantized to zero.
Deriving a threshold value that will be quantized to zero: For example, for a transform coefficient at intra block position (0,0), if QP=51 (and thus the corresponding Qstep=224), the threshold value below which the transform coefficient value will be quantized to zero is 598 because 597.33=224*2/3/PF(0,0), PF(0,0)=a2=¼.
Correspondingly, the intra and inter quantization threshold tables 1 to 6 are derived for QP=0 to QP=51 and for each group of block positions.
For intra blocks, the greatest quantization threshold is 1534. If an intra transform coefficient is greater than 1534 it will be never quantized to zero. For inter blocks, the greatest quantization threshold is 1917. If an inter transform coefficient is greater than 1917 it will be never quantized to zero.
The following tables 7 to 12 can be used to count the number of zero transform coefficients that will be obtained after quantisation, depending from the QP that will be selected.
The numbers in these tables represent QP values.
Table 7, intra quantization look-up table for block positions (0,0),(0,2),(2,0),(2,2): {0,1,2,2,6,8,10,12,13,14,15,16,17,18,18,19,20,20,20,21,22, 22,22,23,23,24,24,24,25,25,25,26,26,26,26,26,27,27,27,28,28, 28,28,28,29,29,29,29,29,30,30,30,30,30,30,31,31,31,31,31,32, 32,32,32,32,32,32,32,32,32,32,33,33,33,33,33,34,34,34,34,34, 34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,36,36,36,36, 36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37,37,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39, 39,39,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51}
This table contains 598 entries.
Table 8, intra quantization look-up table for block positions (0,1),(0,3),(1,0),(1,2),(2,1),(2,3),(3,0),(3,2): {0,1,2,2,2,4,6,8,9,10,11,12,13,14,14,15,15,16,17,17,17,18, 18,19,19,20,20,20,21,21,21,21,22,22,22,23,23,23,23,23,24,24, 24,24,24,25,25,25,26,26,26,26,26,26,26,27,27,27,27,27,27,27, 28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,30,30,30,30, 30,30,30,30,30,30,31,31,31,31,31,31,31,32,32,32,32,32,32,32, 32,32,32,32,32,32,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 34,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37, 37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51}
This table contains 961 entries.
Table 9, intra quantization look-up table for block positions (1,1),(1,3),(3,1),(3,3): {0,1,2,2,2,2,2,4,5,6,7,8,9,10,10,11,11,12,13,13,14,14,15,15, 15,16,16,16,17,17,17,17,18,18,18,19,19,19,19,20,20,20,20,21, 21,21,21,21,21,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24, 24,24,24,24,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26, 26,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28, 28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,30,30, 30,30,30,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31, 31,31,31,31,31,31,31,31,32,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51}
This table contains 1534 entries.
Table 10, inter quantization look-up table for block positions (0,0), (0,2), (2,0),(2,2): {0,1,2,3,4,6,8,10,11,12,13,14,15,16,16,17,18,18,19,19,20,20, 20,21,21,22,22,22,23,23,23,24,24,24,24,25,25,25,26,26,26,26, 26,26,26,27,27,27,28,28,28,28,28,28,28,29,29,29,29,29,29,30, 30,30,30,30,30,30,31,31,31,31,31,31,31,32,32,32,32,32,32,32, 32,32,32,32,32,32,33,33,33,33,33,33,33,34,34,34,34,34,34,34, 34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,35,35,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37, 37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39, 39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51}
This table contains 747 entries.
Table 11, inter quantization look-up table for block positions (0,1),(0,3),(1,0),(1,2),(2,1),(2,3),(3,0),(3,2): {0,1,2,2,2,2,4,6,7,8,9,10,11,12,12,13,14,14,15,15,16,16,17, 17,17,18,18,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22, 23,23,23,23,23,23,24,24,24,24,24,24,24,25,25,25,25,26,26,26, 26,26,26,26,26,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28, 28,28,29,29,29,29,29,29,29,29,29,29,29,29,30,30,30,30,30,30, 30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,32,32,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51}
This table contains 1201 entries.
Table 12, inter quantization look-up table for block positions (1,1),(1,3),(3,1),(3,3): {0,1,2,2,2,2,2,2,3,4,5,6,7,8,8,9,10,10,11,11,12,12,13,13,13, 14,14,14,15,15,15,16,16,16,17,17,17,17,17,18,18,18,18,19,19, 19,19,19,20,20,20,20,20,20,21,21,21,21,21,21,21,22,22,22,22, 22,22,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24, 25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26, 26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28, 28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29, 29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30, 30,30,30,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, 31,31,31,31,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44, 44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47, 47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49, 49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, 50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, 51,51,51,51,51,51,51,51,51,51,51,51}
This table contains 1917 entries.
The magnitude value of every current candidate transform coefficient addresses the corresponding one from tables 7 to 12. The look-up table output is a corresponding QP number between ‘0’ and ‘51’. For example, if the current transform coefficient belongs to position (0,0) in an intra block and its magnitude value is ‘5’, only QP=6 or higher can be used to quantize it to zero. Accordingly, in table 7 the position ‘5’maps to QP=6. E.g. for an intra block, if the current transform coefficient magnitude is between 1482 and 1534 and has a position (1,1), this coefficient is automatically mapped to QP=51.
For intra block coefficient magnitudes greater than 1482 the tables 7 to 10 are not (i.e. need not be) addressed. E.g. for intra block coefficient magnitudes greater than 598 and block positions (0,0), (0,2), (2,0), (2,2) table 7 is not (i.e. need not be) addressed.
These six tables 7 to 12 can be used to quickly map, taking into account the current position in the block and the intra or inter type, between the magnitude of a current transform coefficient and the QP for which this transform coefficient will be quantized to zero.
The QP value resulting from tables 7 to 12 addresses the corresponding one of tables 1 to 6, i.e. table 7 is related to table 1, table 8 is related to table 2, and so on. The output from the corresponding one of tables 1 to 6 is the actual quantization threshold value for the current coefficient magnitude and a given QP.
For each candidate QP value the resulting number of zero coefficients of the block is summed up, following quantization using the corresponding quantization threshold value from tables 1 to 6, so that the functions ρI(QP) and ρP(QP) can be established.
Thus, when using the tables 1 to 12 it can be easily determined for a block of transform values how many of them will become zero if a specific QP is applied in the quantisation. Using the above tables speeds up the computation and allows to avoid the comparison step (i.e. the if-clause) in equations (5).
The above table processing is depicted by
Rate Control
The following processing is carried out for the actual encoding of frames of the video sequence.
The inventive rate control is shown in connection with
Step A)
For achieving a low encoding delay condition, it can be assumed that (e.g. for a coding unit such as a group of pictures) only P frames are encoded after the first I frame. Hence the (virtual) encoder buffer can be initialized as follows:
wherein B is the target number of bits for a frame (including the bits for quantized transform coefficients, motion vectors and header information), R is the channel rate in bits per second, F is the frame rate in frames per second, W is the number of bits in the encoder buffer and represents a modification value for a frame which will be updated after a frame has been coded, Φ is the maximum buffer size, Wprev is the previous number of bits in the buffer, B′ is the actual number of bits used for encoding the previous frame, M is the number of transform coefficients in the current macroblock, and Z=0.1 is set as a default value to achieve a low delay. Then the linear model parameter value Θ is set to 1.5, and the total number of macroblocks for the current frame is initialised.
Step B)
Following the above-described pre-processing step, the mapping table between ρ and QP (0 . . . 51) for each macroblock is obtained.
The QP can be obtained from the above-mentioned ρ-QP lookup mapping table using equation (7):
ρ=384(N−Nm)−(Rc−Rm)/Θ (7)
wherein 384 is the number of transform coefficients in a macroblock, N is the number of macroblocks per frame, Nm is the number of macroblocks which have already been coded in the current frame, Rc is the encoder output bit rate in bits per second for the current frame, and Rm is the number of bits used by the already encoded macroblocks in the current frame.
When determining the QP for the encoding of the current macroblock, a bi-linear search method can be used to get QP from a P/QP frame mapping table, which is the sum of the macroblock ρ/QP mapping tables described in equations (5).
By using the neighbouring information among the macroblocks, the QP of the current macroblock advantageously is constrained by using the average of the QPs for all prior macroblocks in the current frame until the current macroblock, cf. the pseudo codes (8) and (9). The spatial variations of QP in a frame are preferably smaller than ±3 QP values. Advantageously the difference between the average QP of the current frame and the average QP of previous pictures can be constrained, too. The temporal variations of QP between frames are preferably smaller than ±4 QP values.
According to the goal that the QP of neighbouring macroblocks should not vary too much, the QP of the current macroblock is constrained using the average of the QPs (AverageQP) for all prior macroblocks (mb) in the current frame until the current macroblock. This can described by the following pseudo-code:
wherein SumQP is the total sum of all QP values in the current frame until the current macroblock, TempAverageQP is the average QP in the current frame until the current macroblock, CurrentQP is the QP of the current macroblock, and “absolute” means calculating the absolute value.
According to the goal that the QP for corresponding macroblocks in temporally adjacent frames should not vary too much, the QP of the current macroblock is further constrained as described by the following pseudo-code:
wherein AverageRhoQP is the average QP of one or more previous frames, which can be selected according to the Θ value difference of the different frames.
Step C)
Get the number of zero coefficients (ρ) and of bits for the current macroblock and then update the header and the encoding buffer.
Step D)
Repeat steps B and C until the end of the current frame.
In
The invention can be used e.g. in a PC or a DSP platform for real-time encoding. It can also be used for other video coding standards like e.g. MPEG2-Video.
A bit stream that was encoded according to the invention can be recorded on a storage medium, e.g. a DVD, Bluray or HD-DVD optical disc.
Number | Date | Country | Kind |
---|---|---|---|
05300424.8 | May 2005 | EP | regional |