Disclosure of Invention
The embodiment of the invention provides a technical scheme for coding a small-size transformation coefficient block by adopting an entropy coding mode suitable for the large-size transformation coefficient block. The technical scheme of the embodiment of the invention is as follows:
a coding method compatible with different size block transforms, comprising:
scanning each of N sub-transform coefficient blocks obtained according to video image data to generate a sub-sequence composed of coefficients in the sub-transform coefficient block;
wherein N is a positive integer greater than or equal to 2, and an ith one of the N sub-transform coefficient blocks contains
A coefficient,
i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1;
extracting coefficients in each subsequence, and performing interweaving processing on the extracted coefficients to generate a sequence to be coded;
using an apparatus comprising 2x×2yAdaptation of transform blocks of individual coefficientsCoding the sequence to be coded by using an entropy coding mode;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than or equal to the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
A method for generating a sequence to be encoded, comprising:
scanning each of N sub-transform coefficient blocks obtained according to video image data to generate a sub-sequence composed of coefficients in the sub-transform coefficient block;
wherein N is a positive integer greater than or equal to 2, and an ith one of the N sub-transform coefficient blocks contains
A coefficient,
i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1;
extracting coefficients in each subsequence, interleaving the extracted coefficients to generate a usable content 2x×2yThe coding sequence to be coded is coded by the entropy coding mode suitable for the transformation block of each coefficient;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than or equal to the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
An apparatus for generating a sequence to be encoded, comprising:
a subsequence generating unit, a to-be-coded sequence generating unit and an output unit; wherein,
a sub-sequence generating unit for scanning each of N sub-transform coefficient blocks obtained from the video image data to generate a sub-transform coefficientThe sub-sequence composed of the coefficients in the blocks transmits the generated sub-sequence information to the generating unit of the sequence to be coded; where N is a positive integer greater than or equal to 2, and the ith transform coefficient block contains
A coefficient,
i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1;
a to-be-coded sequence generating unit for receiving the subsequence information from the subsequence generating unit, extracting the coefficients in each subsequence, interleaving the extracted coefficients, and generating a usable code containing 2x×2yThe coding sequence to be coded is coded by the entropy coding mode applicable to the transformation block of each coefficient, and the information of the coding sequence to be coded is transmitted to an output unit;
the output unit is used for receiving the information of the code sequence to be coded from the code sequence generating unit and outputting the information;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than or equal to the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
An encoder compatible with different size block transforms, comprising: the device comprises a device for generating a sequence to be coded to be entropy coded, an entropy coding unit and an output unit;
the device for generating the sequence to be coded to be entropy coded comprises: a subsequence generating unit and a to-be-coded sequence generating unit; wherein,
a sub-sequence generating unit, which is used for scanning each sub-transformation coefficient block in N sub-transformation coefficient blocks obtained according to video image data, generating a sub-sequence consisting of coefficients in the sub-transformation coefficient block, and transmitting the generated sub-sequence information to a to-be-coded sequence generating unit; where N is a positive integer greater than or equal to 2, and the ith transform coefficient block contains
A coefficient,
i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1;
a to-be-coded sequence generating unit for receiving the subsequence information from the subsequence generating unit, extracting the coefficients in each subsequence, interleaving the extracted coefficients, and generating a usable code containing 2x×2yThe coding sequence to be coded is coded by the entropy coding mode applicable to the transformation block of each coefficient, and the information of the coding sequence to be coded is transmitted to an output unit;
the output unit is used for receiving the information of the code sequence to be coded from the code sequence generating unit and outputting the information;
an entropy coding unit for receiving the information of the sequence to be coded from the output unit, using a code comprising 2x×2yCoding the sequence to be coded by an entropy coding mode applicable to the transformation block of each coefficient;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than or equal to the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
A decoding method corresponding to coding compatible with different-size block transformations, for performing decoding processing on a coded result according to a process inverse to the coding, comprising:
carrying out entropy decoding processing on the encoding result to obtain a sequence to be decoded;
performing reverse interleaving processing on the sequence to be decoded to obtain N subsequences;
and respectively carrying out inverse scanning processing on the N subsequences to obtain N sub-transformation coefficient blocks.
A decoder corresponding to an encoder compatible with different size block transforms, comprising: the device comprises an entropy decoding unit, an inverse interleaving processing unit and an inverse scanning processing unit; wherein,
the entropy decoding unit is used for carrying out entropy decoding processing on the encoding result to obtain a sequence to be decoded and transmitting the information of the sequence to be decoded to the reverse interleaving processing unit;
the device comprises an entropy decoding unit, a reverse-interleaving processing unit and a reverse-scanning processing unit, wherein the entropy decoding unit is used for decoding a sequence to be decoded;
and the inverse scanning processing unit is used for receiving the information of the N subsequences from the inverse interleaving processing unit and respectively performing inverse scanning processing on the N subsequences to obtain N sub-transformation coefficient blocks.
In summary, according to the coding and decoding scheme compatible with transform of different size blocks provided in the embodiments of the present invention, by interleaving the extracted coefficients from the plurality of small-sized sub-transform coefficient blocks, a coding sequence that can be processed by an entropy coding method suitable for the large-sized transform coefficient block is obtained, so that the entropy coding method suitable for the large-sized transform coefficient block can also be suitable for the small-sized transform coefficient block, and therefore, in a coding system based on block coding of different sizes, under the condition of having an entropy coding method suitable for the large-sized transform coefficient block, it is not necessary to redesign the entropy coding method suitable for the small-sized transform coefficient block, and therefore, the design cost of coding can be reduced, and the design complexity can be reduced.
Detailed Description
The technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
The embodiment of the invention provides a technical scheme for coding a small-size transformation coefficient block by adopting an entropy coding mode suitable for the large-size transformation coefficient block.
The embodiment of the invention firstly provides a coding method compatible with different size block transformations. Referring to fig. 3, fig. 3 is a flow chart of the method. The process may include the steps of:
step 301, scanning each of N sub-transform coefficient blocks obtained from video image data to generate a sub-sequence composed of coefficients in the sub-transform coefficient block;
wherein N is a positive integer greater than or equal to 2, and an ith one of the N sub-transform coefficient blocks contains
A coefficient, i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1.
And 302, extracting coefficients in each subsequence, and performing interleaving processing on the extracted coefficients to generate a sequence to be coded.
Step 303, utilizing a rule 2x×2yCoding the sequence to be coded by an entropy coding mode applicable to the transformation coefficient block of each coefficient;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yAnd the sum of the number of coefficients contained in the N sub-transform coefficient blocks is greater than or equal to:
<math>
<mrow>
<msup>
<mn>2</mn>
<mi>x</mi>
</msup>
<mo>×</mo>
<msup>
<mn>2</mn>
<mi>y</mi>
</msup>
<mo>≥</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>N</mi>
</munderover>
<msup>
<mn>2</mn>
<msub>
<mi>n</mi>
<mi>i</mi>
</msub>
</msup>
<mo>×</mo>
<msup>
<mn>2</mn>
<msub>
<mi>m</mi>
<mi>i</mi>
</msub>
</msup>
<mo>.</mo>
</mrow>
</math>
above contains 2
x×2
yTransform coefficient block of a coefficient relative to a block comprising
For a block of transform coefficients of a coefficient, the former may be a large-sized block, and the latter may be a small-sized block. If the former is an 8 x 8 sized block, the latter size may be: 4 × 4, 2 × 02, 4 × 8, 8 × 4, etc.; if the former is a 16 × 8 block, the latter may be of: 8 × 16, 8 × 8, 4 × 4, 2 × 2, and so on.
Referring to fig. 4, fig. 4 is a flowchart of a method for generating a sequence to be encoded according to an embodiment of the present invention, where the method may include the following steps:
step 401, scanning each of N sub-transform coefficient blocks obtained according to video image data to generate a sub-sequence composed of coefficients in the sub-transform coefficient block;
wherein N is a positive integer greater than or equal to 2, and an ith one of the N sub-transform coefficient blocks contains
A coefficient, i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1.
Step 402, extracting the coefficients in each subsequence, and interleaving the extracted coefficients to generate usable content 2x×2yThe coding sequence to be coded is coded by the entropy coding mode suitable for the transformation block of each coefficient;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
It should be noted that, in the embodiment of the present invention, the transform coefficient block or the sub-transform coefficient block may be quantized or not.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an apparatus for generating a sequence to be encoded according to an embodiment of the present invention. The apparatus may include: a subsequence generating unit, a to-be-coded sequence generating unit and an output unit; wherein,
a sub-sequence generating unit, which is used for scanning each sub-transformation coefficient block in N sub-transformation coefficient blocks obtained according to video image data, generating a sub-sequence consisting of coefficients in the sub-transformation coefficient block, and transmitting the generated sub-sequence information to a to-be-coded sequence generating unit; where N is a positive integer greater than or equal to 2, and the ith transform coefficient block contains
A coefficient, i 1, 2
iAnd m
iIs a positive integer greater than or equal to 1;
a to-be-coded sequence generating unit for receiving the subsequence information from the subsequence generating unit, extracting the coefficients in each subsequence, interleaving the extracted coefficients, and generating a usable code containing 2x×2yThe coding sequence to be coded is coded by the entropy coding mode applicable to the transformation block of each coefficient, and the information of the coding sequence to be coded is transmitted to an output unit;
the output unit is used for receiving the information of the code sequence to be coded from the code sequence generating unit and outputting the information;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
Referring to fig. 6, fig. 6 is a schematic structural diagram of the generating unit of the sequence to be encoded in fig. 5. The unit for generating the sequence to be encoded may include: the device comprises a coefficient extraction module, an interleaving processing module and a to-be-coded sequence generation module; wherein,
the coefficient extraction module is used for extracting coefficients needing to be subjected to interleaving processing from each subsequence and transmitting the extracted coefficient information to the interleaving processing unit;
the interleaving processing unit is used for receiving the coefficient information from the coefficient extraction module, arranging all the coefficients into a sequence, keeping the arrangement sequence of the coefficients which originally belong to all the subsequences in the sequence, keeping the same as the arrangement sequence in the atomic sequence, and transmitting the sequence information to the module for generating the sequence to be coded;
a to-be-coded sequence generating module, configured to receive the sequence information from the interleaving unit, and use the sequence as a to-be-coded sequence; or transforming the sequence to obtain the coding sequence to be coded.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an encoder compatible with different-size block transforms according to an embodiment of the present invention, which may include: the device comprises a device for generating a sequence to be coded to be entropy coded, an entropy coding unit and a sending unit;
the means for generating the sequence to be coded to be entropy coded may comprise the units or modules described above with reference to fig. 5 and 6;
an entropy coding unit for receiving the information of the sequence to be coded from the output unit, using a code comprising 2x×2yCoding the code sequence to be coded by an entropy coding mode applicable to the transformation block of each coefficient, and transmitting coding result information to a transmitting unit;
the transmitting unit is used for receiving the coding result information from the entropy coding unit and transmitting the information;
wherein x and y are positive integers greater than or equal to 2, and the transform coefficient block contains 2 coefficientsx×2yGreater than the sum of the number of coefficients contained in the N sub-transform coefficient blocks.
Specific examples of the above technical solutions provided by the embodiments of the present invention are given below.
The first embodiment is as follows:
in the first embodiment, it is assumed that four 4 × 4 sub-transform coefficient blocks need to be encoded by an entropy encoding method applied to a transform coefficient block having a size of 8 × 8.
In the first embodiment, let SBi represent one of the four sub-transform coefficient blocks, i may be 1, 2, 3 or 4. Referring to fig. 8, 9a and 9b, fig. 8 is a schematic diagram of a combination of 4 x 4 sub-transform coefficient blocks; FIG. 9a is a schematic diagram illustrating a zigzag scanning manner of a 4 × 4 block; fig. 9b is a diagram illustrating a field scanning manner of a 4 × 4 block in the prior art. In general, in a two-dimensional transform coefficient block, the low-frequency high-amplitude coefficients are arranged in the upper left corner of the block, and the two-dimensional transform coefficient block can be scanned to obtain a one-dimensional sequence, and the coefficients in the one-dimensional sequence are usually arranged in a manner of decreasing amplitude from left to right, and the coefficients in the sequence are arranged in this manner, so that the subsequent entropy coding efficiency can be improved. Since the coefficient amplitudes are statistically derived, the case where the coefficients with smaller amplitudes are arranged before the coefficients with larger amplitudes is not excluded, but in general, the overall trend of the one-dimensional sequence ordering is arranged according to the arrangement trend of the frequencies corresponding to the coefficients from low to high. Also, in a sequence, typically some coefficients at the beginning are non-zero in magnitude, and most coefficients are zero in magnitude thereafter.
Referring to fig. 10, fig. 10 is a flowchart of encoding four 4 × 4 sub-transform coefficient blocks according to a first embodiment of the present invention, where the flowchart includes the following steps:
step 1001, scanning the four sub-transform coefficient blocks SBi according to the scanning mode of fig. 9a, respectively, to obtain four sub-sequences Si, each sub-sequence including 16 coefficients, that is,
S1:a0,a1,a2,...,a15;
S2:b0,b1,b2,...,b15;
S3:c0,c1,c2,...,c15;
S4:d0,d1,d2,...,d15。
in this embodiment, the scanning method used may also be the scanning method of fig. 9b or another scanning method suitable for the entropy coding method.
Step 1002, checking coefficients in each subsequence, and if all the coefficients in the S1-S4 subsequences are zero, executing step 1003; otherwise, step 1004 is performed.
In step 1003, a coding result indicating that all coefficients in the four subsequences are zero can be obtained, and a flag can be set to mark the coding result, thereby ending the current coding process.
In this embodiment, a variable cbp may be set, and according to the variable value, it may be determined whether the encoding process needs to be continued, and if all coefficients in the four subsequences are set to be zero, cbp is 0; otherwise, cbp ═ 1; that is, if cbp is 0, the current encoding process may be ended, and the cbp is 0 and written into the encoding result, and if cbp is 1, the subsequent steps need to be continuously executed.
And 1004, extracting the coefficients in the subsequences of which the coefficients are not all zero from the four subsequences, executing the subsequent steps, and deleting the subsequences of which the coefficients are all zero.
In this embodiment, a variable may also be set to indicate whether each subsequence is zero. If cbppi is set, if cbppi is 0, it can be indicated that all coefficients of the subsequence Si are zero, and the sequence of Si can be deleted; if cbpSi is 1, it may indicate that the subsequence needs to be encoded. And, the value of the variable cbpSi may also be written to the encoding result.
Step 1005, interleaving the extracted coefficients to obtain a sequence of no more than 64 coefficients, which may be composed of coefficients in these subsequences.
In this embodiment, if there are coefficients that are not zero in all of the four subsequences, the sequence obtained after the interleaving process may be:
a0 b0 c0 d0 a1 b1 c1 d1 a2 b2 c2 d2...a15 b15 c15 d15 (1);
the interleaving process may be performed by arranging the coefficients into a sequence, and keeping the arrangement order of the coefficients in the sequence originally belonging to each sub-sequence the same as the arrangement order in the atomic sequence, so that the frequency corresponding to the coefficients in the sequence may show a low-to-high arrangement trend for further improving the subsequent entropy coding efficiency. In the above sequence (1), the coefficients a0, a1, a2, a15 are arranged in the same order as in S1, and the coefficients b0, b1, b2, a, b15 are arranged in the same order as in S2, and it can be similarly seen that the coefficients in the original S3 and S4 are arranged in the same order as in the corresponding atom sequences. In this embodiment, the sequence obtained after the interleaving process may be:
a0 b0 d0 c0 a1 c1 b1 d1 b2 a2 c2 d2...c15 a15 b15 d15 (2);
other possible scenarios are not listed.
Step 1006, 2 × 2 Hadamard transform may be performed on a0, b0, c0, and d0, and sequence (1) is transformed into sequence (3):
a0’b0’c0’d0’a1 b1 c1 d1 a2 b2 c2 d2...a15 b15 c15 d15 (3);
in practical application, the sequence (1) can be used as a sequence to be encoded, and the sequence to be encoded is directly encoded subsequently. In this embodiment, to further improve subsequent entropy coding efficiency, the sequence (1) needs to be transformed, and the sequence (3) obtained after the transformation is used as the sequence to be coded. In this embodiment, a Hadamard transform is applied to sequence (1), and the effect of the Hadamard transform is that the energy represented by the coefficient amplitudes is further concentrated by a0 ', after which the coefficients in sequence (3) are already close to zero, possibly starting from b 0'. Therefore, when entropy coding is performed on the sequence (3) subsequently, only a 0' can be coded to obtain the corresponding code word. If the sequence (1) or (2) is subjected to Hadamard transform, a mark using the transform can be written in the encoding result.
And step 1007, coding the sequence (3) by using an entropy coding mode suitable for the 8 × 8 transform coefficient block, and ending the current coding process.
In addition, in the embodiment of the present invention, step 1005 is also executed before step 1002, and if it is executed before step 1002, sequence (1) includes 64 coefficients. The technical solutions of step 1002 to step 1004 are provided for further improving the coding efficiency, and in practical applications, other approaches for improving the coding efficiency may be adopted. In addition, cbpS may be used instead of cbpS, or the indication information of whether or not the four subsequences need to be encoded, or which subsequences need to be encoded, etc. may be mapped to cbpS, where if cbpS is 0, it may indicate that all four subsequences have only prediction Direct Current (DC) coefficients, i.e., a0, b0, c0, and d0 are non-zero, and other coefficients are all zero; if cbpS is 1, it may indicate that four subsequences need to be encoded; if cbpS is 2, this may indicate that the subsequences S1 and S2 need to be encoded, etc., and so on, and will not be listed.
In the first embodiment of encoding the small-sized sub-transform coefficient blocks by the entropy encoding method suitable for the large-sized transform coefficient block, the combination of the selected small-sized sub-transform coefficient blocks is 4 × 4 blocks, the large-sized transform coefficient block is 8 × 8 blocks, and the 4 × 4 blocks can be combined into just one 8 × 8 block. In fact, the coding scheme provided by the embodiment of the present invention is a compatible scheme, that is, as long as the number of coefficients of the large-sized transform coefficient block is 2, the number of coefficients of the transform coefficient block is 2x×2yIf the number of the sub-transform coefficient blocks is larger than the sum of the numbers of the coefficients of the N small-sized sub-transform coefficient blocks participating in the combination, the N small-sized sub-transform coefficient blocks obtained by the combination can be encoded by an entropy encoding method suitable for the large-sized sub-transform coefficient block, and the sizes of the N small-sized sub-transform coefficient blocks are not necessarily the same. Since, as can be seen from the first embodiment, the small-sized sub-transform coefficient blocks are encoded by using the entropy encoding method applicable to the large-sized transform coefficient block, as long as the number of coefficients included in each of the small-sized sub-transform coefficient blocks in the sequence to be encoded obtained through interleaving does not exceed the number of coefficients included in the large-sized transform coefficient block, of course, the number of coefficients included in the sequence to be encoded obtained through interleaving includes the number of coefficients that may be deleted before and after interleaving, and are zero.
In addition, in the first embodiment, in addition to writing the entropy coding result into the coding result, the characteristic information of the coding process, such as the combination information of the sub-transform coefficient blocks, the information of the scanning mode, the information of cbp, the information of cbpSi, the information about how to interleave, and the identification information of the Hadamard transform, can be written into the coding result, so that the decoding end can perform decoding according to the inverse process of the coding end when decoding. The information on how to interleave may be, how to perform a default interleaving manner in the embodiment of the present invention, that is, if the sequence obtained after interleaving is the sequence (1), the identifier of the related information may not need to be transmitted, and the interleaving manner is defaulted at the decoding end, if the interleaving manner is non-default, and if the sequence obtained after interleaving is the sequence (2), the identifier information of the non-default interleaving manner is written in the encoding result and transmitted to the decoding end.
Example two:
in the second embodiment, 16 sub-transform coefficient blocks of 4 × 4 are encoded by an entropy encoding method applied to transform coefficient blocks of 8 × 8.
Referring to fig. 11, fig. 11 is a schematic diagram of an arrangement of 16 sub-transform coefficient blocks in units of one 4 × 4 sub-transform coefficient block. Referring to fig. 12, fig. 12 is a schematic diagram of the coding combination scheme of 16 4 × 4 sub-transform coefficient blocks in the second embodiment. As shown in fig. 12, in the second embodiment, 4 sub-transform coefficient blocks of 4 × 4 are still combined, for example, 0 to 3 sub-transform coefficient blocks shown in fig. 11 are combined, 4 to 7 sub-transform coefficient blocks are combined, 8 to 11 sub-transform coefficient blocks are combined, and 12 to 15 sub-transform coefficient blocks are combined. Based on the encoding flow of the first embodiment, the 4 combinations in the present embodiment are encoded by using the entropy encoding method applied to the 8 × 8 block. The scanning sequence when encoding every four sub-transform coefficient blocks is as shown in fig. 12, and when encoding 0-3 four sub-transform coefficient blocks, scanning sub-transform coefficient block 0 first to obtain a corresponding sub-sequence; scanning the sub-transformation coefficient block 1 to obtain a corresponding sub-sequence; then scanning the sub-transformation coefficient block 2 to obtain a corresponding sub-sequence; finally, scanning the sub-transformation coefficient block 3 to obtain a corresponding sub-sequence; and then extracting coefficients from each subsequence, and performing interleaving processing on the extracted coefficients, wherein the subsequent processing flow can refer to embodiment one and is not described again.
In addition, combination information on the respective sub-transform coefficient blocks in the current encoding may be written in the encoding result, and if the combination is composed of 4 × 4 sub-transform coefficient blocks, the combination has four in total, and 16 sub-transform coefficient blocks in total, and the sub-transform coefficient blocks are arranged in the arrangement shown in fig. 11.
Example three:
in the third embodiment, 16 sub-transform coefficient blocks of 4 × 4 are encoded by entropy encoding suitable for transform coefficient blocks of 8 × 8 size. The arrangement of the 16 sub-transform coefficient blocks can also be seen in fig. 11. Referring to fig. 13, fig. 13 is a schematic diagram of the coding combination scheme of 16 4 × 4 sub-transform coefficient blocks in the third embodiment. In the third embodiment, the sub-transform coefficient blocks 0, 4, 8, and 12 may be regarded as a combination, that is, the combination includes four 4 × 4 sub-transform coefficient blocks, and the four sub-transform coefficient blocks are encoded based on the encoding procedure in the first embodiment, where the sub-transform coefficient blocks 0, 5, 8, and 12 are sequentially scanned in the scanning order as shown in fig. 13.
For the remaining 1, 4, 2, 3, 6, 7, 9, 13, 10, 11, 14, 15 sub-transform coefficient blocks, 4 combinations may continue to be formed: 1. 2, 3 combination; 5. 6, 7 combination; 9. 10, 11 combination; 13. 14, 15 are combined. When the combination 1, 2, 3 is coded, the sub-transform coefficient block 1 is scanned first according to the scanning sequence shown in fig. 13 to obtain the corresponding sub-sequence; then scanning the sub-transformation coefficient block 2 to obtain a corresponding sub-sequence; finally, scanning the sub-transformation coefficient block 3 to obtain a corresponding sub-sequence; and performing interleaving processing on the obtained three subsequences, wherein the interleaving processing method still comprises the following steps: the sequence order of the coefficients originally belonging to each subsequence is maintained to be the same as the sequence order in the atomic sequence.
The process of forming the respective to-be-coded sequences by the other three combinations can be analogized and is not described in detail.
In this embodiment, the plurality of sub transform coefficient blocks participating in the combination are not necessarily consecutive or immediately adjacent, and sub transform coefficient blocks that are more distant apart may be selected as necessary. In this embodiment, the combination related information may also be written into the encoding result, and the writing manner may be mapping writing or variable amplitude.
Example four:
in the fourth embodiment, the sub-transform coefficient blocks of different sizes are encoded by an entropy encoding method suitable for transform coefficient blocks of size 8 × 8. Referring to fig. 14, fig. 14 is a schematic diagram of combinations of sub-transform coefficient blocks of different sizes in the fourth embodiment. The combination comprises: 4 2 x 2 sub-transform coefficient blocks, 3 4 x 4 sub-transform coefficient blocks. A description will now be given of how to obtain the combined sequence to be encoded. Referring to fig. 15, fig. 15 is a flowchart of the fourth embodiment to obtain the sequence to be coded of the combination shown in fig. 14, where the flowchart may include the following steps:
step 1501, scanning 4 sub-transform coefficient blocks of 2 × 2 in sequence to obtain corresponding 4 sub-sequences Ai, i may be 1, 2, 3, 4. Wherein,
A 1:aa0、aa1、aa2、aa3;
A2:ab0、ab1、ab2、ab3;
A3:ac0、ac1、ac2、ac3;
A4:ad0、ad1、ad2、ad3。
step 1502, extracting coefficients from the 4 subsequences, and performing interleaving processing on the proposed coefficients to obtain an S1 sequence with coefficients not exceeding 16.
S 1:aa0、ab0、ac0、ad0、aa1、ab1、ac1、ad1...aa3、ab3、ac3、ad3。
In this step, the interleaving process is performed similarly to the embodiment.
Step 1503, scanning the other 3 sub-transform coefficient blocks of 4 × 4 in sequence to obtain three sub-sequences: s2, S3 and S4.
S2:b0,b1,b2,...,b15;
S3:c0,c1,c2,...,c15;
S4:d0,d1,d2,...,d15。
Step 1504, performing interleaving processing on the four subsequences from S1 to S4 to obtain a sequence to be coded:
aa0、b0、c0、d0、ab0、b1、c1、d1、...、ad3、b15、c15、d15。
in this step, the interleaving process is performed similarly to the embodiment.
In this embodiment, the execution order of the above step 1502 and step 1503 need not strictly adhere to, that is, since there are multiple sub-transform coefficient blocks in combination, the processing order of scanning the multiple sub-transform coefficient blocks, coefficient interleaving, and the like can be performed according to the actual situation, and accordingly, the execution order of the above steps 301 and 302, or the execution order of the steps 401 and 402, is only for the finally obtained to-be-encoded sequence, that is, the interleaving process is performed on the coefficients extracted from each sub-sequence, and when the method is specifically implemented, there may be a case where sub-transform coefficient blocks of different sizes need to be encoded as in the fourth embodiment, and accordingly, the process similar to the fourth embodiment can be adopted.
To this end, a sequence to be coded is obtained, which is then coded in an entropy coding manner suitable for 8 × 8 blocks of transform coefficients.
Example five:
in the fifth embodiment, two 8 × 4 sub-transform coefficient blocks are encoded by an entropy encoding method suitable for an 8 × 8 transform coefficient block. Referring to fig. 16, fig. 16 is a schematic diagram of a combination of two 8 × 4 sub-transform coefficient blocks in this embodiment. Referring to fig. 17, fig. 17 is a flowchart of the fifth embodiment to obtain the combined sequence to be coded shown in fig. 18, where the flowchart may include the following steps:
in step 1701, two 8 × 4 sub-transform coefficient blocks are sequentially scanned in a zigzag-like scanning manner as shown in fig. 16, resulting in two corresponding sub-sequences S1 and S2. Wherein,
S1:a0、b0、a1、b1、a2、b2、...、a15、b15;
S2:c0、d0、c1、d1、c2、d2、...、c15、d15。
scanning similar to field scanning or other scanning methods may be used, and typically the energy represented by the preceding coefficient amplitudes is greater in the scanned sequence.
Step 1702, performing interleaving processing on the coefficients extracted from S1 and S2 to obtain the combined to-be-coded sequence:
a0、b0、c0、d0、a1、b1、c1、d1、...、a15、b15、c15、d15。
in this step, the interleaving process is performed similarly to the embodiment.
To this end, the combined sequence to be encoded shown in fig. 16 is obtained, and then the sequence to be encoded is encoded by an entropy encoding method suitable for the 8 × 8 transform coefficient block.
The embodiment of the invention also provides a decoding method corresponding to the coding compatible with the transformation of the blocks with different sizes, and the decoding processing is carried out on the coding result according to the process inverse to the coding, namely the decoding process corresponds to the coding process and is the inverse process of the coding process. Referring to fig. 18, fig. 18 is a flowchart of the decoding method, which may include the steps of:
step 1801, entropy decoding is performed on the encoding result to obtain a sequence to be decoded.
The sequences to be decoded correspond to the same sequence to be coded.
And 1802, performing reverse interleaving processing on the sequence to be decoded to obtain N subsequences.
The effect of the de-interleaving process is to re-reduce the sequence to be decoded into a plurality of sub-sequences.
Step 1803, performing inverse scanning processing on the N subsequences respectively to obtain N sub-transform coefficient blocks.
The effect of the inverse scan is to restore the coefficients in each sequence to the corresponding positions in the two-dimensional block.
The embodiment of the invention also provides a decoder corresponding to the encoder compatible with the block transform with different sizes. Referring to fig. 19, fig. 19 is a schematic diagram of the structure of the decoder. The decoder may include: the device comprises an entropy decoding unit, an inverse interleaving processing unit and an inverse scanning processing unit; wherein,
the entropy decoding unit is used for carrying out entropy decoding processing on the encoding result to obtain a sequence to be decoded and transmitting the information of the sequence to be decoded to the de-interleaving processing unit; the band code sequences corresponding to the sequences to be decoded are the same;
the device comprises an entropy decoding unit, a reverse interleaving unit and a reverse scanning unit, wherein the entropy decoding unit is used for decoding a sequence to be decoded;
and the inverse scanning processing unit is used for receiving the information of the N subsequences from the inverse interleaving processing unit and respectively performing inverse scanning processing on the N subsequences to obtain N sub-transformation coefficient blocks.
The implementation of the decoding process in the embodiment of the present invention is described by decoding the code in the first embodiment. The decoder decodes the received coding result, such as:
decoding the combination information of the sub-transformation coefficient block in the coding result to obtain the information such as the size of the block corresponding to the sequence to be decoded;
decoding the cbp information in the coding result, if the cbp is 0, then no more information about the current coding exists; if cbp is 1, continuing decoding;
decoding information of CbpSi (i is 1, 2, 3, 4), and acquiring Si corresponding to a sequence to be decoded;
decoding to obtain a sequence to be decoded, which adopts a Hadamard transform identifier and carries out Hadamard inverse transform on the sequence to be decoded to obtain an inverse transformed sequence to be decoded;
the interleaving mode identification is not decoded, so that the converted sequence to be decoded is subjected to reverse interleaving treatment according to a default interleaving mode to obtain a plurality of subsequences;
decoding the information of the scanning mode, carrying out inverse scanning processing on each subsequence, resetting each coefficient to the corresponding position of the original two-dimensional sub-transformation coefficient block, and ending the decoding of the sub-transformation coefficient block.
In summary, according to the coding and decoding scheme compatible with transform of different size blocks provided in the embodiments of the present invention, by interleaving the extracted coefficients from the plurality of small-sized sub-transform coefficient blocks, a coding sequence that can be processed by an entropy coding method suitable for the large-sized transform coefficient block is obtained, so that the entropy coding method suitable for the large-sized transform coefficient block can also be suitable for the small-sized transform coefficient block, and thus, in a coding system based on block coding of different size, such as a coding system incorporating ABT technology, under the condition of having an entropy coding method suitable for the large-sized transform coefficient block, it is not necessary to redesign the entropy coding method suitable for the small-sized transform coefficient block, and therefore, the design cost of coding can be reduced, and the design complexity can be reduced.
In addition, in the embodiment of the invention, because a plurality of sub-transform coefficient blocks can be coded simultaneously, the correlation among the blocks is further reduced, and the coding performance is improved. In addition, in the embodiment of the invention, a plurality of sub-transform coefficient blocks can be coded simultaneously, and compared with the case of coding the sub-transform coefficient blocks one by one, the frequency of reading the coded end of block (EoB) mark is reduced, thereby effectively improving the coding efficiency.