CN114286108B - Method, device, electronic device and storage medium for determining intra-frame coding mode - Google Patents
Method, device, electronic device and storage medium for determining intra-frame coding mode Download PDFInfo
- Publication number
- CN114286108B CN114286108B CN202111666394.0A CN202111666394A CN114286108B CN 114286108 B CN114286108 B CN 114286108B CN 202111666394 A CN202111666394 A CN 202111666394A CN 114286108 B CN114286108 B CN 114286108B
- Authority
- CN
- China
- Prior art keywords
- pixel block
- current
- detected
- current pixel
- prediction mode
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 230000009466 transformation Effects 0.000 claims abstract description 70
- 238000012545 processing Methods 0.000 claims abstract description 46
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 15
- 238000013139 quantization Methods 0.000 claims description 38
- 230000001131 transforming effect Effects 0.000 claims description 5
- 238000004590 computer program Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 11
- 239000011159 matrix material Substances 0.000 description 8
- 241000023320 Luma <angiosperm> Species 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- OSWPMRLSEDHDFF-UHFFFAOYSA-N methyl salicylate Chemical compound COC(=O)C1=CC=CC=C1O OSWPMRLSEDHDFF-UHFFFAOYSA-N 0.000 description 5
- 238000005457 optimization Methods 0.000 description 5
- 238000007906 compression Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000006835 compression Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000003190 augmentative effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 239000000969 carrier Substances 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 239000004984 smart glass Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The method comprises the steps of determining a current coding prediction mode in preset at least two coding prediction modes, determining a current pixel block to be detected in a current frame image, obtaining a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, determining a prediction pixel block of the current pixel block to be detected according to the reference reconstruction pixel block, obtaining a prediction residual error of the current pixel block to be detected according to the current pixel block to be detected and the prediction pixel block, carrying out transformation processing on the prediction residual error to obtain a transformation residual error, calculating a distortion value corresponding to the transformation residual error according to the transformation residual error and a preset distortion estimation algorithm, and forming a reconstruction pixel block corresponding to the current pixel block to be detected according to the prediction residual error, the distortion value corresponding to the transformation residual error and the prediction pixel block. The method is used for reducing the calculated amount when reconstructing the pixel block and saving the hardware resources.
Description
Technical Field
The present application relates to the field of video coding technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for determining an intra-frame coding mode.
Background
Currently, network applications are gradually evolving towards multimedia services. Video has become one of the main carriers of information dissemination as an important component of multimedia services. The wide application of video sets new requirements on the quality of video, and the resolution of various videos is increasing. Meanwhile, the growth speed of the video data volume is far more than the development speed of the storage device and the network bandwidth, so the video compression coding technology has received a long-term and wide attention.
In the existing video compression coding technology, the intra-frame coding is to perform predictive coding by using intra-frame information only, the coding process is independent of the information of the previous and subsequent frames, the coding process is independent, the complexity is low, and the method is one of the main coding modes of the new generation encoders such as H264, H265 and the like. In the new generation of encoders such as H264 and H265, the intra-frame encoding includes 3 types of intra-frame encoding modes, which are intra 4*4 luminance prediction, intra 16×16 luminance prediction, and intra 8×8 chrominance prediction, respectively. Each intra-frame coding mode has multiple coding prediction modes, for example, 9 optional coding prediction modes for intra 4*4 luminance prediction, 4 optional coding prediction modes for intra 16×16 luminance prediction, and 4 coding prediction modes for intra 8×8 chrominance prediction. Since the parameters required for each coding prediction mode are different, the coding effect achieved for different video images is also different. In order to select the optimal coding prediction mode for different video images, in the prior art, a set of coding prediction modes with the best Rate distortion performance can be selected for the encoder by a Rate-distortion optimization (Rate-Distortion Optimization, RDO) algorithm among all possible coding prediction modes. Therefore, in order to select a coding prediction mode with the best Rate-Distortion performance from among a plurality of coding prediction modes, it is necessary to traverse all the coding prediction modes and calculate a Rate-Distortion Cost (Rate-Distortion Cost) corresponding to each coding prediction mode at the same time. And the RD-cost needs to calculate the distortion between the reconstructed pixel and the original pixel, and the reconstructed pixel needs to be acquired first in the process of calculating the distortion between the reconstructed pixel and the original pixel. At present, the mode of obtaining the reconstructed pixel is obtained by performing operations such as transformation, quantization, inverse transformation and the like on a prediction residual error between a prediction pixel block and a pixel block to be detected, and has high calculation complexity and lower coding efficiency.
Disclosure of Invention
In view of this, the present application provides a method, apparatus, electronic device and storage medium for determining intra-frame coding modes, so as to solve the problems of high computation complexity of reconstructed pixels and low coding efficiency when calculating rate distortion costs of each coding prediction mode in the prior art.
In a first aspect, an embodiment of the present application provides a method for determining an intra-coding mode, including:
Determining a current coding prediction mode in preset at least two coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode;
Determining a predicted pixel block of the current pixel block to be detected according to the reference reconstructed pixel block, and acquiring a predicted residual error of the current pixel block to be detected according to the current pixel block to be detected and the predicted pixel block;
transforming the prediction residual error of the current pixel block to be detected to obtain a transformed residual error;
Calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm;
And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block.
Preferably, determining the current pixel block to be detected, and obtaining the reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode includes:
In the current frame image, determining a current pixel block to be detected in at least one pixel block to be detected of which the corresponding reconstructed pixel block is not determined according to a preset sequence;
And determining a reference reconstructed pixel block corresponding to the current pixel block to be detected in the current coding prediction mode in the reconstructed pixel blocks according to the current pixel block to be detected and the current coding prediction mode.
Preferably, the forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block includes:
calculating a residual error reconstruction value corresponding to the predicted residual error according to the predicted residual error and a distortion value corresponding to the transformed residual error;
And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual error reconstruction value corresponding to the predicted residual error and the predicted pixel block.
Preferably, the method further comprises:
carrying out quantization processing on the transformation residual error to obtain quantization information of the current pixel block to be detected;
And calculating the corresponding rate distortion cost of the current pixel block to be detected in the current coding prediction mode according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected and the quantization information.
Preferably, the method further comprises:
detecting whether the current pixel block to be detected calculates corresponding rate distortion cost in each of the preset at least two coding prediction modes;
If the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes, determining the coding prediction mode of the current pixel block to be detected when the rate distortion cost corresponding to the current pixel block to be detected is the minimum as the target coding prediction mode of the current pixel block to be detected;
and adopting the target coding prediction mode to code the current pixel block to be detected.
Preferably, the method further comprises:
If the current pixel block to be detected does not calculate the corresponding rate distortion cost in at least one preset coding prediction mode, selecting one preset coding prediction mode from at least one preset coding prediction mode which does not calculate the corresponding rate distortion cost, updating the current coding prediction mode, and re-executing the steps in a current frame image to determine the current pixel block to be detected, and obtaining a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode until detecting whether the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes or not until the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes.
Preferably, the method further comprises:
And when the current frame image is not the uncoded image of the last frame in the acquired multi-frame images, acquiring the next frame image of the current frame image, updating the next frame image into the current frame image, and re-executing the steps to determine a current coding prediction mode in at least two preset coding prediction modes, determining a current pixel block to be detected in the current frame image, acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, and coding the current pixel block to be detected by adopting the target coding prediction mode until the current frame image is the uncoded image of the last frame in the acquired multi-frame images.
In a second aspect, an embodiment of the present application provides an apparatus for determining an intra-coding mode, including:
The processing unit is used for determining a current coding prediction mode in preset at least two coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode;
an obtaining unit, configured to determine a predicted pixel block of the current pixel block to be detected according to the reference reconstructed pixel block, and obtain a prediction residual error of the current pixel block to be detected according to the current pixel block to be detected and the predicted pixel block;
The processing unit is further used for carrying out transformation processing on the prediction residual error of the current pixel block to be detected to obtain a transformation residual error;
the calculating unit is used for calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm;
the processing unit is further configured to form a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual, and the prediction pixel block.
Preferably, the processing unit is specifically configured to determine, in the current frame image, a current pixel block to be detected in at least one pixel block to be detected in which a corresponding reconstructed pixel block is not determined according to a preset sequence;
And determining a reference reconstructed pixel block corresponding to the current pixel block to be detected in the current coding prediction mode in the reconstructed pixel blocks according to the current pixel block to be detected and the current coding prediction mode.
Preferably, the processing unit is specifically configured to calculate a residual reconstruction value corresponding to the prediction residual according to the prediction residual and a distortion value corresponding to the transformation residual;
And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual error reconstruction value corresponding to the predicted residual error and the predicted pixel block.
Preferably, the processing unit is further configured to perform quantization processing on the transformed residual error to obtain quantization information of the current pixel block to be detected;
The processing unit is further configured to calculate a rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected, and quantization information.
Preferably, the apparatus further comprises:
The detection unit is used for detecting whether the current pixel block to be detected calculates corresponding rate distortion cost in each of the preset at least two coding prediction modes;
the determining unit is used for determining the coding prediction mode of the current pixel block to be detected as the target coding prediction mode of the current pixel block to be detected if the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes;
the processing unit is further configured to encode the current pixel block to be detected by using the target encoding prediction mode.
Preferably, the processing unit is further configured to select, if there is the current pixel block to be detected and the corresponding rate-distortion cost is not calculated in at least one preset coding prediction mode, one preset coding prediction mode from among at least one preset coding prediction mode in which the corresponding rate-distortion cost is not calculated, update the current coding prediction mode, and re-execute the current coding prediction mode in the current frame image, determine the current pixel block to be detected, obtain, according to the current coding prediction mode, a reference reconstructed pixel block corresponding to the current pixel block to be detected, and detect, by the trigger detection unit, whether the current pixel block to be detected calculates the corresponding rate-distortion cost in each of the preset at least two coding prediction modes until the current pixel block to be detected calculates the corresponding rate-distortion cost in each of the preset at least two coding prediction modes.
Preferably, the processing unit is further configured to obtain a next frame image of the current frame image when the current frame image is not the last frame uncoded image in the obtained multi-frame images, update the next frame image to the current frame image, and re-execute the next frame image in at least two preset coding prediction modes to determine a current coding prediction mode, determine a current pixel block to be detected in the current frame image, obtain a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, and until the current pixel block to be detected is coded by adopting the target coding prediction mode until the current frame image is the last frame uncoded image in the obtained multi-frame images.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, the memory storing a computer program that, when executed, causes the electronic device to perform the method of any one of the first aspects.
In a fourth aspect, an embodiment of the present application provides a storage medium, including a stored program, where the program, when executed, controls a device in which the storage medium is located to perform the method of any one of the first aspects.
The scheme provided by the embodiment of the application is adopted, a current coding prediction mode is determined in at least two coding prediction modes, a current pixel block to be detected is determined in a current frame image, a reference reconstruction pixel block corresponding to the current pixel block to be detected is obtained according to the current coding prediction mode, a prediction pixel block of the current pixel block to be detected is determined according to the current pixel block to be detected and the reference reconstruction pixel block, a prediction residual of the current pixel block to be detected is obtained according to the current pixel block to be detected and the prediction pixel block, transformation processing is carried out on the prediction residual to obtain a transformation residual, a distortion value corresponding to the transformation residual is calculated according to the transformation residual and a preset distortion estimation algorithm, and a reconstruction pixel block corresponding to the current pixel block to be detected is formed according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block. That is, in the embodiment of the application, when reconstructing the pixel block, only the prediction residual error of the current pixel block to be detected and the prediction pixel block is required to be transformed, and only the transformation residual error is required to be subjected to a distortion estimation algorithm to obtain the distortion corresponding to the transformation residual error, so that the reconstruction pixel block corresponding to the current pixel block to be detected can be obtained according to the distortion corresponding to the transformation residual error, the prediction residual error and the prediction pixel block, and operations such as quantization, inverse transformation and the like are not required, the calculated amount when reconstructing the pixel block is greatly reduced, the hardware resource is saved, and the processing efficiency when reconstructing the pixel block is improved, thus, the RD-cost efficiency for calculating each coding prediction mode can be improved, and the coding efficiency is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of a scene of an intra-frame coding prediction mode according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a scene of another intra-coded prediction mode according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for determining an intra-frame coding mode according to an embodiment of the present application;
Fig. 5 is a schematic diagram of a scene for determining an intra-frame coding mode according to an embodiment of the present application;
FIG. 6 is a flowchart of another method for determining an intra-frame coding mode according to an embodiment of the present application;
FIG. 7 is a schematic diagram of another scenario for determining an intra-frame coding mode according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for determining an intra-frame coding mode according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of another apparatus for determining an intra-frame coding mode according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
Detailed Description
For a better understanding of the technical solution of the present application, the following detailed description of the embodiments of the present application refers to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely an association relationship describing the associated object, and means that three relationships may exist, for example, a and/or b, and may mean that a single first exists while a single first and a single second exist. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Before describing embodiments of the present application in detail, terms applied or likely to be applied to the embodiments of the present application will be explained first.
Image coding, also called image compression, refers to a technique of representing an image or information contained in an image with a small number of bits under the condition that a certain quality (signal-to-noise ratio requirement or subjective evaluation score) is satisfied.
Rate-distortion optimization (Rate-distortion Optimization, RDO), which is generally aimed at obtaining as little image distortion as possible at as small a coding Rate as possible. I.e. how the distortion is minimized given the encoding bit rate, where the rate is how much of the information (bit rate R) and the distortion is the degree of difference of the received short signal from the source signal (distortion D).
In the related art, intra coding is one of the main coding modes of the new generation encoders such as H264 and H265. Taking the H264 encoder as an example, in the H264 encoder, the intra-frame encoding includes 3 types of intra-frame encoding modes, which are intra 4*4 luminance prediction, intra 16×16 luminance prediction, and intra 8×8 chrominance prediction, respectively.
Intra 4*4 luma prediction predicts each 4*4 luma block independently, which is suitable for image coding with a lot of details. As shown in fig. 1, there are 9 optional coding prediction modes for intra 4*4 luma prediction, and the reference pixels required for each coding prediction mode are shown in table 1 below:
TABLE 1
The intra 16 x 16 luminance prediction is suitable for flat area image coding, as shown in fig. 2, the intra 16 x 16 luminance prediction has 4 optional coding prediction modes, namely a mode 0, a mode 1, a vertical coding prediction mode, a mode 2, a direct current coding prediction mode and a mode 3, a plane coding prediction mode.
There are also 4 optional coding prediction modes for intra 8 x 8 chroma prediction, namely mode 0: dc coding prediction mode, mode 1: horizontal coding prediction mode, mode 2: vertical coding prediction mode and mode 3: plane coding prediction mode.
Since the parameters required for each coding prediction mode are different, the coding effect achieved for different video images is also different. In order to select the optimal coding prediction mode for different video images, in the prior art, a group of coding prediction modes with the best rate distortion performance can be selected for the encoder in all possible coding prediction modes through a rate distortion optimization algorithm. Therefore, in order to select a coding prediction mode having the best rate-distortion performance from among a plurality of coding prediction modes, it is necessary to traverse all the coding prediction modes and calculate the rate-distortion cost corresponding to each coding prediction mode at the same time. And the RD-cost needs to calculate the distortion between the reconstructed pixel and the original pixel, and the reconstructed pixel needs to be acquired first in the process of calculating the distortion between the reconstructed pixel and the original pixel. At present, the mode of obtaining the reconstructed pixel is obtained by performing operations such as transformation, quantization, inverse transformation and the like on a prediction residual between a reference pixel block pixel and a pixel block to be detected, and has high calculation complexity and lower prediction coding efficiency.
In view of the above problems, an embodiment of the present application provides a method for determining an intra-frame coding mode, wherein in at least two coding prediction modes, a current coding prediction mode is determined, a current pixel block to be detected is determined in a current frame image, a reference reconstructed pixel block corresponding to the current pixel block to be detected is obtained according to the current coding prediction mode, a predicted pixel block of the current pixel block to be detected is determined according to the current pixel block to be detected and the reference reconstructed pixel block, a prediction residual of the current pixel block to be detected is obtained according to the current pixel block to be detected and the predicted pixel block, transformation processing is performed on the prediction residual to obtain a transformed residual, a distortion value corresponding to the transformed residual is calculated according to the transformed residual and a preset distortion estimation algorithm, and a reconstructed pixel block corresponding to the current pixel block to be detected is formed according to the predicted residual, the distortion value corresponding to the transformed residual and the predicted pixel block. That is, in the embodiment of the application, when reconstructing the pixel block, only the prediction residual error of the current pixel block to be detected and the prediction pixel block is required to be transformed, and only the transformation residual error is required to be subjected to a distortion estimation algorithm to obtain the distortion corresponding to the transformation residual error, so that the reconstruction pixel block corresponding to the current pixel block to be detected can be obtained according to the distortion corresponding to the transformation residual error, the prediction residual error and the prediction pixel block, and operations such as quantization, inverse transformation and the like are not required, the calculated amount when reconstructing the pixel block is greatly reduced, the hardware resource is saved, and the processing efficiency when reconstructing the pixel block is improved, thus, the RD-cost efficiency for calculating each coding prediction mode can be improved, the target coding prediction module of each pixel block to be detected can be more rapidly determined, and the coding efficiency is improved. The following is a detailed description.
Referring to fig. 3, a schematic diagram of an electronic device is provided in an embodiment of the present application. In fig. 3, the electronic device is exemplified by a mobile phone 300, and fig. 3 shows a front view and a rear view of the mobile phone 300, where two front cameras 311, 112 are disposed on the front side of the mobile phone 300, and four rear cameras 321, 322, 323, 324 are disposed on the rear side of the mobile phone 300. Through the plurality of cameras that dispose, can provide multiple shooting modes for the user. The user can select a corresponding shooting mode to shoot according to the shooting scene so as to improve the user experience.
It should be understood that the illustration in fig. 3 is only an exemplary illustration and should not be taken as a limitation on the scope of the application. For example, the number and location of the cameras may be different for different handsets. In addition, the electronic device according to the embodiment of the present application may be a tablet computer, a personal computer (personal computer, PC), a personal digital assistant (personal DIGITAL ASSISTANT, PDA), a smart watch, a netbook, a wearable electronic device, an augmented reality (augmented reality, AR) device, a Virtual Reality (VR) device, a vehicle-mounted device, a smart car, a smart sound, a robot, a smart glasses, a smart television, or the like, in addition to a mobile phone.
It should be noted that, in some possible implementations, the electronic device may also be referred to as a terminal device, a User Equipment (UE), or the like, which is not limited by the embodiment of the present application.
Referring to fig. 4, a flowchart of a method for determining an intra-frame coding mode is provided in an embodiment of the present application. The method is applied to the electronic equipment shown in fig. 3, and comprises the following steps:
Step S401, determining a current coding prediction mode in preset at least two coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode.
In the embodiment of the application, when the electronic equipment needs to encode one frame of image, the frame of image can be encoded by adopting intra-frame encoding. Because the intra-frame coding comprises a plurality of coding prediction modes, the coding effect of each coding prediction mode is different for different images, and in order to select the optimal coding prediction mode, the coding prediction mode of the intra-frame coding needs to be determined for each frame of image. In determining the optimal coding prediction mode, calculating the rate-distortion cost may be used to determine the optimal coding prediction mode by the value of the rate-distortion cost. And when calculating the rate distortion cost, the distortion between the reconstructed pixel block and the original pixel block needs to be calculated, namely the sum of square errors between the reconstructed pixel block and the original pixel block is calculated. Therefore, before calculating the rate-distortion cost, the reconstruction of the pixel block needs to be performed. For convenience of implementation, each frame of image is generally divided into a plurality of pixel blocks which are not overlapped and have the same size, a determination of a reconstructed pixel block is performed for each pixel block, and further, a determination of an optimal coding prediction mode can be determined according to the reconstructed pixel block, namely, the determined target coding prediction mode is used, and the determined target coding prediction mode is adopted to perform corresponding coding on the pixel block. Intra coding includes 3 classes of intra coding modes, namely intra 4*4 luma prediction, intra 16 x 16 luma prediction and intra 8 x 8 chroma prediction. That is, when a luminance macroblock in the encoding mode is used for each frame of image, there are two division methods, that is, 4*4 and 16×16. That is, each frame image is divided into a plurality of 4*4-sized pixel blocks or a plurality of 16×16-sized pixel blocks according to the luminance of each frame image. When using chroma macro blocks in coding mode, there is a partition of 8 x 8 size. That is, each frame image is divided into a plurality of 8×8 pixel blocks according to the chromaticity of each frame image.
Since the electronic device may acquire multiple frames of images when performing image encoding, a determination of an encoding prediction mode in an intra-frame encoding mode needs to be performed for each frame of image. Since the determination manner of each frame image is the same, in the embodiment of the present application, the current frame image may be taken as an example for explanation. In the current frame image, the current frame image may be divided into a plurality of pixel blocks of a prescribed size according to a preset division manner. In the embodiment of the present application, a preset division manner may be taken as an example to describe a size 4*4 of a luminance macroblock. That is, the current frame image is divided into a plurality of 4*4-sized pixel blocks. Pixel reconstruction is required for each 4*4-sized pixel block. At this time, the electronic device may divide the current frame image into a plurality of pixel blocks of 4*4, and determine the pixel block to be detected for performing pixel reconstruction currently, that is, the current pixel block to be detected. Because each type of intra-frame coding mode comprises a plurality of coding prediction modes, in the embodiment of the application, a target coding prediction mode needs to be determined in the plurality of coding prediction modes aiming at the current pixel block to be detected, so that the corresponding rate distortion cost of the current pixel block to be detected in each coding prediction mode needs to be calculated. At this time, the electronic device may determine, from among the preset at least two coding prediction modes, one coding prediction mode as the current coding prediction mode. Because each coding prediction mode needs to use the related data of the adjacent reconstructed pixel blocks to acquire the reconstructed pixel block corresponding to the current pixel block to be detected, and the adjacent reconstructed pixel blocks to be used in each coding prediction mode are not identical, when the current pixel block to be detected and the current coding prediction mode are determined, the reference reconstructed pixel block corresponding to the current pixel block to be detected needs to be determined in the reconstructed pixel blocks.
As a possible implementation manner, determining the current pixel block to be detected in the current frame image, and obtaining the reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode includes:
And determining the current pixel block to be detected in at least one pixel block to be detected of which the corresponding reconstructed pixel block is not determined according to a preset sequence in the current frame image. And determining a reference reconstructed pixel block corresponding to the current pixel block to be detected under the current coding prediction mode in the reconstructed pixel blocks according to the current pixel block to be detected and the current coding prediction mode.
In the embodiment of the application, in the current frame image, after the current frame image is divided into a plurality of pixel blocks with 4*4 sizes, the current pixel block to be detected can be determined in at least one pixel block to be detected of the corresponding reconstructed pixel block according to a preset sequence by taking the pixel block with 4*4 sizes as a unit. The preset sequence is preset, and may include a sequence from the left side to the right side of the image and from the upper side to the lower side of the image.
After determining the current pixel block to be detected, as a plurality of coding prediction modes exist, as the rate distortion cost corresponding to the current pixel block to be detected needs to be calculated for each coding prediction mode, one coding prediction mode is determined as the current coding prediction mode in a plurality of coding prediction modes in which the rate distortion cost corresponding to the current pixel block to be detected is not calculated, so that the rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode is calculated. Because the reference reconstructed pixel blocks required by each coding prediction mode are different, after the current coding prediction mode is determined, the reference reconstructed pixel block corresponding to the current pixel block to be detected in the current coding prediction mode can be determined in the reconstructed pixel blocks according to the current coding prediction mode and the current pixel block to be detected.
It should be noted that, when the current pixel block to be detected does not have a corresponding reference reconstructed pixel block, that is, when the current pixel block to be detected is the pixel block to be detected in the first row or the first column of the current frame image, the reference reconstructed pixel block is not calculated, and at this time, the preset reference pixel block stored in the storage medium may be used as the reference reconstructed pixel block corresponding to the current pixel block to be detected.
Step S402, according to the current pixel block to be detected and the reference reconstructed pixel block, determining a predicted pixel block of the current pixel block to be detected, and according to the current pixel block to be detected and the predicted pixel block, obtaining a predicted residual error of the current pixel block to be detected.
In the embodiment of the application, after the current pixel block to be detected and the parameter reconstruction pixel block are determined, the prediction pixel block of the current pixel to be detected can be calculated, namely, the value of each pixel point in the prediction pixel block can be determined according to the current coding prediction mode and the reference reconstruction pixel block, and then the prediction pixel block of the current pixel to be detected is determined. For example, the value of the pixel point in the reference reconstructed pixel block is determined as the value of the pixel point at the corresponding position in the predicted pixel block. After determining the predicted pixel block of the current pixel block to be measured, the predicted residual error of the current pixel block to be measured can be calculated according to the current pixel block to be measured and the pixel block to be measured. And calculating pixel difference values between each pixel point in the current pixel block to be detected and the pixel point at the corresponding position in the predicted pixel block to obtain the predicted residual error of the current pixel block to be detected.
Step S403, transforming the prediction residual of the current pixel block to be detected to obtain a transformed residual.
In the embodiment of the application, as the image contains more flat area content or area with slow content change, the scattered distribution of the image energy in the space domain can be converted into relatively concentrated distribution in the frequency domain through transformation, thereby achieving the effects of reducing the transmission code stream and compressing the image. Based on the above, the electronic device may perform transformation processing on the prediction residual of the current pixel block to be detected after calculating the prediction residual of the current pixel block to be detected, so as to obtain a transformation residual.
As a possible implementation, the electronic device may calculate the prediction residual as a transformed residual by the formula f=d fYDf T. Wherein D f is a transformation matrix of a preset frequency domain, specified by the H.264/AVC standard, F represents the frequency domain, F is a transformation residual, and Y is a prediction residual. D f and D f T are transposed matrices with respect to each other, e.g.,
That is, the product of D f, the prediction residual, and D f T is calculated to obtain the transformed residual.
And step S404, calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm.
In the image encoding and compression process, the distortion mainly comes from the quantization process, and q low-bit bits are discarded due to the rounding operation performed by right-shifting q-bits in the quantization process. Wherein q is an integer greater than 0, and the value of q is determined according to the number of bits shifted to the right when rounding is required in the actual calculation process.
In the embodiment of the application, after the electronic device calculates the transformation residual, the distortion corresponding to the transformation residual can be calculated by using a preset distortion estimation algorithm, and is determined as the distortion value corresponding to the transformation residual.
As a possible implementation, the electronic device may calculate the distortion value through the formula D l=((|low-qbits-offset|/2q_bits)*Qstep)2. D l represents a distortion value, low -qbits represents a data amount lost by a right shift number of bits in the quantization process, offset represents an offset, q_bits represents a number of right shift numbers in the quantization process, and Q step represents a quantization step size.
And step S405, forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block.
In the embodiment of the application, after the electronic equipment calculates the distortion value corresponding to the change parameter, the electronic equipment can form the reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction parameter, the distortion value corresponding to the transformation residual and the predicted pixel block.
As a possible implementation manner, forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual, and the prediction pixel block includes:
And calculating a residual error reconstruction value corresponding to the predicted residual error according to the distortion value corresponding to the predicted residual error and the transformed residual error. And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual error reconstruction value corresponding to the predicted residual error and the predicted pixel block.
In the embodiment of the application, when the electronic equipment reconstructs the pixels, the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block can be utilized to form the reconstructed pixel block corresponding to the current pixel block to be detected. Since the prediction residual is distorted in the encoding process, in order to improve the accuracy of the reconstructed pixel block, the prediction residual needs to be compensated before the reconstructed pixel block corresponding to the current pixel block to be detected is formed, and at this time, after the distortion value corresponding to the transformation residual is calculated, the residual reconstruction value corresponding to the prediction residual can be calculated according to the prediction residual and the distortion value corresponding to the transformation residual. As a possible implementation, the difference between the distortion value corresponding to the prediction residual and the transform residual may be used as the residual reconstruction value corresponding to the prediction residual. For example, a difference between a value of each prediction residual in the matrix of prediction residuals and a distortion value of a corresponding position in the matrix of distortion values corresponding to the transformed residual may be used as a residual reconstruction value of the corresponding position in the matrix of residual reconstruction values.
After the residual error reconstruction value corresponding to the prediction residual error is calculated, a reconstruction pixel block corresponding to the current pixel block to be detected can be formed according to the residual error reconstruction value corresponding to the prediction residual error and the prediction pixel block. As a possible implementation manner, the sum value between the residual reconstruction value corresponding to the prediction residual and the prediction pixel block may be used as the reconstruction pixel block corresponding to the current pixel block to be measured. That is, the sum value between each residual reconstruction value in the residual reconstruction matrix and the value of the pixel point at the corresponding position in the predicted pixel block may be used as the value of the pixel point at the corresponding position in the reconstructed pixel block corresponding to the current pixel block to be detected, as shown in fig. 5.
By the method, the reconstructed pixel block corresponding to the current pixel block to be detected can be calculated, and when the reconstructed pixel block corresponding to the current pixel block to be detected is calculated, only the prediction residual is required to be subjected to transformation processing, and the processing procedures of inverse quantization and inverse transformation are not required, so that the calculation complexity is greatly reduced, the rate of the reconstructed pixel block is improved, the rate of RDC (remote data storage) by adopting the calculated reconstructed pixel block is improved, and the determination efficiency of the coding prediction mode is further improved.
Referring to fig. 6, a flowchart of another method for determining an intra coding mode according to an embodiment of the present application is shown. The method is applied to the electronic equipment shown in fig. 3. The method in the embodiment of the present application increases the process of calculating the corresponding rate distortion cost relative to the method described in fig. 4, and specifically includes the following steps:
Step S601, determining a current coding prediction mode in preset at least two coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode.
The details of step S401 are not described herein.
Step S602, according to the reference reconstructed pixel block, determining a predicted pixel block of the current pixel block to be detected, and according to the current pixel block to be detected and the predicted pixel block, obtaining a predicted residual of the current pixel block to be detected.
The details of step S402 are not described herein.
And step S603, performing transformation processing on the prediction residual of the current pixel block to be detected to obtain a transformation residual.
The details of step S403 are not described herein.
Step S604, calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm.
The details of step S404 are not described herein.
And step S605, forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block.
The details of step S405 are not described herein.
And step S606, carrying out quantization processing on the transformed residual error to obtain quantization information of the current pixel block to be detected.
In the embodiment of the application, after the electronic setting is performed to calculate the variation residual, in order to perform subsequent RDC calculation, quantization processing is required to be performed on the variation residual, so as to obtain quantization information of the current pixel block to be measured. For example, a quantization matrix may be set in advance, and after the transform residual is calculated, the value of each change residual in the matrix of transform residuals may be divided by the corresponding quantization value in the quantization matrix, and the quotient may be rounded to obtain the quantized value. The quantization information of the current pixel block to be detected can be calculated through the mode.
Step S607, calculating a rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected, the quantization information, and the coding code rate.
In the embodiment of the application, after obtaining the quantized information of the current pixel block to be detected, the electronic equipment needs to encode the quantized information, the information such as the coding prediction mode and the like, and when encoding the quantized information, the information such as the coding prediction mode and the like, the code rate of the quantized information and the code rate of the information such as the coding prediction mode and the like can be obtained.
After the electronic equipment obtains the code rate of the quantized information during coding and the code rate of the information such as the coding prediction mode, the corresponding rate distortion cost of the current pixel block to be detected under the current coding prediction mode can be calculated according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected, the quantized information and each coding code rate.
As a possible implementation manner, the electronic device may calculate, according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected, the quantization information, and the coding rate, a distortion value between the current pixel block to be detected and the reconstructed pixel block corresponding to the current pixel block to be detected by using a sum of square error and a formula, and calculate, according to the distortion value between the current pixel block to be detected and the reconstructed pixel block corresponding to the current pixel block to be detected, the quantization information, and the coding rate, a rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode. Wherein the sum of square error formula is as follows:Wherein ori i represents a pixel value corresponding to an ith pixel in the current pixel block to be detected, rec i represents a pixel reconstruction value corresponding to the ith pixel in the reconstructed pixel block, and N represents the number of pixel points in the current pixel block to be detected. D represents the distortion value between the current pixel block to be measured and the reconstructed pixel block corresponding to the current pixel block to be measured.
As a possible implementation manner, the electronic device calculates the rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode according to the distortion, the quantization information and each coding rate between the current pixel block to be detected and the reconstructed pixel block corresponding to the current pixel block to be detected by using a formula rdcost=d+λr. The RDcost represents the corresponding rate distortion cost of the current pixel block to be detected in the current coding prediction mode, lambda represents the Lagrangian factor, and R represents the coding rate of quantization information, the coding rate of information such as the coding prediction mode and the like.
Step S608, detecting whether the current pixel block to be detected calculates a corresponding rate distortion cost in each of the preset at least two coding prediction modes.
In the embodiment of the application, since the coding prediction modes in the intra-frame coding include a plurality of coding prediction modes, the optimal coding prediction mode needs to be selected from the plurality of coding prediction modes to code the current pixel block to be detected, and therefore, the rate distortion cost corresponding to the current pixel block to be detected in each coding prediction mode needs to be calculated, and the optimal coding prediction mode of the current pixel block to be detected is determined according to the rate distortion cost corresponding to the current pixel block to be detected in each coding prediction mode. Based on the above, the electronic device calculates the rate distortion cost of the current pixel block to be detected in the currently used coding prediction mode, and then needs to detect whether the rate distortion cost of the current pixel block to be detected is calculated in other coding prediction modes. That is, whether the current pixel block to be detected has a corresponding rate distortion cost calculated in each preset coding prediction mode in each intra-frame coding mode is detected. If the corresponding rate distortion cost of the current pixel block to be detected is not calculated in at least one coding prediction mode in the preset at least two coding prediction modes, determining one coding prediction mode in the at least one coding prediction mode in which the corresponding rate distortion cost is not calculated, and determining the reconstructed pixel block corresponding to the current pixel block to be detected in the coding prediction mode, so that the rate distortion cost in the coding prediction mode is calculated.
If the current pixel block to be detected calculates the corresponding rate distortion cost in each of at least two coding prediction modes, the fact that the corresponding rate distortion cost of the current pixel block to be detected in all coding prediction modes is obtained is indicated, at this time, according to the corresponding rate distortion cost in each coding prediction mode, an optimal coding prediction mode is determined, and the optimal coding prediction mode is determined to be the target coding prediction mode of the current pixel block.
The electronic device performs the following steps differently depending on the result of the determination. When the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes, steps S609a-S611 are executed. When there is a corresponding rate distortion cost not calculated in at least one preset encoding prediction mode for the current pixel block to be detected, step S609b is executed.
S609a, if the current pixel block to be detected calculates the corresponding rate distortion cost under each of the preset at least two coding prediction modes, determining the coding prediction mode of the current pixel block to be detected when the rate distortion cost corresponding to the current pixel block to be detected is the minimum as the target coding prediction mode of the current pixel block to be detected.
In the embodiment of the application, when the electronic equipment detects that the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes, the electronic equipment can compare each rate distortion cost to determine the minimum value of the rate distortion cost, and then can determine the coding prediction mode of the current pixel block to be detected, where the minimum value of the rate distortion cost is located. In the coding prediction mode, the coding distortion of the current pixel block to be detected is minimum and the coding rate is highest, namely the coding effect performance of the coding prediction mode where the corresponding rate distortion cost is minimum is optimal for the current pixel block to be detected, and at the moment, the coding prediction mode where the corresponding rate distortion cost is minimum for the current pixel block to be detected can be determined as the target coding prediction mode.
Step S609b, if there is a current pixel block to be detected that does not calculate the corresponding rate distortion cost in at least one preset coding prediction mode, then selecting one preset coding prediction mode from the at least one preset coding prediction mode that does not calculate the corresponding rate distortion cost, updating the current coding prediction mode, and re-executing the step to determine the current pixel block to be detected in the current frame image, and obtaining a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode until the step detects whether the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes until the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes.
In the embodiment of the application, if the electronic equipment determines that the corresponding rate-distortion cost is not calculated in at least one preset coding prediction mode for the current pixel block to be detected, the electronic equipment indicates that the corresponding rate-distortion cost is not calculated in all preset coding prediction modes for the current pixel block to be detected. At this time, the current pixel block to be detected needs to calculate the rate distortion cost under the preset coding prediction mode without calculating the corresponding rate distortion cost. Based on this, the electronic device may select one preset coding prediction mode from at least one preset coding prediction mode for which the corresponding rate-distortion cost is not calculated, update the preset coding prediction mode to the current coding prediction mode, and execute the above steps S601 to S609 again by using the current coding prediction mode, that is, execute the formation of the reconstructed pixel block of the current pixel block to be detected and the acquisition of the quantization information again, and calculate the corresponding rate-distortion cost of the current pixel block to be detected in the current coding prediction mode by using the reconstructed pixel block, the current pixel block to be detected and the quantization information. And re-detecting whether the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes. And if the corresponding rate distortion cost is not calculated in at least one preset coding prediction mode of the current pixel block to be detected, selecting one preset coding prediction mode from at least one preset coding prediction mode in which the corresponding rate distortion cost is not calculated, updating the preset coding prediction mode into the current coding prediction mode, and re-executing the steps S601-S609 until the corresponding rate distortion cost is calculated in each of at least two preset coding prediction modes of the current pixel block to be detected.
S610, coding the current pixel block to be detected by adopting a target coding prediction mode.
In the embodiment of the application, after determining the target coding prediction mode of the current module to be detected, the electronic device can adopt the target coding prediction mode to carry out coding processing on the pixel block to be detected.
Referring to fig. 7, a comparison graph of a rate distortion curve is provided in an embodiment of the present application. In fig. 7, a contrast diagram between a rate-distortion curve obtained by the method of the present application and a rate-distortion curve obtained by quantizing, transforming, dequantizing and inverse transforming a prediction residual in the prior art is shown, where a reconstructed pixel block is obtained, and the reconstructed pixel block is used to calculate a corresponding rate-distortion cost. As can be seen from fig. 7, the rate-distortion curve obtained by the method of the present application is substantially identical to the rate-distortion curve obtained by the conventional method of the prior art. Due to the mode in the application, the inverse transformation and inverse quantization processes are not needed, and the implementation mode is simpler and the complexity is lower.
Step S611, when the current frame image is not the last frame uncoded image in the obtained multi-frame images, the next frame image of the current frame image is obtained, the next frame image is updated to the current frame image, the step is re-executed to determine the current coding prediction mode in the preset at least two coding prediction modes, the current pixel block to be detected is determined in the current frame image, the reference reconstruction pixel block corresponding to the current pixel block to be detected is obtained according to the current coding prediction mode, and the current pixel block to be detected is coded by adopting the target coding prediction mode until the current frame image is the last frame uncoded image in the obtained multi-frame images.
In the embodiment of the present application, when a plurality of frame images are acquired, each frame image needs to be intra-coded. Therefore, after determining the target coding prediction mode for each pixel block in the current frame image through the steps and adopting the target coding prediction mode for coding, the next frame image of the current frame image in the acquired multi-frame image can be subjected to intra-frame coding. At this time, the electronic device may detect whether the current frame image is the last frame image of the acquired multi-frame image, for example, detect whether an uncoded image exists after the current frame image, and if so, acquire the next frame image. At this time, the electronic device may update the acquired next frame image to the current frame image, and re-execute the process of determining the target coding prediction mode of each pixel block in the current frame image on the updated current frame image, and when determining the target coding prediction mode of each pixel block, perform corresponding coding processing on each pixel block by using the target coding prediction mode. That is, the electronic device may re-perform the above steps S601-S610 after updating the next frame image to the current frame image until the current frame image is an uncoded image of the last frame.
Referring to fig. 8, a schematic structural diagram of an apparatus for determining an intra-frame coding mode according to an embodiment of the present application is provided. As shown in fig. 8, the apparatus for determining an intra coding mode includes:
The processing unit 801 is configured to determine a current coding prediction mode in at least two preset coding prediction modes, determine a current pixel block to be detected in a current frame image, and obtain a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode.
As a possible implementation manner, the processing unit 801 is specifically configured to determine, in the current frame image, a current pixel block to be detected in at least one pixel block to be detected in which a corresponding reconstructed pixel block is not determined according to a preset sequence, and determine, in the reconstructed pixel blocks, a reference reconstructed pixel block corresponding to the current pixel block to be detected in the current coding prediction mode according to the current pixel block to be detected and the current coding prediction mode.
The obtaining unit 802 is configured to determine a predicted pixel block of the current pixel block to be measured according to the reference reconstructed pixel block, and obtain a prediction residual of the current pixel block to be measured according to the current pixel block to be measured and the predicted pixel block.
The processing unit 801 is further configured to perform transform processing on the prediction residual of the current pixel block to be detected, to obtain a transformed residual.
The calculating unit 803 is further configured to calculate a distortion value corresponding to the transformed residual according to the transformed residual and a preset distortion estimation algorithm.
The processing unit 801 is further configured to form a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual, and the prediction pixel block.
As a possible implementation manner, the processing unit 801 is specifically configured to calculate a residual reconstruction value corresponding to the prediction residual according to the distortion value corresponding to the prediction residual and the transformation residual, and form a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual reconstruction value corresponding to the prediction residual and the predicted pixel block.
As a possible implementation manner, the processing unit 801 is further configured to perform quantization processing on the transformed residual, so as to obtain quantization information of the current pixel block to be measured.
The processing unit 801 is further configured to calculate, according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected, and quantization information, a rate distortion cost corresponding to the current pixel block to be detected in the current coding prediction mode.
Referring to fig. 9, another apparatus for determining an intra coding mode according to an embodiment of the present application is shown. As shown in fig. 9, the apparatus further includes:
The detecting unit 804 is configured to detect whether the current pixel block to be detected calculates a corresponding rate-distortion cost in each of the preset at least two coding prediction modes.
The determining unit 805 is configured to determine, if the current pixel block to be detected calculates a corresponding rate-distortion cost in each of the preset at least two coding prediction modes, the coding prediction mode in which the rate-distortion cost corresponding to the current pixel block to be detected is the minimum as the target coding prediction mode of the current pixel block to be detected.
The processing unit 801 is further configured to encode the current pixel block to be detected using a target encoding prediction mode.
The processing unit 801 is further configured to, if there is a current pixel block to be detected that does not calculate a corresponding rate-distortion cost in at least one preset coding prediction mode, select one preset coding prediction mode from the at least one preset coding prediction modes that does not calculate a corresponding rate-distortion cost, update the current coding prediction mode to a current coding prediction mode, and re-execute the updating in the current frame image, determine the current pixel block to be detected, obtain a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, and detect whether the current pixel block to be detected calculates a corresponding rate-distortion cost in each of the preset at least two coding prediction modes by the trigger detection unit 804 until the current pixel block to be detected calculates a corresponding rate-distortion cost in each of the preset at least two coding prediction modes.
The processing unit 801 is further configured to, when the current frame image is not the last frame uncoded image in the acquired multi-frame images, acquire a next frame image of the current frame image, update the next frame image to the current frame image, and re-execute the updating in the preset at least two coding prediction modes, determine a current coding prediction mode, determine a current pixel block to be detected in the current frame image, acquire a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, and until the current pixel block to be detected is coded by using the target coding prediction mode, until the current frame image is the last frame uncoded image in the acquired multi-frame images.
Corresponding to the embodiment, the application also provides electronic equipment. Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 1000 may include a processor 1001, a memory 1002, and a communication unit 1003. The components may communicate via one or more buses, and it will be appreciated by those skilled in the art that the configuration of the server as shown in the drawings is not limiting of the embodiments of the application, and that it may be a bus-like structure, a star-like structure, or include more or fewer components than shown, or may be a combination of certain components or a different arrangement of components.
Wherein the communication unit 1003 is configured to establish a communication channel, so that the storage device may communicate with other devices. Receiving user data sent by other devices or sending user data to other devices.
The processor 1001, which is a control center of the storage device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and/or processes data by running or executing software programs and/or modules stored in the memory 1002, and calling data stored in the memory. The processor may be comprised of integrated circuits (INTEGRATED CIRCUIT, ICs), such as a single packaged IC, or may be comprised of packaged ICs that connect multiple identical or different functions. For example, the processor 1001 may include only a central processing unit (central processing unit, CPU). In the embodiment of the invention, the CPU can be a single operation core or can comprise multiple operation cores.
The memory 1002, for storing instructions for execution by the processor 1001, the memory 1002 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
The execution of the instructions in memory 1002, when executed by processor 1001, enables electronic device 1000 to perform some or all of the steps of the embodiment shown in fig. 6.
In a specific implementation, the present invention further provides a computer storage medium, where the computer storage medium may store a program, where the program may include some or all of the steps in each embodiment of the method for determining an intra-coding mode provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.
Claims (9)
1. A method of determining intra-coding modes, comprising:
determining a reconstructed pixel block for each pixel block;
determining a target coding prediction mode according to the reconstructed pixel block;
Determining a reconstructed pixel block according to each pixel block, wherein the method comprises the steps of determining a current coding prediction mode in at least two preset coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode;
Determining a predicted pixel block of the current pixel block to be detected according to the reference reconstructed pixel block, and acquiring a predicted residual error of the current pixel block to be detected according to the current pixel block to be detected and the predicted pixel block;
transforming the prediction residual error of the current pixel block to be detected to obtain a transformed residual error;
Calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm;
forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the predicted residual, a distortion value corresponding to the transformed residual and the predicted pixel block;
wherein the forming the reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, the distortion value corresponding to the transformation residual and the prediction pixel block includes:
calculating a residual error reconstruction value corresponding to the predicted residual error according to the predicted residual error and a distortion value corresponding to the transformed residual error;
And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual error reconstruction value corresponding to the predicted residual error and the predicted pixel block.
2. The method according to claim 1, wherein determining a current pixel block to be detected in the current frame image, and obtaining a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode includes:
In the current frame image, determining a current pixel block to be detected in at least one pixel block to be detected of which the corresponding reconstructed pixel block is not determined according to a preset sequence;
And determining a reference reconstructed pixel block corresponding to the current pixel block to be detected in the current coding prediction mode in the reconstructed pixel blocks according to the current pixel block to be detected and the current coding prediction mode.
3. The method as recited in claim 2, further comprising:
carrying out quantization processing on the transformation residual error to obtain quantization information of the current pixel block to be detected;
And calculating the corresponding rate distortion cost of the current pixel block to be detected in the current coding prediction mode according to the current pixel block to be detected, the reconstructed pixel block corresponding to the current pixel block to be detected and the quantization information.
4. A method according to claim 3, further comprising:
detecting whether the current pixel block to be detected calculates corresponding rate distortion cost in each of the preset at least two coding prediction modes;
If the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes, determining the coding prediction mode of the current pixel block to be detected when the rate distortion cost corresponding to the current pixel block to be detected is the minimum as the target coding prediction mode of the current pixel block to be detected;
and adopting the target coding prediction mode to code the current pixel block to be detected.
5. The method as recited in claim 4, further comprising:
If the current pixel block to be detected does not calculate the corresponding rate distortion cost in at least one preset coding prediction mode, selecting one preset coding prediction mode from at least one preset coding prediction mode which does not calculate the corresponding rate distortion cost, updating the current coding prediction mode, and re-executing the steps in a current frame image to determine the current pixel block to be detected, and obtaining a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode until detecting whether the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes or not until the current pixel block to be detected calculates the corresponding rate distortion cost in each of the preset at least two coding prediction modes.
6. The method as recited in claim 1, further comprising:
And when the current frame image is not the uncoded image of the last frame in the acquired multi-frame images, acquiring the next frame image of the current frame image, updating the next frame image into the current frame image, and re-executing the steps to determine a current coding prediction mode in at least two preset coding prediction modes, determining a current pixel block to be detected in the current frame image, acquiring a reference reconstruction pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode, and coding the current pixel block to be detected by adopting the target coding prediction mode until the current frame image is the uncoded image of the last frame in the acquired multi-frame images.
7. An apparatus for determining intra-coding modes, comprising:
A processing unit for determining a reconstructed pixel block for each pixel block;
determining a target coding prediction mode according to the reconstructed pixel block;
Determining a reconstructed pixel block according to each pixel block, wherein the method comprises the steps of determining a current coding prediction mode in at least two preset coding prediction modes, determining a current pixel block to be detected in a current frame image, and acquiring a reference reconstructed pixel block corresponding to the current pixel block to be detected according to the current coding prediction mode;
an obtaining unit, configured to determine a predicted pixel block of the current pixel block to be detected according to the reference reconstructed pixel block, and obtain a prediction residual error of the current pixel block to be detected according to the current pixel block to be detected and the predicted pixel block;
The processing unit is further used for carrying out transformation processing on the prediction residual error of the current pixel block to be detected to obtain a transformation residual error;
the calculating unit is used for calculating a distortion value corresponding to the transformation residual according to the transformation residual and a preset distortion estimation algorithm;
The processing unit is further configured to form a reconstructed pixel block corresponding to the current pixel block to be detected according to the prediction residual, a distortion value corresponding to the transformation residual, and the prediction pixel block;
the processing unit is specifically configured to calculate a residual reconstruction value corresponding to the prediction residual according to the prediction residual and a distortion value corresponding to the transformation residual;
And forming a reconstructed pixel block corresponding to the current pixel block to be detected according to the residual error reconstruction value corresponding to the predicted residual error and the predicted pixel block.
8. An electronic device comprising a processor and a memory, the memory storing a computer program that, when executed, causes the electronic device to perform the method of any of claims 1-6.
9. A storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the method of any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111666394.0A CN114286108B (en) | 2021-12-31 | 2021-12-31 | Method, device, electronic device and storage medium for determining intra-frame coding mode |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111666394.0A CN114286108B (en) | 2021-12-31 | 2021-12-31 | Method, device, electronic device and storage medium for determining intra-frame coding mode |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114286108A CN114286108A (en) | 2022-04-05 |
CN114286108B true CN114286108B (en) | 2025-03-18 |
Family
ID=80879277
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111666394.0A Active CN114286108B (en) | 2021-12-31 | 2021-12-31 | Method, device, electronic device and storage medium for determining intra-frame coding mode |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114286108B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111971959A (en) * | 2018-02-09 | 2020-11-20 | 弗劳恩霍夫应用研究促进协会 | Partition-based intra coding concept |
CN113347417A (en) * | 2021-07-20 | 2021-09-03 | 杭州博雅鸿图视频技术有限公司 | Method, device, equipment and storage medium for improving rate distortion optimization calculation efficiency |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1509045A3 (en) * | 2003-07-16 | 2006-08-09 | Samsung Electronics Co., Ltd. | Lossless image encoding/decoding method and apparatus using intercolor plane prediction |
JP2014127832A (en) * | 2012-12-26 | 2014-07-07 | Canon Inc | Image encoding apparatus, image encoding method, and computer program |
JP5711789B2 (en) * | 2013-07-25 | 2015-05-07 | 日本電信電話株式会社 | Image coding method, image coding apparatus, and image coding program |
KR102357283B1 (en) * | 2016-10-14 | 2022-01-28 | 세종대학교산학협력단 | Method and apparatus for encoding/decoding an image |
-
2021
- 2021-12-31 CN CN202111666394.0A patent/CN114286108B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111971959A (en) * | 2018-02-09 | 2020-11-20 | 弗劳恩霍夫应用研究促进协会 | Partition-based intra coding concept |
CN113347417A (en) * | 2021-07-20 | 2021-09-03 | 杭州博雅鸿图视频技术有限公司 | Method, device, equipment and storage medium for improving rate distortion optimization calculation efficiency |
Also Published As
Publication number | Publication date |
---|---|
CN114286108A (en) | 2022-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US12063354B2 (en) | Video decoding method and apparatus, video coding method and apparatus, device, and storage medium | |
US11563974B2 (en) | Method and apparatus for video decoding | |
US11558639B2 (en) | Selective resolution video encoding method, computer device, and readable storage medium | |
US20200374514A1 (en) | Video encoding and decoding method and device, computer device, and storage medium | |
KR100772576B1 (en) | Method for encoding and decoding video information, motion compensated video encoder and corresponding decoder | |
US10567786B2 (en) | Motion vector processing | |
US9414086B2 (en) | Partial frame utilization in video codecs | |
EP1971153A1 (en) | Method for encoding and decoding video information, a motion compensated video encoder and a corresponding decoder | |
US8903188B2 (en) | Method and device for processing components of an image for encoding or decoding | |
US20090257492A1 (en) | Video data management | |
CN115668915A (en) | Image encoding method, image decoding method and related devices | |
US20240430487A1 (en) | Picture prediction method, encoder, decoder, and storage medium | |
CN118018746A (en) | Chroma block prediction method and device | |
WO2018052552A1 (en) | Dual filter type for motion compensated prediction in video coding | |
EP3893510B1 (en) | Video image encoding and decoding method and apparatus | |
CN114071161B (en) | Image encoding method, image decoding method and related devices | |
CN108713318A (en) | A kind of processing method and equipment of video frame | |
CN113766246A (en) | Image encoding method, image decoding method and related device | |
CN115769573A (en) | Encoding method, decoding method and related device | |
US20160261869A1 (en) | Content-adaptive b-picture pattern video encoding | |
CN114286108B (en) | Method, device, electronic device and storage medium for determining intra-frame coding mode | |
WO2012041245A1 (en) | Improved Multiple Predictor Set For Intra Coding with Intra Mode Prediction | |
US20130170565A1 (en) | Motion Estimation Complexity Reduction | |
US12184837B2 (en) | Modifying a set of angle prediction modes for coding an equirectangular projection format image | |
RU2787885C2 (en) | Method and equipment for mutual prediction, bit stream and non-volatile storage carrier |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |