CN112422973A - Encoding method and device - Google Patents

Encoding method and device Download PDF

Info

Publication number
CN112422973A
CN112422973A CN202011177332.9A CN202011177332A CN112422973A CN 112422973 A CN112422973 A CN 112422973A CN 202011177332 A CN202011177332 A CN 202011177332A CN 112422973 A CN112422973 A CN 112422973A
Authority
CN
China
Prior art keywords
macro block
macroblock
type
copy
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011177332.9A
Other languages
Chinese (zh)
Inventor
杨鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Wanxiang Electronics Technology Co Ltd
Original Assignee
Xian Wanxiang Electronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Wanxiang Electronics Technology Co Ltd filed Critical Xian Wanxiang Electronics Technology Co Ltd
Priority to CN202011177332.9A priority Critical patent/CN112422973A/en
Publication of CN112422973A publication Critical patent/CN112422973A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods 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 a pixel

Abstract

The disclosure provides a coding method and a coding device, relates to the field of image processing, and can solve the problems of large code stream and low security after coding in the related technology. The specific technical scheme is as follows: dividing a current frame into a macro blocks of a multiplied by a; determining the macro block type of each macro block; dividing a macro block comprising a non-copy class macro block into b × b small macro blocks; determining the macro block type of each small macro block; and coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein the macro block and the small macro block of which the macro block types are copy macro blocks only need to be marked, and the small macro block of which the macro block type is a non-copy macro block is subjected to pixel-by-pixel coding. The current frame may be divided into macroblocks, and then each macroblock may be subdivided. After the macroblock types of the macroblocks with different sizes are identified, the corresponding types of coding can be carried out. Therefore, the coding code stream can be reduced, and the complexity of the program and the code stream can be improved, thereby improving the safety performance.

Description

Encoding method and device
Technical Field
The present disclosure relates to the field of image processing, and in particular, to an encoding method and apparatus.
Background
The existing vgtp coding and decoding algorithm mainly adopts a macro block with a fixed size of 16x16 pixels as a coding unit, performs type identification by taking the macro block as a unit, and then performs coding by adopting a corresponding coding mode. The main object of vgtp is computer synthesis image and the future video picture size will be developed to 4k resolution, the area of the same and slowly changing content in the image will be increased, and the use of smaller macro block size is not beneficial to reducing the code stream.
Disclosure of Invention
The embodiment of the disclosure provides an encoding method and an encoding device, which can solve the problems of large code stream and low security after encoding in the related art. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided an encoding method, the method including:
dividing a current frame into a macro blocks of a multiplied by a;
determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macroblocks include the following macroblock types: image macro blocks and text macro blocks; the non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock;
if the macro block comprises the non-copy macro block, dividing the macro block comprising the non-copy macro block into b × b small macro blocks; wherein b is less than a;
determining the macro block type of each small macro block;
and coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein for the macro block and the small macro block of which the macro block type is a copy macro block, only the macro block type needs to be marked, and for the small macro block of which the macro block type is a non-copy macro block, pixel-by-pixel coding is carried out.
The encoding method provided by the embodiment of the disclosure comprises the following steps: dividing a current frame into a macro blocks of a multiplied by a; determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; non-copy class macroblocks include macroblock types including: image macro blocks and text macro blocks; non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock; if the macro block comprises the non-copy macro block, dividing the macro block comprising the non-copy macro block into b multiplied by b small macro blocks; wherein b is less than a; determining the macro block type of each small macro block; and coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein the macro block and the small macro block of which the macro block types are copy macro blocks only need to be marked, and the small macro block of which the macro block type is a non-copy macro block is subjected to pixel-by-pixel coding. The current frame may be divided into macroblocks, and then each macroblock may be subdivided. After the macroblock types of the macroblocks with different sizes are identified, the corresponding types of coding can be carried out. Therefore, the coding code stream can be reduced, and the complexity of the program and the code stream can be improved, thereby improving the safety performance.
In one embodiment, the encoding the current frame according to the macroblock type of each macroblock and the macroblock type of each small macroblock includes:
if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into small macro blocks of c multiplied by c; wherein c is less than b;
determining the macro block type of each small macro block;
if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into a smallest macro block of d multiplied by d; wherein d is less than c;
determining the macro block type of each minimum macro block;
and coding the current frame according to the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block, wherein for the macro block, the small macro block and the minimum macro block of which the macro block types are copy macro blocks, the macro block types only need to be marked, and for the minimum macro block of which the macro block type is the non-copy macro block, pixel-by-pixel coding is carried out.
In one embodiment, the encoding the current frame according to the macroblock type of each macroblock, the macroblock type of each small macroblock, and the macroblock type of each minimum macroblock includes:
and coding the current frame according to a preset internal coding sequence, the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block.
In one embodiment, the determining the macroblock type of each macroblock includes:
judging whether the current macro block is of an unchanged macro block type;
if the current macro block is the unchanged macro block type, determining that the current macro block is the copy macro block;
if the current macro block is not the unchanged macro block type, judging whether the current macro block is the motion vector macro block type;
if the current macro block is the motion vector macro block type, determining that the current macro block is the copy macro block;
if the current macro block is not the motion vector macro block type, judging whether the current macro block is a left copy macro block type;
if the current macro block is the type of the left copy macro block, determining that the current macro block is the copy macro block;
if the current macro block is not the type of the left-copy macro block, judging whether the current macro block is the type of an upper-copy macro block;
if the current macro block is the type of the upper copy macro block, determining that the current macro block is the copy macro block;
and if the current macro block is not the type of the upper copy macro block, determining that the current macro block is the non-copy macro block.
In one embodiment, the determining that the current macroblock is the non-copy class macroblock includes:
judging whether the current macro block is a character macro block type;
and if the current macro block is not the character macro block type, determining that the current macro block is the image macro block type.
In one embodiment, the determining whether the current macroblock is a text macroblock type includes:
acquiring brightness difference values of the brightness values of all pixels in the current macroblock and brightness values of all pixels around the current macroblock;
acquiring the number of target pixels in the current macro block of which the brightness difference value exceeds a preset threshold value;
and if the ratio of the number of the target pixels to the number of all pixels in the current macro block is greater than a preset threshold, determining that the current macro block is the character macro block type.
According to a second aspect of the embodiments of the present disclosure, there is provided an encoding apparatus, the apparatus including:
a first dividing module for dividing the current frame into a macro blocks of a × a;
the first determining module is used for determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macroblocks include the following macroblock types: image macro blocks and text macro blocks; the non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock;
a second dividing module, configured to divide the macroblock including the non-copy type macroblock into b × b small macroblocks if the macroblock includes the non-copy type macroblock; wherein b is less than a;
a second determining module, configured to determine a macroblock type of each small macroblock;
and the coding module is used for coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein for the macro block and the small macro block of which the macro block type is a copy macro block, only the macro block type needs to be marked, and for the small macro block of which the macro block type is a non-copy macro block, pixel-by-pixel coding is carried out.
In one embodiment, the encoding module comprises:
a first dividing module, configured to divide a small macroblock including the non-copy type macroblock into small macroblocks of c × c if the small macroblock includes the non-copy type macroblock; wherein c is less than b;
the first determining submodule is used for determining the macro block type of each small macro block;
a second dividing sub-module, configured to divide the small macro block including the non-copy macro block into a smallest d × d macro block if the small macro block includes the non-copy macro block; wherein d is less than c;
the second determining submodule is used for determining the macroblock type of each minimum macroblock;
and the coding sub-module is used for coding the current frame according to the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block, wherein for the macro block, the small macro block and the minimum macro block of which the macro block types are copy macro blocks, only the macro block types need to be marked, and for the minimum macro block of which the macro block type is the non-copy macro block, pixel-by-pixel coding is carried out.
In one embodiment, the encoding submodule includes:
and the coding subunit is used for coding the current frame according to a preset internal coding sequence, and the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block.
In one embodiment, the first determining module comprises:
the first judgment submodule is used for judging whether the current macro block is of an unchanged macro block type;
a third determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the unchanged macroblock type;
a second judging sub-module, configured to judge whether the current macroblock is a motion vector macroblock type if the current macroblock is not the unchanged macroblock type;
a fourth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the motion vector macroblock type;
a third judging submodule, configured to judge whether the current macroblock is a left-copy macroblock type if the current macroblock is not the motion vector macroblock type;
a fifth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the left-copy macroblock type;
a fourth judging submodule, configured to judge whether the current macroblock is an upper-copy macroblock type if the current macroblock is not the left-copy macroblock type;
a sixth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the upper copy macroblock type;
a seventh determining sub-module, configured to determine that the current macroblock is the non-copy macroblock if the current macroblock is not the type of the upper-copy macroblock.
In one embodiment, the seventh determination sub-module includes:
a fifth judging submodule, configured to judge whether the current macroblock is a text macroblock type;
an eighth determining sub-module, configured to determine that the current macroblock is the image macroblock type if the current macroblock is not the text macroblock type.
In one embodiment, the fifth determining sub-module includes:
the first obtaining submodule is used for obtaining the brightness difference value of the brightness value of each pixel in the current macroblock and the brightness value of all pixels around the current macroblock;
the second obtaining submodule is used for obtaining the number of target pixels in the current macro block of which the brightness difference value exceeds a preset threshold value;
a ninth determining sub-module, configured to determine that the current macroblock is the text macroblock type if a ratio of the number of the target pixels to the number of all pixels in the current macroblock is greater than a preset threshold.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flowchart of an encoding method provided by an embodiment of the present disclosure;
fig. 2 is a flowchart of an encoding method provided by an embodiment of the present disclosure;
fig. 3 is a basic flowchart for identifying the type of a macroblock provided by an embodiment of the present disclosure;
fig. 4 is a schematic diagram of macroblock partitioning according to an embodiment of the disclosure;
fig. 5 is a schematic diagram of macroblock partitioning according to an embodiment of the disclosure;
fig. 6 is a schematic diagram of macroblock partitioning according to an embodiment of the disclosure;
fig. 7 is a coding sequence diagram provided by an embodiment of the present disclosure;
fig. 8 is a block diagram of an encoding apparatus provided in an embodiment of the present disclosure;
fig. 9 is a structural diagram of an encoding module in an encoding apparatus according to an embodiment of the disclosure;
fig. 10 is a structural diagram of an encoding submodule in an encoding apparatus according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
An embodiment of the present disclosure provides an encoding method, as shown in fig. 1, the encoding method includes the following steps:
101. the current frame is divided into a × a macroblocks.
102. Determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macro block comprises: image macro blocks and text macro blocks; the non-copy class macro block comprises: unchanged macroblocks, motion vector macroblocks, left copy macroblocks, and top copy macroblocks.
In the present disclosure, an unchanged macroblock (english: unchanged), a motion vector macroblock (english: mvmb), a left copy macroblock (english: leftcopy mb), and a top copy macroblock (english: upcopy mb) are referred to as a copy shellfish macro.
Image macro blocks (english: picturemb) and text macro blocks (english: textmb) are referred to as non-copy class macros.
103. If the macro block comprises the non-copy macro block, dividing the macro block comprising the non-copy macro block into b multiplied by b small macro blocks; wherein b is less than a.
In this step, the larger non-copy macro blocks are further subdivided into smaller macro blocks with smaller granularity, and then the macro block types in the small macro blocks are further determined.
104. The macroblock type of each small macroblock is determined.
105. And coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein the macro block and the small macro block of which the macro block types are copy macro blocks only need to be marked, and the small macro block of which the macro block type is a non-copy macro block is subjected to pixel-by-pixel coding.
Through the division, the main source of the code stream is the non-copy macro block, so that the non-copy macro block can be finely divided, the non-copy macro block is further divided into smaller small macro blocks, only the non-copy type small macro blocks in the non-copy macro block are coded, and compared with the whole non-copy macro block, the coding pixel points can be reduced, so that the code stream is reduced.
The encoding method provided by the embodiment of the disclosure comprises the following steps: dividing a current frame into a macro blocks of a multiplied by a; determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; non-copy class macroblocks include macroblock types including: image macro blocks and text macro blocks; non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock; if the macro block comprises the non-copy macro block, dividing the macro block comprising the non-copy macro block into b multiplied by b small macro blocks; wherein b is less than a; determining the macro block type of each small macro block; and coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein the macro block and the small macro block of which the macro block types are copy macro blocks only need to be marked, and the small macro block of which the macro block type is a non-copy macro block is subjected to pixel-by-pixel coding. The current frame may be divided into macroblocks, and then each macroblock may be subdivided. After the macroblock types of the macroblocks with different sizes are identified, the corresponding types of coding can be carried out. Therefore, the coding code stream can be reduced, and the complexity of the program and the code stream can be improved, thereby improving the safety performance.
In one embodiment, as shown in FIG. 2, the above step 105 comprises the following sub-steps:
1051. if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into small macro blocks of c multiplied by c; wherein c is less than b;
1052. determining the macro block type of each small macro block;
1053. if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into a minimum macro block of d multiplied by d; wherein d is less than c;
1054. determining the macro block type of each minimum macro block;
1055. and coding the current frame according to the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block, wherein for the macro block, the small macro block and the minimum macro block of which the macro block types are copy macro blocks, the macro block type only needs to be marked, and for the minimum macro block of which the macro block type is a non-copy macro block, pixel-by-pixel coding is carried out.
Since the above-mentioned small macro block is not the minimum granularity, in order to further reduce the code stream, each small macro block can be further subdivided, the small macro block of the non-copy macro block in the small macro block is further subdivided to be divided into the small macro blocks, and then the small macro block of the non-copy macro block in the small macro blocks is further subdivided to be divided into the minimum macro blocks.
In one embodiment, the above step 1055 comprises the following sub-steps:
and coding the current frame according to the preset inner coding sequence, the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block.
And coding according to a preset sequence of the wavefront coding of the inner code and from the upper left corner to the lower right corner, wherein the coding mode is similar to that in the related art and is not described herein again.
In one embodiment, as shown in fig. 3, determining the macroblock type for each macroblock includes the sub-steps of:
a1, judging whether the current macro block is of an unchanged macro block type;
a2, if the current macro block is of an unchanged macro block type, determining that the current macro block is a copy macro block;
a3, if the current macro block is not the unchanged macro block type, judging whether the current macro block is the motion vector macro block type;
a4, if the current macro block is the type of the motion vector macro block, determining that the current macro block is a copy macro block;
a5, if the current macro block is not the motion vector macro block type, judging whether the current macro block is the left copy macro block type;
a6, if the current macro block is of the type of left copy macro block, determining that the current macro block is a copy macro block;
a7, if the current macro block is not the type of the left copy macro block, judging whether the current macro block is the type of the upper copy macro block;
a8, if the current macro block is of the copy macro block type, determining that the current macro block is a copy macro block;
a9, if the current macro block is not the type of the copy-up macro block, determining that the current macro block is a non-copy macro block.
In one embodiment, determining that the current macroblock is a non-copy class macroblock comprises the following sub-steps:
b1, judging whether the current macro block is a character macro block type;
and B2, if the current macro block is not the character macro block type, determining that the current macro block is the image macro block type.
In one embodiment, the step of determining whether the current macroblock is a text macroblock type comprises the following sub-steps:
c1, acquiring the brightness difference value between the brightness value of each pixel in the current macroblock and the brightness value of all the pixels around the current macroblock;
c2, acquiring the number of target pixels in the current macro block with the brightness difference value exceeding a preset threshold;
and C3, if the ratio of the number of the target pixels to the number of all pixels in the current macro block is larger than a preset ratio, determining that the current macro block is the type of the character macro block.
That is, in the present disclosure, it is determined whether the current macroblock is a text macroblock type by a high gradient contrast method.
Specifically, the high gradient contrast algorithm: comparing all pixels in one block with all pixels of all points around the block, and determining that the pixel is a high-gradient pixel when the difference between the brightness value of the pixel and the brightness value of the surrounding pixel is larger, namely the difference exceeds the preset threshold Nt, by setting a preset threshold Nt. If the percentage of high gradient pixels in a block reaches a preset ratio, the block is considered as a text-type macro block (textmb).
For example: comparing all pixels in one block with pixels of 8 points around the pixels, and determining that the pixel is a high-gradient pixel by setting a preset threshold Nt when the difference between the brightness value of the pixel and the brightness value of the surrounding pixel is larger, namely the difference exceeds the preset threshold Nt. If the percentage of high gradient pixels in a block reaches 30%, the block is considered to be a text type block (textmb).
The technical solution of the present disclosure is explained below by specific examples, and in the following embodiments, a is assumed to be 64; b is 32; c is 16; d is 8.
The encoding method comprises the following steps:
in the first step, the current frame is divided into 64 × 64 macroblocks, and the type of each macroblock is identified.
Referring to fig. 3, fig. 3 is a basic flowchart for identifying the type of a macroblock. The specific process of identifying the type of the macro block is as follows:
step 1, judging whether the macro block is of an unchanged macro block type, if not, executing step 2, and if so, determining that the macro block is a copy macro block.
And 2, judging whether the macro block is of the mvmb motion vector macro block type, if not, executing the step 3, and if so, determining that the macro block is a copy macro block.
And 3, judging whether the macro block is of a leftcopy mb type, if not, executing the step 4, and if so, determining that the macro block is a copy macro block.
And 4, judging whether the macro block is of the upcopy type, if not, executing the step 5, and if so, determining that the macro block is a copy macro block.
And 5, judging whether the macro block is of a textmb character macro block type or not through high gradient comparison, if not, determining that the macro block is of a picturemb image macro block type, and if so, determining that the macro block is of the textmb type.
That is, the input macroblock is identified by changemb, mvmb, leftcopy mb, upcopy mb, picturemb, textmb, and the macroblock of changemb, mvmb, leftcopy mb, upcopy mb type is called copy-type macroblock.
Specifically, if the macro block is identified as a copy macro block, false is returned, otherwise, true is returned.
It should be noted that the copy-like macroblock refers to a macroblock having the same pixel point as a macroblock in a previous frame or a reference frame, and in order to reduce a code stream, the copy-like macroblock does not need to be encoded pixel by pixel during encoding, and only needs to record the type of the macroblock. During decoding, the pixel points in the macroblock can be directly obtained from the previous frame or the reference frame.
And for non-copy type macro blocks, namely, the macro blocks of picturemb type and textmb type, pixel-by-pixel coding is required during coding.
Therefore, the main source of the code stream is the macro block of the non-copy class, the macro block of the non-copy class can be divided by finely dividing the macro block of the non-copy class, only the block of the non-copy class in the macro block of the non-copy class is coded, and compared with the whole macro block of the non-copy class, the code stream can be reduced by reducing the pixel points of the code.
It can be understood that the second step is mainly aimed at the macro blocks of the non-copy class, and accurately distinguishes the blocks of the non-copy shellfish from the blocks of the copy shellfish.
And secondly, further dividing the macro block according to the type of the macro block.
Specifically, a 64x64 macroblock is decomposed into 4 32x32 small macroblocks, and each small macroblock is subjected to type identification, as shown in fig. 4.
The method specifically comprises the following steps:
step 01, decomposing a 64x64 macroblock into 4 32x32 small macroblocks; judging whether at least one decomposed 4 small macro blocks of 32x32 has a return result of future; if not, step 02 is executed, and if yes, step 03 is executed.
Specifically, 4 small macroblocks of 32x32 obtained by decomposing a 64x64 macroblock are put into the flow of fig. 3, and the type of each small macroblock is determined; judging whether the returned result of at least one small macro block is tube, namely whether at least one small macro block is in a non-copy type, if so, indicating that the macro block comprises the small macro block in the non-copy type, and continuously dividing the small macro block in the non-copy type; if not, the macro block does not comprise the small macro block of the non-copy shellfish, and the division is not needed.
Step 02, judging whether the types of the decomposed 4 small macro blocks with the size of 32x32 are the same; if yes, marking the 4 small macro blocks as the type; if not, respectively marking the type of each small macro block; the third step is performed.
Step 03, marking the corresponding type of the small macro block with false return result; the 32x32 small macro block with the return result of true is decomposed into 4 small macro blocks with the size of 16x16, and the block type of each small macro block is identified, as shown in fig. 5.
In fig. 3, the return result of the 32x32 small macroblock in the upper left corner is false, and the return results of the other 3 32x32 small macroblocks are true.
Step 04, judging whether at least one of the decomposed 4 small macro blocks of 16 × 16 has a return result of true; if not, go to step 05, and if yes, go to step 06.
Specifically, the decomposed 4 small macro blocks of 16 × 16 are input to the processing flow shown in fig. 1, and the type of each small macro block is determined. Judging whether the returned result of at least one small macro block is tune, namely whether at least one small macro block is in a non-copy type, if so, indicating that the small macro block comprises the non-copy type small macro block, and continuously dividing the non-copy type small macro block; if not, the small macro block does not comprise the small macro block of the non-copy shellfish, and the small macro block does not need to be divided.
Step 05, judging whether the types of the decomposed 4 small macro blocks of 16x16 are the same; if yes, marking the 4 small macro blocks as the type; if not, respectively marking the types of the small macro blocks; the third step is performed.
Step 06, marking the corresponding type of the small macro block with the returned result of false; the small macro block of 16x16 with the returned result of true is decomposed into 4 minimum macro blocks of 8x8, and block type identification is performed on each minimum macro block, as shown in fig. 6.
Step 07, judging whether the decomposed 4 minimum macro blocks of 8 × 8 have at least one returned result of the minimum macro block as true; if not, step 08 is executed, and if yes, step 09 is executed.
Specifically, the decomposed 4 minimum macroblocks of 8 × 8 are input to the processing flow shown in fig. 3, and the type of each minimum macroblock is determined. Judging whether the returned result of at least one minimum macro block is tune, namely whether at least one minimum macro block is in a non-copy type, if so, indicating that the minimum macro block comprises the non-copy type minimum macro block, and continuously dividing the non-copy type minimum macro block; if not, the small macro blocks do not include the non-copy small macro blocks, and the small macro blocks do not need to be divided.
Step 08, judging whether the types of the decomposed 4 minimum macro blocks of 8x8 are the same; if yes, marking the 4 minimum macro blocks as the type; if not, respectively marking the type of each minimum macro block; the third step is performed.
Step 09, marking the corresponding type of the minimum macro block with the return result of false; and marking the minimum macro block of the 8x8 with the return result of true as literal coding, and marking the minimum macro block of the textmb type as jpeg coding.
It will be appreciated that the minimum macro-block of 8x8, which returns a true result, is a finely divided block of non-copied shellfish. Only the blocks need to be coded pixel by pixel, and the code stream can be reduced in a larger amplitude.
Thirdly, each 64x64 macroblock in the current frame is encoded according to the block type.
Specifically, as illustrated in fig. 7, based on the description of fig. 6, the coding is performed from the upper left corner to the lower left corner of the macroblock 64 × 64 according to the preset sequence of intra-coded wavefront coding, that is, according to the division result of the second step, each small macroblock/minimum macroblock in the macroblock is sequentially coded according to the sequence from the upper left corner to the lower left corner.
It should be noted that, for a block/small macro block/minimum macro block whose returned result is false, pixel-by-pixel coding is not required, and only the type is labeled; for blocks/small macro blocks/minimum macro blocks marked as literal codes and jpeg codes, pixel-by-pixel coding is required.
In the present invention, the current frame may be divided into macroblocks of 64 × 64 units, and then each macroblock of 64 × 64 may be subdivided. Specifically, by high gradient contrast, a 64x64 macroblock is subdivided into several different sized blocks, 64x64, 32x32, 16x16, and 8x 8. After the type recognition is performed on the blocks with different sizes, the corresponding type of coding can be performed.
Therefore, the coding code stream can be reduced, and the complexity of the program and the code stream can be improved, thereby improving the safety performance.
Based on the encoding method described in the embodiment corresponding to fig. 1, the following is an embodiment of the apparatus of the present disclosure, which may be used to execute an embodiment of the method of the present disclosure.
An embodiment of the present disclosure provides an encoding apparatus, as shown in fig. 8, the apparatus including:
a first dividing module 11, configured to divide a current frame into a × a macroblocks;
a first determining module 12, configured to determine a macroblock type of each macroblock; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macroblocks include the following macroblock types: image macro blocks and text macro blocks; the non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock;
a second dividing module 13, configured to divide the macroblock that includes the non-copy type macroblock into b × b small macroblocks if the macroblock includes the non-copy type macroblock; wherein b is less than a;
a second determining module 14, configured to determine a macroblock type of each small macroblock;
and an encoding module 15, configured to encode the current frame according to the macroblock type of each macroblock and the macroblock type of each small macroblock, where for the macroblock and the small macroblock of which the macroblock type is a copy-type macroblock, only the macroblock type needs to be labeled, and for the small macroblock of which the macroblock type is a non-copy-type macroblock, pixel-by-pixel encoding is performed.
In one embodiment, as shown in fig. 9, the encoding module 15 includes:
a first dividing module 151, configured to divide a small macroblock including the non-copy macro block into small c × c macro blocks if the small macroblock includes the non-copy macro block; wherein c is less than b;
a first determining sub-module 152, configured to determine a macroblock type of each small macroblock;
a second dividing sub-module 153, configured to divide the small macro block including the non-copy macro block into a smallest d × d macro block if the small macro block includes the non-copy macro block; wherein d is less than c;
a second determining sub-module 154 for determining the macroblock type of each minimum macroblock;
the coding sub-module 155 is configured to code the current frame according to the macroblock type of each macroblock, the macroblock type of each small macroblock, and the macroblock type of each minimum macroblock, where for the macroblock, the small macroblock, and the minimum macroblock, whose macroblock types are copy-type macroblocks, only the macroblock type needs to be labeled, and for the minimum macroblock, whose macroblock type is the non-copy-type macroblock, pixel-by-pixel coding is performed.
In one embodiment, as shown in fig. 10, the encoding sub-module 155 includes:
a coding subunit 1551, configured to code the current frame according to a preset inner coding sequence, as well as the macroblock type of each macroblock, the macroblock type of each small macroblock, and the macroblock type of each minimum macroblock.
In one embodiment, the first determining module 152 includes:
the first judgment submodule is used for judging whether the current macro block is of an unchanged macro block type;
a third determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the unchanged macroblock type;
a second judging sub-module, configured to judge whether the current macroblock is a motion vector macroblock type if the current macroblock is not the unchanged macroblock type;
a fourth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the motion vector macroblock type;
a third judging submodule, configured to judge whether the current macroblock is a left-copy macroblock type if the current macroblock is not the motion vector macroblock type;
a fifth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the left-copy macroblock type;
a fourth judging submodule, configured to judge whether the current macroblock is an upper-copy macroblock type if the current macroblock is not the left-copy macroblock type;
a sixth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the upper copy macroblock type;
a seventh determining sub-module, configured to determine that the current macroblock is the non-copy macroblock if the current macroblock is not the type of the upper-copy macroblock.
In one embodiment, the seventh determination sub-module includes:
a fifth judging submodule, configured to judge whether the current macroblock is a text macroblock type;
an eighth determining sub-module, configured to determine that the current macroblock is the image macroblock type if the current macroblock is not the text macroblock type.
In one embodiment, the fifth determining sub-module includes:
the first obtaining submodule is used for obtaining the brightness difference value of the brightness value of each pixel in the current macroblock and the brightness value of all pixels around the current macroblock;
the second obtaining submodule is used for obtaining the number of target pixels in the current macro block of which the brightness difference value exceeds a preset threshold value;
a ninth determining sub-module, configured to determine that the current macroblock is the text macroblock type if a ratio of the number of the target pixels to the number of all pixels in the current macroblock is greater than a preset threshold.
Based on the encoding method described in the embodiment corresponding to fig. 1, an embodiment of the present disclosure further provides a computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be a Read Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. The storage medium stores computer instructions for executing the encoding method described in the embodiment corresponding to fig. 1, which is not described herein again.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method of encoding, the method comprising:
dividing a current frame into a macro blocks of a multiplied by a;
determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macroblocks include the following macroblock types: image macro blocks and text macro blocks; the non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock;
if the macro block comprises the non-copy macro block, dividing the macro block comprising the non-copy macro block into b × b small macro blocks; wherein b is less than a;
determining the macro block type of each small macro block;
and coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein for the macro block and the small macro block of which the macro block type is a copy macro block, only the macro block type needs to be marked, and for the small macro block of which the macro block type is a non-copy macro block, pixel-by-pixel coding is carried out.
2. The method of claim 1, wherein said encoding the current frame according to the macroblock type of each macroblock and the macroblock type of each small macroblock comprises:
if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into small macro blocks of c multiplied by c; wherein c is less than b;
determining the macro block type of each small macro block;
if the small macro block comprises the non-copy macro block, dividing the small macro block comprising the non-copy macro block into a smallest macro block of d multiplied by d; wherein d is less than c;
determining the macro block type of each minimum macro block;
and coding the current frame according to the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block, wherein for the macro block, the small macro block and the minimum macro block of which the macro block types are copy macro blocks, the macro block types only need to be marked, and for the minimum macro block of which the macro block type is the non-copy macro block, pixel-by-pixel coding is carried out.
3. The method of claim 2, wherein the encoding the current frame according to the macroblock type of each macroblock, the macroblock type of each small macroblock, and the macroblock type of each minimum macroblock comprises:
and coding the current frame according to a preset internal coding sequence, the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block.
4. The method of claim 1, wherein determining the macroblock type for each macroblock comprises:
judging whether the current macro block is of an unchanged macro block type;
if the current macro block is the unchanged macro block type, determining that the current macro block is the copy macro block;
if the current macro block is not the unchanged macro block type, judging whether the current macro block is the motion vector macro block type;
if the current macro block is the motion vector macro block type, determining that the current macro block is the copy macro block;
if the current macro block is not the motion vector macro block type, judging whether the current macro block is a left copy macro block type;
if the current macro block is the type of the left copy macro block, determining that the current macro block is the copy macro block;
if the current macro block is not the type of the left-copy macro block, judging whether the current macro block is the type of an upper-copy macro block;
if the current macro block is the type of the upper copy macro block, determining that the current macro block is the copy macro block;
and if the current macro block is not the type of the upper copy macro block, determining that the current macro block is the non-copy macro block.
5. The method of claim 4, wherein the determining that the current macroblock is the non-copy class macroblock comprises:
judging whether the current macro block is a character macro block type;
and if the current macro block is not the character macro block type, determining that the current macro block is the image macro block type.
6. The method of claim 5, wherein the determining whether the current macroblock is a text macroblock type comprises:
acquiring brightness difference values of the brightness values of all pixels in the current macroblock and brightness values of all pixels around the current macroblock;
acquiring the number of target pixels in the current macro block of which the brightness difference value exceeds a preset threshold value;
and if the ratio of the number of the target pixels to the number of all pixels in the current macro block is greater than a preset threshold, determining that the current macro block is the character macro block type.
7. An encoding apparatus, characterized in that the apparatus comprises:
a first dividing module for dividing the current frame into a macro blocks of a × a;
the first determining module is used for determining the macro block type of each macro block; the macroblock types include: non-copy class macro blocks and copy class macro blocks; the non-copy class macroblocks include the following macroblock types: image macro blocks and text macro blocks; the non-copy class macroblocks include the following macroblock types: an unchanged macroblock, a motion vector macroblock, a left copy macroblock, and an upper copy macroblock;
a second dividing module, configured to divide the macroblock including the non-copy type macroblock into b × b small macroblocks if the macroblock includes the non-copy type macroblock; wherein b is less than a;
a second determining module, configured to determine a macroblock type of each small macroblock;
and the coding module is used for coding the current frame according to the macro block type of each macro block and the macro block type of each small macro block, wherein for the macro block and the small macro block of which the macro block type is a copy macro block, only the macro block type needs to be marked, and for the small macro block of which the macro block type is a non-copy macro block, pixel-by-pixel coding is carried out.
8. The apparatus of claim 7, wherein the encoding module comprises:
a first dividing module, configured to divide a small macroblock including the non-copy type macroblock into small macroblocks of c × c if the small macroblock includes the non-copy type macroblock; wherein c is less than b;
the first determining submodule is used for determining the macro block type of each small macro block;
a second dividing sub-module, configured to divide the small macro block including the non-copy macro block into a smallest d × d macro block if the small macro block includes the non-copy macro block; wherein d is less than c;
the second determining submodule is used for determining the macroblock type of each minimum macroblock;
and the coding sub-module is used for coding the current frame according to the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block, wherein for the macro block, the small macro block and the minimum macro block of which the macro block types are copy macro blocks, only the macro block types need to be marked, and for the minimum macro block of which the macro block type is the non-copy macro block, pixel-by-pixel coding is carried out.
9. The apparatus of claim 8, wherein the encoding submodule comprises:
and the coding subunit is used for coding the current frame according to a preset internal coding sequence, and the macro block type of each macro block, the macro block type of each small macro block and the macro block type of each minimum macro block.
10. The apparatus of claim 7, wherein the first determining module comprises:
the first judgment submodule is used for judging whether the current macro block is of an unchanged macro block type;
a third determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the unchanged macroblock type;
a second judging sub-module, configured to judge whether the current macroblock is a motion vector macroblock type if the current macroblock is not the unchanged macroblock type;
a fourth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the motion vector macroblock type;
a third judging submodule, configured to judge whether the current macroblock is a left-copy macroblock type if the current macroblock is not the motion vector macroblock type;
a fifth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the left-copy macroblock type;
a fourth judging submodule, configured to judge whether the current macroblock is an upper-copy macroblock type if the current macroblock is not the left-copy macroblock type;
a sixth determining sub-module, configured to determine that the current macroblock is the copy-type macroblock if the current macroblock is the upper copy macroblock type;
a seventh determining sub-module, configured to determine that the current macroblock is the non-copy macroblock if the current macroblock is not the type of the upper-copy macroblock.
CN202011177332.9A 2020-10-28 2020-10-28 Encoding method and device Pending CN112422973A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011177332.9A CN112422973A (en) 2020-10-28 2020-10-28 Encoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011177332.9A CN112422973A (en) 2020-10-28 2020-10-28 Encoding method and device

Publications (1)

Publication Number Publication Date
CN112422973A true CN112422973A (en) 2021-02-26

Family

ID=74841282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011177332.9A Pending CN112422973A (en) 2020-10-28 2020-10-28 Encoding method and device

Country Status (1)

Country Link
CN (1) CN112422973A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110043407A (en) * 2009-10-21 2011-04-27 에스케이 텔레콤주식회사 Video coding and decoding method and apparatus
US20160050440A1 (en) * 2014-08-15 2016-02-18 Ying Liu Low-complexity depth map encoder with quad-tree partitioned compressed sensing
CN108989793A (en) * 2018-07-20 2018-12-11 深圳市华星光电技术有限公司 A kind of detection method and detection device of text pixel
CN110446041A (en) * 2018-05-02 2019-11-12 中兴通讯股份有限公司 A kind of video coding-decoding method, device, system and storage medium
CN110996127A (en) * 2019-11-25 2020-04-10 西安万像电子科技有限公司 Image coding and decoding method, device and system
CN111770334A (en) * 2020-07-23 2020-10-13 西安万像电子科技有限公司 Data encoding method and device, and data decoding method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110043407A (en) * 2009-10-21 2011-04-27 에스케이 텔레콤주식회사 Video coding and decoding method and apparatus
US20160050440A1 (en) * 2014-08-15 2016-02-18 Ying Liu Low-complexity depth map encoder with quad-tree partitioned compressed sensing
CN110446041A (en) * 2018-05-02 2019-11-12 中兴通讯股份有限公司 A kind of video coding-decoding method, device, system and storage medium
CN108989793A (en) * 2018-07-20 2018-12-11 深圳市华星光电技术有限公司 A kind of detection method and detection device of text pixel
CN110996127A (en) * 2019-11-25 2020-04-10 西安万像电子科技有限公司 Image coding and decoding method, device and system
CN111770334A (en) * 2020-07-23 2020-10-13 西安万像电子科技有限公司 Data encoding method and device, and data decoding method and device

Similar Documents

Publication Publication Date Title
CN110839155B (en) Method and device for motion estimation, electronic equipment and computer-readable storage medium
EP2418855A1 (en) Video encoding device and video decoding device
US20100080472A1 (en) Image processing apparatus, moving image decoding apparatus, moving image encoding apparatus and method
US8873625B2 (en) Enhanced compression in representing non-frame-edge blocks of image frames
WO2016034117A1 (en) Method for color index coding using a generalized copy previous mode
CN111445424B (en) Image processing method, device, equipment and medium for processing mobile terminal video
US8363978B2 (en) System and method for block edge location with varying block sizes and offsets in compressed digital video
CN109862365B (en) Image data processing method and device
CN111447452A (en) Data coding method and system
KR20230162989A (en) Multimedia data processing methods, apparatus, devices, computer-readable storage media, and computer program products
CN106331730B (en) H.264 video same quantization factor double compression detection method
CN110324617B (en) Image processing method and device
CN108391132B (en) Character block coding method and device
CN108600755B (en) Image frame coding method and device
CN113079375B (en) Method and device for determining video coding and decoding priority order based on correlation comparison
CN111770334B (en) Data encoding method and device, and data decoding method and device
CN113422959A (en) Video encoding and decoding method and device, electronic equipment and storage medium
CN114071140B (en) Decoding method, encoding method, device, equipment and machine readable storage medium
CN114827610B (en) Video image encoding and decoding method, apparatus and medium
CN110933415B (en) Object region detection method, device and non-transitory computer readable medium for object region detection
CN111083481A (en) Image coding method and device
CN112422973A (en) Encoding method and device
CN109862315B (en) Video processing method, related device and computer storage medium
CN113079374B (en) Image encoding method and apparatus
CN115209162A (en) Video coding dividing method, video processing method and computer equipment

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