CN109495739B - Image encoding method and apparatus thereof - Google Patents

Image encoding method and apparatus thereof Download PDF

Info

Publication number
CN109495739B
CN109495739B CN201811261695.3A CN201811261695A CN109495739B CN 109495739 B CN109495739 B CN 109495739B CN 201811261695 A CN201811261695 A CN 201811261695A CN 109495739 B CN109495739 B CN 109495739B
Authority
CN
China
Prior art keywords
prediction mode
image block
current image
pixel
mode candidate
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
Application number
CN201811261695.3A
Other languages
Chinese (zh)
Other versions
CN109495739A (en
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.)
Hangzhou Lianhai Network Technology Co ltd
Original Assignee
Hangzhou Lianhai Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Lianhai Network Technology Co ltd filed Critical Hangzhou Lianhai Network Technology Co ltd
Priority to CN201811261695.3A priority Critical patent/CN109495739B/en
Publication of CN109495739A publication Critical patent/CN109495739A/en
Application granted granted Critical
Publication of CN109495739B publication Critical patent/CN109495739B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • 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/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/56Motion estimation with initialisation of the vector search, e.g. estimating a good candidate to initiate a search

Abstract

The invention relates to an image coding method and equipment thereof, which comprises the steps of selecting an estimation prediction mode of a current image block by selecting a prediction mode library; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates; predicting the image data in the current image block according to an estimated prediction mode to obtain residual data of the image data in the current image block; and coding the residual data and the corresponding estimated prediction mode index identification to form a code stream. A plurality of prediction mode candidates are predefined in a selected prediction mode library, and an estimated prediction mode is selected to encode a current image block. The encoding method does not need to poll each prediction mode, reduces a large amount of calculation, and further improves the encoding compression rate of the video image.

Description

Image encoding method and apparatus thereof
Technical Field
The present invention relates to the field of compression technologies, and in particular, to an image encoding method and apparatus.
Background
With the development of video image technology, various video image coding standards have been developed to reduce the bit rate required for video image transmission or the capacity required for storage. Video pictures can be compression coded because of the redundancy in the picture data. The redundancy of image data is mainly represented by: spatial redundancy due to correlation between adjacent pixels in the image; temporal redundancy caused by correlation between different frames in the image sequence; spectral redundancy due to the correlation of different color planes or spectral bands. The purpose of compression coding is to reduce the number of bits required to represent image data by removing these data redundancies. According to a video image compression method, such as Moving Picture Experts Group (MPEG) -1, MPEG-2, MPEG-4, or H.264/MPEG-4 Advanced Video Coding (AVC), a picture is divided into a plurality of image blocks to encode the picture. Each of the plurality of image blocks is encoded in any of an inter prediction and an intra prediction encoding mode.
The compression coding technology of video images mainly comprises four parts, including: the device comprises a prediction module, a quantization module, a code control module and an entropy coding module. The prediction module is used as an important module for predicting the current pixel value according to the information of the adjacent pixels by utilizing the spatial redundancy existing between the adjacent pixels.
With the continuous increase of video image data, how to select an optimal prediction mode for a current image block so as to improve the efficiency of compression coding becomes an urgent problem to be solved.
Disclosure of Invention
Therefore, to solve the technical defects and shortcomings of the prior art, the present invention provides an image encoding method and apparatus.
Specifically, an embodiment of the present invention provides an image encoding method, including:
selecting an estimation prediction mode of a current image block by selecting a prediction mode library; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates;
predicting the image data in the current image block according to an estimated prediction mode to obtain residual data of the image data in the current image block;
and coding the residual data and the corresponding estimated prediction mode index identification to form a code stream.
In one embodiment of the present invention, the selected prediction mode library includes a first prediction mode candidate, a second prediction mode candidate, and a third prediction mode candidate; wherein the content of the first and second substances,
the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block;
the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block;
and the third prediction mode candidate is a prediction mode candidate which selects the optimal division based on different division forms of the current image block.
In one embodiment of the present invention, the selecting of the estimation prediction mode includes:
detecting image characteristic information of the current image block;
and predicting a prediction mode candidate for the current image block in a selected prediction mode library by using the image characteristic information as an estimated prediction mode of the current image block.
In an embodiment of the present invention, predicting image data in a current image block according to an estimated prediction mode to obtain residual data of the image data in the current image block includes:
if the estimated prediction mode is the first prediction mode candidate, predicting the current image block through the first prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the second prediction mode candidate, predicting the current image block through the second prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring residual data of image data in the current image block.
An image encoding device proposed in another embodiment of the present invention includes:
the selector is used for selecting the estimation prediction mode of the current image block by selecting the prediction mode library; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates;
the predictor is used for predicting the image data in the current image block according to the estimation prediction mode to obtain residual data of the image data in the current image block;
and the encoder is used for encoding the residual data and the corresponding estimated prediction mode index identification to form a code stream.
In one embodiment of the present invention, the selected prediction mode library in the selector includes a first prediction mode candidate, a second prediction mode candidate, and a third prediction mode candidate; wherein the content of the first and second substances,
the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block;
the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block;
and the third prediction mode candidate is a prediction mode candidate which selects the optimal division based on different division forms of the current image block.
In one embodiment of the present invention, the selecting of the estimated prediction mode in the selector includes:
detecting image characteristic information of the current image block;
and predicting a prediction mode candidate for the current image block in a selected prediction mode library by using the image characteristic information as an estimated prediction mode of the current image block.
In one embodiment of the invention, the predictor is specifically configured to:
if the estimated prediction mode is the first prediction mode candidate, predicting the current image block through the first prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the second prediction mode candidate, predicting the current image block through the second prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring residual data of image data in the current image block.
Based on this, the invention has the following advantages:
a plurality of prediction mode candidates are predefined in a selected prediction mode library, and an estimated prediction mode is selected to encode a current image block. The encoding method does not need to poll each prediction mode, reduces a large amount of calculation, and further improves the encoding compression rate of the video image.
Other aspects and features of the present invention will become apparent from the following detailed description, which proceeds with reference to the accompanying drawings. It is to be understood, however, that the drawings are designed solely for purposes of illustration and not as a definition of the limits of the invention, for which reference should be made to the appended claims. It should be further understood that the drawings are not necessarily drawn to scale and that, unless otherwise indicated, they are merely intended to conceptually illustrate the structures and procedures described herein.
Drawings
The following detailed description of embodiments of the invention will be made with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of an image encoding method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating positions of a current pixel component and surrounding pixel components according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating gradient value calculation according to an embodiment of the present invention;
fig. 4(a) and fig. 4(b) are a schematic diagram of a pixel index and a schematic diagram of a reconstructed pixel search number of a horizontal stripe prediction search window according to an embodiment of the present invention;
fig. 5(a) and fig. 5(b) are a schematic diagram of a pixel index and a schematic diagram of a reconstructed pixel search number of a vertical stripe prediction search window according to an embodiment of the present invention;
fig. 6(a) and fig. 6(b) are schematic diagrams of pixel index and reconstructed pixel search number of a rectangular prediction search window according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a method for predicting position sub-weights in a search window according to an embodiment of the present invention;
FIGS. 8a to 8c are schematic diagrams illustrating different division manners according to an embodiment of the present invention;
fig. 9 is a schematic diagram of image coding according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart of an image encoding method according to an embodiment of the present invention; this embodiment describes an image encoding method provided by the present invention in detail, and the method includes the following steps:
step 1, selecting an estimation prediction mode of a current image block by selecting a prediction mode library;
video is a continuous sequence of image frames. For example, to improve the prediction accuracy of image data, an image is generally divided into a plurality of image blocks, and image coding is performed on the image block basis.
Before an image block is encoded, a selective prediction mode library is created, wherein the selective prediction mode library is a database formed by a plurality of predetermined prediction mode candidates, and each prediction mode candidate is a prediction method for a current image block. The number of the prediction mode candidates is multiple, three prediction mode candidates are selected in one embodiment, and the first prediction mode candidate is suitable for prediction of an image with general texture complexity; a second prediction mode candidate, adapted to predict an image of complex texture complexity; and a third prediction mode candidate, adapted to predict an image of simple texture complexity; the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block; the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block; the third prediction mode candidate is a prediction mode candidate which selects the optimal division based on different division forms of the current image block.
The texture complexity of the current image block is judged by detecting the image characteristic information of the current image block, which specifically comprises the following steps: and calculating the difference value of every two adjacent pixel components in the current image block, and acquiring the gradient value of each current image block according to the difference value of every two adjacent pixel components. The specific calculation formula is as follows:
Figure BDA0001844009950000041
wherein, Grad represents the gradient value of each current image block, i represents the position index of the pixel component in the current image block, P represents the value of the pixel component in the current image block, and ABS represents absolute value operation. When the value of i is 0, the value represents the pixel component with the position index of 0, i.e. the first pixel component of the first row, and at this time, P is seti-1Is taken as P0I.e. byPi-Pi-1=P0-P0Further, the processing method of the first pixel component of the first row is the same.
Determining the maximum pixel difference value of two pixel components in the current image block according to the bit width of each pixel component in the current image block; for example, if the bit width of each pixel component is 9, the pixel value range of each pixel component is 0 to 511, the maximum pixel difference value of two pixel components in the current image block is 511, and the pixel difference value range of two pixel components in the current image block is 0 to 511. Setting gradient grading according to the maximum pixel difference value of two pixel components in the current image block, wherein the gradient grading can be divided into a plurality of grade intervals; preferably, the first threshold and the second threshold are set, and the first threshold and the second threshold can be manually set according to requirements. Classifying the pixel difference value range interval smaller than a first threshold value into a first-level interval; classifying the pixel difference value range interval which is larger than the first threshold and smaller than the second threshold into a second level interval; and classifying the pixel difference value range interval which is larger than the second threshold value and smaller than the maximum pixel difference value into a third level interval. Judging the level interval of the gradient value of the current image block; and determining the image characteristic information of the current image block according to the level interval of the gradient value of the current image block. Specifically, if the gradient value of the current image block is in the first-level interval, the image feature information of the current image block is simple complexity texture information; if the gradient value of the current image block is in the second-level interval, the image feature information of the current image block is general complexity texture information; and if the gradient value of the current image block is in the third level interval, the image characteristic information of the current image block is complex complexity texture information.
And predicting a prediction mode candidate as an estimated prediction mode for the current image block in the selected prediction mode library by utilizing the image characteristic information. Specifically, if the image feature information of the current image block is the simple complexity texture information, selecting a third prediction mode candidate as an estimated prediction mode; if the image characteristic information of the current image block is general complexity texture information, selecting a first prediction mode candidate as an estimation prediction mode; and if the image characteristic information of the current image block is the complexity texture information, selecting a second prediction mode candidate as an estimation prediction mode.
Step 2, predicting the image data in the current image block according to an estimation prediction mode to obtain residual data of the image data in the current image block;
if the estimated prediction mode is a first prediction mode candidate, predicting the current image block through the first prediction mode candidate, and acquiring image data in the current image block, namely residual data of each pixel component;
if the estimated prediction mode is a second prediction mode candidate, predicting the current image block through the second prediction mode candidate, and acquiring image data in the current image block, namely residual data of each pixel component;
and if the estimated prediction mode is a third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring image data in the current image block, namely residual data of each pixel component.
And 3, coding the residual data of each pixel component in the current image block acquired in the step 2 and the estimated prediction mode index identifier corresponding to the current image block to form a code stream. And outputting the code stream to an image decoding end.
In the present embodiment, a plurality of prediction mode candidates are defined in advance in a selected prediction mode library, and an estimated prediction mode is selected to encode a current image block. The encoding method does not need to poll each prediction mode, reduces a large amount of calculation, and further improves the encoding compression rate of the video image.
Example two
The present embodiment describes in detail a process of predicting a current image block by the first prediction mode candidate, which is proposed by the present invention, on the basis of the above-described embodiments. The method comprises the following steps:
step 21, for the current image block, defining that the current pixel has K (K >1) pixel components, which are respectively pixel component 1 and pixel component 2 … … pixel component K;
step 22, for each pixel component of the current pixel, determining N texture direction gradient values G1-GN of each pixel component through the surrounding pixel components of the pixel component;
preferably, the surrounding pixel components of the current pixel component may be adjacent to the current pixel component, or may not be adjacent; as shown in fig. 2, fig. 2 is a schematic diagram illustrating positions of a current pixel component and surrounding pixel components according to an embodiment of the present invention; the CUR represents the current pixel component, i.e. the surrounding pixel component may be GHIK or ABCDEFJ.
Step 23, weighting the N texture direction gradient values G1-GN (G1-GN represents both the magnitude and the direction of the texture direction gradient value) of each pixel component to obtain a first weighted gradient value BG weighted by the N texture direction gradient values, wherein the weighting formula is as follows:
BGi=w1*G1+w2*G2+…+wN*GN(i=1…K)
wherein w1 and w2 … wN are weighting coefficients; BG1 is the first weighted gradient value for pixel component 1, BG2 is the first weighted gradient value for pixel component 2, and so on, BGK is the first weighted gradient value for pixel component K.
Preferably, the weighting coefficients w1, w2 … wN are set to obtain the optimal value BGbst of the first weighted gradient value of each pixel component according to the positional relationship of each pixel component and the corresponding pixel for calculating the texture direction gradient value.
Preferably, the closer the pixel for which the current texture direction gradient value is calculated is to the current pixel component, the larger the weighting coefficient value, the total of the weighting coefficient values is 1, specifically w1+ w2+ … + wN is 1.
Step 24, weighting the optimal value BGbst of the first weighted gradient values of the K pixel components to obtain a second weighted gradient value BG ″ weighted by the optimal value of the first weighted gradient value, where the weighting formula is as follows:
BG"i=t1*BGbst1+t2*BGbst2+…+tK*BGbstK(i=1…K)
wherein t1 and t2 … tK are weighting coefficients; BGbst1 is the optimal value of the first weighted gradient value of the pixel component 1, BGbst2 is the optimal value of the first weighted gradient value of the pixel component 2, and so on, BGbstK is the optimal value of the first weighted gradient value of the pixel component K, BG "1 is the second weighted gradient value of the pixel component 1, BG"2 is the second weighted gradient value of the pixel component 2, and so on, BG "K is the second weighted gradient value of the pixel component K, and the optimal value BG" bst of the second weighted gradient value BG "is determined.
Preferably, the weighting coefficients t1, t2 … tK are set to obtain the optimal value BGbst of the second weighted gradient value for each pixel component according to the relationship of each pixel component and the optimal value BGbst corresponding to the first weighted gradient value.
Preferably, the weighting coefficient value BGbst, which is the optimal value of the first weighting gradient value at the current pixel component, is the largest, the weighting coefficient value BGbst, which is the optimal value of the first weighting gradient value at other pixel components having increasing distances from the current pixel component, is gradually decreased, and the sum of the weighting coefficient values is 1, specifically, t1+ t2+ … + tk is 1.
The direction of the optimal value BG "bst of the second weighted gradient value is the reference direction Dir of the current pixel component.
Step 25, weighting the pixel values of all available pixel components in the reference direction of each pixel component to obtain a reference value Ref of each pixel component, where the weighting formula is as follows:
Refi=r1*cpt1+r2*cpt2+…+rN*cptN(i=1…K)
wherein r1 and r2 … rN are weighting coefficients, which may be the same or different; cpt 1-cptN are the pixel values of the N available pixel components in the reference direction of each pixel component; ref1 is the reference value for pixel component 1, Ref2 is the reference value for pixel component 2, and so on, and RefK is the reference value for pixel component K.
26, subtracting the reference value from the current pixel component pixel value to obtain a prediction residual Dif of the current pixel component pixel; the formula is as follows:
Difi=Curcpti-Refi(i=1…K)
wherein, cutcpt 1 is the pixel value of pixel component 1, cutcpt 2 is the pixel value of pixel component 2, and so on, and cutcptk is the pixel value of pixel component K; dif1 is the prediction residual for pixel component 1, Dif2 is the prediction residual for pixel component 2, and so on, DifK is the prediction residual for pixel component K.
And 27, repeating S22-S26 for the rest pixel components of the current pixel to obtain the prediction residuals of all the pixel components of the pixel, so as to obtain the prediction residuals of each pixel component in the current image block.
Preferably, the multi-pixel components can be processed in parallel or in series, as required by a specific application specification scenario.
In one embodiment, the present pixel is divided into Y, U, V pixel components as an example, and the specific steps are as follows:
step 31, defining that the current pixel has three pixel components, namely a pixel component Y, a pixel component U and a pixel component V;
step 32, for three pixel components of the current pixel, determining 3 texture direction gradient values G1, G2, G3 of each pixel component through the surrounding pixel components of each pixel component;
preferably, as for the pixel component Y, the pixel component U, and the pixel component V, respectively according to fig. 3, fig. 3 is a schematic diagram of gradient value calculation according to an embodiment of the present invention; ABS (K-H) is a 45-degree gradient value, ABS (K-G) is a 90-degree gradient value, ABS (K-F) is a 135-degree gradient value, and ABS (K-J) is a 180-degree gradient value. Wherein ABS is an absolute value operation.
And step 33, weighting the 3 texture direction gradient values G1, G2 and G3 in the step 32, such as 45-degree gradient values, 90-degree gradient values and 135-degree gradient values, for each pixel component Y, U and V to obtain a first weighted gradient value BG of each pixel component, and solving an optimal value of the first weighted gradient value BG of each pixel component.
Preferably, for example, for the Y pixel component, the distances between the pixel H at 45 degree gradient value, the pixel G at 90 degree gradient value and the pixel F at 135 degree gradient value and the Y pixel component gradually increase, so w1 is 0.5, w2 is 0.3, w3 is 0.2, BGbstY is 0.5 × G1+0.3 × G2+0.2 × G3. BGbstU and BGbstV can be obtained by the same method.
And step 34, weighting the optimal gradient value of the first weighted gradient values of the 3 pixel components to obtain a second weighted gradient value BG 'weighted by the optimal value of the first weighted gradient value, and selecting the optimal value BG' bst of the second weighted gradient value. The weighting is calculated as follows:
BG"bstY=0.5*BGbstY+0.3*BGbstU+0.2*BGbstV
BG"bstU=0.3*BGbstY+0.4*BGbstU+0.3*BGbstV
BG"bstV=0.2*BGbstY+0.3*BGbstU+0.5*BGbstV
wherein BG ' bstY is the optimum value of the second weighting gradient value of the pixel component Y, BG ' bstU is the optimum value of the second weighting gradient value of the pixel component U, BG ' bstV is the optimum value of the second weighting gradient value of the pixel component V, BGbstY is the optimum value of the first weighting gradient value of the pixel component Y, BGbstU is the optimum value of the first weighting gradient value of the pixel component U, BGbstV is the optimum value of the first weighting gradient value of the pixel component V.
The coefficient selection rule in the above formula is that the optimal value BGbst of the first weighting gradient value under the current pixel component has the largest weighting coefficient value, the optimal value BGbst of the first weighting gradient value under other pixel components whose distances from the current pixel component gradually increase gradually decreases gradually, and the sum of the weighting coefficient values is 1.
The BG "bst direction is the reference direction Dir of the current pixel component, i.e. DirY is the reference direction of the pixel component Y, DirU is the reference direction of the pixel component U, and DirV is the reference direction of the pixel component V.
Step 35, weighting the pixel values of 2 pixel components in the reference direction of the 3 pixel components to obtain the reference value Ref of the 3 pixel components, where the weighting formula is as follows:
RefY=r1*cpt1+r2*cpt2
RefU=r1*cpt1+r2*cpt2
RefV=r1*cpt1+r2*cpt2
wherein, RefY is a reference value of the Y pixel component, RefU is a reference value of the U pixel component, RefV is a reference value of the V pixel component, and cpt1, cpt2 are pixel component pixel values of each reference direction.
Preferably, for any pixel component, if it is 45 degrees reference, the reference value REF is 0.8 × I + 0.2E; if 90 degrees reference, the reference value is 0.8 × H + 0.2C; if 135 degrees reference, the reference value is 0.8G + 0.2A; if the reference value is 180 degrees, the reference value is 0.8 × K +0.2J, and the closer the pixel value of the pixel component is to the current pixel, the larger the configuration coefficient is.
Step 36, subtracting the reference value from the pixel value of the current pixel component to obtain the prediction residual difference Dif of the pixel component of the current pixel, which is calculated as follows:
DifY=CurcptY-RefY
DifU=CurcptU-RefU
DifV=CurcptV-RefV
wherein, cutpty is a pixel value of the pixel component Y, cutptu is a pixel value of the pixel component U, and cutptv is a pixel value of the pixel component V; DifY is the prediction residual of the pixel component Y, DifU is the prediction residual of the pixel component U, and DifV is the prediction residual of the pixel component V.
1. According to the embodiment, the prediction direction of the current pixel component can be more reasonably determined through the multi-directional gradient weighting of each pixel component and the direction weighting of the multi-pixel component at the same position, and a better prediction direction deviation rectifying effect can be achieved for the image with simple texture complexity. In addition, the method can balance the texture prediction directions between the pixel components at the same position and between the adjacent multi-pixel components of the same pixel component, reduce the possibility of misjudgment of single pixel component prediction, and finally further reduce the theoretical limit entropy of prediction.
2. The embodiment performs parallel processing on multiple pixel components, and is more beneficial to realizing the parallel processing of the prediction method. Compared with the long time and low efficiency of serial pixel component processing, the parallel processing can improve the processing speed by times, and is beneficial to the hardware realization of the prediction algorithm.
EXAMPLE III
The present embodiment describes in detail a process of predicting a current image block by the second prediction mode candidate according to the present invention on the basis of the above-described embodiments. The method comprises the following steps:
101. a plurality of predicted search windows is determined.
Referring to fig. 4 to 6, fig. 4 to 6 are schematic diagrams of pixel indexes and numbers of reconstructed pixels of three prediction search windows provided by an embodiment of the present invention. Fig. 4(a) and fig. 4(b) are a schematic diagram of a pixel index and a schematic diagram of a reconstructed pixel search number of a horizontal stripe prediction search window according to an embodiment of the present invention; fig. 5(a) and fig. 5(b) are a schematic diagram of a pixel index and a schematic diagram of a reconstructed pixel search number of a vertical stripe prediction search window according to an embodiment of the present invention; fig. 6(a) and fig. 6(b) are a schematic diagram of pixel index and a schematic diagram of reconstructed pixel search number of a rectangular prediction search window according to an embodiment of the present invention.
With CijRepresenting the current pixel, PijRepresenting the encoded reconstructed pixels. Where ij is the position index of the current pixel or the reconstructed pixel. A plurality of sliding windows are set as the prediction search windows, and the shapes of the prediction search windows can be horizontal strips, vertical strips, L-shaped, cross-shaped, T-shaped, rectangular and the like.
With reference to fig. 4 to 6, in the embodiment of the present invention, a plurality of prediction search windows with the same size and different shapes are set, for example, a first prediction search window, a second prediction search window, and a third prediction search window, respectively. The first prediction search window is a horizontal bar prediction search window, the window is in the shape of a horizontal bar, the second prediction search window is a vertical bar prediction search window, the window is in the shape of a vertical bar, the third prediction search window is a rectangular prediction search window, and the window is in the shape of a rectangle. The three prediction search windows are the same in size and each contain K pixels. Preferably, the plurality of prediction search windows each contain 8 pixels. E.g. the current pixel C within a first prediction search window, i.e. a horizontal stripe prediction search windowijAt the rightmost position, the other positions in the first prediction search window are encoded K-1 reconstructed pixels Pi-1,j、Pi-2,j、Pi-3,j、Pi-4,j、Pi-5,j、Pi-6,j、Pi-7,j(ii) a Within the second prediction search window, the vertical slice prediction search window, the current pixel CijAt the lowest position, and the other positions in the second prediction search window are the encoded K-1 reconstructed pixels Pi,j-1、Pi,j-2、Pi,j-3、Pi,j-4、Pi,j-5、Pi,j-6、Pi,j-7(ii) a Within a third, rectangular prediction search window, the current pixel CijAt the lower right corner, and the other positions in the third prediction search window are encoded K-1 reconstructed pixels Pi-1,j、Pi-2,j、Pi-3,j、Pi,j-1、Pi-1,j-1、Pi-2,j-1、Pi-3,j-1. For the current pixel CijWhen prediction is carried out, the current pixel C is predicted according to reconstruction values NewData (P) of K-1 reconstruction pixels in the first prediction search window, the second prediction search window and the third prediction search window respectivelyijReconstructed value of (C) NewDataij) Three reconstructed values NewData1 (C) are obtainedij)、NewData2(Cij)、NewData3(Cij) Wherein NewData1 (C)ij) For the current pixel C calculated in the first prediction search windowijFirst reconstructed value of (a), NewData2 (C)ij) For the current pixel C calculated in the second prediction search windowijSecond reconstructed value of (1), NewData3 (C)ij) For the current pixel C calculated in the third prediction search windowijAnd (3) a third reconstructed value.
In the embodiment of the invention, in each prediction search window, the current pixel C is predicted according to the reconstruction values of K-1 reconstruction pixelsijWhen the reconstruction value is obtained, sequentially numbering K-1 reconstruction pixels in the prediction search window into 0, 1, 2, K0、P1、P2、...Pk...、PK-2A sequential search is performed. For example, the first prediction search window of the embodiment of the present invention includes 7 reconstructed pixels arranged along the horizontal direction, the 7 reconstructed pixels are numbered from left to right, the number is from 0 to 6, and the 6 reconstructed pixels P are numbered0、P1、P2、P3、P4、P5、P6From the reconstructed pixel P numbered 00The search is started until the reconstructed pixel P with number 6 is searched6Looking for the current pixel CijThe first prediction residual is calculated. The second prediction search window comprises 7 reconstructed pixels along the vertical directionThe direction is arranged, 7 reconstruction pixels are numbered from top to bottom, the number is from 0 to 6, and the 6 reconstruction pixels P are numbered0、P1、P2、P3、P4、P5、P6From the reconstructed pixel P numbered 00The search is started until the reconstructed pixel P with number 6 is searched6Looking for the current pixel CijAnd calculating a second prediction residual. The third prediction search window comprises 7 reconstructed pixels which are arranged in a 4 multiplied by 2 matrix, the 7 reconstructed pixels are numbered from 0 to 6, and the 6 reconstructed pixels P are numbered0、P1、P2、P3、P4、P5、P6From the reconstructed pixel P numbered 00The search is started until the reconstructed pixel P with number 6 is searched6Looking for the current pixel CijAnd calculating a third prediction residual. Calculating the current pixel C in a plurality of prediction search windows respectivelyijThe method of predicting a plurality of residuals is described as follows.
102. Determining a current pixel CijN pixel components.
Setting a current pixel CijComprising N pixel components of
Figure BDA0001844009950000111
Wherein N is a natural number greater than 1,
Figure BDA0001844009950000112
represents the current pixel CijThe nth pixel component of (1). For example, the current pixel CijMay comprise 3 pixel components RGB, or 4 pixel components RGBW, or 3 pixel components Lab, or 3 pixel components YUV, or 4 pixel components CMYK.
103. Computing a current pixel C within a plurality of predictive search windowsijA plurality of weights Wij. The plurality of weights includes a first weight, a second weight, and a third weight. Current pixel C calculated in a first predictive search window, such as a horizontal stripe predictive search windowijWeight W ofijIs firstWeight, current pixel C calculated in a second predictive search window, e.g. a vertical slice predictive search windowijWeight W ofijFor the second weight, the current pixel C is calculated in a third prediction search window, such as a rectangular prediction search windowijWeight W ofijIs the third weight. In particular, the current pixel C is calculated within each prediction windowijWeight W ofijThe method of (1) is as follows:
within the prediction search window, corresponding to K-1 encoded reconstructed pixels P0、P1、P2、...Pk...、PK-2Weight WijComprising K-1 sub-weights, i.e.
Wij={Wij、0,Wij、1,Wij、2,...Wij、k...,Wij、K-2}
Wherein, Wij、kIs the current pixel CijCorresponding to the encoded reconstructed pixel PkSub-weights of (c). Sub-weight Wij、kIs the current pixel CijOf N pixel components
Figure BDA0001844009950000121
Relative reconstructed pixel PkOf N pixel components
Figure BDA0001844009950000122
N component sub-weights
Figure BDA0001844009950000123
The result of the weighted summation is
Figure BDA0001844009950000124
Wherein the content of the first and second substances,
Figure BDA0001844009950000125
is the current pixel CijOf the nth pixel component
Figure BDA0001844009950000126
Relative reconstructed pixel PkOf the nth pixel component
Figure BDA0001844009950000127
The weight of the component(s) of (c),
Figure BDA0001844009950000128
are component weighted values and satisfy
Figure BDA0001844009950000129
In one embodiment of the present invention,
Figure BDA00018440099500001210
is taken as
Figure BDA00018440099500001211
In another embodiment of the invention, the pixel components are based on
Figure BDA00018440099500001212
Respectively with N pixel components
Figure BDA00018440099500001213
Is determined according to the distance, the closer the distance is, the corresponding distance is
Figure BDA00018440099500001214
The larger; in yet another embodiment of the invention, the determination is empirically determined
Figure BDA00018440099500001215
The value of (a).
In the embodiment of the invention, the current pixel CijWeight W ofijFrom the current pixel CijDiff weight DIF ofijAnd (4) determining. Corresponding to K-1 encoded reconstructed pixels P0、P1、P2、...Pk...、PK-2Difference degree weight DIFijWith K-1 diff sub-weights DIFij、kI.e. by
DIFij={DIFij、0,DIFij、1,DIFij、2,...DIFij、k...,DIFij、K-2}
The method for determining the weight provided by one embodiment of the invention comprises the following steps:
1031. calculating the current pixel CijPixel component of
Figure BDA00018440099500001216
Component disparity weighting with respect to pixel components of reconstructed pixels
Figure BDA00018440099500001217
Each pixel component
Figure BDA00018440099500001218
Component difference degree weight of
Figure BDA00018440099500001219
With K-1 component difference degree sub-weights
Figure BDA00018440099500001220
Namely, it is
Figure BDA00018440099500001221
Wherein the component difference degree sub-weight
Figure BDA0001844009950000131
According to the current pixel CijPixel component of
Figure BDA0001844009950000132
And a reconstructed pixel PkPixel component of
Figure BDA0001844009950000133
Is determined.
Preferably, in the embodiment of the present invention, the component difference degree sub-weight
Figure BDA0001844009950000134
As pixel components
Figure BDA0001844009950000135
Original value of
Figure BDA0001844009950000136
And reconstructing the pixel components
Figure BDA0001844009950000137
Is a reconstructed value of
Figure BDA0001844009950000138
Of the absolute value of the difference, i.e.
Figure BDA0001844009950000139
1032. Calculating the current pixel CijWith respect to each reconstructed pixel PkSub-weight W ofij、k. Current pixel CijRelative reconstructed pixel PkSub-weight W ofij、kIs the current pixel CijOf N pixel components
Figure BDA00018440099500001310
Relative reconstructed pixel PkOf N pixel components
Figure BDA00018440099500001311
N component difference degree sub-weights
Figure BDA00018440099500001312
Weighted summation, i.e.
Figure BDA00018440099500001313
Wherein the content of the first and second substances,
Figure BDA00018440099500001314
is the current pixel CijOf the nth pixel component
Figure BDA00018440099500001315
Relative reconstructed pixel PkOf the nth pixel component
Figure BDA00018440099500001316
The component difference degree sub-weights of (a),
Figure BDA00018440099500001317
are component weighted values and satisfy
Figure BDA00018440099500001318
In one embodiment of the present invention,
Figure BDA00018440099500001319
is taken as
Figure BDA00018440099500001320
In another embodiment of the invention, the pixel components are based on
Figure BDA00018440099500001321
Respectively with N pixel components
Figure BDA00018440099500001322
Is determined according to the distance, the closer the distance is, the corresponding distance is
Figure BDA00018440099500001323
The larger; in yet another embodiment of the invention, the determination is empirically determined
Figure BDA00018440099500001324
The value of (a).
1033. Calculating the current pixel CijWeight W ofij. Then the weight is
Figure BDA00018440099500001325
104. According to a plurality of weights WijDetermining a current pixel CijAnd calculating a plurality of prediction residuals. The plurality of reference pixels include, for example, a first reference pixel, a second reference pixel, and a third reference pixel; the plurality of prediction residuals includes, for example, a first prediction residual, a second prediction residual, and a third prediction residual. In particular, the current pixel C is determined according to the first weightijCalculating to obtain a first prediction residual error; determining the current pixel C according to the second weightijCalculating to obtain a second prediction residual error; determining the current pixel C according to the third weightijAnd calculating to obtain a third prediction residual. Specifically, the method for calculating each prediction residual includes the following steps:
1041. according to weight WijDetermining a current pixel CijReference pixel P ofs. In particular, the slave weight W is calculated according to an optimal algorithmijK-1 sub-weights W ofij、kSelecting an optimal value, and reconstructing a pixel P corresponding to the optimal valuesAs the current pixel CijThe reference pixel of (2). The optimum value determining algorithm is, for example, a minimum weight determining algorithm, i.e. from the weight Wij={Wij、0,Wij、1,Wij、2,...Wij、k...,Wij、K-2Selecting the minimum value of the sub-weights, such as W, from K-1 sub-weights ofij、sCorresponding reconstructed pixel PsTo reconstruct the pixel PsAs the current pixel CijThe reference pixel of (2).
1042. Calculating the current pixel CijPrediction residual RES ofij. In particular, according to the reference pixel, i.e. PsReconstructed value of (N)s) Encoding a pixel C with the current pixelijOriginal value of (C) OldDataij) Calculating the current pixel CijRelative reference pixel PsPrediction residual RES ofijIs a
Figure BDA0001844009950000141
Wherein the content of the first and second substances,
Figure BDA0001844009950000142
Figure BDA0001844009950000143
is the current pixel CijOf the nth pixel component
Figure BDA0001844009950000144
Relative reference pixel PsOf the nth pixel component
Figure BDA0001844009950000145
The prediction residual of (2).
Through the steps 101-104, the current pixel C is found in a plurality of prediction search windowsijAnd calculating to obtain a plurality of prediction residuals. E.g. finding the current pixel C within a first predictive search windowijFirst reference pixel Ps1And calculating to obtain a first prediction residual RESij1(ii) a Finding the current pixel C within the second predictive search windowijSecond reference pixel Ps2And calculating to obtain a second prediction residual RESij2(ii) a Finding the current pixel C within the third predictive search windowijThird reference pixel Ps3And calculating to obtain a third prediction residual RESij3
105. Comparing the plurality of prediction residuals to determine an optimal prediction residual RESij_PerfAnd corresponding optimal reference pixel Ps_Perf. In a plurality of prediction residuals, e.g. a first prediction residual RESij1Second prediction residual RESij2Third prediction residual RESij3Determining the minimum prediction residual according to the minimum algorithm, and taking the minimum prediction residual as the current pixel CijIs best predicted residual RESij_PerfTaking the reference pixel corresponding to the minimum prediction residual as the current pixel CijIs optimized to the reference pixel Ps_Perf. The prediction residual of the current pixel is the prediction residual of each pixel component of the current pixel, and the prediction residual may also be referred to as residual data.
The difference in one embodiment is that step 103 computes the current pixel C within multiple prediction search windowsijA plurality of weights WijTime, weight WijDIF is weighted by the disparity of the current pixelijAnd location weight POSijAnd (4) jointly determining. Corresponding to K-1 encoded reconstructed pixels P0、P1、P2、...Pk...、PK-2Difference degree weight DIFijWith K-1 diff sub-weights DIFij、kLocation weighted POSijWith K-1 position sub-weights POSij、kI.e. by
DIFij={DIFij、0,DIFij、1,DIFij、2,...DIFij、k...,DIFij、K-2}
POSij={POSij、0,POSij、1,POSij、2,...POSij、k...,POSij、K-2}
Another method for determining a weight provided in the embodiment of the present invention includes the following steps:
1034. calculating pixel components of a current pixel
Figure BDA0001844009950000151
Component disparity weighting with respect to pixel components of reconstructed pixels
Figure BDA0001844009950000152
Each pixel component
Figure BDA0001844009950000153
Component difference degree weight of
Figure BDA0001844009950000154
With K-1 component difference degree sub-weights
Figure BDA0001844009950000155
Namely, it is
Figure BDA0001844009950000156
Wherein the component difference degree sub-weight
Figure BDA0001844009950000157
According to the current pixel CijPixel component of
Figure BDA0001844009950000158
And a reconstructed pixel PkPixel component of
Figure BDA0001844009950000159
Is determined.
Preferably, in the embodiment of the present invention, the component difference degree sub-weight
Figure BDA00018440099500001510
As pixel components
Figure BDA00018440099500001511
Original value of
Figure BDA00018440099500001512
And reconstructing the pixel components
Figure BDA00018440099500001513
Is a reconstructed value of
Figure BDA00018440099500001514
Of the absolute value of the difference, i.e.
Figure BDA00018440099500001515
1035. Calculating pixel components of a current pixel
Figure BDA00018440099500001516
Component position weighting of pixel components relative to reconstructed pixels
Figure BDA00018440099500001517
Each pixel component
Figure BDA00018440099500001518
Component position weight of
Figure BDA00018440099500001519
With K-1 component positions sub-weights
Figure BDA00018440099500001520
Namely, it is
Figure BDA0001844009950000161
Wherein the component position sub-weights
Figure BDA0001844009950000162
According to the current pixel CijAnd a reconstructed pixel PkIs determined.
Referring to fig. 7, fig. 7 is a schematic diagram of predicting position sub-weights in a search window according to an embodiment of the present invention. In the embodiment of the invention, the current pixel C is usedijAnd a reconstructed pixel PkThe number of pixels spaced apart as the component position sub-weight
Figure BDA0001844009950000163
Corresponding to K-1 reconstructed pixels P in the prediction search window0、P1、P2、...Pk...、PK-2E.g. with the current pixel CijAdjacent reconstructed pixel P6And CijIf the number of interval pixels is 0, determining the sub-weight of the corresponding component position as
Figure BDA0001844009950000164
Reconstruction pixel P5And CijIf the number of interval pixels is 1, determining the sub-weight of the corresponding component position as
Figure BDA0001844009950000165
Similarly, corresponding to 7 reconstructed pixels P0、P1、P2、P3、P4、P5、P6The 7 component position sub-weights of (1):
Figure BDA0001844009950000166
Figure BDA0001844009950000167
Figure BDA0001844009950000168
1036. calculating pixel components of a current pixel
Figure BDA0001844009950000169
Component weight of (2)
Figure BDA00018440099500001610
Each pixel component
Figure BDA00018440099500001611
Component weight of (2)
Figure BDA00018440099500001612
With K-1 component sub-weights
Figure BDA00018440099500001613
Namely, it is
Figure BDA00018440099500001614
Wherein the component sub-weights are
Figure BDA00018440099500001615
Wherein the content of the first and second substances,
Figure BDA00018440099500001616
and
Figure BDA00018440099500001617
are respectively a difference weighted value and a position weighted value, anSatisfy the requirement of
Figure BDA00018440099500001618
In one embodiment of the invention, take
Figure BDA00018440099500001619
In another embodiment of the invention, according to
Figure BDA00018440099500001620
Is determined to correspond to
Figure BDA00018440099500001621
The value of (a) is,
Figure BDA00018440099500001622
the larger, the
Figure BDA00018440099500001623
The smaller; according to
Figure BDA00018440099500001624
Is determined by the size of
Figure BDA00018440099500001625
The value of (a) is,
Figure BDA00018440099500001626
the larger, the
Figure BDA00018440099500001627
The smaller. In a further embodiment of the present invention,
Figure BDA00018440099500001628
and
Figure BDA00018440099500001629
is determined from empirical values.
1037. Calculating the current pixel CijWith respect to each reconstructed pixel PkSub-weight W ofij、k. Current pixel CijRelative reconstructed pixel PkSub-weight W ofij、kIs the current pixel CijOf N pixel components
Figure BDA00018440099500001630
Relative reconstructed pixel PkOf N pixel components
Figure BDA00018440099500001631
N component sub-weights
Figure BDA00018440099500001632
Weighted summation, i.e.
Figure BDA0001844009950000171
Wherein the content of the first and second substances,
Figure BDA0001844009950000172
are component weighted values and satisfy
Figure BDA0001844009950000173
In one embodiment of the present invention,
Figure BDA0001844009950000174
is taken as
Figure BDA0001844009950000175
In another embodiment of the invention, the pixel components are based on
Figure BDA0001844009950000176
Respectively with N pixel components
Figure BDA0001844009950000177
Is determined according to the distance, the closer the distance is, the corresponding distance is
Figure BDA0001844009950000178
The larger; in yet another embodiment of the invention, the determination is empirically determined
Figure BDA0001844009950000179
The value of (a).
1038. Calculating the current pixel CijThe weight of (1) is then
Figure BDA00018440099500001710
Figure BDA00018440099500001711
Figure BDA00018440099500001712
In one embodiment, the difference is that after step 105, the method further comprises:
106. outputting the optimal reference pixel P of the current pixels_PerfPosition information of (2) and optimal prediction residual RESij_Perf. Optimal reference pixel Ps_PerfMay be the optimal reference pixel Ps_PerfThe position index ij or the number s.
In summary, in the prediction mode of the embodiment of the present invention, a plurality of reference pixels are found by using prediction search windows of various shapes, and a plurality of prediction residuals are obtained by calculation, and an optimal prediction residual is selected from the plurality of prediction residuals. For complex texture images, the prediction effect is better, and the theoretical limit entropy is reduced.
Example four
The present embodiment describes in detail a process of predicting a current image block by a third prediction mode candidate, which is proposed by the present invention, on the basis of the above-described embodiments. The method comprises the following steps:
as shown in fig. 8a to 8c, fig. 8a to 8c are schematic diagrams illustrating different division manners provided by an embodiment of the invention; the method comprises the steps of dividing a current image block according to different division modes, specifically, dividing the current image block into an upper image block and a lower image block according to a horizontal division mode; dividing a current image block into a left image block and a right image block according to a vertical division mode; and partitioning the current image block according to a non-partitioning mode.
And respectively calculating different prediction residuals corresponding to the current image block in different segmentation modes. Specifically, for the horizontal division mode, subtracting the minimum value of the pixel components of the upper image block from all the pixel components of the upper image block to obtain the prediction residuals of all the pixel components of the upper image block; calculating the lower image block in the same way, subtracting the minimum value of the pixel components of the lower image block from all the pixel components of the lower image block to obtain the prediction residual errors of all the pixel components of the lower image block, and finally obtaining the first prediction residual errors of all the pixel components of the current image block; for the vertical division mode, subtracting the minimum value of the pixel components of the left image block from all the pixel components of the left image block to obtain the prediction residual errors of all the pixel components of the left image block; the right image block is calculated in the same way, the minimum value of the pixel components of the right image block is subtracted from all the pixel components of the right image block to obtain the prediction residual errors of all the pixel components of the right image block, and finally the second prediction residual errors of all the pixel components of the current image block are obtained; and for the non-segmentation mode, subtracting the minimum value of the pixel components in the current image block from the pixel components in the current image block to finally obtain a third prediction residual of all the pixel components of the current image block.
And respectively calculating different bit numbers corresponding to the current image block under different segmentation modes. Specifically, for the horizontal division mode, a first difference between a maximum value of a pixel component in an upper image block and a minimum value of the pixel component in the upper image block is calculated to obtain a first minimum bit number representing the first difference, a second difference between a maximum value of the pixel component in a lower image block and a minimum value of the pixel component in the lower image block is calculated to obtain a second minimum bit number representing the second difference, a first bit number is obtained according to the first minimum bit number, the second minimum bit number and a bit depth of original data of a current image block, and the first bit number satisfies the following formula:
MBIT1=N1*BIT_MIN1+N2*BIT_MIN2+2*BITDEPTH
where MBIT1 is the first BIT number, BIT _ MIN1 is the first minimum BIT number, N × BIT _ MIN2 is the second minimum BIT number, BITDEPTH is the BIT depth of the original data of the current image block, N1 is the number of pixel components in the upper image block, and N2 is the number of pixel components in the lower image block.
For the vertical division mode, calculating a third difference value between the maximum value of the pixel component in the left image block and the minimum value of the pixel component in the left image block to obtain a third minimum bit number representing the third difference value, calculating a fourth difference value between the maximum value of the pixel component in the right image block and the minimum value of the pixel component in the right image block to obtain a fourth minimum bit number representing the fourth difference value, and obtaining a second bit number according to the third minimum bit number, the fourth minimum bit number and the bit depth of original data of the current image block, wherein the second bit number satisfies the following requirements:
MBIT2=N3*BIT_MIN3+N4*BIT_MIN4+2*BITDETH
where MBIT2 is the second BIT number, BIT _ MIN3 is the third minimum BIT number, BIT _ MIN4 is the fourth minimum BIT number, BITDEPTH is the BIT depth of the original data of the current image block, N3 is the number of pixel components in the left image block, and N4 is the number of pixel components in the right image block.
For the non-segmentation mode, calculating a fifth difference value between the maximum value of the pixel component in the current image block and the minimum value of the pixel component in the current image block to obtain a fifth minimum bit number representing the fifth difference value, and obtaining a third bit number according to the fifth minimum bit number and the bit depth of the original data of the current image block, wherein the third bit number satisfies:
MBIT3=M*BIT_MIN5+2*BITDETH
where MBIT3 is the third BIT number, BIT _ MIN5 is the fifth minimum BIT number, BITDEPTH is the BIT depth of the original data of the current image block, and M is the number of pixel components in the current image block.
Selecting a segmentation mode according to different prediction residuals and different bit numbers, specifically, for a horizontal segmentation mode, obtaining a first reconstruction value of a current image block according to a first prediction residual, obtaining a first reconstruction difference value by calculating an absolute value of a difference between the first reconstruction value and an original value of the current image block, and calculating the first reconstruction difference value by using the first reconstruction difference value
And weighting the first bit number to obtain a first weighted value of the current image block in a horizontal segmentation mode, wherein the first weighted value satisfies the following formula:
RDO1=a*MBIT1+b*RES1
here, RDO1 is a first weight value, MBIT1 is a first number of bits, RES1 is a first reconstruction difference value, and a and b are weighting coefficients.
The values of a and b may be preset fixed values, further, a + b is 1, preferably, a may be selected to be 0.5, b may be selected to be 0.5, and a and b may also be flexibly adjusted in size.
For the vertical segmentation mode, a second reconstruction value of the current image block is obtained according to a second prediction residual error, an absolute value of a difference between the second reconstruction value and an original value of the current image block is obtained to obtain a second reconstruction difference value, the second reconstruction difference value and a second bit number are weighted to obtain a second weighted value of the current image block in the vertical segmentation mode, wherein the second weighted value meets the following formula:
RDO2=a*MBIT2+b*RES2
here, RDO2 is the second weighted value, MBIT2 is the second bit number, RES2 is the second reconstructed difference value, and a and b are weighting coefficients.
The values of a and b may be preset fixed values, further, a + b is 1, preferably, a may be selected to be 0.5, b may be selected to be 0.5, and a and b may also be flexibly adjusted in size.
For the non-segmentation mode, obtaining a third reconstruction value of the current image block according to a third prediction residual error, obtaining a third reconstruction difference value by calculating an absolute value of a difference between the third reconstruction value and an original value of the current image block, and weighting the third reconstruction difference value and a third bit number to obtain a third weighted value of the current image block in the non-segmentation mode, wherein the third weighted value satisfies the following formula;
RDO3=a*MBIT3+b*RES3
the RDO3 is a third weighted value, the MBIT3 is a third bit number, the RES3 is a third reconstruction difference value, and a and b are weighting coefficients.
The values of a and b may be preset fixed values, further, a + b is 1, preferably, a may be selected to be 0.5, b may be selected to be 0.5, and a and b may also be flexibly adjusted in size.
And selecting a partition mode corresponding to the minimum value of the first weighted value, the second weighted value and the third weighted value as a final partition mode, wherein the predicted residual error under the partition mode is a final predicted residual error. The prediction residual may also be referred to as residual data.
The prediction mode provided by the embodiment predicts through the correlation among the pixel component values of the current region, compares the compressed data amount of the three conditions of horizontal segmentation, vertical segmentation and non-segmentation by using the algorithm of the invention, selects the corresponding optimal segmentation mode to perform residual prediction so as to minimize the difference between the initial image block and the predicted image block, thereby improving the compression efficiency and the subjective picture quality.
EXAMPLE five
This embodiment describes in detail an image encoding device proposed by the present invention on the basis of the above-described embodiment, the device including:
the selector is used for selecting the estimation prediction mode of the current image block by selecting the prediction mode library; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates;
the predictor is used for predicting the image data in the current image block according to the estimation prediction mode to obtain residual data of the image data in the current image block;
and the encoder is used for encoding the residual data and the corresponding estimated prediction mode index identification to form a code stream.
Wherein the selected prediction mode library in the selector comprises a first prediction mode candidate, a second prediction mode candidate and a third prediction mode candidate; the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block; the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block; and the third prediction mode candidate is a prediction mode candidate which selects the optimal division based on different division forms of the current image block.
Wherein the selecting of the estimated prediction mode in the selector comprises:
detecting image characteristic information of the current image block;
and predicting a prediction mode candidate for the current image block in a selected prediction mode library by using the image characteristic information as an estimated prediction mode of the current image block.
Wherein the predictor is specifically configured to:
if the estimated prediction mode is the first prediction mode candidate, predicting the current image block through the first prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the second prediction mode candidate, predicting the current image block through the second prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring residual data of image data in the current image block.
In summary, the present invention has been explained by using specific examples, and the above description of the embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention, and the scope of the present invention should be subject to the appended claims.

Claims (4)

1. An image encoding method for encoding image data for each image block, comprising:
selecting an estimation prediction mode of a current image block by selecting a prediction mode library; the method comprises the following steps: the first step is as follows: detecting image characteristic information of the current image block; the method comprises the following steps: calculating the difference value of every two adjacent pixel components in the current image block, and acquiring the gradient value of each current image block according to the difference value of every two adjacent pixel components; determining the maximum pixel difference value of two pixel components in the current image block according to the bit width of each pixel component in the current image block; setting three level spaces according to the maximum pixel difference value of two pixel components in the current image block, a first threshold and a second threshold: classifying the pixel difference value range interval smaller than a first threshold value into a first-level interval; classifying the pixel difference value range interval which is larger than the first threshold and smaller than the second threshold into a second level interval; classifying the pixel difference range interval which is larger than the second threshold and smaller than the maximum pixel difference into a third level interval; wherein the first threshold is less than the second threshold; judging the level interval of the gradient value of the current image block; determining the image characteristic information of the current image block according to the level interval of the gradient value of the current image block: if the gradient value of the current image block is in the first-level interval, the image feature information of the current image block is simple complexity texture information; if the gradient value of the current image block is in the second-level interval, the image feature information of the current image block is general complexity texture information; if the gradient value of the current image block is in the third level interval, the image feature information of the current image block is complex complexity texture information; the second step is as follows: predicting a prediction mode candidate for the current image block in a selective prediction mode library by using the image characteristic information as an estimated prediction mode of the current image block: if the image characteristic information of the current image block is the simple complexity texture information, selecting a third prediction mode candidate as an estimation prediction mode; if the image characteristic information of the current image block is general complexity texture information, selecting a first prediction mode candidate as an estimation prediction mode; if the image characteristic information of the current image block is the complexity texture information, selecting a second prediction mode candidate as an estimation prediction mode; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates; the selected prediction mode library comprises a first prediction mode candidate, a second prediction mode candidate and a third prediction mode candidate; the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block; the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block; the third prediction mode candidate is a prediction mode candidate which selects the optimal segmentation based on different segmentation forms of the current image block;
predicting the image data in the current image block according to an estimated prediction mode to obtain residual data of the image data in the current image block;
and coding the residual data and the corresponding estimated prediction mode index identification to form a code stream.
2. The method of claim 1, wherein predicting the image data in the current image block according to the estimated prediction mode to obtain residual data of the image data in the current image block comprises:
if the estimated prediction mode is the first prediction mode candidate, predicting the current image block through the first prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the second prediction mode candidate, predicting the current image block through the second prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring residual data of image data in the current image block.
3. An image encoding device characterized by comprising:
the selector is used for selecting the estimation prediction mode of the current image block by selecting the prediction mode library; the selector is used for detecting the image characteristic information of the current image block; the method is specifically used for: calculating the difference value of every two adjacent pixel components in the current image block, and acquiring the gradient value of each current image block according to the difference value of every two adjacent pixel components; determining the maximum pixel difference value of two pixel components in the current image block according to the bit width of each pixel component in the current image block; setting three level spaces according to the maximum pixel difference value of two pixel components in the current image block, a first threshold and a second threshold: classifying the pixel difference value range interval smaller than a first threshold value into a first-level interval; classifying the pixel difference value range interval which is larger than the first threshold and smaller than the second threshold into a second level interval; classifying the pixel difference range interval which is larger than the second threshold and smaller than the maximum pixel difference into a third level interval; wherein the first threshold is less than the second threshold; judging the level interval of the gradient value of the current image block; determining the image characteristic information of the current image block according to the level interval of the gradient value of the current image block: if the gradient value of the current image block is in the first-level interval, the image feature information of the current image block is simple complexity texture information; if the gradient value of the current image block is in the second-level interval, the image feature information of the current image block is general complexity texture information; if the gradient value of the current image block is in the third level interval, the image feature information of the current image block is complex complexity texture information; the selector is further configured to predict a prediction mode candidate for the current image block in a selected prediction mode library as an estimated prediction mode of the current image block by using the image feature information: if the image characteristic information of the current image block is the simple complexity texture information, selecting a third prediction mode candidate as an estimation prediction mode; if the image characteristic information of the current image block is general complexity texture information, selecting a first prediction mode candidate as an estimation prediction mode; if the image characteristic information of the current image block is the complexity texture information, selecting a second prediction mode candidate as an estimation prediction mode; wherein, the selected prediction mode database is a database formed by a plurality of predetermined prediction mode candidates; the selected prediction mode library in the selector comprises a first prediction mode candidate, a second prediction mode candidate and a third prediction mode candidate; the first prediction mode candidate is a prediction mode candidate for selecting an optimal reference based on multiple pixel components in the current image block; the second prediction mode candidate is a prediction mode candidate which selects the optimal reference based on different reference windows in the current image block; the third prediction mode candidate is a prediction mode candidate which selects the optimal segmentation based on different segmentation forms of the current image block;
the predictor is used for predicting the image data in the current image block according to the estimation prediction mode to obtain residual data of the image data in the current image block;
and the encoder is used for encoding the residual data and the corresponding estimated prediction mode index identification to form a code stream.
4. The apparatus of claim 3, wherein the predictor is specifically configured to:
if the estimated prediction mode is the first prediction mode candidate, predicting the current image block through the first prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the second prediction mode candidate, predicting the current image block through the second prediction mode candidate to obtain residual data of image data in the current image block;
if the estimated prediction mode is the third prediction mode candidate, predicting the current image block through the third prediction mode candidate, and acquiring residual data of image data in the current image block.
CN201811261695.3A 2018-10-26 2018-10-26 Image encoding method and apparatus thereof Active CN109495739B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811261695.3A CN109495739B (en) 2018-10-26 2018-10-26 Image encoding method and apparatus thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811261695.3A CN109495739B (en) 2018-10-26 2018-10-26 Image encoding method and apparatus thereof

Publications (2)

Publication Number Publication Date
CN109495739A CN109495739A (en) 2019-03-19
CN109495739B true CN109495739B (en) 2021-01-15

Family

ID=65691783

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811261695.3A Active CN109495739B (en) 2018-10-26 2018-10-26 Image encoding method and apparatus thereof

Country Status (1)

Country Link
CN (1) CN109495739B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964906B (en) * 2009-07-22 2012-07-04 北京工业大学 Rapid intra-frame prediction method and device based on texture characteristics
CN102843555B (en) * 2011-06-24 2017-07-14 中兴通讯股份有限公司 A kind of intra-frame prediction method and system
CN103796023B (en) * 2014-03-05 2017-02-01 武汉拓宝科技股份有限公司 H.265/HEVC transcoding method and transcoder based on H.264/AVC macro block structure and texture
CN104469381B (en) * 2014-12-30 2017-06-30 合肥工业大学 A kind of VLSI of H.264 motion estimation search window Adaptive adjusting algorithm realizes system
MX2018014190A (en) * 2016-05-17 2019-08-05 Arris Entpr Llc Template matching for jvet intra prediction.

Also Published As

Publication number Publication date
CN109495739A (en) 2019-03-19

Similar Documents

Publication Publication Date Title
US20210105461A1 (en) Method and apparatus for processing video signal
TWI690194B (en) Sub-prediction unit temporal motion vector prediction (sub-pu tmvp) for video coding
US9729897B2 (en) Motion prediction method
US9307250B2 (en) Optimization of intra block size in video coding based on minimal activity directions and strengths
CN108282659B (en) Method and apparatus for image encoding and decoding using intra prediction
JP5890520B2 (en) Method and apparatus for predicting color difference component of image using luminance component of image
US20190313116A1 (en) Video signal processing method and device
US20230239496A1 (en) Method and apparatus for encoding/decoding image
RU2518718C2 (en) Method and apparatus for encoding and decoding motion vector based on reduced motion vector predictor candidates
US20140286433A1 (en) Hierarchical motion estimation for video compression and motion analysis
KR101375664B1 (en) Method and apparatus of encoding/decoding image using diffusion property of image
CN107810632B (en) Intra prediction processor with reduced cost block segmentation and refined intra mode selection
CN103079070A (en) Video encoder
US20160191920A1 (en) Method and apparatus for determining merge mode
US11659178B2 (en) Image encoding method/device, image decoding method/device, and recording medium in which bitstream is stored
US20120008684A1 (en) Method and apparatus of encoding and decoding video signal
CN109547783B (en) Video compression method based on intra-frame prediction and equipment thereof
US20160212421A1 (en) System and method for performing optimal temporal predictive mode decision in h.264 video coding
KR100910209B1 (en) Apparatus and Method for the fast full search motion estimation using the partitioned search window
EP1921865A2 (en) Obtaining a motion vector in block-based motion estimation
US11909971B2 (en) Image encoding method/device, image decoding method/device, and recording medium in which bitstream is stored
CN109413421B (en) Video encoding method, video encoding apparatus, video decoding method, and video decoding apparatus
CN109495739B (en) Image encoding method and apparatus thereof
CN109587481B (en) Video encoding method and apparatus
CN109379592B (en) Image encoding method and apparatus thereof

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
TA01 Transfer of patent application right

Effective date of registration: 20201229

Address after: Room 3101, 22nd floor, Shenzi building, Binhe District, Hangzhou City

Applicant after: Hangzhou Lianhai Network Technology Co.,Ltd.

Address before: 710065 Xi'an new hi tech Zone, Shaanxi, No. 86 Gaoxin Road, No. second, 1 units, 22 stories, 12202 rooms, 51, B block.

Applicant before: XI'AN CREATION KEJI Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Image encoding methods and equipment

Effective date of registration: 20231009

Granted publication date: 20210115

Pledgee: Hangzhou High-tech Financing Guarantee Co.,Ltd.

Pledgor: Hangzhou Lianhai Network Technology Co.,Ltd.

Registration number: Y2023330002260

PE01 Entry into force of the registration of the contract for pledge of patent right