CN115118979A - Image encoding method, image decoding method, device, equipment and storage medium - Google Patents

Image encoding method, image decoding method, device, equipment and storage medium Download PDF

Info

Publication number
CN115118979A
CN115118979A CN202210635198.5A CN202210635198A CN115118979A CN 115118979 A CN115118979 A CN 115118979A CN 202210635198 A CN202210635198 A CN 202210635198A CN 115118979 A CN115118979 A CN 115118979A
Authority
CN
China
Prior art keywords
image
block
joint
image block
encoding
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
CN202210635198.5A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210635198.5A priority Critical patent/CN115118979A/en
Publication of CN115118979A publication Critical patent/CN115118979A/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Abstract

The application discloses an image coding method, an image decoding device, an image coding apparatus, an image decoding apparatus and a storage medium, and belongs to the technical field of computer vision processing. The method comprises the following steps: acquiring a first chrominance residual block and a second chrominance residual block of any image block of a target image; determining a target joint coding mode based on chrominance residual error information of a reference pixel point corresponding to any image block; based on a target joint coding mode, carrying out joint coding on a first chroma residual block and a second chroma residual block of any image block to obtain a joint chroma residual block; an encoding result of any one of the image blocks is determined based on the joint chrominance residual block. According to the method and the device, the decoding sequence of the reference pixel points is located in front of the image blocks, so that when the coding result of the image blocks is decoded, a target joint coding mode can be determined based on the chroma residual error information of the reference pixel points corresponding to the image blocks. Identification information for identifying the target joint coding mode is saved, and the data volume of the coding result of the image block is reduced.

Description

Image encoding method, image decoding method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computer vision processing, in particular to an image encoding method, an image decoding device, equipment and a storage medium.
Background
In the field of computer vision processing technology, images are a common type of data. By encoding the image, the data volume of the image can be compressed, the storage space required by the image can be reduced, and the channel resource occupied by the image transmission can be reduced.
In the related art, the target image may be divided into a plurality of image blocks, and each image block is encoded to obtain an encoding result of each image block, thereby implementing encoding processing on the target image. For any image block, a first chroma residual block and a second chroma residual block of the image block may be obtained first. And determining a target joint coding mode based on the first chroma residual block and the second chroma residual block. And then, jointly encoding the first chroma residual block and the second chroma residual block based on the target joint encoding mode to obtain a joint chroma residual block. Then, the encoding result of the image block is determined based on the identification information and the joint chroma residual block. The identification information is used to identify a target joint coding mode adopted by the image block.
In the above technology, the encoding result of the image block includes the identification information and the joint chroma residual block, and the data size of the encoding result of the image block is large, which causes the data size of the encoded image to be large, and affects the encoding performance.
Disclosure of Invention
The application provides an image encoding method, an image decoding method, an apparatus, a device and a storage medium, which can be used for solving the problem of large data size of an encoding result of an image block in the related art.
In one aspect, an image encoding method is provided, the method including:
for any image block in a plurality of image blocks included in a target image, acquiring a first color residual block and a second color residual block of the any image block;
determining a target joint coding mode based on chrominance residual error information of reference pixel points corresponding to any image block, wherein the reference pixel points are pixel points around any image block and are positioned in front of any image block in decoding sequence;
based on the target joint coding mode, carrying out joint coding on the first chroma residual block and the second chroma residual block of any image block to obtain a joint chroma residual block;
determining an encoding result of the any image block based on the joint chrominance residual block.
In another aspect, there is provided an image decoding method, the method including:
for any image block in a plurality of image blocks included in a target image, acquiring a coding result of the image block, wherein the coding result of the image block includes a joint chroma residual block;
determining a target joint coding mode based on chroma residual information of reference pixel points corresponding to any image block, wherein the reference pixel points are pixel points around any image block and are positioned in front of any image block in decoding sequence;
decoding the joint chrominance residual block based on the target joint coding mode to obtain a first chrominance residual block and a second chrominance residual block of any image block;
and determining a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
In another aspect, there is provided an image encoding apparatus, the apparatus including:
the image processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a first chrominance residual block and a second chrominance residual block of any image block in a plurality of image blocks included in a target image;
a determining module, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to the any image block, where the reference pixels are pixels around the any image block and a decoding sequence of the reference pixels is located before the any image block;
the encoding module is used for carrying out joint encoding on the first chroma residual block and the second chroma residual block of any image block based on the target joint encoding mode to obtain a joint chroma residual block;
the determining module is further configured to determine an encoding result of the any image block based on the joint chroma residual block.
In a possible implementation manner, the determining module is configured to determine distortion values of multiple joint coding modes based on chroma residual information of reference pixel points corresponding to any image block, where the distortion values of the joint coding modes are used to characterize image quality after the image block is coded based on the joint coding modes; determining a target joint encoding mode from the plurality of joint encoding modes based on the distortion values for the plurality of joint encoding modes.
In one possible implementation, the chroma residual information includes an original first chroma residual and an original second chroma residual; the determining module is configured to determine, for any one of the joint coding modes, a predicted second chroma residual of the reference pixel corresponding to the any one of the joint coding modes by using the original first chroma residual of the reference pixel; and determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residual error of the reference pixel point and the predicted second chrominance residual error of the reference pixel point corresponding to any one of the joint coding modes.
In a possible implementation manner, the number of the reference pixels is multiple; the determining module is configured to calculate, for any one of the reference pixel points, a difference between an original second chrominance residual of the any one of the reference pixel points and a predicted second chrominance residual of the any one of the reference pixel points corresponding to the any one of the joint coding modes, so as to obtain a distortion value of the any one of the reference pixel points corresponding to the any one of the joint coding modes; and determining a distortion value corresponding to any one joint encoding mode based on the distortion values of a plurality of reference pixel points corresponding to any one joint encoding mode.
In a possible implementation manner, the determining module is configured to determine, based on the distortion values of the multiple joint encoding modes, a joint encoding mode corresponding to a minimum distortion value from the multiple joint encoding modes; determining the rate distortion cost of the joint coding mode corresponding to the minimum distortion value, wherein the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is used for representing the coding quality when coding is carried out on the basis of the joint coding mode corresponding to the minimum distortion value; and determining the joint coding mode corresponding to the minimum distortion value as the target joint coding mode based on that the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than the rate-distortion cost of a non-joint coding mode.
In a possible implementation manner, the determining module is further configured to determine distortion values of multiple joint coding modes based on chrominance residual information of a reference pixel corresponding to any image block; determining a joint encoding mode corresponding to a minimum distortion value from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes; and determining an encoding result of any image block based on the first chroma residual block and the second chroma residual block of any image block based on that the rate-distortion cost of the joint encoding mode corresponding to the minimum distortion value is greater than the rate-distortion cost of the non-joint encoding mode.
In a possible implementation manner, the determining module is configured to use the joint chroma residual block and target identification information as a coding result of the any image block, where the target identification information is used to characterize whether the any image block adopts joint coding.
In another aspect, there is provided an image decoding apparatus, the apparatus including:
the image processing device comprises an acquisition module, a decoding module and a processing module, wherein the acquisition module is used for acquiring the coding result of any image block in a plurality of image blocks included in a target image, and the coding result of any image block comprises a joint chroma residual block;
a determining module, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to the any image block, where the reference pixels are pixels around the any image block and a decoding sequence of the reference pixels is located before the any image block;
a decoding module, configured to perform decoding processing on the joint chroma residual block based on the target joint coding mode to obtain a first chroma residual block and a second chroma residual block of any one of the image blocks;
the determining module is further configured to determine a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
In a possible implementation manner, the determining module is configured to determine distortion values of multiple joint coding modes based on chroma residual information of reference pixel points corresponding to any image block, where the distortion values of the joint coding modes are used to characterize image quality after the image block is coded based on the joint coding modes; determining a target joint encoding mode from the plurality of joint encoding modes based on the distortion values for the plurality of joint encoding modes.
In a possible implementation manner, the encoding result of any image block further includes target identification information; and if the target identification information represents that any image block adopts joint coding, the coding result of any image block comprises a joint chroma residual block.
In a possible implementation manner, the encoding result of any image block further includes target identification information; if the target identification information represents that any image block does not adopt joint coding, the coding result of any image block comprises a first chrominance residual block and a second chrominance residual block of any image block;
the determining module is further configured to determine a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
In another aspect, an electronic device is provided, which includes a processor and a memory, where at least one computer program is stored in the memory, and the at least one computer program is loaded by the processor and executed to enable the electronic device to implement any one of the image encoding methods or any one of the image decoding methods.
In another aspect, a computer-readable storage medium is provided, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor, so as to enable an electronic device to implement any one of the above-mentioned image encoding methods or any one of the above-mentioned image decoding methods.
In another aspect, a computer program or a computer program product is provided, in which at least one computer program is stored, the at least one computer program being loaded and executed by a processor, so as to enable an electronic device to implement any one of the above-mentioned image encoding methods or to implement any one of the above-mentioned image decoding methods.
The technical scheme provided by the application at least brings the following beneficial effects:
the technical scheme provided by the application determines the target joint coding mode of any image block based on the chrominance residual error information of the reference pixel point corresponding to the image block. Because the reference pixel points are pixel points around any image block and the decoding sequence is located before any image block, when the encoding result of any image block is decoded, the chrominance residual error information of the reference pixel point corresponding to any image block can be obtained, and the target joint encoding mode is determined based on the chrominance residual error information of the reference pixel point corresponding to any image block. The method saves identification information for identifying the target joint coding mode, reduces the data quantity of the coding result of the image block, and improves the coding performance.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of an implementation environment of an image encoding method or an image decoding method according to an embodiment of the present application;
fig. 2 is a flowchart of an image encoding method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a reference pixel provided in an embodiment of the present application;
fig. 4 is a flowchart of an image decoding method according to an embodiment of the present application;
fig. 5 is a schematic diagram of an image encoding method provided in an embodiment of the present application;
FIG. 6 is a diagram illustrating an image decoding method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an implementation environment of an image encoding method or an image decoding method according to an embodiment of the present application, and as shown in fig. 1, the implementation environment includes a terminal device 101 and a server 102. The image encoding method or the image decoding method in the embodiment of the present application may be executed by the terminal device 101, may be executed by the server 102, or may be executed by both the terminal device 101 and the server 102.
The terminal device 101 may be a smart phone, a game console, a desktop computer, a tablet computer, a laptop portable computer, a smart television, a smart car device, a smart voice interaction device, a smart appliance, or the like. The server 102 may be a server, or a server cluster composed of multiple servers, or any one of a cloud computing platform and a virtualization center, which is not limited in this embodiment of the present application. The server 102 may be communicatively connected to the terminal apparatus 101 via a wired network or a wireless network. The server 102 may have functions of data processing, data storage, data transceiving, and the like, and is not limited in the embodiment of the present application. The number of the terminal apparatus 101 and the server 102 is not limited, and may be one or more.
The technical scheme provided by the embodiment of the application can be realized based on Cloud Technology. The cloud technology is a hosting technology for unifying series resources such as hardware, software, network and the like in a wide area network or a local area network to realize the calculation, storage, processing and sharing of data.
The cloud technology is a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied based on a cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
Based on the above implementation environment, the embodiment of the present application provides an image encoding method, which may be executed by the terminal device 101 or the server 102 in fig. 1, or may be executed by both the terminal device 101 and the server 102, taking the flowchart of the image encoding method provided by the embodiment of the present application shown in fig. 2 as an example. For convenience of description, the terminal apparatus 101 or the server 102 that performs the image encoding method in the embodiment of the present application will be referred to as an electronic apparatus, and the method may be performed by the electronic apparatus. As shown in fig. 2, the method includes steps S201 to S204.
In step S201, for any image block of a plurality of image blocks included in the target image, a first chroma residual block and a second chroma residual block of any image block are obtained.
The embodiment of the application does not limit the acquisition mode, content and the like of the target image. Illustratively, an arbitrary image taken by the user is acquired as the target image, or an arbitrary image captured from the network is acquired as the target image, or an arbitrary frame image extracted from the video is acquired as the target image.
The target image may be divided into a plurality of image blocks. The division manner is not limited in the embodiments of the present application, and for example, the target image is divided into a predetermined number of image blocks, or the target image is divided into a plurality of image blocks of a predetermined size by sliding a window of a predetermined size. The size of any image block is not limited in the embodiments of the present application, and for example, any image block is a pixel block greater than or equal to 4 × 4, and any image block is a pixel block less than or equal to 32 × 32.
Any image block includes pixel information of a plurality of pixels, and the pixel information of any pixel includes an original luminance value (Y may be used to represent the original luminance value) of the pixel, an original first chrominance value (Cb may be used to represent the original first chrominance value) of the pixel, and an original second chrominance value (Cr may be used to represent the original second chrominance value) of the pixel. The image composed of Y, Cb, and Cr of each pixel belongs to an image of YUV (a color coding method) video format.
It should be noted that the original first chrominance values of each pixel in any image block may form a chrominance block, and the chrominance block may be marked as the original first chrominance block. Similarly, the original second chrominance values of the respective pixels in any image block may constitute another chrominance block, which may be denoted as the original second chrominance block.
Any method may be employed to determine the predicted first chroma block and the predicted second chroma block for any image block based on intra prediction. When the target image is any frame image extracted from the video, any method can be adopted to determine the predicted first chroma block and the predicted second chroma block of any image block based on an inter-frame prediction mode. The predicted first chrominance block of any image block comprises the predicted first chrominance values of all the pixels in the image block, and the predicted second chrominance block of any image block comprises the predicted second chrominance values of all the pixels in the image block.
Subtracting the predicted first chroma block of the image block from the original first chroma block of any image block to obtain a first chroma residual block of the image block. Subtracting the predicted first chrominance value of the corresponding pixel point in the predicted first chrominance block of the image block from the original first chrominance value of each pixel point in the original first chrominance block of any image block to obtain the first chrominance residual of the corresponding pixel point in the first chrominance residual block of the image block. The first chrominance residual of the pixel point calculated in this way can be referred to as the original first chrominance residual of the pixel point. The first chrominance residual block of the image block comprises an original first chrominance residual of each pixel point in the image block.
Similarly, the predicted second chroma block of the image block is subtracted from the original second chroma block of any image block to obtain a second chroma residual block of the image block. Specifically, the original second chrominance value of each pixel point in the original second chrominance block of any image block is subtracted by the predicted second chrominance value of the corresponding pixel point in the predicted second chrominance block of the image block, so as to obtain the second chrominance residual of the corresponding pixel point in the second chrominance residual block of the image block. The second chrominance residual error of the pixel point calculated in the way can be called as the original second chrominance residual error of the pixel point. The second chrominance residual block of the image block comprises the original second chrominance residual of each pixel point in the image block.
Step S202, a target joint coding mode is determined based on chroma residual information of reference pixel points corresponding to any image block, the reference pixel points are pixel points around any image block, and a decoding sequence is located in front of any image block.
For an image, because the pixel information of two adjacent pixel points is similar, the chrominance residual error information of the two adjacent pixel points is also similar. At this time, the chroma residual information of one pixel point can be used to approximately represent the chroma residual information of another pixel point adjacent to the pixel point.
For any image block, the related art determines a target joint coding mode corresponding to the image block based on a first chrominance residual block and a second chrominance residual block of the image block, and the embodiment of the present application is based on a principle that "chrominance residual information of one pixel point is used to approximately represent chrominance residual information of another pixel point adjacent to the pixel point", and chrominance residual information of pixel points around the image block is used to represent the first chrominance residual block and the second chrominance residual block of the image block, so as to determine the target joint coding mode based on the chrominance residual information of the pixel points around the image block.
In addition, for any image block, the target joint coding mode is determined by using the chroma residual information of the pixel points which are positioned in front of the image block in the decoding sequence, so that when the coding result of the image block is obtained in the decoding process, the chroma residual information of the pixel points which are positioned in front of the image block in the decoding sequence can be obtained certainly, and the target joint coding mode is determined based on the chroma residual information of the pixel points which are positioned in front of the image block in the decoding sequence in the coding process.
In summary, the reference pixels corresponding to any image block are the pixels around the image block and the decoding sequence is located before the image block. Referring to fig. 3, fig. 3 is a schematic diagram of a reference pixel provided in an embodiment of the present application, and for the image block shown in fig. 3, the image block is an 8 × 8 pixel block. In the embodiment of the present application, decoding is performed in the order from left to right and from top to bottom. Therefore, the decoding order of the pixels on the left side of the image block is located before the image block, and the decoding order of the pixels on the upper portion of the image block is also located before the image block. The 8 pixel points around the image block on the left side of the image block and the 8 pixel points around the image block on the upper part of the image block can be used as reference pixel points corresponding to the image block.
After the reference pixel point corresponding to any image block is determined, the chroma residual information of the reference pixel point can be obtained, and a target joint coding mode is determined based on the chroma residual information of the reference pixel point.
In a possible implementation manner, determining a target joint coding mode based on chrominance residual information of a reference pixel corresponding to any image block includes: determining distortion values of a plurality of joint coding modes based on chrominance residual error information of reference pixel points corresponding to any image block, wherein the distortion values of the joint coding modes are used for representing the image quality after the image block is coded based on the joint coding modes; a target joint encoding mode is determined from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes.
The number of the joint coding modes is not limited in the embodiments of the present application. Illustratively, the number of the joint coding modes is three, which are respectively denoted as joint coding mode 1, joint coding mode 2, and joint coding mode 3. The distortion value of each joint coding mode may be determined based on the chroma residual information of the reference pixel corresponding to any image block. The larger the distortion value of the joint encoding mode is, the worse the image quality after encoding any one of the image blocks based on the joint encoding mode is, and therefore, the distortion value of the joint encoding mode is inversely proportional to the image quality after encoding any one of the image blocks based on the joint encoding mode. And determining a target joint encoding mode from the multiple joint encoding modes based on the distortion values of the multiple joint encoding modes, so that the joint encoding mode corresponding to higher image quality can be determined, and the image quality after encoding can be improved.
Optionally, the chroma residual information comprises an original first chroma residual and an original second chroma residual; determining distortion values of a plurality of joint coding modes based on chrominance residual error information of a reference pixel point corresponding to any image block, wherein the determining comprises the following steps: for any one joint coding mode, determining a predicted second chroma residual of a reference pixel corresponding to any one joint coding mode by using the original first chroma residual of the reference pixel; and determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residual error of the reference pixel point and the predicted second chrominance residual error of the reference pixel point corresponding to any one of the joint coding modes.
In an embodiment of the present application, the chrominance residual information of the reference pixel includes an original first chrominance residual of the reference pixel and an original second chrominance residual of the reference pixel. The predicted first chrominance value and the predicted second chrominance value of the reference pixel point can be determined by adopting any method based on an inter-frame prediction or intra-frame prediction mode. And subtracting the predicted first chrominance value of the reference pixel point from the original first chrominance value of the reference pixel point to obtain an original first chrominance residual error of the reference pixel point. And subtracting the predicted second chrominance value of the reference pixel point from the original second chrominance value of the reference pixel point to obtain an original second chrominance residual error of the reference pixel point.
Optionally, the encoding order and the decoding order of the image blocks in the target image are the same. Because the decoding sequence of the reference pixel points is positioned before any image block, the encoding sequence and the decoding sequence of the image block in which the reference pixel points are positioned are both positioned before any image block. The first chrominance residual block and the second chrominance residual block of the image block where the reference pixel point is located can be obtained. Since the first chrominance residual block of the image block where the reference pixel point is located includes the original first chrominance residual of each pixel point in the image block where the reference pixel point is located, the original first chrominance residual of the reference pixel point can be extracted from the first chrominance residual block of the image block where the reference pixel point is located. Similarly, the second chrominance residual block of the image block where the reference pixel point is located comprises the original second chrominance residual of each pixel point in the image block where the reference pixel point is located, so that the original second chrominance residual of the reference pixel point can be extracted from the second chrominance residual block of the image block where the reference pixel point is located.
By carrying out statistical analysis processing on the target image, a symbolic relation can be obtained, and the symbolic relation is used for representing the relation whether the positive and negative of the original first chrominance residual error and the original second chrominance residual error are the same or not. For example, if the original first chrominance residual is a positive value and the original second chrominance residual is also a positive value, or the original first chrominance residual is a negative value and the original second chrominance residual is also a negative value, the sign relationship is + 1. If the original first chrominance residual is a positive value and the original second chrominance residual is a negative value, or the original first chrominance residual is a negative value and the original second chrominance residual is a positive value, the sign relationship is-1.
The predicted second chrominance residual of the reference pixel corresponding to any one of the joint coding modes can be determined based on the original first chrominance residual of the reference pixel and the sign relationship. The original first chrominance residual error of the reference pixel point can be multiplied by the sign relation to obtain a product result, and the product result is multiplied by the weight corresponding to any one joint coding mode to obtain the predicted second chrominance residual error of the reference pixel point corresponding to the joint coding mode. Namely, Cr' ═ CSign × Cb × a is calculated. Wherein, Cr' represents the predicted second chroma residual of the reference pixel corresponding to any one joint coding mode, and CSign represents the sign relation. Cb represents the original first chrominance residual of the reference pixel, and a represents the weight corresponding to any one of the joint coding modes.
In the embodiment of the application, the number of the joint coding modes is multiple, and the weights corresponding to different joint coding modes are different. The following is a further explanation by taking the case where the number of the joint coding modes is three.
For joint coding mode 1, joint coding mode 1 corresponds to a weight of 0.5. The original first chrominance residual error of the reference pixel point and the sign relation can be multiplied to obtain a product result, and the product result is multiplied by 0.5 to obtain a predicted second chrominance residual error of the reference pixel point corresponding to the joint coding mode 1. Namely, Cr' ═ (CSign × Cb)/2 was calculated. Wherein, Cr' represents the predicted second chroma residual of the reference pixel corresponding to the joint coding mode 1, and CSign represents the sign relation. Cb represents the original first chrominance residual of the reference pixel.
For joint coding mode 2, the weight for joint coding mode 2 is 1. The original first chrominance residual of the reference pixel may be multiplied by the sign relationship to obtain a product result, and the product result is used as the predicted second chrominance residual of the reference pixel corresponding to the joint coding mode 2. Namely, Cr' ═ CSign × Cb is calculated. Wherein, Cr' represents the predicted second chroma residual of the reference pixel corresponding to the joint coding mode 2, and CSign represents the sign relation. Cb represents the original first chrominance residual of the reference pixel.
For joint coding mode 3, joint coding mode 3 corresponds to a weight of 2. The original first chrominance residual error of the reference pixel point and the sign relation can be multiplied to obtain a product result, and the product result is multiplied by 2 to obtain a predicted second chrominance residual error of the reference pixel point corresponding to the joint coding mode 3. I.e. calculate Cr' ═ 2 (CSign × Cb). Wherein, Cr' represents the predicted second chroma residual of the reference pixel corresponding to the joint coding mode 3, and CSign represents the sign relation. Cb represents the original first chrominance residual of the reference pixel.
It should be noted that the number of the reference pixels is at least one, and for any reference pixel, the predicted second chrominance residual of the reference pixel corresponding to any joint coding mode may be determined according to Cr' ═ CSign × Cb × a, so as to obtain the predicted second chrominance residual of each reference pixel corresponding to any joint coding mode.
Optionally, the number of the reference pixels is multiple; determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residuals of the reference pixel points and the predicted second chrominance residuals of the reference pixel points corresponding to any one of the joint coding modes, including: for any reference pixel point, calculating a difference value between the original second chrominance residual error of any reference pixel point and the predicted second chrominance residual error of any reference pixel point corresponding to any joint coding mode to obtain a distortion value of any reference pixel point corresponding to any joint coding mode; and determining the distortion value corresponding to any joint coding mode based on the distortion values of a plurality of reference pixel points corresponding to any joint coding mode.
For any reference pixel, the original second chrominance residual of any reference pixel and the predicted second chrominance residual of any reference pixel corresponding to any joint coding mode may be subtracted to obtain a difference between the original second chrominance residual of any reference pixel and the predicted second chrominance residual of any reference pixel corresponding to any joint coding mode (hereinafter, referred to as a difference corresponding to any reference pixel corresponding to any joint coding mode).
Optionally, an absolute value of a difference value corresponding to any reference pixel corresponding to any joint encoding mode is obtained, so as to obtain a distortion value of any reference pixel corresponding to any joint encoding mode. And adding the distortion values of the plurality of reference pixel points corresponding to any one joint encoding mode to obtain the distortion value corresponding to any one joint encoding mode.
Optionally, the square of the difference value corresponding to any reference pixel point corresponding to any joint encoding mode is obtained to obtain the distortion value of any reference pixel point corresponding to any joint encoding mode. And adding the distortion values of the plurality of reference pixel points corresponding to any one joint encoding mode to obtain the distortion value corresponding to any one joint encoding mode.
By the method, the distortion value corresponding to each joint coding mode can be determined. Then, a target joint encoding mode is determined from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes.
Optionally, determining the target joint encoding mode from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes comprises: determining a joint encoding mode corresponding to the minimum distortion value from a plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes; determining the rate distortion cost of the joint coding mode corresponding to the minimum distortion value, wherein the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is used for representing the coding quality when coding is carried out on the basis of the joint coding mode corresponding to the minimum distortion value; and determining the joint coding mode corresponding to the minimum distortion value as a target joint coding mode based on that the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than that of the non-joint coding mode.
In the embodiment of the present application, a minimum distortion value is determined from distortion values of multiple joint encoding modes, and a joint encoding mode corresponding to the minimum distortion value is determined.
The first chroma residual block and the second chroma residual block of any image block may be jointly encoded based on a joint encoding mode corresponding to the minimum distortion value, so as to obtain a joint chroma residual block. And (3) carrying out transformation processing (such as DCT (discrete cosine transform) processing, sine transformation processing and the like) on the combined chrominance residual block to obtain a transformed combined chrominance residual block. And carrying out quantization processing on the transformed combined chrominance residual block to obtain a quantized combined chrominance residual block, and carrying out inverse quantization processing on the quantized combined chrominance residual block to obtain an inverse quantized combined chrominance residual block. And decoding the inverse-quantized joint chrominance residual block based on the joint coding mode corresponding to the minimum distortion value to obtain a first chrominance reconstruction residual block and a second chrominance reconstruction residual block. And calculating the difference square sum of corresponding data based on the first chrominance residual block, the second chrominance residual block, the first chrominance reconstruction residual block and the second chrominance reconstruction residual block of any image block to obtain a first coding distortion value. The first encoding distortion value is used for characterizing the loss of the image block quality caused by encoding the image block based on the joint encoding mode corresponding to the minimum distortion value, and the first encoding distortion value is proportional to the loss of the image block quality.
The quantized joint chrominance residual block may be entropy-encoded to convert the quantized joint chrominance residual block into binary data, so as to obtain binary data of a joint encoding mode corresponding to the minimum distortion value. And determining the information quantity occupied by the binary data of the joint coding mode corresponding to the minimum distortion value, and determining the first information quantity based on the information quantity. The first information quantity is used for representing the information quantity required by encoding based on the joint encoding mode corresponding to the minimum distortion value.
And carrying out weighted summation on the first encoding distortion value and the first information quantity to obtain the rate distortion cost of the joint encoding mode corresponding to the minimum distortion value. Optionally, J0 is calculated as D0+ λ R0, where J0 represents the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value, D0 represents the first coding distortion value, λ is a weight coefficient, which is related to a Quantization Parameter (QP), and R0 represents the first information amount.
It should be noted that the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is obtained based on the first coding distortion value and the first information amount, and is a result obtained by balancing the loss of the image block quality and the required information amount, and therefore, the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value can be used to characterize the coding quality when coding is performed based on the joint coding mode corresponding to the minimum distortion value.
For non-joint coding modes. On the one hand, the first chroma residual block of any image block is transformed to obtain a transformed first chroma residual block. And performing quantization processing on the transformed first chrominance residual block to obtain a quantized first chrominance residual block, and performing inverse quantization processing on the quantized first chrominance residual block to obtain an inverse quantized first chrominance residual block. On the other hand, the second chroma residual block of any image block is transformed to obtain a transformed second chroma residual block. And quantizing the transformed second chrominance residual block to obtain a quantized second chrominance residual block, and performing inverse quantization on the quantized second chrominance residual block to obtain an inverse quantized second chrominance residual block.
And calculating the difference sum of squares of corresponding data based on the first chrominance residual block of any image block, the second chrominance residual block of the image block, the first chrominance residual block after inverse quantization and the second chrominance residual block after inverse quantization to obtain a second encoding distortion value. And the second encoding distortion value is used for representing the loss of the image block quality caused by encoding the image block based on the non-joint encoding mode, and the second encoding distortion value is in direct proportion to the loss of the image block quality.
The quantized first chrominance residual block may be entropy-encoded to convert the quantized first chrominance residual block into binary data, so as to obtain binary data corresponding to the first chrominance residual block. And entropy coding the quantized second chrominance residual block to convert the quantized second chrominance residual block into binary data to obtain the binary data corresponding to the second chrominance residual block. An information amount occupied by binary data corresponding to the first chrominance residual block and an information amount occupied by binary data corresponding to the second chrominance residual block are determined, and the second information amount is determined based on the two information amounts. Wherein the second amount of information is used to characterize an amount of information needed for encoding based on the non-joint coding mode.
And carrying out weighted summation on the second coding distortion value and the second information quantity to obtain the rate distortion cost of the non-joint coding mode. Optionally, J1 is calculated as D1+ λ R1, where J1 represents the rate distortion cost of the non-joint coding mode, D1 represents the second coding distortion value, λ is a weight coefficient related to a Quantization Parameter (QP), and R1 represents the second information quantity.
The rate distortion cost of the non-joint coding mode is obtained based on the second coding distortion value and the second information amount, and is a result of balancing the loss of the image block quality and the required information amount, so that the rate distortion cost of the non-joint coding mode can be used for representing the coding quality when coding is performed based on the non-joint coding mode.
The embodiment of the present application does not limit the conversion processing method and the content of the information amount. Illustratively, the Transform process is a Discrete Cosine Transform (DCT) process, a sine Transform process, or the like. The amount of information may be a number of bits.
When the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than the rate distortion cost of the non-joint coding mode, the coding quality when coding is carried out based on the joint coding mode corresponding to the minimum distortion value is smaller than or equal to the coding quality when coding is carried out based on the non-joint coding mode. According to the embodiment of the application, the joint coding mode corresponding to the minimum distortion value is determined as the target joint coding mode, so that the data volume of the coding result of the image block can be reduced, and the coding quality can be improved.
Step S203, based on the target joint coding mode, joint coding is performed on the first chroma residual block and the second chroma residual block of any image block to obtain a joint chroma residual block.
In the embodiment of the present application, a weight of a first chroma residual block and a weight of a second chroma residual block corresponding to a target joint coding mode may be determined. And calculating to obtain a joint chrominance residual block based on the sign relation, the weight of the first chrominance residual block of any image block and the first chrominance residual block corresponding to the target joint coding mode, and the weight of the second chrominance residual block of any image block and the second chrominance residual block corresponding to the target joint coding mode. The related content of the symbol relationship is introduced above, and is not described herein again.
The target joint coding mode is any one of a plurality of joint coding modes, and the weight of the first chroma residual block and the weight of the second chroma residual block corresponding to each joint coding mode are different. The following is a further explanation taking as an example that the target joint coding mode is any one of joint coding modes 1 to 3. In the following formulas, resCb [ x ] [ y ] represents the first chroma residual block of any image block, resJointC [ x ] [ y ] represents the joint chroma residual block of any image block, resCr [ x ] [ y ] represents the second chroma residual block of any image block, and CSign represents the sign relationship.
The target joint coding mode is joint coding mode 1, which can be written as mode ═ 1. The joint coding mode 1 satisfies the following formula: resCb [ x ] [ y ] (resJointC [ x ] [ y ], resCr [ x ] [ y ] (CSign × resJointC [ x ] [ y ])/2. It can be determined that the first chroma residual block corresponding to the joint coding mode 1 has a weight of 4/5 and the second chroma residual block corresponding to the joint coding mode 1 has a weight of 2/5. Based on 4/5, 2/5, CSign, resCb [ x ] [ y ], and resCr [ x ] [ y ], resJointC [ x ] [ y ] (4 × resCb [ x ] [ y ] +2 × CSign × resCr [ x ] [ y ])/5 is calculated.
The target joint coding mode is joint coding mode 2, which can be denoted as mode 2. The joint coding mode 2 satisfies the following formula: resCb [ x ] [ y ] ═ resJointC [ x ] [ y ], resCr [ x ] [ y ] ═ CSign × resJointC [ x ] [ y ]. It can be determined that the first chroma residual block corresponding to the joint coding mode 2 has a weight of 1/2 and the second chroma residual block corresponding to the joint coding mode 2 has a weight of 1/2. resJointC [ x ] [ y ] (resCb [ x ] [ y ] + CSign × resCr [ x ] [ y ])/2 is calculated based on 1/2, 1/2, CSign, resCb [ x ] [ y ], and resCr [ x ] [ y ].
The target joint coding mode is joint coding mode 3, which can be denoted as mode-3. The joint coding mode 3 satisfies the following formula: resCr [ x ] [ y ] (resJointC [ x ] [ y ], resCb [ x ] [ y ] (CSign × resJointC [ x ] [ y ])/2. It can be determined that the first chroma residual block corresponding to the joint coding mode 3 has a weight of 2/5 and the second chroma residual block corresponding to the joint coding mode 3 has a weight of 4/5. Based on 2/5, 4/5, CSign, resCb [ x ] [ y ], and resCr [ x ] [ y ], resJointC [ x ] [ y ] (4 × resCr [ x ] [ y ] +2 × CSign × resCb [ x ] [ y ])/5 is calculated.
In step S204, the coding result of any image block is determined based on the joint chroma residual block.
After determining the joint chroma residual block of any one image block, determining an encoding result of the image block based on the joint chroma residual block of the image block, storing the encoding result of the image block, or transmitting the encoding result of the image block. According to the manner from step S201 to step S204, the encoding result of each image block included in the target image may be determined, so as to obtain the encoding result of the target image, where the encoding result of the target image includes the encoding result of each image block included in the target image.
It should be noted that, in the embodiment of the present application, when the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than the rate-distortion cost of the non-joint coding mode, the joint coding mode corresponding to the minimum distortion value is determined as the target joint coding mode, and step S203 and step S204 are executed.
In a possible implementation manner, after obtaining the first chroma residual block and the second chroma residual block of any one of the image blocks, the method further includes: determining distortion values of a plurality of joint coding modes based on chrominance residual error information of a reference pixel point corresponding to any image block; determining a joint encoding mode corresponding to the minimum distortion value from a plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes; and determining the first chrominance residual block and the second chrominance residual block of any image block as the encoding result of any image block based on that the rate distortion cost of the joint encoding mode corresponding to the minimum distortion value is greater than that of the non-joint encoding mode.
The related contents of "determining the distortion values of the multiple joint coding modes based on the chroma residual information of the reference pixel corresponding to any image block," and determining the joint coding mode corresponding to the minimum distortion value from the multiple joint coding modes based on the distortion values of the multiple joint coding modes "have been mentioned above, and are not described herein again.
The rate-distortion cost of the joint coding mode and the rate-distortion cost of the non-joint coding mode corresponding to the minimum distortion value can be determined as mentioned above. When the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is larger than that of the non-joint coding mode, the non-joint coding mode is adopted, and the coding quality can be improved. Of course, if the encoding quality is not considered in the application and only the data amount of the encoding result of the image block is considered, the step S203 and the step S204 may be executed by using the joint encoding mode corresponding to the minimum distortion value, that is, the joint encoding mode corresponding to the minimum distortion value as the target joint encoding mode.
When it is determined that the non-joint coding mode is employed, the coding result of any one of the image blocks may be determined based on the first chrominance residual block and the second chrominance residual block of any one of the image blocks.
Alternatively, the first chroma residual block of any one of the image blocks may be detected, and first identification information for identifying whether a non-zero coefficient exists in the first chroma residual block of the image block is determined based on the detection result. The first identification information is a first symbol (e.g., 1) if a non-zero coefficient exists in the first chroma residual block of the image block, and the first identification information is a second symbol (e.g., 0) if the non-zero coefficient does not exist in the first chroma residual block of the image block. The first identification information may be denoted as tu _ cbf _ cb.
It is to be understood that, if the first identification information is the second symbol, which indicates that all data in the first chroma residual block of the image block is 0, the first chroma residual block of the image block may be characterized by any symbol (e.g., 0, null character, special character, etc.).
Likewise, the second chroma residual block of any one of the image blocks may be detected, and second identification information for identifying whether a non-zero coefficient exists in the second chroma residual block of the image block is determined based on the detection result. The second identification information is a third symbol (e.g., 1) if a non-zero coefficient exists in the second chroma residual block of the image block, and the second identification information is a fourth symbol (e.g., 0) if the non-zero coefficient does not exist in the second chroma residual block of the image block. The second identification information may be denoted as tu _ cbf _ cr.
It is to be understood that if the second identification information is a fourth symbol indicating that all data in the second color residual block of the image block are 0, the second color residual block of the image block may be characterized by any symbol (e.g., 0, null character, special character, etc.).
The encoding result of any one of the image blocks may be determined based on the first identification information, the second identification information, and the first chrominance residual block and the second chrominance residual block of any one of the image blocks.
Optionally, determining an encoding result of any image block based on the joint chroma residual block comprises: and taking the joint chrominance residual block and the target identification information as the coding result of any image block, wherein the target identification information is used for representing whether any image block adopts joint coding. Illustratively, the target identification information is denoted as tu _ join _ cbcr _ residual _ flag.
If any image block adopts joint coding, the image block is indicated to be the joint coding of the first chroma residual block and the second chroma residual block of the image block based on the target joint coding mode, and a joint chroma residual block is obtained. At this time, the target identification information may be marked as a fifth symbol (e.g. 1), so as to use the fifth symbol to characterize the image block by joint coding. And determining an encoding result of the image block based on the fifth symbol and the joint chroma residual block of the image block. For example, tu _ join _ cbcr _ residual _ flag is 1, and the joint chroma residual block resJointC [ x ] [ y ] of the image block is determined as the encoding result of the image block.
If any image block does not adopt joint coding, the image block adopts a non-joint coding mode. At this time, the target identification information may be marked as a sixth symbol (e.g. 0) to use the sixth symbol to characterize the image block without joint coding. Determining an encoding result of the image block based on the sixth symbol, the first chrominance residual block of the image block, and the second chrominance residual block of the image block, or based on the sixth symbol, the first chrominance residual block of the image block, the second chrominance residual block of the image block, the first identification information, and the second identification information. For example, tu _ join _ cbcr _ residual _ flag is determined as the encoding result of the image block, 0, first identification information tu _ cbf _ cb (equal to 0 or 1), second identification information tu _ cbf _ cr (equal to 0 or 1), a first chrominance residual block of the image block resCb [ x ] [ y ], and a second chrominance residual block of the image block resCr [ x ] [ y ].
In the related art, the first color residual block of an image block is detected, the first identification information is determined based on the detection result, the second color residual block of any image block is detected, and the second identification information is determined based on the detection result. And characterizing the target joint coding mode adopted by the image block by utilizing the first identification information and the second identification information. Exemplarily, the first identification information is 1 if a non-zero coefficient exists in the first chrominance residual block of the image block, and the first identification information is 0 if no non-zero coefficient exists in the first chrominance residual block of the image block. Similarly, the second identification information is 1 if a non-zero coefficient exists in the second chroma residual block of the image block, and the second identification information is 0 if a non-zero coefficient does not exist in the second chroma residual block of the image block. Referring to table 1 below, table 1 shows a correspondence relationship between the first identification information tu _ cbf _ cb, the second identification information tu _ cbf _ cr, and the joint coding modes 1-3.
TABLE 1
tu_cbf_cb tu_cbf_cr Joint coding mode
1 0 Joint coding mode 1
1 1 Joint coding mode 2
0 1 Joint coding mode 3
For the related art, when any one of the image blocks adopts joint encoding, an encoding result of the image block is determined based on the fifth symbol, the first identification information, the second identification information, and a joint chrominance residual block of the image block. In the embodiment of the present application, the encoding result of the image block is determined based on the fifth symbol and the joint chrominance residual block of the image block. The embodiment of the application saves the first identification information and the second identification information, thereby reducing the data volume of the coding result of the image block, improving the coding performance, and reducing the storage space required for storing the coding result of the image block and the transmission resource required for transmitting the coding result of the image block.
It should be noted that information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data for analysis, stored data, presented data, etc.), and signals referred to in this application are authorized by the user or sufficiently authorized by various parties, and the collection, use, and processing of the relevant data is required to comply with relevant laws and regulations and standards in relevant countries and regions. For example, the first chrominance residual block, the second chrominance residual block, etc. of the image block referred to in this application are obtained with sufficient authorization.
The method is based on the chroma residual information of the reference pixel point corresponding to any image block, and the target joint coding mode of the image block is determined. Because the reference pixel points are pixel points around any image block and the decoding sequence is located before any image block, when the encoding result of any image block is decoded, the chroma residual error information of the reference pixel point corresponding to any image block can be obtained, and the target joint encoding mode is determined based on the chroma residual error information of the reference pixel point corresponding to any image block. The method saves identification information for identifying the target joint coding mode, reduces the data amount of the coding result of the image block, and improves the coding performance.
Based on the foregoing implementation environment, an embodiment of the present application provides an image decoding method, which may be executed by the terminal device 101 or the server 102 in fig. 1, or may be executed by both the terminal device 101 and the server 102, taking a flowchart of the image decoding method provided by the embodiment of the present application shown in fig. 4 as an example. For convenience of description, the terminal apparatus 101 or the server 102 that performs the image decoding method in the embodiment of the present application will be referred to as an electronic apparatus, and the method may be performed by the electronic apparatus. As shown in fig. 4, the method includes steps S401 to S404.
Step S401, for any image block in a plurality of image blocks included in the target image, acquiring an encoding result of any image block, where the encoding result of any image block includes a joint chroma residual block.
As mentioned above, the encoding end may determine the joint chroma residual block of any image block and determine the encoding result of the image block based on the joint chroma residual block of the image block in the manner of steps S201 to S204. Therefore, the decoding side can directly or indirectly obtain the encoding result of any image block from the encoding side.
Step S402, a target joint coding mode is determined based on the chroma residual information of the reference pixel points corresponding to any image block, wherein the reference pixel points are the pixel points around any image block, and the decoding sequence is positioned in front of any image block.
Because the reference pixel points are pixel points of which the decoding sequence is positioned before any image block, when the encoding result of any image block is obtained, the chroma residual error information of the reference pixel point corresponding to any image block can also be obtained. The implementation principle of step S402 is the same as that of step S202, and is not described herein again.
In a possible implementation manner, determining a target joint coding mode based on chroma residual information of a reference pixel corresponding to any image block includes: determining distortion values of a plurality of joint coding modes based on chrominance residual error information of a reference pixel point corresponding to any image block, wherein the distortion values of the joint coding modes are used for representing the image quality after any image block is coded based on the joint coding modes; a target joint encoding mode is determined from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes.
The number of joint coding modes is not limited in the embodiments of the present application. The distortion value of each joint coding mode may be determined based on the chroma residual information of the reference pixel corresponding to any image block. The larger the distortion value of the joint encoding mode is, the worse the image quality after encoding any one of the image blocks based on the joint encoding mode is, and therefore, the distortion value of the joint encoding mode is inversely proportional to the image quality after encoding any one of the image blocks based on the joint encoding mode.
In step S202, a method for determining distortion values of multiple joint coding modes has been introduced, and in step S202, a method for determining a target joint coding mode from multiple joint coding modes has been introduced, which is not described herein again.
Step S403, decoding the joint chrominance residual block based on the target joint coding mode to obtain a first chrominance residual block and a second chrominance residual block of any image block.
In the embodiment of the application, the symbol relationship can be obtained. The manner of determining the symbol relationship at the encoding end has been introduced in the embodiment related to fig. 2, and is not described herein again. The decoding end can directly or indirectly obtain the symbol relationship determined by the encoding end.
After the target joint coding mode is determined, the joint chroma residual block of any image block may be decoded based on the target joint coding mode and the sign relationship of any image block to obtain a first chroma residual block and a second chroma residual block of the image block. Since the target joint coding mode is any one of a plurality of joint coding modes, different joint coding modes have different methods for decoding the joint chroma residual block of any image block.
The following is a further explanation taking as an example that the target joint coding mode is any one of joint coding modes 1 to 3. In the following formulas, resCb [ x ] [ y ] represents the first chroma residual block of any image block, resJointC [ x ] [ y ] represents the joint chroma residual block of any image block, resCr [ x ] [ y ] represents the second chroma residual block of any image block, and CSign represents the sign relationship. Referring to table 2 below, table 2 shows decoding methods corresponding to the joint coding modes 1 to 3, respectively.
TABLE 2
Figure BDA0003680040800000201
Where "> > 1" in table 2 indicates that the binary data is right shifted by one bit, corresponding to decimal data divided by 2. Therefore, the following can be concluded from table 2.
(1) The target joint coding mode is joint coding mode 1, which can be written as mode ═ 1. Joint coding mode 1 satisfies the formula: resCb [ x ] [ y ] (resJointC [ x ] [ y ], resCr [ x ] [ y ] (CSign × resJointC [ x ] [ y ])/2.
(2) The target joint coding mode is joint coding mode 2, which can be denoted as mode 2. Joint coding mode 2 satisfies the formula: resCb [ x ] [ y ] ═ resJointC [ x ] [ y ], resCr [ x ] [ y ] ═ CSign × resJointC [ x ] [ y ].
(3) The target joint coding mode is joint coding mode 3, which can be denoted as mode-3. Joint coding mode 3 satisfies the formula: resCr [ x ] [ y ] (resJointC [ x ] [ y ], resCb [ x ] [ y ] (CSign × resJointC [ x ] [ y ])/2.
In step S404, a decoding result of any image block is determined based on the first chrominance residual block and the second chrominance residual block of any image block.
In the embodiment of the present application, an arbitrary method may be adopted to obtain the predicted first chroma block of any image block, and the predicted first chroma block of the image block is added to the first chroma residual block of the image block to obtain the original first chroma block of the image block. Optionally, the first chroma value of each pixel in the first chroma block of any image block is added to the first chroma residual of the corresponding pixel in the first chroma residual block of the image block to obtain the original first chroma value of the corresponding pixel in the original first chroma block of the image block.
Similarly, any method may be used to obtain the predicted second chroma block of any image block, and the predicted second chroma block of the image block may be added to the second chroma residual block of the image block to obtain the original second chroma block of the image block. Optionally, the predicted second chrominance value of each pixel point in the predicted second chrominance block of any image block is added to the second chrominance residual of the corresponding pixel point in the second chrominance residual block of the image block, so as to obtain the original second chrominance value of the corresponding pixel point in the original second chrominance block of the image block.
By the method, the original first chrominance value and the original second chrominance value of each pixel point in any image block can be determined, which is equivalent to obtaining the decoding result of any image block, and the reconstruction of any image block is realized. And obtaining decoding results of a plurality of image blocks included in the target image through decoding to obtain the decoding results of the target image, thereby realizing reconstruction of the target image.
Optionally, the encoding result of any image block further includes target identification information; if the target identification information represents that any image block adopts joint coding, the coding result of any image block comprises a joint chroma residual block.
The target identification information may be a fifth symbol or a sixth symbol. If the target identification information is the fifth symbol, it indicates that any image block adopts joint coding, and at this time, the coding result of any image block includes a joint chroma residual block in addition to the fifth symbol. The decoding result of any image block may be determined in the manner of step S402-step S404.
Optionally, the encoding result of any image block further includes target identification information; if the target identification information represents that any image block does not adopt joint coding, the coding result of any image block comprises a first chrominance residual block and a second chrominance residual block of any image block; acquiring the coding result of any image block, and then: and determining a decoding result of any image block based on the first chroma residual block and the second chroma residual block of any image block.
If the target identification information is the sixth symbol, it indicates that any image block does not adopt joint coding, that is, any image block adopts a non-joint coding mode. At this time, the encoding result of any one of the image blocks includes the first chrominance residual block and the second chrominance residual block of any one of the image blocks in addition to the sixth symbol.
Since the encoding result of any image block includes the first chrominance residual block and the second chrominance residual block of the image block, the decoding result of any image block can be determined based on the first chrominance residual block and the second chrominance residual block of any image block in the manner of step S404, which is not described herein again.
Alternatively, the encoding result of any one of the image blocks may include a sixth symbol, first identification information, second identification information, and the first and second chroma residual blocks of any one of the image blocks. Since the first identification information is used to identify whether a non-zero coefficient exists in the first chrominance residual block of the image block, the second identification information is used to identify whether a non-zero coefficient exists in the second chrominance residual block of the image block. Therefore, the first chrominance residual block and the second chrominance residual block of any image block can be accurately located from the encoding result of the image block based on the first identification information and the second identification information, so as to determine the decoding result of any image block based on the first chrominance residual block and the second chrominance residual block of any image block.
It should be noted that information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data for analysis, stored data, presented data, etc.), and signals referred to in this application are authorized by the user or sufficiently authorized by various parties, and the collection, use, and processing of the relevant data is required to comply with relevant laws and regulations and standards in relevant countries and regions. For example, the encoding result and the like of any image block referred to in the present application are obtained under sufficient authorization.
In the above method, the encoding result of any of the image blocks comprises a joint chroma residual block. Because the reference pixel points are pixel points around any image block and the decoding sequence is located before any image block, when the encoding result of any image block is decoded, the chrominance residual error information of the reference pixel point corresponding to any image block can be obtained, and the target joint encoding mode is determined based on the chrominance residual error information of the reference pixel point corresponding to any image block. And then, the joint chroma residual block is decoded based on the target joint coding mode, so that the identification information for identifying the target joint coding mode is saved, the data size of the coding result of the image block is reduced, and the coding performance is improved.
The image encoding method and the image decoding method according to the embodiment of the present application are explained above from the perspective of method steps, and are systematically described below with reference to fig. 5 and 6.
Referring to fig. 5, fig. 5 is a schematic diagram of an image encoding method according to an embodiment of the present application, where the image encoding method shown in fig. 5 is executed by an encoding end. The encoding end firstly acquires a target image and divides the target image into a plurality of image blocks. For any image block, a first chroma residual block and a second chroma residual block of the image block are obtained. And then, based on the chroma residual information of the reference pixel point corresponding to any image block, determining distortion values of a plurality of joint coding modes. And determining the rate distortion cost of the joint coding mode and the rate distortion cost of the non-joint coding mode corresponding to the minimum distortion value.
And comparing the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value with the rate-distortion cost of the non-joint coding mode to judge whether the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is greater than the rate-distortion cost of the non-joint coding mode.
If the minimum distortion value is not greater than the rate distortion cost of the joint coding mode corresponding to the minimum distortion value, that is, the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than the rate distortion cost of the non-joint coding mode, the joint coding mode corresponding to the minimum distortion value is the above-mentioned target joint coding mode. The first chroma residual block and the second chroma residual block of the image block may be jointly encoded based on a joint encoding mode corresponding to the minimum distortion value to obtain a joint chroma residual block. And enabling the target identification information to take a value of 1, and determining 1 and the joint chrominance residual block as the coding result of the image block.
If the minimum distortion value is greater than the minimum distortion value, that is, the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is greater than the rate-distortion cost of the non-joint coding mode, the target identification information takes the value of 0, and 0, the first chrominance residual block of the image block, and the second chrominance residual block of the image block are determined as the coding result of the image block.
Referring to fig. 6, fig. 6 is a schematic diagram of an image decoding method according to an embodiment of the present application, where the image decoding method shown in fig. 6 is executed by a decoding end. The decoding end firstly obtains the coding result of any image block, and the coding result of the image block comprises target identification information.
If the target identification information is 1, the encoding result of the image block further includes a joint chroma residual block. The distortion values of multiple joint coding modes can be determined based on the chrominance residual error information of the reference pixel point corresponding to the image block, and the joint chrominance residual block of the image block is decoded based on the joint coding mode corresponding to the minimum distortion value, so as to obtain the first chrominance residual block and the second chrominance residual block of the image block. And then determining a decoding result of the image block based on the first chrominance residual block of the image block and the second chrominance residual block of the image block.
If the target id information is 0, the encoding result of the image block further includes a first chroma residual block of the image block and a second chroma residual block of the image block. A decoding result for the image block may be determined based on the first chroma residual block for the image block and the second chroma residual block for the image block.
In the method, the reference pixel points are pixel points around any image block and the decoding sequence is positioned before any image block, so that when the coding result of any image block is decoded, the chrominance residual error information of the reference pixel points corresponding to any image block can be obtained, and the target joint coding mode is determined based on the chrominance residual error information of the reference pixel points corresponding to any image block. The method saves identification information for identifying the target joint coding mode, reduces the data amount of the coding result of the image block, and improves the coding performance.
Fig. 7 is a schematic structural diagram of an image encoding device according to an embodiment of the present application, and as shown in fig. 7, the image encoding device includes:
an obtaining module 701, configured to obtain, for any image block of a plurality of image blocks included in a target image, a first chroma residual block and a second chroma residual block of the any image block;
a determining module 702, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to any image block, where the reference pixels are pixels around any image block and a decoding sequence is located before any image block;
an encoding module 703, configured to perform joint encoding on the first chroma residual block and the second chroma residual block of any image block based on a target joint encoding mode to obtain a joint chroma residual block;
a determining module 702 is further configured to determine an encoding result of any image block based on the joint chroma residual block.
In a possible implementation manner, the determining module 702 is configured to determine distortion values of multiple joint coding modes based on chroma residual information of reference pixel points corresponding to any image block, where the distortion values of the joint coding modes are used to characterize image quality after any image block is coded based on the joint coding modes; a target joint encoding mode is determined from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes.
In one possible implementation, the chroma residual information includes an original first chroma residual and an original second chroma residual; a determining module 702, configured to determine, for any one of the joint coding modes, a predicted second chroma residual of a reference pixel corresponding to the any one of the joint coding modes by using an original first chroma residual of the reference pixel; and determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residual error of the reference pixel point and the predicted second chrominance residual error of the reference pixel point corresponding to any one of the joint coding modes.
In one possible implementation, the number of reference pixels is multiple; a determining module 702, configured to calculate, for any one of the reference pixel points, a difference between an original second chrominance residual of the any one of the reference pixel points and a predicted second chrominance residual of the any one of the reference pixel points corresponding to any one of the joint coding modes, so as to obtain a distortion value of the any one of the reference pixel points corresponding to any one of the joint coding modes; and determining the distortion value corresponding to any joint coding mode based on the distortion values of a plurality of reference pixel points corresponding to any joint coding mode.
In a possible implementation manner, the determining module 702 is configured to determine, based on distortion values of multiple joint encoding modes, a joint encoding mode corresponding to a minimum distortion value from the multiple joint encoding modes; determining the rate distortion cost of the joint coding mode corresponding to the minimum distortion value, wherein the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is used for representing the coding quality when coding is carried out on the basis of the joint coding mode corresponding to the minimum distortion value; and determining the joint coding mode corresponding to the minimum distortion value as a target joint coding mode based on that the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than that of the non-joint coding mode.
In a possible implementation manner, the determining module 702 is further configured to determine distortion values of multiple joint coding modes based on chrominance residual information of reference pixel points corresponding to any image block; determining a joint encoding mode corresponding to the minimum distortion value from a plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes; and determining the coding result of any image block based on the first chrominance residual block and the second chrominance residual block of any image block based on the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is larger than the rate distortion cost of the non-joint coding mode.
In a possible implementation manner, the determining module 702 is configured to use the joint chroma residual block and the target identification information as an encoding result of any image block, where the target identification information is used to characterize whether any image block adopts joint encoding.
The device determines a target joint coding mode of any image block based on chrominance residual error information of a reference pixel point corresponding to the image block. Because the reference pixel points are pixel points around any image block and the decoding sequence is located before any image block, when the encoding result of any image block is decoded, the chrominance residual error information of the reference pixel point corresponding to any image block can be obtained, and the target joint encoding mode is determined based on the chrominance residual error information of the reference pixel point corresponding to any image block. The method saves identification information for identifying the target joint coding mode, reduces the data quantity of the coding result of the image block, and improves the coding performance.
It should be understood that, when the apparatus provided in fig. 7 implements its functions, it is only illustrated by the division of the functional modules, and in practical applications, the above functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Fig. 8 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus includes:
an obtaining module 801, configured to obtain, for any image block of a plurality of image blocks included in a target image, an encoding result of the any image block, where the encoding result of the any image block includes a joint chroma residual block;
a determining module 802, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to any image block, where the reference pixels are pixels around any image block and a decoding sequence is located before any image block;
a decoding module 803, configured to perform decoding processing on the joint chrominance residual block based on the target joint coding mode to obtain a first chrominance residual block and a second chrominance residual block of any image block;
the determining module 802 is further configured to determine a decoding result of any image block based on the first chroma residual block and the second chroma residual block of any image block.
In a possible implementation manner, the determining module 802 is configured to determine distortion values of multiple joint coding modes based on chroma residual information of reference pixel points corresponding to any image block, where the distortion values of the joint coding modes are used to characterize image quality after any image block is coded based on the joint coding modes; a target joint encoding mode is determined from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes.
In a possible implementation manner, the encoding result of any image block further includes target identification information; if the target identification information represents that any image block adopts joint coding, the coding result of any image block comprises a joint chroma residual block.
In a possible implementation manner, the encoding result of any image block further includes target identification information; if the target identification information represents that any image block does not adopt joint coding, the coding result of any image block comprises a first chrominance residual block and a second chrominance residual block of any image block; the determining module 802 is further configured to determine a decoding result of any image block based on the first chroma residual block and the second chroma residual block of any image block.
The coding result of any image block of the above apparatus comprises a joint chroma residual block. Because the reference pixel points are pixel points around any image block and the decoding sequence is located before any image block, when the encoding result of any image block is decoded, the chrominance residual error information of the reference pixel point corresponding to any image block can be obtained, and the target joint encoding mode is determined based on the chrominance residual error information of the reference pixel point corresponding to any image block. And then, the joint chroma residual block is decoded based on the target joint coding mode, so that the identification information for identifying the target joint coding mode is saved, the data size of the coding result of the image block is reduced, and the coding performance is improved.
It should be understood that, when the apparatus provided in fig. 8 implements its functions, it is only illustrated by the division of the functional modules, and in practical applications, the above functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Fig. 9 shows a block diagram of a terminal device 900 according to an exemplary embodiment of the present application. The terminal device 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 901 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 902 is used to store at least one computer program for execution by the processor 901 to implement the image encoding method or the image decoding method provided by the method embodiments in the present application.
In some embodiments, the terminal device 900 may further include: a peripheral interface 903 and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by buses or signal lines. Various peripheral devices may be connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 904, display screen 905, camera assembly 906, audio circuitry 907, and power supply 908.
The peripheral interface 903 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 904 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 904 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to capture touch signals on or over the surface of the display screen 905. The touch signal may be input to the processor 901 as a control signal for processing. At this point, the display 905 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 905 may be one, and is disposed on the front panel of the terminal device 900; in other embodiments, the number of the display screens 905 may be at least two, and the display screens are respectively disposed on different surfaces of the terminal device 900 or in a folding design; in other embodiments, the display 905 may be a flexible display, disposed on a curved surface or on a folded surface of the terminal device 900. Even more, the display screen 905 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display panel 905 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 906 is used to capture images or video. Optionally, camera assembly 906 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of a terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 906 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuit 907 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different positions of the terminal apparatus 900. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuit 907 may also include a headphone jack.
Power supply 908 is used to provide power to various components within terminal device 900. The power source 908 may be alternating current, direct current, disposable or rechargeable. When the power source 908 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal device 900 also includes one or more sensors 909. The one or more sensors 909 include, but are not limited to: an acceleration sensor 911, a gyro sensor 912, a pressure sensor 913, an optical sensor 914, and a proximity sensor 915.
The acceleration sensor 911 can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal apparatus 900. For example, the acceleration sensor 911 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 912 can detect the body direction and the rotation angle of the terminal device 900, and the gyro sensor 912 and the acceleration sensor 911 cooperate to acquire the 3D motion of the user on the terminal device 900. The processor 901 can implement the following functions according to the data collected by the gyro sensor 912: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 913 may be disposed on a side bezel of the terminal device 900 and/or underneath the display 905. When the pressure sensor 913 is disposed on the side frame of the terminal device 900, the holding signal of the terminal device 900 from the user can be detected, and the processor 901 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed at a lower layer of the display screen 905, the processor 901 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 905. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The optical sensor 914 is used to collect the ambient light intensity. In one embodiment, the processor 901 may control the display brightness of the display 905 according to the ambient light intensity collected by the optical sensor 914. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is reduced. In another embodiment, the processor 901 may also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 914.
A proximity sensor 915, also called a distance sensor, is generally provided on the front panel of the terminal apparatus 900. The proximity sensor 915 is used to collect a distance between the user and the front surface of the terminal apparatus 900. In one embodiment, when the proximity sensor 915 detects that the distance between the user and the front face of the terminal device 900 gradually decreases, the processor 901 controls the display 905 to switch from the bright screen state to the dark screen state; when the proximity sensor 915 detects that the distance between the user and the front surface of the terminal device 900 becomes gradually larger, the processor 901 controls the display 905 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 9 is not limiting to terminal device 900 and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components may be used.
Fig. 10 is a schematic structural diagram of a server provided in an embodiment of the present application, where the server 1000 may generate a relatively large difference due to a difference in configuration or performance, and may include one or more processors 1001 and one or more memories 1002, where the one or more memories 1002 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 1001 to implement the image encoding method or the image decoding method provided in the foregoing method embodiments, and exemplarily, the processor 1001 is a CPU. Of course, the server 1000 may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the server 1000 may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, there is also provided a computer-readable storage medium having at least one computer program stored therein, the at least one computer program being loaded by a processor and executed to cause an electronic device to implement any one of the image encoding methods or the image decoding methods described above.
Alternatively, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program or a computer program product having at least one computer program stored therein, the at least one computer program being loaded and executed by a processor to cause an electronic device to implement any one of the image encoding methods or the image decoding methods described above.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The above description is only exemplary of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the principles of the present application should be included in the protection scope of the present application.

Claims (16)

1. An image encoding method, characterized in that the method comprises:
for any image block in a plurality of image blocks included in a target image, acquiring a first color residual block and a second color residual block of the any image block;
determining a target joint coding mode based on chrominance residual error information of reference pixel points corresponding to any image block, wherein the reference pixel points are pixel points around any image block and are positioned in front of any image block in decoding sequence;
based on the target joint coding mode, carrying out joint coding on the first chroma residual block and the second chroma residual block of any image block to obtain a joint chroma residual block;
determining an encoding result of the any image block based on the joint chrominance residual block.
2. The method according to claim 1, wherein the determining a target joint coding mode based on the chroma residual information of the reference pixel corresponding to any image block comprises:
determining distortion values of a plurality of joint coding modes based on chrominance residual error information of a reference pixel point corresponding to any image block, wherein the distortion values of the joint coding modes are used for representing the image quality after any image block is coded based on the joint coding modes;
determining a target joint encoding mode from the plurality of joint encoding modes based on the distortion values for the plurality of joint encoding modes.
3. The method of claim 2, wherein the chroma residual information comprises an original first chroma residual and an original second chroma residual; the determining distortion values of a plurality of joint coding modes based on the chrominance residual error information of the reference pixel point corresponding to any image block includes:
for any one joint coding mode, determining a predicted second chroma residual of the reference pixel corresponding to the any one joint coding mode by using the original first chroma residual of the reference pixel;
and determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residual error of the reference pixel point and the predicted second chrominance residual error of the reference pixel point corresponding to any one of the joint coding modes.
4. The method according to claim 3, wherein the number of the reference pixels is plural; determining a distortion value corresponding to any one of the joint coding modes based on the original second chrominance residuals of the reference pixels and the predicted second chrominance residuals of the reference pixels corresponding to any one of the joint coding modes, including:
for any reference pixel point, calculating a difference value between the original second chrominance residual error of the any reference pixel point and the predicted second chrominance residual error of the any reference pixel point corresponding to the any joint coding mode to obtain a distortion value of the any reference pixel point corresponding to the any joint coding mode;
and determining a distortion value corresponding to any one joint encoding mode based on the distortion values of a plurality of reference pixel points corresponding to any one joint encoding mode.
5. The method according to claim 2, wherein the determining a target joint encoding mode from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes comprises:
determining a joint encoding mode corresponding to a minimum distortion value from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes;
determining the rate distortion cost of the joint coding mode corresponding to the minimum distortion value, wherein the rate distortion cost of the joint coding mode corresponding to the minimum distortion value is used for representing the coding quality when coding is carried out on the basis of the joint coding mode corresponding to the minimum distortion value;
and determining the joint coding mode corresponding to the minimum distortion value as the target joint coding mode based on that the rate-distortion cost of the joint coding mode corresponding to the minimum distortion value is not greater than the rate-distortion cost of a non-joint coding mode.
6. The method according to claim 1, wherein after obtaining the first chroma residual block and the second chroma residual block of any one of the image blocks, further comprising:
determining distortion values of a plurality of joint coding modes based on the chrominance residual error information of the reference pixel point corresponding to any image block;
determining a joint encoding mode corresponding to a minimum distortion value from the plurality of joint encoding modes based on the distortion values of the plurality of joint encoding modes;
and determining an encoding result of any image block based on the first chroma residual block and the second chroma residual block of any image block based on that the rate-distortion cost of the joint encoding mode corresponding to the minimum distortion value is greater than the rate-distortion cost of the non-joint encoding mode.
7. The method according to any of claims 1 to 6, wherein said determining the encoding result of said any image block based on said joint chroma residual block comprises:
and taking the joint chroma residual block and target identification information as the coding result of any image block, wherein the target identification information is used for representing whether any image block adopts joint coding.
8. An image decoding method, characterized in that the method comprises:
for any image block in a plurality of image blocks included in a target image, acquiring a coding result of the image block, wherein the coding result of the image block includes a joint chroma residual block;
determining a target joint coding mode based on chrominance residual error information of reference pixel points corresponding to any image block, wherein the reference pixel points are pixel points around any image block and are positioned in front of any image block in decoding sequence;
decoding the joint chrominance residual block based on the target joint coding mode to obtain a first chrominance residual block and a second chrominance residual block of any image block;
and determining a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
9. The method according to claim 8, wherein the determining a target joint coding mode based on the chroma residual information of the reference pixel corresponding to any image block comprises:
determining distortion values of a plurality of joint coding modes based on chrominance residual error information of a reference pixel point corresponding to any image block, wherein the distortion values of the joint coding modes are used for representing the image quality after any image block is coded based on the joint coding modes;
determining a target joint encoding mode from the plurality of joint encoding modes based on the distortion values for the plurality of joint encoding modes.
10. The method according to claim 8, wherein the encoding result of any one of the image blocks further includes target identification information; and if the target identification information represents that any image block adopts joint coding, the coding result of any image block comprises a joint chroma residual block.
11. The method according to claim 8, wherein the encoding result of any one of the image blocks further includes target identification information; if the target identification information represents that any image block does not adopt joint coding, the coding result of any image block comprises a first chrominance residual block and a second chrominance residual block of any image block;
the obtaining of the encoding result of any image block further includes:
and determining a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
12. An image encoding apparatus, characterized in that the apparatus comprises:
the image processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a first chrominance residual block and a second chrominance residual block of any image block in a plurality of image blocks included in a target image;
a determining module, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to the any image block, where the reference pixels are pixels around the any image block and a decoding sequence of the reference pixels is located before the any image block;
the encoding module is used for carrying out joint encoding on the first chroma residual block and the second chroma residual block of any image block based on the target joint encoding mode to obtain a joint chroma residual block;
the determining module is further configured to determine an encoding result of the any image block based on the joint chroma residual block.
13. An image decoding apparatus, characterized in that the apparatus comprises:
the image processing device comprises an acquisition module, a decoding module and a processing module, wherein the acquisition module is used for acquiring the coding result of any image block in a plurality of image blocks included in a target image, and the coding result of any image block comprises a joint chroma residual block;
a determining module, configured to determine a target joint coding mode based on chrominance residual information of reference pixels corresponding to the any image block, where the reference pixels are pixels around the any image block and a decoding sequence of the reference pixels is located before the any image block;
a decoding module, configured to perform decoding processing on the joint chroma residual block based on the target joint coding mode to obtain a first chroma residual block and a second chroma residual block of any one of the image blocks;
the determining module is further configured to determine a decoding result of the any image block based on the first chroma residual block and the second chroma residual block of the any image block.
14. An electronic device, characterized in that it comprises a processor and a memory in which at least one computer program is stored, which is loaded and executed by the processor, so as to cause the electronic device to implement the image encoding method according to any one of claims 1 to 7 or to implement the image decoding method according to any one of claims 8 to 11.
15. A computer-readable storage medium, in which at least one computer program is stored, which is loaded and executed by a processor, to cause an electronic device to implement the image encoding method according to any one of claims 1 to 7 or to implement the image decoding method according to any one of claims 8 to 11.
16. A computer program product, in which at least one computer program is stored, which is loaded and executed by a processor, to cause an electronic device to implement an image encoding method according to any one of claims 1 to 7 or to implement an image decoding method according to any one of claims 8 to 11.
CN202210635198.5A 2022-06-06 2022-06-06 Image encoding method, image decoding method, device, equipment and storage medium Pending CN115118979A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210635198.5A CN115118979A (en) 2022-06-06 2022-06-06 Image encoding method, image decoding method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210635198.5A CN115118979A (en) 2022-06-06 2022-06-06 Image encoding method, image decoding method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115118979A true CN115118979A (en) 2022-09-27

Family

ID=83326426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210635198.5A Pending CN115118979A (en) 2022-06-06 2022-06-06 Image encoding method, image decoding method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115118979A (en)

Similar Documents

Publication Publication Date Title
CN110234008B (en) Encoding method, decoding method and device
CN110708552B (en) Decoding method, encoding method and device
CN111770340B (en) Video encoding method, device, equipment and storage medium
CN110062246B (en) Method and device for processing video frame data
CN110933334B (en) Video noise reduction method, device, terminal and storage medium
CN112532975B (en) Video encoding method, video encoding device, computer equipment and storage medium
WO2019001015A1 (en) Method and device for encoding and decoding image data
CN111107357B (en) Image processing method, device, system and storage medium
CN116074512A (en) Video encoding method, video encoding device, electronic equipment and storage medium
CN113891074B (en) Video encoding method and apparatus, electronic apparatus, and computer-readable storage medium
CN115118979A (en) Image encoding method, image decoding method, device, equipment and storage medium
CN111770339B (en) Video encoding method, device, equipment and storage medium
CN116563771A (en) Image recognition method, device, electronic equipment and readable storage medium
CN109040753B (en) Prediction mode selection method, device and storage medium
CN110062226B (en) Video coding method, video decoding method, device, system and medium
CN114422782B (en) Video encoding method, video encoding device, storage medium and electronic equipment
CN116506616A (en) Video frame coding method, device, electronic equipment and storage medium
CN116980627A (en) Video filtering method and device for decoding, electronic equipment and storage medium
CN116546203A (en) Video frame processing method and device, electronic equipment and readable storage medium
CN115474037A (en) Video quality detection method and device, electronic equipment and readable storage medium
CN117676170A (en) Method, apparatus, device and storage medium for detecting blocking effect
CN116546236A (en) Video frame filtering method and device, electronic equipment and storage medium
CN115811615A (en) Screen video coding method and device, computer equipment and storage medium
CN116703763A (en) Video restoration method, device, equipment and storage medium
CN117768650A (en) Image block chroma prediction method and device, electronic equipment and storage medium

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