CN113556547A - Image coding and decoding method and device - Google Patents

Image coding and decoding method and device Download PDF

Info

Publication number
CN113556547A
CN113556547A CN202110609877.0A CN202110609877A CN113556547A CN 113556547 A CN113556547 A CN 113556547A CN 202110609877 A CN202110609877 A CN 202110609877A CN 113556547 A CN113556547 A CN 113556547A
Authority
CN
China
Prior art keywords
code stream
coding
macro block
image frame
frame
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
CN202110609877.0A
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 CN202110609877.0A priority Critical patent/CN113556547A/en
Publication of CN113556547A publication Critical patent/CN113556547A/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/20Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding
    • H04N19/27Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding involving both synthetic and natural picture components, e.g. synthetic natural hybrid coding [SNHC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/63Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets

Landscapes

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

Abstract

The invention provides an image coding and decoding method and equipment, relates to the technical field of image processing, and can solve the problem that a coding code stream is large when lossless coding is carried out on an image by H.264 and H.265 coding standards. The specific technical scheme is as follows: acquiring a current image frame; performing lossy coding on a current image frame to obtain a first coding code stream; determining a lossless coding macro block in a current image frame, wherein the lossless coding macro block is a macro block which has the same pixels with the same positions of the previous image frame but has not the same pixels with the same positions of the previous image frame in the current image frame; carrying out lossless coding on residual data of a lossless coding macro block in a current image frame to obtain a second coding code stream; and packing the first coding code stream and the second coding code stream to obtain the coding code stream of the current image frame. The invention is used for image coding and decoding.

Description

Image coding and decoding method and device
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image encoding and decoding method and apparatus.
Background
There are many ways to encode video images, and for example, h.264 encoding, h.265 encoding, and the like are commonly used. Among them, the h.264 coding is a highly compressed digital Video codec standard proposed by the Joint Video Team (JVT) jointly composed of ITU-T Video Coding Experts Group (VCEG) and ISO/IEC Moving Picture Experts Group (MPEG). H.265 coding is a new video coding standard established by ITU-T VCEG following h.264 coding. The h.265 standard surrounds the existing video coding standard h.264, preserving some of the original techniques, while improving some of the related techniques. The new technology uses advanced technology to improve the relationship among code stream, coding quality, time delay and algorithm complexity, and achieves the optimal setting, and specifically comprises the following steps: the method has the advantages of improving compression efficiency, robustness and error recovery capability, reducing real-time delay, reducing channel acquisition time and random access time delay, reducing complexity and the like. H.264 coding can realize standard definition (the resolution is below 1280 P.720) digital image transmission at the speed lower than 1Mbps due to algorithm optimization; the H.265 coding can realize the transmission of 720P (with the resolution of 1280 x 720) common high-definition audio and video by using the transmission speed of 1-2 Mbps.
At present, when lossless coding is performed on images by adopting the h.264 and h.265 coding standards, lossless coding is used for each frame of image, which results in very large coding code stream.
Disclosure of Invention
The embodiment of the invention provides an image coding and decoding method and device, which can solve the problem that coding code stream is large when lossless coding is carried out on an image by H.264 and H.265 coding standards. The technical scheme is as follows:
according to a first aspect of embodiments of the present invention, there is provided an image encoding method, the method including:
acquiring a current image frame;
performing lossy coding on the current image frame to obtain a first coding code stream;
determining a lossless coding macro block in the current image frame, wherein the lossless coding macro block is a macro block which has the same pixels with the same positions as the previous image frame but has not the same pixels with the same positions as the previous image frame in the current image frame;
carrying out lossless coding on residual data of the lossless coding macro block in the current image frame to obtain a second coding code stream;
and packing the first coding code stream and the second coding code stream to obtain the coding code stream of the current image frame.
The image coding method provided by the embodiment of the invention firstly carries out lossy coding on the current image frame, then determines the lossless coding macro block in the current image frame and carries out lossless coding on residual data of the lossless coding macro block, and finally packs the respectively obtained first coding code stream and second coding code stream so as to obtain the coding code stream of the current image frame.
In one embodiment, said determining lossless coded macroblocks in said current image frame comprises:
determining the macro blocks with the same pixels at the same positions of the current image frame and the previous image frame to obtain a first macro block group;
determining the macro blocks with the same pixels at the same positions of the current image frame and the previous image frame of the previous image frame to obtain a second macro block group;
and determining lossless coding macro blocks in the current image frame according to the first macro block group and the second macro block group.
In one embodiment, said determining lossless encoded macroblocks in said current image frame from said first group of macroblocks and said second group of macroblocks comprises:
determining the same macro blocks in the first macro block group and the second macro block group to obtain a third macro block group;
and removing the macro blocks in the third macro block group from the first macro block group to obtain the lossless coding macro blocks in the current image frame.
In one embodiment, when losslessly encoding residual data of a losslessly encoded macroblock in the current image frame, the method further comprises:
and carrying out lossless coding on the position information of all the macro blocks in the third macro block group.
In one embodiment, said lossless encoding of residual data of a lossless encoded macroblock in said current image frame comprises:
acquiring a reconstructed frame of the first coding code stream;
calculating the residual error of the lossless coding macro block in the current image frame by utilizing the reconstructed frame of the first coding code stream to obtain residual error data;
and carrying out lossless coding on residual data and position information of the lossless coding macro block in the current image frame.
In one embodiment, after obtaining the encoded code stream of the current image frame, the method further includes:
and sending the coding code stream of the current image frame to a decoding end, and/or storing the coding code stream of the current image frame.
According to a second aspect of embodiments of the present invention, there is provided an image decoding method including:
acquiring a current frame coding code stream;
determining a first coding code stream and a second coding code stream in the current frame coding code stream, wherein the first coding code stream is a lossy coding code stream, and the second coding code stream is a lossless coding code stream;
decoding the first coding code stream to obtain a reconstructed frame of the first coding code stream;
decoding the second coded code stream to obtain position information and residual data of a macro block;
and determining a decoding image corresponding to the current frame coding code stream according to the reconstructed frame, the position information of the macro block and the residual data.
According to the image decoding method provided by the embodiment of the invention, the obtained current frame coding code stream consists of a lossy coding code stream and a lossless coding code stream, and the code stream is smaller compared with the total lossless coding code stream; the lossy coding code stream and the lossless coding code stream are respectively decoded, and a decoding image corresponding to the current frame coding code stream can be determined according to the decoding result.
In one embodiment, the determining, according to the reconstructed frame, the position information of the macroblock, and the residual data, a decoded image corresponding to the current frame code stream includes:
traversing all macro blocks in the reconstructed frame;
if the current macro block only has residual error data but no position information, the corresponding macro block in the decoded image is the sum of the current macro block and the residual error data;
if the current macro block has no residual error data and position information, the corresponding macro block in the decoded image is the current macro block;
if the current macro block only has the position information and has no residual data, the corresponding macro block in the decoded image is the corresponding macro block in the previous reconstructed frame.
In one embodiment, after determining a decoded image corresponding to the current frame code stream according to the reconstructed frame, the position information of the macroblock, and the residual data, the method further includes:
displaying the decoded image, and/or storing the decoded image.
According to a third aspect of embodiments of the present invention, there is provided an image encoding apparatus comprising a processor and a memory, the memory having stored therein at least one computer instruction, the computer instruction being loaded and executed by the processor to implement the steps performed in the image encoding method according to any of the embodiments above.
According to a fourth aspect of the embodiments of the present invention, there is provided an image decoding apparatus, comprising a processor and a memory, wherein at least one computer instruction is stored in the memory, and the computer instruction is loaded and executed by the processor to implement the steps performed in the image decoding method according to any one of the above embodiments.
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 invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a flowchart of an image encoding method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of determining a lossless encoded macroblock in a current image frame according to an embodiment of the present invention;
FIG. 3 is a flowchart of an image decoding method according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present invention.
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 embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
In general, the image quality of the human eye for the varying part is required to be lower than that of the still part. Therefore, in the embodiment of the present application, lossy coding is used for the changed part of the image to reduce the code stream, and lossless coding is used for the residual of the unchanged part to ensure the image quality.
An embodiment of the present invention provides an image encoding method, which may be applied to an image encoding apparatus, as shown in fig. 1, and the image encoding method may include the following steps:
step 101: a current image frame is acquired.
Each image frame comprises a plurality of macro blocks, wherein each macro block comprises N M pixel points. Wherein both N and M are integers greater than 1.
In an alternative embodiment, N and M are equal, that is, each frame is divided into several non-overlapping square regions according to N × N pixels, and each region is called a macroblock.
In the encoding process, the current image frame is recorded as Ft,FtThe previous frame image of (1) is Ft-1,Ft-1The last frame image of is Ft-2
Step 102: and carrying out lossy coding on the current image frame to obtain a first coding code stream.
The current image frame may be lossy-coded using an H264 video encoder, a 265 video encoder, or another encoder, to obtain a first coded stream of the current image frame. The encoder used in this step is not limited.
Step 103: a lossless encoded macroblock in a current image frame is determined.
Wherein the lossless coding macro block is the current image frame FtMiddle and previous frame image Ft-1The pixels at the same position are identical but identical to the previous frame image Ft-1Last frame image F oft-2Macroblocks where co-located pixels are not exactly the same.
Specifically, determining the lossless coding macroblock in the current image frame includes: determining a macro block with completely identical pixels at the same position of a current image frame and a previous image frame to obtain a first macro block group; determining the macro blocks with the same pixels at the same positions of the current image frame and the previous image frame of the previous image frame to obtain a second macro block group; lossless coding macroblocks in the current image frame are determined from the first group of macroblocks and the second group of macroblocks.
In one embodiment, determining the losslessly encoded macroblocks in the current image frame from the first group of macroblocks and the second group of macroblocks comprises: determining the same macro blocks in the first macro block group and the second macro block group to obtain a third macro block group; and removing the macro blocks in the third macro block group from the first macro block group to obtain the lossless coding macro block in the current image frame.
For example, each image frame includes 2 × 2 macroblocks, as shown in fig. 2, where (a) represents Ft-1The last frame image of is Ft-2(b) represents FtPrevious frame image Ft-1And (c) represents the current image frame FtThe positions of the four macroblocks may be labeled a11, a12, a21, and a22, respectively, for each image frame.
Referring to FIG. 2, the image frame F shown in (c) is first foundtImage frames F shown in (a) and (b)t-1Obtaining a first macroblock group, which is marked as S1, by using macroblocks with identical pixels at the same position, and then, S1 is the macroblocks at positions a12, a21, and a 22; then finding the image frame F shown in (c)tAnd (a) the image frame Ft-2If the macroblocks with the same position have the same pixels, a second macroblock group is obtained and is marked as S2, and then S2 is the macroblocks at positions a12 and a 21; then determining the image frame F shown in (c) from S1 and S2tSpecifically, the same macroblock in S1 and S2 may be found first to obtain a third macroblock group, which is denoted as S3, and then S3 is the macroblock in the positions of a12 and a21, and then the macroblock in S3 is removed from S1, so as to obtain the image frame F shown in (c)tThe lossless coding macroblock in (1) is marked as S, and then S is the macroblock at a22 position.
Step 104: and carrying out lossless coding on residual data of the lossless coding macro block in the current image frame to obtain a second coding code stream.
And after the lossless coding macro block in the current image frame is determined, carrying out lossless coding on residual error data of the lossless coding macro block in the current image frame to obtain a second coding code stream. The lossless coding may include entropy coding or run-length coding.
Specifically, the lossless encoding of the residual data of the lossless encoded macroblock in the current image frame includes: acquiring a reconstructed frame of a first coding code stream; calculating the residual error of a lossless coding macro block in the current image frame by utilizing the reconstructed frame of the first coding code stream to obtain residual error data; residual data and position information of a lossless coding macroblock in a current image frame are losslessly coded.
The obtaining of the reconstructed frame of the first encoded code stream may be calling a decoder to decode the first encoded code stream to obtain the reconstructed frame. In particular, in the encoding process, inverse quantization and inverse transformation may be performed on quantized pixels according to a decoding algorithm to obtain a reconstructed frame, and then, the reconstructed frame for obtaining the first encoded code stream may also be a reconstructed frame for directly reading the first encoded code stream from an encoder that performs lossy encoding on the current image frame. The reconstructed frame of the acquired first coded stream may be recorded as F't
When lossless encoding is performed on residual data of the lossless encoded macroblocks in the current image frame, the method further comprises lossless encoding the position information of all macroblocks in the third group of macroblocks.
For example, in the image frame shown in fig. 2, the image frame F shown in (c) is obtainedtAfter lossless coding of the macroblock S in (1), the formula R ═ F can be usedt–F’tAnd calculating residual data of all macro blocks in the S, wherein R is the obtained residual data. The formula here applies to the image frame FtAll macroblocks in (1) calculate the residual since S is FtThus obtaining all macroblock residuals, the residual data of the lossless coded macroblock S can be obtained therefrom. After the residual data of all the macroblocks in S are obtained, the position information and the residual data of all the macroblocks in S are transformed and losslessly encoded, and at the same time, the position information of all the macroblocks in S3 is losslessly encoded. The transformation includes fourier transform, wavelet transform, or DCT (discrete cosine transform) and other transformation methods.
Wherein S3 is the macroblock at the A12 and A21 positions, and is Ft、Ft-1And Ft-2The same macro block in (1) is the unchanged part of the image, because the image frame F is being processedt-1Carry out codingWhen the residuals of the macroblocks at the A12 and A21 positions have been losslessly encoded, then image frame F is being encodedtWhen encoding, the image frame F can be usedt-1The coding results of the A12 and A21 position macroblocks replace FtThe coding of the macroblock contained in S3. Based on this, for the image frame F shown in FIG. 2tIt is combined with the image frame Ft-1In contrast, the macroblock at the a11 position is a changed portion in the image and lossy coding is used, and the macroblocks at the a12 and a21 positions are portions in the image that have not been changed, and the image frame F is usedt-1The results of coding the macroblocks at positions a12 and a21 were replaced by lossless coding of the residual, and the macroblock at position a22 was a portion of the image that did not change, and was lossless coding of the residual. In this way, lossy coding is used for the changed part in the image to reduce the code stream, and lossless coding is used for the residual error of the unchanged part in the image, so that the quality of the image can be ensured while the coding code stream is reduced.
Step 105: and packing the first coding code stream and the second coding code stream to obtain the coding code stream of the current image frame.
And after the first coding code stream and the second coding code stream are obtained, packaging the first coding code stream and the second coding code stream to obtain the coding code stream of the current image frame.
And after the coding code stream of the current image frame is obtained, sending the coding code stream of the current image frame to a decoding end, and/or storing the coding code stream of the current image frame.
If the image coding needs to be continued, go to step 101, otherwise, end the flow.
The image coding method provided by the embodiment of the invention firstly carries out lossy coding on the current image frame, then determines the lossless coding macro block in the current image frame and carries out lossless coding on residual error data of the lossless coding macro block, and finally packs the first coding code stream and the second coding code stream which are respectively obtained, thereby obtaining the coding code stream of the current image frame. The method can perform lossy coding on the changed part of the image in the coding process, reduce the coding code stream through the lossy coding, and perform lossless coding on residual data of the unchanged part of the image, thereby reducing the coding code stream while ensuring the image quality.
Based on the image encoding method provided in the embodiment corresponding to fig. 1, another embodiment of the present invention provides an image decoding method, which can be applied to an image decoding device. Referring to fig. 3, the image decoding method provided in this embodiment may include the following steps:
step 301: and acquiring a current frame coding code stream.
One frame of coded code stream can be read from a memory for storing the coded code stream, or one frame of coded code stream transmitted by a coding end is received.
Step 302: and determining a first code stream and a second code stream in the current frame code stream.
The first coding code stream is a lossy coding code stream, and the second coding code stream is a lossless coding code stream.
Specifically, the encoding end performs lossy encoding on all macro blocks in the image frame during encoding, performs lossless encoding on residual errors of lossless encoded macro blocks in the image frame, and performs packing processing on the first encoded code stream and the second encoded code stream obtained respectively. And during decoding, splitting a first coded code stream and a second coded code stream in the obtained current frame coded code stream.
Step 303: and decoding the first coding code stream to obtain a reconstructed frame of the first coding code stream.
Step 304: and decoding the second coded code stream to obtain the position information and residual data of the macro block.
Step 305: and determining a decoding image corresponding to the current frame coding code stream according to the position information of the reconstructed frame, the macro block and the residual data.
Specifically, determining a decoded image corresponding to the current frame encoding code stream includes: traversing all macro blocks in the reconstructed frame; if the current macro block in the reconstructed frame only has residual error data but no position information, the corresponding macro block in the decoded image is the sum of the current macro block and the residual error data; if the current macro block in the reconstructed frame has no residual error data and position information, the corresponding macro block in the decoded image is the current macro block; and if the current macro block in the reconstructed frame only has the position information and does not have residual error data, the corresponding macro block in the decoded image is the corresponding macro block in the previous reconstructed frame.
For example, in the image frame F shown in FIG. 2tTaking the encoded code stream of (1) as an example, splitting a first encoded code stream and a second encoded code stream in the encoded code stream, and decoding the first encoded code stream to obtain FtOf reconstructed frame F'tAfter the second coding code stream is decoded, the position information and residual data of the macro block can be obtained, and the decoding can obtain: the macroblock at the a11 position has no position information and no residual data; macroblocks at the a12 and a21 positions have only position data; the macroblock at position a22 has only residual data. Then, in the decoded image corresponding to the current frame coded stream, the macroblock at position a11 is the reconstructed frame F'tThe macroblock at the A11 position, the macroblocks at the A12 and A21 positions are Ft-1The macroblocks at positions A12 and A21 in the reconstructed frame of (1), the macroblock at position A22 being the reconstructed frame F'tThe macroblock at position a22 plus residual data.
And after the decoded image corresponding to the current frame coding code stream is obtained, displaying the decoded image, or storing the decoded image, or displaying the decoded image and storing the decoded image.
According to the image decoding method provided by the embodiment of the invention, the obtained current frame coding code stream consists of a lossy coding code stream and a lossless coding code stream, and the code stream is smaller compared with the total lossless coding code stream; the lossy coding code stream and the lossless coding code stream are respectively decoded, and a decoding image corresponding to the current frame coding code stream can be determined according to the decoding result.
Based on the image encoding method and the image decoding method described in the embodiments corresponding to fig. 1 and fig. 3, the following is an embodiment of the apparatus of the present invention, which can be used to execute an embodiment of the method of the present invention.
An embodiment of the present invention provides an image encoding apparatus, as shown in fig. 4, where the image encoding apparatus 40 includes: an obtaining module 401, a first encoding module 402, a determining module 403, a second encoding module 404 and a synthesizing module 405;
the obtaining module 401 is configured to obtain a current image frame;
the first encoding module 402 is configured to perform lossy encoding on a current image frame to obtain a first encoded code stream;
the determining module 403 is configured to determine a lossless coding macro block in the current image frame, where the lossless coding macro block is a macro block in the current image frame, where pixels at the same position as that of the previous image frame are completely the same, but pixels at the same position as that of the previous image frame are not completely the same;
the second encoding module 404 is configured to perform lossless encoding on residual data of a lossless encoded macro block in the current image frame to obtain a second encoded code stream;
the synthesizing module 405 is configured to pack the first encoded code stream and the second encoded code stream to obtain an encoded code stream of the current image frame.
In one embodiment, as shown in fig. 5, the determination module 403 may include a first determination unit 4031, a second determination unit 4032, and a third determination unit 4033; wherein the content of the first and second substances,
the first determining unit 4031 is configured to determine macroblocks in the same position as the previous image in the current image frame, where the pixels are completely the same, to obtain a first macroblock group;
the second determining unit 4032 is configured to determine macroblocks with identical pixels at the same positions in the current image frame and the previous image frame of the previous image frame, so as to obtain a second macroblock group;
the third determining unit 4033 is configured to determine lossless encoded macro blocks in the current image frame according to the first macro block group and the second macro block group.
In an embodiment, the third determining unit 4033 is specifically configured to determine the same macro blocks in the first macro block group and the second macro block group to obtain a third macro block group, and then remove macro blocks in the third macro block group from the first macro block group to obtain lossless coding macro blocks in the current image frame.
In one embodiment, the second encoding module 404 is further configured to losslessly encode the position information of all the macroblocks in the third macroblock group.
In one embodiment, as shown in fig. 6, the second encoding module 404 may include a reconstructed frame obtaining unit 4041, a calculating unit 4042 and a lossless encoding unit 4043; wherein the content of the first and second substances,
the reconstructed frame obtaining unit 4041 is configured to obtain a reconstructed frame of the first encoded code stream;
the calculating unit 4042 is configured to calculate a residual error of the lossless coding macro block in the current image frame by using the reconstructed frame of the first coding code stream, so as to obtain residual error data;
the lossless encoding unit 4043 is configured to losslessly encode the residual data and the position information of the losslessly encoded macroblock in the current image frame.
In one embodiment, as shown in FIG. 7, the image encoding device 40 further comprises a sending module 406. The sending module 406 is configured to send the encoded code stream of the current image frame to the decoding end after obtaining the encoded code stream of the current image frame.
In one embodiment, as shown in fig. 8, the image encoding apparatus 40 further includes a storage module 407. The storage module 407 is configured to store the encoded code stream of the current image frame after obtaining the encoded code stream of the current image frame.
In the image encoding device provided in the embodiment of the present invention, the first encoding module performs lossy encoding on the current image frame, the determining module determines a lossless encoding macro block in the current image frame, the second encoding module performs lossless encoding on residual data of the lossless encoding macro block, and the synthesizing module packs the first encoding code stream and the second encoding code stream obtained respectively, so as to obtain the encoding code stream of the current image frame. The method can perform lossy coding on the changed part of the image in the coding process, reduce the coding code stream through the lossy coding, perform lossless coding on residual data of the unchanged part of the image, and ensure the quality of the image.
An embodiment of the present invention provides an image decoding apparatus, as shown in fig. 9, where the image decoding apparatus 90 includes: a code stream obtaining module 901, a code stream determining module 902, a first decoding module 903, a second decoding module 904 and an image determining module 905. Wherein the content of the first and second substances,
the code stream obtaining module 901 is configured to obtain a current frame coding code stream;
the code stream determining module 902 is configured to determine a first encoded code stream and a second encoded code stream in a current frame encoded code stream, where the first encoded code stream is a lossy encoded code stream, and the second encoded code stream is a lossless encoded code stream;
the first decoding module 903 is configured to decode the first encoded code stream to obtain a reconstructed frame of the first encoded code stream;
the second decoding module 904 is configured to decode the second encoded code stream to obtain position information and residual data of the macro block;
the image determining module 905 is configured to determine a decoded image corresponding to the current frame coding code stream according to the reconstructed frame obtained by the first decoding module 903 and the position information and residual data of the macro block obtained by the second encoding module 904.
In an embodiment, the image determining module 905 is specifically configured to traverse all macro blocks in the reconstructed frame, if it is determined that the current macro block has only residual data and no location information, the corresponding macro block in the decoded image is a sum of the current macro block and the residual data, if it is determined that the current macro block has no residual data and no location information, the corresponding macro block in the decoded image is the current macro block, and if it is determined that the current macro block has only location information and no residual data, the corresponding macro block in the decoded image is the corresponding macro block in the previous reconstructed frame.
In the image decoding device provided in the embodiment of the present invention, the current frame coding code stream obtained by the code stream obtaining module is composed of a lossy coding code stream and a lossless coding code stream, and the code stream is smaller than the total lossless coding code stream; the lossy coding code stream and the lossless coding code stream are respectively decoded, and a decoding image corresponding to the current frame coding code stream can be determined according to the decoding result.
Referring to fig. 10, an embodiment of the present application further provides an image encoding apparatus 100, where the image encoding apparatus 100 includes a processor 1001 and a memory 1002, where the memory 1002 stores at least one computer instruction, and the computer instruction is loaded and executed by the processor 1001 to implement the image encoding method described in the embodiment corresponding to fig. 1.
Referring to fig. 11, an embodiment of the present invention further provides an image decoding apparatus 110, where the image encoding apparatus 110 includes a processor 1101 and a memory 1102, where the memory 1102 stores therein at least one computer instruction, and the computer instruction is loaded and executed by the processor 1101 to implement the image decoding method described in the embodiment corresponding to fig. 3.
Based on the image encoding method described in the embodiment corresponding to fig. 1 and/or the image decoding method described in the embodiment corresponding to fig. 3, an embodiment of the present invention 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 data transmission method described in the embodiment corresponding to fig. 1 and/or fig. 3, which is not described herein again.
Other embodiments of the invention 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 invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention 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 invention is limited only by the appended claims.

Claims (10)

1. An image encoding method, characterized in that the method comprises:
acquiring a current image frame;
performing lossy coding on the current image frame to obtain a first coding code stream;
determining a lossless coding macro block in the current image frame, wherein the lossless coding macro block is a macro block which has the same pixels with the same positions as the previous image frame but has not the same pixels with the same positions as the previous image frame in the current image frame;
carrying out lossless coding on residual data of the lossless coding macro block in the current image frame to obtain a second coding code stream;
and packing the first coding code stream and the second coding code stream to obtain the coding code stream of the current image frame.
2. The method of claim 1, wherein the determining lossless coding macroblocks in the current image frame comprises:
determining the macro blocks with the same pixels at the same positions of the current image frame and the previous image frame to obtain a first macro block group;
determining the macro blocks with the same pixels at the same positions of the current image frame and the previous image frame of the previous image frame to obtain a second macro block group;
and determining lossless coding macro blocks in the current image frame according to the first macro block group and the second macro block group.
3. The method of claim 2, wherein said determining lossless encoded macroblocks in said current image frame from said first group of macroblocks and said second group of macroblocks comprises:
determining the same macro blocks in the first macro block group and the second macro block group to obtain a third macro block group;
and removing the macro blocks in the third macro block group from the first macro block group to obtain the lossless coding macro blocks in the current image frame.
4. The method of claim 3, wherein when losslessly encoding residual data of losslessly encoded macroblocks in the current image frame, the method further comprises:
and carrying out lossless coding on the position information of all the macro blocks in the third macro block group.
5. The method of claim 1, wherein said lossless encoding of residual data for lossless encoded macroblocks in said current image frame comprises:
acquiring a reconstructed frame of the first coding code stream;
calculating the residual error of the lossless coding macro block in the current image frame by utilizing the reconstructed frame of the first coding code stream to obtain residual error data;
and carrying out lossless coding on residual data and position information of the lossless coding macro block in the current image frame.
6. The method according to any one of claims 1 to 5, wherein after said obtaining the encoded codestream of the current image frame, the method further comprises:
and sending the coding code stream of the current image frame to a decoding end, and/or storing the coding code stream of the current image frame.
7. An image decoding method, characterized in that the method comprises:
acquiring a current frame coding code stream;
determining a first coding code stream and a second coding code stream in the current frame coding code stream, wherein the first coding code stream is a lossy coding code stream, and the second coding code stream is a lossless coding code stream;
decoding the first coding code stream to obtain a reconstructed frame of the first coding code stream;
decoding the second coded code stream to obtain position information and residual data of a macro block;
and determining a decoding image corresponding to the current frame coding code stream according to the reconstructed frame, the position information of the macro block and the residual data.
8. The method of claim 7, wherein the determining the decoded image corresponding to the current frame code stream according to the reconstructed frame, the position information of the macroblock, and the residual data comprises:
traversing all macro blocks in the reconstructed frame;
if the current macro block only has residual error data but no position information, the corresponding macro block in the decoded image is the sum of the current macro block and the residual error data;
if the current macro block has no residual error data and position information, the corresponding macro block in the decoded image is the current macro block;
if the current macro block only has the position information and has no residual data, the corresponding macro block in the decoded image is the corresponding macro block in the previous reconstructed frame.
9. An image encoding apparatus, comprising a processor and a memory, the memory having stored therein at least one computer instruction, the computer instruction being loaded and executed by the processor to implement the steps performed in the image encoding method of any one of claims 1 to 6.
10. An image decoding device, characterized in that it comprises a processor and a memory, in which at least one computer instruction is stored, which is loaded and executed by the processor to implement the steps performed in the image decoding method according to any one of claims 7 or 8.
CN202110609877.0A 2021-06-01 2021-06-01 Image coding and decoding method and device Pending CN113556547A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110609877.0A CN113556547A (en) 2021-06-01 2021-06-01 Image coding and decoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110609877.0A CN113556547A (en) 2021-06-01 2021-06-01 Image coding and decoding method and device

Publications (1)

Publication Number Publication Date
CN113556547A true CN113556547A (en) 2021-10-26

Family

ID=78101996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110609877.0A Pending CN113556547A (en) 2021-06-01 2021-06-01 Image coding and decoding method and device

Country Status (1)

Country Link
CN (1) CN113556547A (en)

Similar Documents

Publication Publication Date Title
RU2736421C1 (en) Method of encoding and decoding images and encoding and decoding device
JP6412910B2 (en) Method for decoding video, method for encoding video, decoder, encoder, computer readable recording medium recording decoding program, and computer readable recording medium recording encoding program
RU2751082C1 (en) Method for coding and decoding of images, coding and decoding device and corresponding computer programs
JP4393875B2 (en) System and method for providing a single layer video encoded bitstream suitable for reduced complexity decoding
KR102053242B1 (en) Machine learning algorithm using compression parameter for image reconstruction and image reconstruction method therewith
JP4440640B2 (en) Image block decoding method
US6757330B1 (en) Efficient implementation of half-pixel motion prediction
US20040179610A1 (en) Apparatus and method employing a configurable reference and loop filter for efficient video coding
US20060165164A1 (en) Scratch pad for storing intermediate loop filter data
KR101500781B1 (en) Method for processing images and the corresponding electronic device
KR20060109290A (en) Image decoding device, image decoding method, and image decoding program
CA2722553A1 (en) Video decoder and method for motion compensation for out-of-boundary pixels
JP2007524309A (en) Video decoding method
CN115836525B (en) Video encoding, decoding method and apparatus for prediction from multiple cross components
CN111034198B (en) Image encoding and decoding method, encoding and decoding device, and corresponding computer program
CN114902670B (en) Method and apparatus for signaling sub-image division information
CN113068026A (en) Decoding prediction method, device and computer storage medium
KR20170114598A (en) Video coding and decoding methods using adaptive cross component prediction and apparatus
US9479771B2 (en) Using multiple transform/subband representations for video encoding
CN115486074A (en) Brick and strip segmentation in video processing
CN113556547A (en) Image coding and decoding method and device
KR20220097997A (en) Video coding apparatus and method for controlling loop filtering
CN115567710A (en) Data encoding method and apparatus, and method and apparatus for decoding data stream
RU2782400C2 (en) Method of encoding and decoding images, device for encoding and decoding and corresponding software
RU2808075C1 (en) Method for image coding and decoding, coding and decoding device and corresponding computer programs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication