WO2023005830A1 - 预测编码方法、装置和电子设备 - Google Patents

预测编码方法、装置和电子设备 Download PDF

Info

Publication number
WO2023005830A1
WO2023005830A1 PCT/CN2022/107303 CN2022107303W WO2023005830A1 WO 2023005830 A1 WO2023005830 A1 WO 2023005830A1 CN 2022107303 W CN2022107303 W CN 2022107303W WO 2023005830 A1 WO2023005830 A1 WO 2023005830A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel block
target
standard deviation
pixel
intra
Prior art date
Application number
PCT/CN2022/107303
Other languages
English (en)
French (fr)
Inventor
张勇
Original Assignee
维沃移动通信有限公司
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 维沃移动通信有限公司 filed Critical 维沃移动通信有限公司
Publication of WO2023005830A1 publication Critical patent/WO2023005830A1/zh

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
    • H04N19/11Selection of coding mode or of prediction mode among a plurality of spatial predictive coding modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component

Definitions

  • the present application belongs to the technical field of video coding, and in particular relates to a predictive coding method, device and electronic equipment.
  • Video coding is based on the high correlation of video signals and the visual characteristics of the human eye. Through appropriate coding methods, it can eliminate the redundancy caused by various correlations and human eye characteristics, so as to compress video signals and reduce the transmission bit rate. the goal of.
  • H.264/Advanced Video Coding AVC
  • multi-directional spatial prediction technology is usually used in intra-frame coding, that is, an optimal prediction direction is selected according to the characteristics of the image itself to maximize the removal of space. redundancy.
  • H.264/AVC can support predictive coding of variable block sizes. For predictive coding of pixel blocks of luminance components in macroblocks, predictive coding can be performed based on 4 ⁇ 4 pixel blocks or 16 ⁇ 16 pixel blocks.
  • the purpose of the embodiments of the present application is to provide a predictive coding method, device and electronic equipment, which can solve the problem of very high computational complexity of predictive coding algorithms in video coding technology.
  • the embodiment of the present application provides a predictive coding method, the method including:
  • the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component;
  • first standard deviation information determining first standard deviation information, where the first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block;
  • the intra-frame coding type is used to represent a pixel block size when performing intra-frame coding on the first pixel block;
  • K is an integer greater than 1.
  • an embodiment of the present application provides a predictive encoding device, which includes:
  • An acquisition module configured to acquire an image to be encoded, where the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component;
  • a first determination module configured to determine first standard deviation information, where the first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block;
  • the second determination module is configured to determine the intra-frame coding type of the first pixel block based on the first standard deviation information, and the intra-frame coding type is used to characterize the pixels when the first pixel block performs intra-frame coding block size;
  • a selection module configured to select a target coding mode of the first pixel block from K preset coding modes corresponding to the intra-frame coding type, where K is an integer greater than 1.
  • an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
  • an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
  • the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
  • a sixth aspect provides a computer program product stored in a non-transitory storage medium, wherein the computer program product is executed by at least one processor to implement the method as described in the first aspect .
  • a communication device configured to execute the method described in the first aspect.
  • the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component; determining the first standard deviation information, and using the first standard deviation information To characterize the brightness dispersion of pixels in the first pixel block; determine the intra-frame coding type of the first pixel block based on the first standard deviation information, and the intra-frame coding type is used to characterize the first
  • the target coding mode of the first pixel block is selected from K preset coding modes corresponding to the intra-coding type.
  • the size of the pixel block for intra-frame coding can be determined in advance under the premise of ensuring that the coding quality is basically unchanged, so that unnecessary calculation of the cost function can be avoided, thereby reducing the cost of the predictive coding algorithm. computational complexity.
  • FIG. 1 is a flow chart of a predictive coding method provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of 4:1 subsampling
  • FIG. 3 is a schematic diagram of prediction of a preset coding mode corresponding to the first type
  • Fig. 4 is a schematic diagram of the relationship between pixels when predictive coding is performed based on a 4 ⁇ 4 pixel block
  • Fig. 5 is a schematic diagram of a prediction direction of a preset coding mode corresponding to the second type
  • Fig. 6 is a schematic diagram of prediction of a preset coding mode corresponding to the second type
  • Fig. 7 is a schematic diagram of the relationship between the fourth pixel block and the fifth pixel block and the target pixel block;
  • FIG. 8 is a structural diagram of a predictive encoding device provided by an embodiment of the present application.
  • FIG. 9 is a structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
  • Fig. 1 is a flow chart of the predictive coding method provided by the embodiment of the present application, as shown in Fig. 1, including the following steps:
  • Step 101 acquire an image to be encoded, where the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component.
  • the image to be encoded may be an image in a video, and the video may include multiple images, and the image to be encoded is any one of the multiple images.
  • the video can be predictively encoded, and the predictive encoding of the video refers to performing predictive encoding on the images in the video in sequence according to the time of the video sequence.
  • the format and size of the video are not limited.
  • the video can be a video sequence in a public intermediate format (Quarter Common Intermediate Format, QCIF), and the QCIF video sequence can be predictively encoded, wherein the QCIF size Can be 176 ⁇ 144.
  • QCIF Quadrater Common Intermediate Format
  • the image in the video may be predictively encoded in the frame coding mode, or the image in the video may be predictively encoded in the field coding mode, which is not specifically limited here. It should be noted that if the field coding mode is used to predictively encode images in the video, the relevant configuration parameters need to be multiplied by 2, and the relevant configuration parameters during predictive coding will be described below.
  • the frame encoding mode Take the frame encoding mode to predictively encode images in a video as an example.
  • the basic level uses I frames and P frames to encode images. Encoding is performed, and I frames can be inserted periodically, for example, an I frame can be inserted every 1 second of video, and a P frame can be inserted between two adjacent I frames. That is to say, when performing video encoding, the image to be encoded may be an I frame or a P frame, which is not specifically limited here.
  • the image to be coded may include a plurality of macroblocks, such as a QCIF (176 ⁇ 144) video sequence, an image may contain 99 macroblocks, and each macroblock includes a first pixel block with a size of 16 ⁇ 16, the first pixel block
  • the pixel block may be the luminance component of the macroblock, representing the luminance of the image, represented by the Y component.
  • the macroblock can also include two other pixel blocks, both of which can be 8 ⁇ 8 in size, which can be the chrominance component of the macroblock, representing the chrominance of the image , represented by U and V components, respectively.
  • Performing predictive encoding on an image refers to sequentially performing predictive encoding on each macroblock in the plurality of macroblocks according to a preset order.
  • the predictive encoding is performed on the first pixel block of the luminance component in the macroblock, and for the predictive encoding of the pixel block of the chrominance component in the macroblock, existing or new predictive encoding techniques can be used, which are not described here Make specific restrictions.
  • Step 102 determining first standard deviation information, where the first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block.
  • the first standard deviation information may include at least one standard deviation that characterizes the degree of brightness dispersion of pixels in the first pixel block, and the first standard deviation information may be used to represent the texture of the first pixel block in the macroblock the complexity.
  • the first standard deviation information may include a first target standard deviation, denoted by SD, and the first target standard deviation may represent the brightness dispersion of the first pixel block in the horizontal direction and the vertical direction.
  • the first standard deviation information may include a first target standard deviation, a second target standard deviation, and a third target standard deviation
  • the second target standard deviation may represent the horizontal deviation of the first pixel block.
  • the brightness dispersion degree is expressed by SD H
  • the third target standard deviation can characterize the brightness dispersion degree of the first pixel block in the vertical direction, and is expressed by SD V.
  • the first standard deviation information may include the first target standard deviation, the second target standard deviation, the third target standard deviation, the fourth target standard deviation and the fifth target standard deviation, the fourth target standard deviation
  • the difference can represent the degree of dispersion of the differential brightness of every two adjacent pixels of the first pixel block in the horizontal direction, expressed by SD HH
  • the fifth target standard deviation can represent the difference between every two adjacent pixels of the first pixel block in the vertical direction
  • the degree of dispersion of the differential luminance of a pixel is represented by SD VV .
  • the pixel points in the first pixel block can be used to directly determine the first standard deviation information; the first pixel block can also be divided into N third pixel blocks, where N is an integer greater than 1, based on the N third pixel blocks. Subsampling to obtain N target pixel points, and determining the first standard deviation information based on the N target pixel points.
  • the luminance value of each target pixel is equal to the mean value of luminance values of all pixels in a third pixel block, so that the number of pixels for calculating the first standard deviation information can be reduced, thereby reducing the amount of calculation.
  • the first pixel block can be sub-sampled by 16:1.
  • the number of pixels after sampling is 1/16 of the number of pixels in the first pixel block.
  • 16 target pixels are obtained to form a 4 ⁇ 4 size
  • the sub-block of the first pixel block can also be sub-sampled by 4:1.
  • the number of pixels after sampling is 1/4 of the number of pixels in the first pixel block.
  • 64 target pixels are obtained.
  • a sub-block with a size of 8 ⁇ 8 can also be sub-sampled to the first pixel block at 64:1.
  • the number of pixels after sampling is 1/64 of the number of pixels in the first pixel block.
  • 4 target pixels to form a 2 ⁇ 2 sub-block.
  • Figure 2 is a schematic diagram of 4:1 subsampling, as shown in Figure 2
  • the left figure in Fig. 2 shows the pixels of the third pixel block, and the white solid circle represents the available pixels 201 in the third pixel block.
  • the target pixel 202 is the The four pixel points 201 are obtained by sub-sampling, and the brightness value thereof is obtained by averaging the brightness values of four surrounding pixel points.
  • the following formula (1) may be used to calculate the first target standard deviation.
  • N1 ⁇ N1 N
  • p(x, y) is the brightness value of the target pixel
  • m is the average brightness of N target pixels, where, when When the first pixel block is subjected to 16:1 sub-sampling, N1 is equal to 4.
  • the second target standard deviation can be calculated using the following formula (2).
  • SD y is the standard deviation of the luminance values of the pixel points in row y in the N1 ⁇ N1 sub-block, which is calculated by the following formula (3).
  • m y is the mean brightness value of all pixels in row y in the N1 ⁇ N1 sub-block.
  • the third target standard deviation can be calculated using the following formula (4).
  • SD x is the standard deviation of the luminance values of pixel points in x columns in the N1 ⁇ N1 sub-block, which is calculated by the following formula (5).
  • m x is the average brightness value of all pixels in column x in the N1 ⁇ N1 sub-block.
  • the fourth target standard deviation can be calculated using the following formula (6).
  • DSD y can be calculated by the following formula (7).
  • B h (x, y) is the first-order differential brightness value of every two adjacent pixels in the horizontal direction in the N1 ⁇ N1 sub-block
  • bm y represents all target pixels in row y in B h (x, y)
  • the mean brightness value of the point, B h (x, y) is calculated by the following formula (8).
  • the fifth target standard deviation can be calculated using the following formula (9).
  • DSD x can be calculated by the following formula (10).
  • B v (x, y) is the first-order differential brightness value of every two adjacent pixels in the vertical direction in the N1 ⁇ N1 sub-block
  • bm x represents all target pixels in column x in B v (x, y)
  • the mean value of brightness of a point, B v (x, y), is calculated by the following formula (11).
  • Step 103 Determine an intra-frame encoding type of the first pixel block based on the first standard deviation information, where the intra-frame encoding type is used to represent a pixel block size when performing intra-frame encoding on the first pixel block.
  • the H.264/AVC standard adopts intra-frame prediction based on the spatial domain, uses the reconstructed pixel values around the current macroblock to predict the pixels of the current coding block, and performs transformation, quantization and entropy coding on the prediction residual.
  • the intra-frame encoding type of the first pixel block of the luminance component in the macroblock is used to represent the pixel block size when the first pixel block is intra-frame encoded, and it can be divided into two types, one is 16 ⁇ 16, and the intra-frame encoding The type can be referred to as the first type.
  • the size of the pixel block when the first pixel block is intra-frame coded is equal to the size of the first pixel block.
  • This type of intra-frame coding can be called the second type.
  • the size of the pixel block when the first pixel block is intra-frame coded is smaller than the size of the first pixel block .
  • Determining the intra-frame coding type of the first pixel block based on the first standard deviation information refers to determining whether the intra-frame coding type of the first pixel block is the first type or the second type based on the first standard deviation information.
  • predictive coding is performed based on the first 16 ⁇ 16 pixel block. If the intra-frame encoding type of the first pixel block is determined to be the second type, predictive encoding is performed based on 4 ⁇ 4 pixel blocks, that is, the first pixel block is divided into multiple 4 ⁇ 4 pixel blocks for sequential predictive encoding.
  • the first standard deviation information representing the texture complexity of the first pixel block in the macroblock can be used to predict the size of the pixel block during intra-frame encoding.
  • the first target standard deviation, the second target standard deviation, the third target standard deviation, the fourth target standard deviation and the fifth target standard deviation may represent the texture complexity of the first pixel block in the macroblock to a certain extent.
  • the texture complexity is simpler; when the first target standard deviation is relatively large, it means that the brightness distribution of pixels in the first pixel block The more dispersed the brightness distribution of pixels, the more complex the texture complexity will be.
  • the second target standard deviation When the second target standard deviation is relatively small, it means that the brightness distribution of the pixels in the first pixel block in the horizontal direction is more concentrated, and correspondingly, the texture complexity in the horizontal direction is simpler.
  • the second target standard deviation When the second target standard deviation is relatively large , it means that the brightness distribution of pixels in the first pixel block in the horizontal direction is more scattered, and correspondingly, the texture complexity in the horizontal direction is more complex.
  • the standard deviation of the third target When the standard deviation of the third target is relatively small, it means that the brightness distribution of the pixels in the first pixel block in the vertical direction is more concentrated, and correspondingly, the texture complexity in the vertical direction is simpler.
  • the standard deviation of the third target When the standard deviation of the third target is relatively large , it means that the brightness distribution of pixels in the first pixel block in the vertical direction is more scattered, and correspondingly, the texture complexity in the vertical direction is more complex.
  • both the fourth target standard deviation and the fifth target standard deviation are relatively small, it means that the brightness distribution of the pixels in the first pixel block is flatter, and correspondingly, the texture complexity is smoother.
  • the first standard deviation information indicates that the texture complexity of the first pixel block is simple or relatively flat
  • it can be determined to perform predictive coding based on a 16 ⁇ 16 pixel block
  • the first standard deviation information indicates that the first pixel block
  • it may be determined to perform predictive coding based on 4 ⁇ 4 pixel blocks. In this way, there is no need to perform a full search of the 4 ⁇ 4 pixel blocks and the 16 ⁇ 16 pixel blocks, thereby effectively reducing the computational complexity of the intra-frame coding.
  • Step 104 selecting a target coding mode of the first pixel block from K preset coding modes corresponding to the intra-frame coding type.
  • K is an integer greater than 1.
  • different intra-frame coding types have different corresponding preset coding modes, where the preset coding mode may be an intra-frame coding mode.
  • the intra-frame coding type is the first type, that is, for areas with little spatial detail, the luminance component of the entire macroblock can be used as a whole, and predictive coding is performed based on 16 ⁇ 16 pixel blocks, H.264/AVC standard Four preset encoding modes corresponding to the first type are defined, which are respectively called vertical V, horizontal H, direct current D and flat P, as shown in FIG. 3 .
  • macroblocks containing rich details can be predictively encoded based on 4 ⁇ 4 pixel blocks.
  • the intra-frame coding type is the second type, in the H.264/AVC standard, the first pixel block Divided into 16 4 ⁇ 4 pixel blocks. Each pixel block is predicted by the 17 pixels on the adjacent top and left that have been encoded and reconstructed. As shown in Figure 4, the pixels represented by capital letters come from adjacent pixel blocks and have been decoded and reconstructed pixels. The pixels represented by lowercase letters are the pixels to be predictively coded in the current pixel block.
  • mode 0 to mode 8 there are 9 preset coding modes for predictive coding based on 4 ⁇ 4 pixel blocks, namely mode 0 to mode 8, among which mode 2 is direct current (DC) mean value prediction.
  • mode 2 is direct current (DC) mean value prediction.
  • the arrows in FIG. 5 indicate the prediction directions of other preset coding modes except mode 2, and the schematic diagram of prediction in various preset coding modes is shown in FIG. 6 .
  • a target coding mode of the first pixel block may be selected from K preset coding modes corresponding to the intra-frame coding type of the first pixel block.
  • the first method may be: for each predictively coded pixel block, traverse K preset coding modes corresponding to the intra-frame coding type, and calculate cost function values of various preset coding modes.
  • the preset encoding type is the first type
  • the preset encoding mode with the smallest cost function value may be selected as the target encoding mode of the first pixel block.
  • this selection method can reduce the traversal of the preset encoding modes. For the full search of the 4 ⁇ 4 and 16 ⁇ 16 preset encoding modes, it is usually necessary to calculate 148 different cost functions value to select the target encoding mode, and in this embodiment, only four different cost function values need to be calculated, thereby greatly reducing the computational complexity.
  • interpolation establishes a 4 ⁇ 4 intra-frame prediction block in the first pixel block, calculates the error information between the intra-frame prediction block and the original pixel block, and traverses 9 preset encodings mode, calculate the cost function value in each preset coding mode based on the error information, and select the preset coding mode with the smallest cost function value as the best coding mode for the intra prediction block.
  • the 4 ⁇ 4 intra-frame prediction blocks in the first pixel block all have their corresponding optimal coding modes, and the target coding mode of the first pixel block is based on the set of all intra-frame prediction blocks in the first pixel block.
  • This selection method can reduce the traversal of the preset coding modes. Compared with the full search of the 4 ⁇ 4 and 16 ⁇ 16 preset coding modes, it can avoid the traversal of the 16 ⁇ 16 preset coding modes, thereby reducing the calculation the complexity.
  • the cost function value in the preset encoding mode may be the minimum rate-distortion cost function value, or may be the absolute error transformation and the cost function value, which is not specifically limited here.
  • the rate-distortion cost function is defined as shown in the following formula (12).
  • QP, ⁇ MODE ) SSD(s,c,IMODE
  • QP, ⁇ MODE ) is the value of the rate-distortion cost function
  • QP is the quantization parameter
  • IMODE represents one of the preset coding modes available
  • s represents the original pixel value
  • c represents the reconstructed value, which is obtained through discrete cosine transform (Discrete Cosine Transform, DCT), quantization, inverse discrete cosine transform (Inverse Discrete Cosine Transform, IDCT) and inverse quantization
  • QP) represents the number of coding bits when IMODE mode is selected, including the number of bits used in the preset coding mode and the number of bits used to code the brightness transformation coefficient.
  • Context Adaptive Binary Arithmetic Coding Context Adaptive Binary Arithmetic Coding
  • CABAC Context Adaptive Binary Arithmetic Coding
  • CAVLC Context Adaptive Variable Length Coding
  • SSD is the sum of squared errors of s and c, let A represent the pixel area, then SSD can be calculated using the following formula (13).
  • the second type can be: in the case where the preset coding type is the second type, that is, predictive coding is performed based on a 4 ⁇ 4 pixel block, and the similarity of the coding mode and texture structure of the current pixel block and its surrounding pixel blocks can be used , exclude impossible prediction directions in advance, finally determine the best coding mode of the current pixel block, and obtain the target coding mode of the first pixel block.
  • This selection method will be described in detail in the following embodiments.
  • the image to be encoded includes a macroblock, and the macroblock includes the first pixel block of the brightness component; the first standard deviation information is determined, and the first standard deviation information is used to represent The brightness dispersion degree of the pixels in the first pixel block; determine the intra-frame coding type of the first pixel block based on the first standard deviation information, and the intra-frame coding type is used to characterize the first pixel block A pixel block size when intra-frame coding is performed; a target coding mode of the first pixel block is selected from K preset coding modes corresponding to the intra-frame coding type.
  • the size of the pixel block for intra-frame coding can be determined in advance under the premise of ensuring that the coding quality is basically unchanged, so that unnecessary calculation of the cost function can be avoided, thereby reducing the cost of the predictive coding algorithm. computational complexity.
  • the first standard deviation information includes first target standard deviation and second standard deviation information, and the first target standard deviation is used to characterize the brightness dispersion of the first pixel block in the horizontal direction and vertical direction degree, the determining the intra-frame coding type of the first pixel block based on the first standard deviation information includes:
  • the intra-frame coding type is a first type, and the first type represents a pixel block size when intra-frame coding is performed on the first pixel block equal to the size of the first pixel block;
  • the intra-frame coding type is determined based on the second standard deviation information.
  • the first target standard deviation can reflect the degree of brightness dispersion of pixels in the first pixel block as a whole.
  • the second The luminance distribution of pixels in a pixel block is relatively concentrated, which means that the texture in the first pixel block is relatively simple.
  • the encoding effect of performing predictive encoding on the first pixel block as a whole is generally better, so the intra-frame encoding type can be determined as the first type.
  • the intra coding type of the first pixel block may be further determined based on the second standard deviation information.
  • the second standard deviation information is to evaluate the texture characteristics of the first pixel block in the horizontal direction and the texture characteristics in the vertical direction from the brightness dispersion degree in the horizontal direction and the brightness dispersion degree in the vertical direction of the first pixel block respectively.
  • the intra-frame encoding type as the first type, otherwise determine the intra-frame encoding
  • the type is the second type.
  • the first threshold may be set according to actual conditions, and is not specifically limited here.
  • the intra-frame encoding type when the first standard deviation is less than or equal to the first threshold, it is determined that the intra-frame encoding type is the first type, and the first type indicates that the first pixel block performs intra-frame coding.
  • the size of the pixel block during encoding is equal to the size of the first pixel block; if the first standard deviation is greater than the first threshold, the intra-frame coding type is determined based on the second standard deviation information. In this way, the determination of the intra-coding type of the first pixel block can be realized.
  • the second standard deviation information includes a second target standard deviation, a third target standard deviation, and third standard deviation information
  • the second target standard deviation is used to characterize the horizontal direction of the first pixel block.
  • the brightness dispersion degree of the said third target standard deviation is used to characterize the brightness dispersion degree of the first pixel block in the vertical direction
  • the determination of the intra-frame coding type based on the second standard deviation information includes:
  • the second target standard deviation is less than or equal to a second threshold, or the third target standard deviation is less than or equal to a third threshold, determine that the intra-frame coding type is the first type
  • the intra-frame coding type is determined based on the third standard deviation information.
  • the second target standard deviation can reflect the brightness dispersion degree of the first pixel block in the horizontal direction.
  • the first pixel can be determined The luminance distribution of the pixels in the block in the horizontal direction is concentrated, which means that the texture of the first pixel block in the horizontal direction is relatively simple.
  • the encoding effect of performing predictive encoding on the first pixel block as a whole is generally better, so the intra-frame encoding type can be determined as the first type.
  • the third target standard deviation can reflect the brightness dispersion degree of the first pixel block in the vertical direction.
  • the third target standard deviation is relatively small and is less than or equal to the third threshold, it can be determined
  • the luminance distribution of the pixel points is concentrated, which means that the texture of the first pixel block in the vertical direction is relatively simple.
  • the encoding effect of performing predictive encoding on the first pixel block as a whole is generally better, so the intra-frame encoding type can be determined as the first type.
  • the intra coding type of the first pixel block may be further determined based on the third standard deviation information.
  • the third standard deviation information is the degree of dispersion of the differential brightness of every two adjacent pixel points in the horizontal direction from the first pixel block, and the dispersion of the differential brightness of every two adjacent pixel points of the first pixel block in the vertical direction degree, to evaluate whether the luminance value of the pixel in the first pixel block is flat.
  • the intra-frame coding type is the first type; otherwise, it is determined that the intra-frame coding type is the second type.
  • the second threshold and the third threshold can be set according to actual conditions, and are not specifically limited here.
  • the intra-frame coding type is the first One type: when the second target standard deviation is greater than the second threshold and the third target standard deviation is greater than the third threshold, determine the intra-frame encoding based on the third standard deviation information type. In this way, the determination of the intra-frame encoding type of the first pixel block can be further realized, and the omission of the 16 ⁇ 16 preset encoding mode such as vertical V or horizontal H can be avoided, resulting in a decrease in encoding quality.
  • the third standard deviation information includes a fourth target standard deviation and a fifth target standard deviation
  • the fourth target standard deviation is used to characterize every two adjacent pixels of the first pixel block in the horizontal direction.
  • the degree of dispersion of the differential brightness of points, the fifth target standard deviation is used to characterize the degree of dispersion of the differential brightness of every two adjacent pixel points in the vertical direction of the first pixel block, the third standard based on
  • the difference information determines the intra coding type, including:
  • the fourth target standard deviation is less than or equal to a fourth threshold
  • the fifth target standard deviation is less than or equal to a fifth threshold
  • the fourth target standard deviation is greater than the fourth threshold, or the fifth target standard deviation is greater than the fifth threshold, determine that the intra-frame coding type is the second type, and the second type
  • the size of the pixel block representing the intra-frame encoding of the first pixel block is smaller than the size of the first pixel block.
  • the fourth target standard deviation can reflect the brightness flatness of the first pixel block in the horizontal direction.
  • the first pixel block can be determined The brightness of the pixel points in the block in the horizontal direction is relatively flat
  • the fifth target standard deviation can reflect the flatness of the brightness of the first pixel block in the vertical direction.
  • the fifth target standard deviation is relatively small and is less than or equal to the fifth threshold In this case, it may be determined that the brightness of the pixel points in the vertical direction of the first pixel block is relatively flat.
  • the fourth target standard deviation is less than or equal to the fourth threshold
  • the fifth target standard deviation is less than or equal to the fifth threshold
  • the texture of the first pixel block is relatively smooth.
  • the encoding effect of performing predictive encoding on the first pixel block as a whole is generally better, so the intra-frame encoding type can be determined as the first type.
  • the fourth threshold and the fifth threshold can be set according to actual conditions, and are not specifically limited here.
  • the intra-frame coding type is determined to be the second type, so that the determination of the intra-frame coding type of the first pixel block can be further realized, and the 16 ⁇ 16 preset coding mode such as flat P Omission, resulting in a decline in encoding quality.
  • the method before determining the first standard deviation information, the method further includes:
  • Subsampling is performed based on the N third pixel blocks to obtain N target pixel points, and the brightness value of each target pixel point is equal to the mean value of the brightness values of all pixel points in a third pixel block;
  • Said determination of the first standard deviation information includes:
  • the first standard deviation information is determined based on the pixel block formed by the N target pixel points.
  • the first pixel block can be divided into N third pixel blocks, N is an integer greater than 1, sub-sampling is performed based on the N third pixel blocks to obtain N target pixel points, and based on these N
  • the target pixel is used to determine the first standard deviation information.
  • the luminance value of each target pixel is equal to the mean value of luminance values of all pixels in a third pixel block.
  • the first pixel block can be sub-sampled by 16:1.
  • the number of pixels after sampling is 1/16 of the number of pixels in the first pixel block.
  • 16 target pixels are obtained to form a 4 ⁇ 4 size
  • the sub-block of the first pixel block can also be sub-sampled by 4:1.
  • the number of pixels after sampling is 1/4 of the number of pixels in the first pixel block.
  • 64 target pixels are obtained.
  • a sub-block with a size of 8 ⁇ 8 can also be sub-sampled to the first pixel block at 64:1.
  • the number of pixels after sampling is 1/64 of the number of pixels in the first pixel block.
  • 4 target pixels to form a 2 ⁇ 2 sub-block.
  • the number of pixels after sampling is 1/4 of the number of pixels in the first pixel block, while in 16:1 subsampling, the number of pixels after sampling is the first pixel 1/16 of the number of pixels in the block.
  • the number of pixels for calculating the first standard deviation information can be reduced, thereby reducing the amount of calculation.
  • the intra-frame coding type is the second type, and the second type indicates that the size of the pixel block when performing intra-frame coding on the first pixel block is smaller than the size of the first pixel block, and the Selecting the target coding mode of the first pixel block from the K preset coding modes corresponding to the intra-frame coding type, including:
  • the first pixel block includes the M second pixel blocks, the size of each second pixel block is the same as the intra-frame coding type
  • M is an integer greater than 1;
  • the first candidate coding mode of the target pixel block is selected from the K preset coding modes corresponding to the intra coding type, and the target pixel block is the M second Any pixel block in the pixel block;
  • the fourth pixel block is the same as in the image to be coded
  • the fifth pixel block is a pixel block adjacent to the left of the target pixel block in the image to be encoded
  • the target coding mode is determined based on the first candidate coding mode and the second candidate coding mode.
  • This embodiment is limited to the selection process of the preset coding mode when the intra-frame coding type is the second type, which adopts the second selection method in the above-mentioned embodiment, that is, using the current pixel block and its surrounding pixel blocks
  • the similarity between the coding mode and the texture structure excludes impossible prediction directions in advance, finally determines the best coding mode of the current pixel block, and obtains the target coding mode of the first pixel block.
  • the first pixel block is divided into 16 4 ⁇ 4 second pixel blocks, for each second pixel block, and for each first pixel point in the second pixel block, based on Sobel Sobel
  • the operator calculates the edge vector of the first pixel point to obtain edge vector information of the second pixel block.
  • the edge vectors of all the first pixel points in the second pixel block constitute the edge vector information of the second pixel block.
  • the first candidate coding mode of the second pixel block can be selected from 9 preset coding modes.
  • the predicted direction angle and brightness difference intensity of all first pixels in the target pixel block can be determined, based on the predicted direction angle and brightness difference of all first pixel points To determine the best prediction direction of the target pixel block, so as to determine the first candidate coding mode of the target pixel block.
  • the second candidate coding mode of the target pixel block may be determined based on the fourth pixel block and the fifth pixel block, and the second candidate coding mode is the most likely coding mode of the target pixel block, represented by predIntraPredMode.
  • predIntraPredMode For the determination process, reference may be made to the H.264/AVC standard, which is not specifically limited here.
  • the relationship between the fourth pixel block, the fifth pixel block and the target pixel block is as shown in FIG.
  • the fifth pixel block 703 is located on the left of the target pixel block 701 and adjacent to the target pixel block 701 .
  • a target coding mode may be determined based on the first candidate coding mode and the second candidate coding mode. Specifically, in the case that the first candidate encoding mode and the second candidate encoding mode are the same, the first candidate encoding mode may be directly determined as the target encoding mode, or the cost function values of the first candidate encoding mode and mode 2 may be traversed, Select the first candidate coding mode and the coding mode with a small cost function value in mode 2 as the target coding mode.
  • the rate-distortion cost function values of the L candidate encoding modes can be traversed, and the encoding mode with the smallest rate-distortion cost function value among the L candidate encoding modes can be selected as the target encoding mode.
  • the L candidate encoding modes may include the first candidate encoding mode and the second candidate encoding mode, or may also include mode 2 while including the first candidate encoding mode and the second candidate encoding mode.
  • the similarity between the coding mode and texture structure of the current pixel block and its surrounding pixel blocks can be used to exclude impossible prediction directions in advance, and finally determine the current pixel
  • the optimal coding mode of the block is obtained to obtain the target coding mode of the first pixel block, so that unnecessary calculation of the cost function can be avoided, thereby further reducing the computational complexity of the predictive coding algorithm.
  • the edge vector information includes an edge vector of each first pixel in the target pixel block, where the edge vector is used to characterize the degree of brightness difference between the first pixel and the second pixel,
  • the second pixel is a pixel adjacent to the first pixel in the image to be encoded
  • the following equations (16) and (17) can be used to calculate the first brightness difference intensity and the first direction angle of the first pixel.
  • the second direction angle that is, the prediction direction angle ⁇ is defined as shown in the following formula (18).
  • the first orientation angle is the second orientation angle
  • the second direction angle can be obtained by subtracting ⁇ from the first direction angle
  • the second direction angle corresponds to the angle range of the preset coding mode, that is, based on the correspondence between the second direction angle and the angle range, and the correspondence between the preset coding mode and the angle range, the predicted direction of each first pixel can be
  • the corners are classified into corresponding preset coding modes to determine the first candidate coding mode in combination with the first intensity of brightness difference.
  • the first brightness difference intensity and the first direction angle of the first pixel point are determined through the edge vector information of the target pixel block, and the second direction angle corresponding to the preset coding mode is determined based on the first direction angle, and at the same time A first candidate coding mode is selected from K preset coding modes in combination with the first brightness difference strength. In this way, the selection of the first candidate encoding mode can be realized, some less likely encoding modes can be excluded, and unnecessary calculation of the cost function can be avoided.
  • the selecting the first candidate coding mode from the K preset coding modes based on the first brightness difference strength and the second direction angle includes:
  • the preset coding mode corresponding to the target brightness difference strength is determined as the first candidate coding mode, and the target brightness difference strength is the largest second brightness difference strength among the second brightness difference strengths in various preset coding modes.
  • the predicted direction angle of each first pixel point can be classified into the corresponding preset coding mode, and the edge strength of the same preset coding mode, that is, the first brightness difference strength, is accumulated.
  • Table 1 shows the corresponding relationship between the preset encoding mode and the angle range.
  • the prediction direction angle of the first pixel can be summarized into the corresponding preset encoding mode, for example, the prediction direction The angle is 2 ⁇ /16, which can be generalized into mode 8.
  • the first brightness difference intensities of the first pixels in the same preset encoding mode are accumulated. Assuming that the predicted direction angle of the current first pixel point is classified into the kth mode, that is, mode k, and Stren(mode k ) represents the brightness difference intensity under mode k, that is, the edge intensity, then the edge intensity is calculated according to the following formula (19): renew.
  • the best encoding mode for the target pixel block can be determined according to the degree of brightness difference between the first pixel point and the second pixel point, so as to realize the selection of the first candidate encoding mode.
  • the determining the target coding mode based on the first candidate coding mode and the second candidate coding mode includes:
  • the target coding mode with the first candidate coding mode If the first candidate coding mode is the same as the second candidate coding mode, determine the target coding mode with the first candidate coding mode;
  • the target candidate coding mode is a candidate coding mode with the smallest rate-distortion cost function value among the L candidate coding modes
  • the L candidate coding modes include the first candidate coding mode and the second candidate coding mode
  • L is an integer greater than 1.
  • the L candidate encoding modes may also include mode 2, namely DC mean value prediction. If the first candidate encoding mode is different from the second candidate encoding mode, the first candidate encoding mode intraPredMode, the second candidate encoding mode The modes predIntraPredMode and DC mean prediction are used as three candidate coding modes, and the coding mode with the smallest cost function value is selected as the target coding mode. In this way, it is possible to prevent the omission of possible candidate coding modes from degrading the coding quality, thereby ensuring the quality of video coding.
  • mode 2 namely DC mean value prediction.
  • the intra-frame encoding type is the first type, and the first type indicates that the size of the pixel block when performing intra-frame encoding on the first pixel block is equal to the size of the first pixel block, and the Selecting the target coding mode of the first pixel block from the K preset coding modes corresponding to the intra-frame coding type, including:
  • the target cost function value is the absolute error transformation and cost corresponding to the K preset coding modes Among the function values, the minimum cost function value.
  • a Sum of Absolute Transform Difference (SATD) cost function may be used instead of the rate-distortion cost function.
  • SATD is the transformed residual, which not only reflects the distortion, but also reflects the size of the generated code stream to a certain extent. Therefore, it can be used as the basis for the selection of the coding mode.
  • the SATD cost function is shown in the following formula (20).
  • IMODE is one of the 4 predictive coding modes of 16 ⁇ 16
  • T represents the Hadamard transform
  • Ha represent the a-order Hadamard matrix
  • the Hadamard matrix can be obtained recursively using the following equations (22) and (23).
  • the preset coding mode with the smallest SATD cost function value among the 4 preset coding modes can be determined as the target candidate mode, and the determination of the target coding mode can be realized while reducing the calculation amount of the cost function value, so that Unnecessary calculation of the cost function is avoided, so that the computational complexity of the predictive coding algorithm can be further reduced.
  • this predictive coding scenario only 4 cost functions need to be calculated, which greatly improves the coding speed of the intra prediction module in the video encoder compared to the 148 cost function calculations of the full search.
  • a macroblock may adopt intra-frame coding or inter-frame coding, therefore, it is necessary to perform intra-frame prediction and inter-frame prediction on the macroblock respectively, To determine whether to use intra-coding or inter-coding.
  • intra-frame prediction the predictive coding of the pixel blocks of the luminance component and the predictive coding of the pixel blocks of the chrominance components are independent of each other, and decisions can be made separately.
  • the selection of the target coding mode for the pixel block of the luminance component can be determined by using the predictive coding method of the above embodiment, and the selection of the target coding mode for the pixel block of the chrominance component can be determined based on the rate-distortion cost function.
  • the total intra prediction cost and the inter prediction cost in the macroblock can be calculated, and the intra prediction cost and the inter prediction cost can be compared Size, in order to perform intra-coding or inter-coding selection.
  • the total intra prediction cost calculation in the macroblock uses the Lagrangian model shown in the following formula (24), but when calculating the sum of squared errors, the sum of the squared errors of the pixel blocks of the luma component and the pixel blocks of the chroma component is required .
  • s Y represents the original pixel value of the pixel block of the luminance component
  • c Y represents the reconstructed value of the luminance
  • s U represents the original pixel value of the chrominance component U
  • c U represents the reconstruction of the chrominance component U value
  • s V represents the original pixel value of the chrominance component V
  • c V represents the reconstructed value of the chrominance component V.
  • QP) is the total number of bits when the target coding mode is adopted, including the number of bits used to encode the macroblock header information and the number of encoded bits of the transform coefficients of the pixel blocks of the Y, U, and V components.
  • the predictive coding method provided in the embodiment of the present application may be executed by a predictive coding device, or a control module in the predictive coding device for executing the predictive coding method.
  • the predictive coding device provided in the embodiment of the present application is described by taking the predictive coding device performing the predictive coding method as an example.
  • FIG. 8 is a structural diagram of a predictive encoding device provided by an embodiment of the present application.
  • the predictive encoding device 800 includes:
  • An acquisition module 801 configured to acquire an image to be encoded, where the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component;
  • the first determining module 802 is configured to determine first standard deviation information, where the first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block;
  • the second determination module 803 is configured to determine the intra-frame coding type of the first pixel block based on the first standard deviation information, and the intra-frame coding type is used to represent the intra-frame coding of the first pixel block pixel block size;
  • the selection module 804 is configured to select a target coding mode of the first pixel block from K preset coding modes corresponding to the intra coding type, where K is an integer greater than 1.
  • the first standard deviation information includes first target standard deviation and second standard deviation information
  • the first target standard deviation is used to characterize the brightness dispersion of the first pixel block in the horizontal direction and vertical direction degree
  • the second determination module 803 includes:
  • a first determining submodule configured to determine that the intra-frame encoding type is a first type when the first standard deviation is less than or equal to a first threshold, and the first type indicates that the first pixel block performs The size of the pixel block during intra-frame encoding is equal to the size of the first pixel block;
  • a second determining submodule configured to determine the intra-frame coding type based on the second standard deviation information when the first standard deviation is greater than the first threshold.
  • the second determining submodule includes:
  • a first determining unit configured to determine that the intra-frame coding type is the first type
  • a second determining unit configured to determine the set based on the third standard deviation information when the second target standard deviation is greater than the second threshold and the third target standard deviation is greater than the third threshold Intra-frame coding type described above.
  • the third standard deviation information includes a fourth target standard deviation and a fifth target standard deviation
  • the fourth target standard deviation is used to characterize every two adjacent pixels of the first pixel block in the horizontal direction.
  • the degree of dispersion of the differential brightness of points, the fifth target standard deviation is used to characterize the degree of dispersion of the differential brightness of every two adjacent pixel points in the vertical direction of the first pixel block
  • the second determination unit specifically Used for:
  • the fourth target standard deviation is less than or equal to a fourth threshold
  • the fifth target standard deviation is less than or equal to a fifth threshold
  • the fourth target standard deviation is greater than the fourth threshold, or the fifth target standard deviation is greater than the fifth threshold, determine that the intra-frame coding type is the second type, and the second type
  • the size of the pixel block representing the intra-frame encoding of the first pixel block is smaller than the size of the first pixel block.
  • the device also includes:
  • a division module configured to divide the first pixel block into N third pixel blocks, the number of pixels in each third pixel block is equal, and N is an integer greater than 1;
  • Sub-sampling module for performing sub-sampling based on the N third pixel blocks to obtain N target pixels, the brightness value of each target pixel point is equal to the mean value of the brightness values of all pixels in a third pixel block;
  • the first determining module is specifically configured to determine the first standard deviation information based on the pixel block formed by the N target pixel points.
  • the intra-frame encoding type is the second type, and the second type indicates that the size of the pixel block when the first pixel block is intra-frame encoded is smaller than the size of the first pixel block, and the selection module 804 includes:
  • the third determination sub-module is used to determine the edge vector information of each second pixel block in the M second pixel blocks, the first pixel block includes the M second pixel blocks, and the edge vector information of each second pixel block
  • the size corresponds to the intra-frame coding type, and M is an integer greater than 1;
  • a selection submodule configured to select a first candidate coding mode of the target pixel block from K preset coding modes corresponding to the intra coding type based on edge vector information of the target pixel block, the target pixel block being Any pixel block in the M second pixel blocks;
  • a fourth determining submodule configured to determine a second candidate coding mode of the target pixel block based on the coding mode of the fourth pixel block and the coding mode of the fifth pixel block in the image to be coded, the fourth pixel block is a pixel block adjacent to the upper side of the target pixel block in the image to be encoded, and the fifth pixel block is a pixel block adjacent to the left side of the target pixel block in the image to be encoded;
  • a fifth determining submodule configured to determine the target coding mode based on the first candidate coding mode and the second candidate coding mode.
  • the edge vector information includes an edge vector of each first pixel in the target pixel block, where the edge vector is used to characterize the degree of brightness difference between the first pixel and the second pixel,
  • the second pixel is a pixel adjacent to the first pixel in the image to be encoded
  • the selection submodule includes:
  • a third determining subunit configured to determine the first brightness difference intensity and the first direction angle of each of the first pixel points based on the edge vector information of the target pixel block;
  • the fourth determining subunit is configured to determine, for each of the first pixels, a second direction angle of the first pixel based on the first direction angle of the first pixel, and the second direction angle Corresponding to the angle range of the preset encoding mode;
  • a selection subunit is configured to select the first candidate coding mode from the K preset coding modes based on the first brightness difference strength and the second direction angle.
  • the selection subunit is specifically used for:
  • the preset coding mode corresponding to the target brightness difference strength is determined as the first candidate coding mode, and the target brightness difference strength is the largest second brightness difference strength among the second brightness difference strengths in various preset coding modes.
  • the fifth determining submodule is specifically used for:
  • the target coding mode with the first candidate coding mode If the first candidate coding mode is the same as the second candidate coding mode, determine the target coding mode with the first candidate coding mode;
  • the target candidate coding mode is a candidate coding mode with the smallest rate-distortion cost function value among the L candidate coding modes
  • the L candidate coding modes include the first candidate coding mode and the second candidate coding mode
  • L is an integer greater than 1.
  • the intra-frame encoding type is the first type
  • the first type indicates that the size of the pixel block when the first pixel block is intra-frame encoded is equal to the size of the first pixel block
  • the selection module 804 includes:
  • the sixth determining submodule is used to determine the absolute error transformation and cost function value of each preset coding mode under the K preset coding modes;
  • the seventh determination submodule is used to determine the preset coding mode corresponding to the target cost function value in the K preset coding modes as the target coding mode, and the target cost function value is the K preset coding mode The minimum cost function value among the absolute error transformation and cost function value corresponding to the mode.
  • the image to be encoded is acquired by the acquisition module 801, the image to be encoded includes a macroblock, and the macroblock includes the first pixel block of the luminance component; the first standard deviation information is determined by the first determination module 802, and the The first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block; the intra-frame coding type of the first pixel block is determined based on the first standard deviation information through the second determination module 803, The intra-frame encoding type is used to characterize the pixel block size when the first pixel block is intra-frame encoded; the first pixel block is selected from K preset encoding modes corresponding to the intra-frame encoding type through the selection module 804 The target encoding mode for the pixel block.
  • the size of the pixel block for intra-frame coding can be determined in advance under the premise of ensuring that the coding quality is basically unchanged, so that unnecessary calculation of the cost function can be avoided, thereby reducing the cost of the predictive coding algorithm. computational complexity.
  • the predictive encoding device in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal.
  • the device may be a mobile electronic device or a non-mobile electronic device.
  • the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant).
  • non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
  • Network Attached Storage NAS
  • personal computer personal computer, PC
  • television television
  • teller machine or self-service machine etc.
  • the predictive encoding device in this embodiment of the present application may be a device with an operating system.
  • the operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
  • the predictive encoding device provided in the embodiment of the present application can implement various processes implemented in the method embodiment in FIG. 1 , and details are not repeated here to avoid repetition.
  • the embodiment of the present application further provides an electronic device 900, including a processor 901, a memory 902, and programs or instructions stored in the memory 902 and operable on the processor 901,
  • the program or instruction is executed by the processor 901, it realizes each process of the above-mentioned embodiment of the predictive coding method, and can achieve the same technical effect. To avoid repetition, details are not repeated here.
  • the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
  • FIG. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
  • the electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010, etc. part.
  • the electronic device 1000 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 1010 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions.
  • a power supply such as a battery
  • the structure of the electronic device shown in FIG. 10 does not constitute a limitation to the electronic device.
  • the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange different components, and details will not be repeated here. .
  • processor 1010 is used for:
  • the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component;
  • first standard deviation information determining first standard deviation information, where the first standard deviation information is used to characterize the degree of brightness dispersion of pixels in the first pixel block;
  • the intra-frame coding type is used to represent a pixel block size when performing intra-frame coding on the first pixel block;
  • K is an integer greater than 1.
  • the image to be encoded is acquired by the processor 1010, the image to be encoded includes a macroblock, and the macroblock includes a first pixel block of a luminance component; the first standard deviation information is determined, and the first standard deviation information It is used to characterize the degree of brightness dispersion of pixels in the first pixel block; the intra-frame coding type of the first pixel block is determined based on the first standard deviation information, and the intra-frame coding type is used to characterize the first pixel block A pixel block size when intra-frame encoding is performed on a pixel block; a target encoding mode of the first pixel block is selected from K preset encoding modes corresponding to the intra-frame encoding type.
  • the size of the pixel block for intra-frame coding can be determined in advance under the premise of ensuring that the coding quality is basically unchanged, so that unnecessary calculation of the cost function can be avoided, thereby reducing the cost of the predictive coding algorithm. computational complexity.
  • the first standard deviation information includes first target standard deviation and second standard deviation information, and the first target standard deviation is used to represent brightness dispersion of the first pixel block in the horizontal direction and vertical direction degree, Processor 1010, is also used to:
  • the intra-frame coding type is a first type, and the first type represents a pixel block size when intra-frame coding is performed on the first pixel block equal to the size of the first pixel block;
  • the intra-frame coding type is determined based on the second standard deviation information.
  • the second standard deviation information includes a second target standard deviation, a third target standard deviation, and third standard deviation information
  • the second target standard deviation is used to characterize the horizontal direction of the first pixel block.
  • luminance dispersion degree the third target standard deviation is used to characterize the luminance dispersion degree of the first pixel block in the vertical direction
  • the processor 1010 is further configured to:
  • the second target standard deviation is less than or equal to a second threshold, or the third target standard deviation is less than or equal to a third threshold, determine that the intra-frame coding type is the first type
  • the intra-frame coding type is determined based on the third standard deviation information.
  • the third standard deviation information includes a fourth target standard deviation and a fifth target standard deviation
  • the fourth target standard deviation is used to characterize every two adjacent pixels of the first pixel block in the horizontal direction.
  • the degree of dispersion of the differential brightness of points, the fifth target standard deviation is used to characterize the degree of dispersion of the differential brightness of every two adjacent pixel points in the vertical direction of the first pixel block, and the processor 1010 is further configured to:
  • the fourth target standard deviation is less than or equal to a fourth threshold
  • the fifth target standard deviation is less than or equal to a fifth threshold
  • the fourth target standard deviation is greater than the fourth threshold, or the fifth target standard deviation is greater than the fifth threshold, determine that the intra-frame coding type is the second type, and the second type
  • the size of the pixel block representing the intra-frame encoding of the first pixel block is smaller than the size of the first pixel block.
  • processor 1010 is also used for:
  • Subsampling is performed based on the N third pixel blocks to obtain N target pixel points, and the brightness value of each target pixel point is equal to the mean value of the brightness values of all pixel points in a third pixel block;
  • Processor 1010 specifically for:
  • the first standard deviation information is determined based on the pixel block formed by the N target pixel points.
  • the intra-frame coding type is a second type, and the second type indicates that the size of the pixel block when the first pixel block is intra-frame coded is smaller than the size of the first pixel block, and the processor 1010, Also used for:
  • the first pixel block includes the M second pixel blocks, the size of each second pixel block is the same as the intra-frame coding type
  • M is an integer greater than 1;
  • the first candidate coding mode of the target pixel block is selected from the K preset coding modes corresponding to the intra coding type, and the target pixel block is the M second Any pixel block in the pixel block;
  • the fourth pixel block is the same as in the image to be coded
  • the fifth pixel block is a pixel block adjacent to the left of the target pixel block in the image to be encoded
  • the target coding mode is determined based on the first candidate coding mode and the second candidate coding mode.
  • the edge vector information includes an edge vector of each first pixel in the target pixel block, where the edge vector is used to characterize the degree of brightness difference between the first pixel and the second pixel,
  • the second pixel is a pixel adjacent to the first pixel in the image to be encoded, and the processor 1010 is further configured to:
  • processor 1010 is also used for:
  • the preset coding mode corresponding to the target brightness difference strength is determined as the first candidate coding mode, and the target brightness difference strength is the largest second brightness difference strength among the second brightness difference strengths in various preset coding modes.
  • processor 1010 is also used for:
  • the target coding mode with the first candidate coding mode If the first candidate coding mode is the same as the second candidate coding mode, determine the target coding mode with the first candidate coding mode;
  • the target candidate coding mode is a candidate coding mode with the smallest rate-distortion cost function value among the L candidate coding modes
  • the L candidate coding modes include the first candidate coding mode and the second candidate coding mode
  • L is an integer greater than 1.
  • the intra-frame coding type is a first type, and the first type indicates that the size of the pixel block when performing intra-frame coding on the first pixel block is equal to the size of the first pixel block, and the processor 1010, Also used for:
  • the target cost function value is the absolute error transformation and cost corresponding to the K preset coding modes Among the function values, the minimum cost function value.
  • the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 is used for the image capture device (such as the image data of the still picture or video obtained by the camera) for processing.
  • the display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the user input unit 1007 includes a touch panel 10071 and other input devices 10072 .
  • the touch panel 10071 is also called a touch screen.
  • the touch panel 10071 may include two parts, a touch detection device and a touch controller.
  • Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, and joysticks, which will not be repeated here.
  • the memory 1009 can be used to store software programs as well as various data, including but not limited to application programs and operating systems.
  • Processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces, and application programs, and the modem processor mainly processes wireless communications. It can be understood that the foregoing modem processor may not be integrated into the processor 1010 .
  • the embodiment of the present application also provides a readable storage medium, the readable storage medium may be nonvolatile or volatile, the readable storage medium stores programs or instructions, and the programs or instructions are stored in When executed by the processor, each process of the above embodiment of the predictive coding method can be realized, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.
  • the processor is the processor in the electronic device described in the above embodiments.
  • the readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
  • the embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above-mentioned predictive coding method embodiment
  • the chip includes a processor and a communication interface
  • the communication interface is coupled to the processor
  • the processor is used to run programs or instructions to implement the above-mentioned predictive coding method embodiment
  • chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
  • An embodiment of the present application further provides a computer program product, wherein the computer program product is stored in a non-transitory readable storage medium, and the computer program product is executed by at least one processor to implement the above location information reporting
  • the computer program product is stored in a non-transitory readable storage medium, and the computer program product is executed by at least one processor to implement the above location information reporting
  • the term “comprising”, “comprising” or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase “comprising a " does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
  • the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

Landscapes

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

Abstract

本申请公开了一种预测编码方法、装置和电子设备,属于视频编码技术领域。该方法包括:获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。

Description

预测编码方法、装置和电子设备
相关申请的交叉引用
本申请主张在2021年07月29日在中国提交的中国专利申请No.202110864260.3的优先权,其全部内容通过引用包含于此。
技术领域
本申请属于视频编码技术领域,具体涉及一种预测编码方法、装置和电子设备。
背景技术
视频编码以视频信号的高度相关性和人眼的视觉特性为出发点,通过恰当的编码方式,消除各种相关性和人眼特性所产生的冗余,来达到压缩视频信号和减小传输码率的目的。
目前,在H.264/高级视频编码(Advanced Video Coding,AVC)中,帧内编码通常采用多方向空间预测技术,即按照图像本身的特点选择一个最佳的预测方向,以最大限度地去除空间冗余。同时,H.264/AVC可以支持可变块大小的预测编码,对于宏块中亮度分量的像素块的预测编码,可以基于4×4的像素块或16×16的像素块进行预测编码。
相关技术中,为了确定最佳的帧内编码模式,通常是分别计算宏块中亮度分量的像素块在所有帧内编码模式下的率失真代价函数值,并选择使率失真代价函数值最小的帧内编码模式,这导致预测编码算法的计算复杂度非常高。
发明内容
本申请实施例的目的是提供一种预测编码方法、装置和电子设备,能够解决视频编码技术中预测编码算法的计算复杂度非常高的问题。
第一方面,本申请实施例提供了一种预测编码方法,该方法包括:
获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
第二方面,本申请实施例提供了一种预测编码装置,该装置包括:
获取模块,用于获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
第一确定模块,用于确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
第二确定模块,用于基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
选择模块,用于从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的方法的步骤。
第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的方法的步骤。
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的方法。
第六方面,提供了一种计算机程序产品,所述计算机程序产品存储在非瞬态的存储介质中,其中,所述计算机程序产品被至少一个处理器执行以实现如第一方面所述的方法。
第七方面,提供了一种通信设备,被配置为执行如第一方面所述的方法。
在本申请实施例中,通过获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式。这样通过利用像素块的纹理结构的相似性,在保证编码质量基本不变的前提下,预先确定进行帧内编码的像素块大小,如此可以避免不必要的代价函数计算,从而可以降低预测编码算法的计算复杂度。
附图说明
图1是本申请实施例提供的预测编码方法的流程图;
图2是4:1亚采样的示意图;
图3是第一类型对应的预设编码模式的预测示意图;
图4是基于4×4的像素块进行预测编码时的像素点关系示意图;
图5是第二类型对应的预设编码模式的预测方向示意图;
图6是第二类型对应的预设编码模式的预测示意图;
图7是第四像素块和第五像素块与目标像素块的关系示意图;
图8是本申请实施例提供的预测编码装置的结构图;
图9是本申请实施例提供的电子设备的结构图;
图10为实现本申请实施例的一种电子设备的硬件结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的预测编码进行详细地说明。
图1是本申请实施例提供的预测编码方法的流程图,如图1所示,包括以下步骤:
步骤101,获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块。
该待编码图像可以为视频中的图像,该视频可以包括多个图像,而待编码图像即为这多个图像中的任一个。可以对该视频进行预测编码,而对该视频进行预测编码指的是按照视频序列的时间依次对视频中图像进行预测编码。
该视频的格式和大小不做限定,在一可选实施方式中,该视频可以为公共中间格式(Quarter Common Intermediate Format,QCIF)的视频序列,可以对QCIF视频序列进行预测编码,其中,QCIF大小可以为176×144。
可以采用帧编码模式对视频中图像进行预测编码,也可以采用场编码模式对视频中图像进行预测编码,这里不进行具体限定。需要说明的是,如果采用场编码模式对视频中图像进行预测编码,则相关配置参数需要乘以2,以下会对预测编码时的相关配置参数进行说明。
以采用帧编码模式对视频中图像进行预测编码为例,可以设定编码器为帧编码模式,视频编码时,可以采用H.264的基本档次进行编码,基本档次使用I帧和P帧对图像进行编码,并且I帧可以周期性插入,如每1秒钟视频可以插入一个I帧,而相邻两个I帧之间可以插入P帧。也就是说,在进行视频编码时,该待编码图像可以为I帧,也可以为P帧,这里不进行具体限定。
该待编码图像中可以包括多个宏块,如QCIF(176×144)视频序列,一个图像可以包含99个宏块,每个宏块包括一个16×16大小的第一像素块,该第一像素块可以为该宏块的亮度分量,表征该图像的亮度,用Y分量表示。
针对彩色图像,该宏块中还可以包括两个其他的像素块,这两个其他的像素块的大小可以均为8×8,可以为该宏块的色度分量,表征该图像的色度,分别用U分量和V分量表示。
而对图像进行预测编码指的是按照预设顺序依次对这多个宏块中的每个宏块进行预测编码。
本实施例中即是对宏块中亮度分量的第一像素块进行预测编码,而针对宏块中色度分量的像素块的预测编码,可以采用现有的或者新的预测编码技术,这里不进行具体限定。
待编码图像的获取方式可以包括多种,比如,可以获取预先存储的视频,从该视频中获取待编码图像,也可以获取其他电子设备发送的视频,从该视频中获取待编码图像,还可以从网络上下载视频,从该视频中获取待编码图像,亦或是采用摄像头拍摄视频,从该视频中获取待编码图像。
步骤102,确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度。
该步骤中,第一标准差信息中可以包括至少一个表征第一像素块中像素点的亮度离散程度的标准差,该第一标准差信息可以用来代表该宏块中第一像素块的纹理复杂度。
在一可选实施方式中,第一标准差信息可以包括第一目标标准差,用SD 表示,该第一目标标准差可以表征第一像素块在水平方向和垂直方向上的亮度离散程度。
在另一可选实施方式中,第一标准差信息可以包括第一目标标准差、第二目标标准差和第三目标标准差,第二目标标准差可以表征第一像素块在水平方向上的亮度离散程度,用SD H表示,第三目标标准差可以表征第一像素块在垂直方向上的亮度离散程度,用SD V表示。
在又一可选实施方式中,第一标准差信息可以包括第一目标标准差、第二目标标准差、第三目标标准差、第四目标标准差和第五目标标准差,第四目标标准差可以表征第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,用SD HH表示,第五目标标准差可以表征第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,用用SD VV表示。
可以采用第一像素块中的像素点来直接确定第一标准差信息;也可以将第一像素块划分为N个第三像素块,N为大于1的整数,基于N个第三像素块进行亚采样,得到N个目标像素点,并基于这N个目标像素点来确定第一标准差信息。其中,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值,这样可以减少计算第一标准差信息的像素点数量,从而可以减少计算量。
可以对第一像素块进行16:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/16,采样后得到16个目标像素点,构成4×4大小的子块,也可以对第一像素块进行4:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/4,采样后得到64个目标像素点,构成8×8大小的子块,还可以对第一像素块进行64:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/64,采样后得到4个目标像素点,构成2×2大小的子块。
以4:1亚采样为例,采样后的像素点个数是第一像素块中像素点个数的1/4,参见图2,图2是4:1亚采样的示意图,如图2所示,图2中左图为第三像素块的像素点示意,其白色实心圆表示第三像素块中可用的像素点201, 图2的右图中,目标像素点202为对第三像素块中4个像素点201进行亚采样得到,其亮度值由周围四个像素点的亮度值平均得到。
以下基于N个目标像素点所构成的像素块确定第一标准差信息为例进行说明。其中,N个目标像素点所构成的像素块可以为N1×N1子块,N1与N的关系为N1×N1=N。
具体的,可以采用下式(1)来计算第一目标标准差。
Figure PCTCN2022107303-appb-000001
其中,上式(1)中,N1与N的关系为N1×N1=N,p(x,y)为目标像素点的亮度值,m为N个目标像素点的亮度均值,其中,当对第一像素块进行16:1的亚采样时,N1等于4。
可以采用下式(2)来计算第二目标标准差。
Figure PCTCN2022107303-appb-000002
其中,SD y为N1×N1子块中y行像素点的亮度值的标准差,用下式(3)计算。
Figure PCTCN2022107303-appb-000003
其中,m y为N1×N1子块中y行所有像素点的亮度均值。
可以采用下式(4)来计算第三目标标准差。
Figure PCTCN2022107303-appb-000004
其中,SD x为N1×N1子块中x列像素点的亮度值的标准差,用下式(5)计算。
Figure PCTCN2022107303-appb-000005
其中,m x为N1×N1子块中x列所有像素点的亮度均值。
可以采用下式(6)来计算第四目标标准差。
Figure PCTCN2022107303-appb-000006
上式(6)中,DSD y可以采用下式(7)计算。
Figure PCTCN2022107303-appb-000007
其中,B h(x,y)为N1×N1子块中水平方向上每相邻两个像素点的一阶差分亮度值,而bm y表示B h(x,y)中y行所有目标像素点的亮度均值,B h(x,y)用下式(8)计算。
B h(x,y)=p(x+1,y)-p(x,y)       (8)
可以采用下式(9)来计算第五目标标准差。
Figure PCTCN2022107303-appb-000008
上式(9)中,DSD x可以采用下式(10)计算。
Figure PCTCN2022107303-appb-000009
其中,B v(x,y)为N1×N1子块中垂直方向上每相邻两个像素点的一阶差分亮度值,而bm x表示B v(x,y)中x列所有目标像素点的亮度均值,B v(x,y)用下式(11)计算。
B v(x,y)=p(x,y+1)-p(x,y)       (11)
步骤103,基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小。
该步骤中,H.264/AVC标准采用基于空间域的帧内预测,利用当前宏块周围已经重建的像素值预测当前编码块的像素,对预测残差进行变换、量化及熵编码。宏块中亮度分量的第一像素块的帧内编码类型用于表征第一像素块进行帧内编码时的像素块大小,其可以分为两类,其一为16×16,该帧内编码类型可以称之为第一类型,在第一类型的帧内编码时,第一像素块进行帧内编码时的像素块大小等于第一像素块的大小。另一为4×4,该帧内编码类型可以称之为第二类型,在第二类型的帧内编码时,第一像素块进行帧内编码时的像素块大小小于第一像素块的大小。
基于第一标准差信息确定第一像素块的帧内编码类型,即指的是基于第一标准差信息,确定第一像素块的帧内编码类型为第一类型还是第二类型, 在确定第一像素块的帧内编码类型为第一类型的情况下,基于16×16的第一像素块进行预测编码。在确定第一像素块的帧内编码类型为第二类型的情况下,基于4×4的像素块进行预测编码,即将第一像素块分成多个4×4的像素块依次进行预测编码。
从大量的实验结果统计来看,基于4×4的像素块进行预测编码适用于带有大量细节的图像进行编码,而基于16×16的像素块进行预测编码适用于对纹理简单,比较平滑的图像进行编码,因此,本实施例可以利用表征宏块中第一像素块的纹理复杂度的第一标准差信息,来预测帧内编码时的像素块大小。
其中,第一目标标准差、第二目标标准差、第三目标标准差、第四目标标准差和第五目标标准差均可以从一定程度上来代表宏块中第一像素块的纹理复杂度。
当第一目标标准差比较小时,则说明第一像素块中像素点的亮度分布越集中,相应的,纹理复杂度越简单,当第一目标标准差比较大时,则说明第一像素块中像素点的亮度分布越分散,相应的,纹理复杂度越复杂。
当第二目标标准差比较小时,则说明第一像素块在水平方向上的像素点的亮度分布越集中,相应的,在水平方向上的纹理复杂度越简单,当第二目标标准差比较大时,则说明第一像素块在水平方向上的像素点的亮度分布越分散,相应的,在水平方向上的纹理复杂度越复杂。
当第三目标标准差比较小时,则说明第一像素块在垂直方向上的像素点的亮度分布越集中,相应的,在垂直方向上的纹理复杂度越简单,当第三目标标准差比较大时,则说明第一像素块在垂直方向上的像素点的亮度分布越分散,相应的,在垂直方向上的纹理复杂度越复杂。
当第四目标标准差和第五目标标准差均比较小时,则说明第一像素块中的像素点的亮度分布越平坦,相应的,纹理复杂度越平滑。
相应的,在第一标准差信息表征第一像素块的纹理复杂度简单或比较平坦的情况下,可以确定基于16×16的像素块进行预测编码,在第一标准差信 息表征第一像素块的纹理复杂度复杂且不平滑的情况下,可以确定基于4×4的像素块进行预测编码。如此,不需要进行4×4的像素块和16×16的像素块的全搜索,从而可以有效降低帧内编码的计算复杂度。
步骤104,从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式。
其中,K为大于1的整数。
该步骤中,帧内编码类型不同,其对应的预设编码模式也不同,其中,该预设编码模式可以为帧内编码模式。
在帧内编码类型为第一类型的情况下,即对于空间细节很少的区域,整个宏块的亮度分量可作为一个整体,基于16×16的像素块进行预测编码,H.264/AVC标准定义了第一类型对应的4种预设编码模式,分别称之为垂直V、水平H、直流D和平坦P,如图3所示。
对于亮度分量来说,包含丰富细节的宏块可以基于4×4的像素块进行预测编码,在帧内编码类型为第二类型的情况下,H.264/AVC标准中,将第一像素块分成16个4×4的像素块。每个像素块用与其相邻的上面和左面已经编码并重建的17个像素点来预测,如图4所示,大写字母表示的像素点来自邻近的像素块并已解码重构的像素点,小写字母表示的像素点为当前像素块中将要进行预测编码的像素点。
根据预测方向的不同,基于4×4的像素块进行预测编码共有9种预设编码模式,分别为模式0至模式8,其中,模式2为直流(Direct Current,DC)均值预测。图5中的箭头表示除模式2之外的其他预设编码模式的预测方向,而各种预设编码模式下的预测示意图如图6所示。
在确定第一像素块的帧内编码类型之后,可以从第一像素块的帧内编码类型对应的K种预设编码模式中选择第一像素块的目标编码模式。
其选择方式可以包括多种,以下列举两种。
第一种可以为:针对每个预测编码的像素块,遍历所述帧内编码类型对应的K种预设编码模式,并计算各种预设编码模式的代价函数值。在预设编 码类型为第一类型的情况下,则可以选择代价函数值最小的预设编码模式作为第一像素块的目标编码模式。
当预设编码类型为第一类型时,该种选择方式可以减少预设编码模式的遍历,针对4×4和16×16的预设编码模式的全搜索,通常需要计算148个不同的代价函数值,以选择目标编码模式,而本实施例中,仅需要计算4个不同的代价函数值,从而可以大大减少计算复杂度。
在预设编码类型为第二类型的情况下,插值建立第一像素块中4×4的帧内预测块,计算帧内预测块和原始像素块之间的误差信息,遍历9种预设编码模式,并基于误差信息计算各预设编码模式下的代价函数值,选择具有最小代价函数值的预设编码模式作为该帧内预测块的最佳编码模式。
而第一像素块中4×4的帧内预测块均有其对应的最佳编码模式,第一像素块的目标编码模式基于第一像素块中所有帧内预测块的集合。
该种选择方式可以减少预设编码模式的遍历,相对于4×4和16×16的预设编码模式的全搜索,其可以避免对16×16的预设编码模式的遍历,从而可以减少计算复杂度。
其中,预设编码模式下的代价函数值可以为最小率失真代价函数值,也可以为绝对误差变换和代价函数值,这里不进行具体限定。而H.264/AVC中,率失真代价函数定义如下式(12)所示。
J(s,c,IMODE|QP,λ MODE)=SSD(s,c,IMODE|QP)+λ MODER(s,c,IMODE|QP)     (12)
上式(12)中,J(s,c,IMODE|QP,λ MODE)为率失真代价函数值,QP为量化参数,IMODE代表所有可用的预设编码模式中的某一种预设编码模式,s代表原始像素值,c代表重构值,其经过离散余弦变换(Discrete Cosine Transform,DCT)、量化、反离散余弦变换(Inverse Discrete Cosine Transform,IDCT)和逆量化得到,R(s,c,IMODE|QP)代表选择IMODE模式时的编码比特数,包括预设编码模式用的比特数和编码亮度变换系数用的比特数,计算比特数时可以使用上下文自适应二进制算术编码(Context Adaptive Binary Arithmetic Coding,CABAC)或者上下文自适应可变长编码(Context Adaptive Variable  Length Coding,CAVLC)。λ MODE是预设编码模式选择的拉格朗日乘子,其定义为λ MODE=0.85×2 (QP-12)/3,SSD是s和c的平方误差和,令A代表像素区域,则SSD可以采用下式(13)计算。
Figure PCTCN2022107303-appb-000010
第二种可以为:在预设编码类型为第二类型的情况下,即基于4×4的像素块进行预测编码,可以利用当前像素块及其周围像素块的编码模式和纹理结构的相似性,预先排除不可能的预测方向,最终确定当前像素块的最佳编码模式,得到第一像素块的目标编码模式。对于该种选择方式将在以下实施方式中进行详细说明。
本实施例中,通过获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式。这样通过利用像素块的纹理结构的相似性,在保证编码质量基本不变的前提下,预先确定进行帧内编码的像素块大小,如此可以避免不必要的代价函数计算,从而可以降低预测编码算法的计算复杂度。
可选的,所述第一标准差信息包括第一目标标准差和第二标准差信息,所述第一目标标准差用于表征所述第一像素块在水平方向和垂直方向上的亮度离散程度,所述基于所述第一标准差信息确定所述第一像素块的帧内编码类型,包括:
在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;
在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。
本实施方式中,第一目标标准差可以从整体上反映第一像素块中像素点的亮度离散程度,在第一目标标准差比较小,且小于或等于第一阈值的情况下,可以确定第一像素块中像素点的亮度分布比较集中,此时可以说明第一像素块中的纹理相对比较简单。在该种情况下,将第一像素块作为一个整体进行预测编码的编码效果通常比较好,因此可以确定帧内编码类型为第一类型。
而在第一目标标准差大于第一阈值的情况下,可以进一步基于第二标准差信息确定第一像素块的帧内编码类型。第二标准差信息是从第一像素块在水平方向上的亮度离散程度和垂直方向上的亮度离散程度,来分别评估第一像素块在水平方向上的纹理特征和垂直方向上的纹理特征的。
在第二标准差信息表征第一像素块在任一方向上的亮度分布比较集中,或者表征第一像素块的亮度分布比较平坦的情况下,确定帧内编码类型为第一类型,否则确定帧内编码类型为第二类型。
其中,第一阈值可以根据实际情况进行设置,这里不进行具体限定。
本实施方式中,通过在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。如此可以实现第一像素块的帧内编码类型的确定。
可选的,所述第二标准差信息包括第二目标标准差、第三目标标准差和第三标准差信息,所述第二目标标准差用于表征所述第一像素块在水平方向上的亮度离散程度,所述第三目标标准差用于表征所述第一像素块在垂直方向上的亮度离散程度,所述基于所述第二标准差信息确定所述帧内编码类型,包括:
在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;
在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于 所述第三阈值的情况下,基于所述第三标准差信息确定所述帧内编码类型。
本实施方式中,第二目标标准差可以反映第一像素块在水平方向上的亮度离散程度,在第二目标标准差比较小,且小于或等于第二阈值的情况下,可以确定第一像素块在水平方向上的像素点的亮度分布比较集中,此时可以说明第一像素块在水平方向上的纹理相对比较简单。在该种情况下,将第一像素块作为一个整体进行预测编码的编码效果通常比较好,因此可以确定帧内编码类型为第一类型。
第三目标标准差可以反映第一像素块在垂直方向上的亮度离散程度,在第三目标标准差比较小,且小于或等于第三阈值的情况下,可以确定第一像素块在垂直方向上的像素点的亮度分布比较集中,此时可以说明第一像素块在垂直方向上的纹理相对比较简单。在该种情况下,将第一像素块作为一个整体进行预测编码的编码效果通常比较好,因此可以确定帧内编码类型为第一类型。
而在第二目标标准差大于第二阈值,且第三目标标准差大于第三阈值的情况下,可以进一步基于第三标准差信息确定第一像素块的帧内编码类型。第三标准差信息是从第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,以及第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,来评估第一像素块中像素点的亮度值是否平坦。
在第三标准差信息表征第一像素块的亮度分布比较平坦的情况下,确定帧内编码类型为第一类型,否则确定帧内编码类型为第二类型。
其中,第二阈值和第三阈值可以根据实际情况进行设置,这里不进行具体限定。
本实施方式中,通过在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于所述第三阈值的情况下,基于所述第三标准差信息确定所述帧内编码类型。如此,可以进一步实现第一像素块的帧内编码类型的确定,避 免16×16的预设编码模式如垂直V或水平H的遗漏,而造成编码质量的下降。
可选的,所述第三标准差信息包括第四目标标准差和第五目标标准差,所述第四目标标准差用于表征所述第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,所述第五目标标准差用于表征所述第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,所述基于所述第三标准差信息确定所述帧内编码类型,包括:
在所述第四目标标准差小于或等于第四阈值,且所述第五目标标准差小于或等于第五阈值的情况下,确定所述帧内编码类型为所述第一类型;
在所述第四目标标准差大于所述第四阈值,或者所述第五目标标准差大于所述第五阈值的情况下,确定所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小。
本实施方式中,第四目标标准差可以反映第一像素块在水平方向上的亮度平坦程度,在第四目标标准差比较小,且小于或等于第四阈值的情况下,可以确定第一像素块在水平方向上的像素点的亮度比较平坦,第五目标标准差可以反映第一像素块在垂直方向上的亮度平坦程度,在第五目标标准差比较小,且小于或等于第五阈值的情况下,可以确定第一像素块在垂直方向上的像素点的亮度比较平坦。
当第四目标标准差小于或等于第四阈值,且第五目标标准差小于或等于第五阈值时,则可以说明第一像素块的纹理相对平滑。在该种情况下,将第一像素块作为一个整体进行预测编码的编码效果通常比较好,因此可以确定帧内编码类型为第一类型。其中,第四阈值和第五阈值可以根据实际情况进行设置,这里不进行具体限定。
而在上述条件均不满足的情况下,确定帧内编码类型为第二类型,如此,可以进一步实现第一像素块的帧内编码类型的确定,避免16×16的预设编码模式如平坦P的遗漏,而造成编码质量的下降。
可选的,所述确定第一标准差信息之前,所述方法还包括:
将所述第一像素块划分为N个第三像素块,每个第三像素块中的像素点数量相等,N为大于1的整数;
基于所述N个第三像素块进行亚采样,得到N个目标像素点,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值;
所述确定第一标准差信息,包括:
基于所述N个目标像素点所构成的像素块确定第一标准差信息。
本实施方式中,可以将第一像素块划分为N个第三像素块,N为大于1的整数,基于N个第三像素块进行亚采样,得到N个目标像素点,并基于这N个目标像素点来确定第一标准差信息。其中,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值。
可以对第一像素块进行16:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/16,采样后得到16个目标像素点,构成4×4大小的子块,也可以对第一像素块进行4:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/4,采样后得到64个目标像素点,构成8×8大小的子块,还可以对第一像素块进行64:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/64,采样后得到4个目标像素点,构成2×2大小的子块。
以4:1亚采样为例,采样后的像素点个数是第一像素块中像素点个数的1/4,而16:1的亚采样,采样后的像素点个数是第一像素块中像素点个数的1/16。如此,通过基于亚采样得到的N个目标像素点所构成的像素块确定第一标准差信息,这样可以减少计算第一标准差信息的像素点数量,从而可以减少计算量。
可选的,所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小,所述从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,包括:
确定M个第二像素块中每个第二像素块的边缘矢量信息,所述第一像素块包括所述M个第二像素块,每个第二像素块的大小与所述帧内编码类型对应,M为大于1的整数;
基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,所述目标像素块为所述M个第二像素块中任一像素块;
基于所述待编码图像中第四像素块的编码模式和第五像素块的编码模式,确定所述目标像素块的第二候选编码模式,所述第四像素块为所述待编码图像中与所述目标像素块上方相邻的像素块,所述第五像素块为所述待编码图像中与所述目标像素块左方相邻的像素块;
基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式。
本实施方式限定的是当帧内编码类型为第二类型的预设编码模式的选择过程,其采用的是上述实施例中的第二种选择方式,即利用当前像素块及其周围像素块的编码模式和纹理结构的相似性,预先排除不可能的预测方向,最终确定当前像素块的最佳编码模式,得到第一像素块的目标编码模式。
具体的,将第一像素块划分成16个4×4的第二像素块,针对每个第二像素块,且针对该第二像素块中的每个第一像素点,可以基于索贝尔Sobel算子计算该第一像素点的边缘矢量,得到第二像素块的边缘矢量信息。
其中,Sobel算子中定义了两个卷积核,其分别用来描述像素点在垂直方向和水平方向上的亮度差异程度。对于第二像素块中位置(i,j)处的第一像素点,设其亮度值是d i,j,定义该第一像素点的边缘矢量
Figure PCTCN2022107303-appb-000011
为下式(14)和(15)所示。
Figure PCTCN2022107303-appb-000012
其中,
Figure PCTCN2022107303-appb-000013
第二像素块中所有第一像素点的边缘矢量则构成了第二像素块的边缘矢量信息。
可以针对每个第二像素块,基于该第二像素块的边缘矢量信息,从9种预设编码模式中选择该第二像素块的第一候选编码模式。以目标像素块为例,可以基于目标像素块的边缘矢量信息,确定该目标像素块中所有第一像素点的预测方向角和亮度差异强度,基于所有第一像素点的预测方向角和亮度差异程度,确定目标像素块的最佳预测方向,从而可以确定该目标像素块的第一候选编码模式。
可以基于第四像素块和第五像素块,确定该目标像素块的第二候选编码模式,该第二候选编码模式为目标像素块最可能的编码模式,用predIntraPredMode表示。其确定过程可以参考H.264/AVC的标准,这里不进行具体限定。
其中,第四像素块和第五像素块与目标像素块的关系如图7所示,目标像素块701为当前进行预测编码的像素块,而第四像素块702位于目标像素块701的上方,且与目标像素块701相邻,第五像素块703位于目标像素块701左方,且与目标像素块701相邻。
之后,可以基于第一候选编码模式和第二候选编码模式,确定目标编码模式。具体的,在第一候选编码模式和第二候选编码模式相同的情况下,可以直接将第一候选编码模式确定为目标编码模式,也可以遍历第一候选编码模式和模式2的代价函数值,选择第一候选编码模式和模式2中代价函数值小的编码模式作为目标编码模式。
在第一候选编码模式和第二候选编码模式不相同的情况下,可以遍历L种候选编码模式的率失真代价函数值,选择L种候选编码模式中率失真代价函数值最小的编码模式作为目标编码模式。其中,L种候选编码模式可以包括第一候选编码模式和第二候选编码模式,也可以在包括第一候选编码模式和第二候选编码模式的同时还包括模式2。
本实施方式中,在帧内编码类型为第二类型的情况下,可以利用当前像 素块及其周围像素块的编码模式和纹理结构的相似性,预先排除不可能的预测方向,最终确定当前像素块的最佳编码模式,得到第一像素块的目标编码模式,如此可以避免不必要的代价函数计算,从而可以进一步降低预测编码算法的计算复杂度。
可选的,所述边缘矢量信息包括所述目标像素块中每个第一像素点的边缘矢量,所述边缘矢量用于表征所述第一像素点相对于第二像素点的亮度差异程度,所述第二像素点为所述待编码图像中与所述第一像素点相邻的像素点,所述基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,包括:
基于所述目标像素块的边缘矢量信息,确定每个所述第一像素点的第一亮度差异强度和第一方向角;
针对每个所述第一像素点,基于所述第一像素点的第一方向角,确定所述第一像素点的第二方向角,所述第二方向角与所述预设编码模式的角度范围对应;
基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式。
本实施方式中,针对目标像素块中每个第一像素点的边缘矢量,可以采用下式(16)和(17)计算第一像素点的第一亮度差异强度和第一方向角。
Figure PCTCN2022107303-appb-000014
Figure PCTCN2022107303-appb-000015
其中,
Figure PCTCN2022107303-appb-000016
为第一像素点的第一亮度差异强度,表征第一像素点与第二像素点的亮度强度差异,
Figure PCTCN2022107303-appb-000017
为第一像素点的第一方向角,表征第一像素点与第二像素点的亮度方向差异。
第二方向角即预测方向角θ定义如下式(18)所示。
Figure PCTCN2022107303-appb-000018
即当
Figure PCTCN2022107303-appb-000019
时,第一方向角即为第二方向角,而当
Figure PCTCN2022107303-appb-000020
时,第一方向角减去π,则可以得到第二方向角。
第二方向角与预设编码模式的角度范围对应,即基于第二方向角与角度范围的对应关系,以及预设编码模式与角度范围的对应关系,可以将每个第一像素点的预测方向角归类到相应的预设编码模式,以结合第一亮度差异强度来确定第一候选编码模式。
本实施方式中,通过目标像素块的边缘矢量信息,确定第一像素点的第一亮度差异强度和第一方向角,并基于第一方向角确定对应预设编码模式的第二方向角,同时结合第一亮度差异强度从K种预设编码模式中选择第一候选编码模式。如此,可以实现第一候选编码模式的选择,排除某些可能性较小的编码模式,避免不必要的代价函数的计算。
可选的,所述基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式,包括:
针对每个所述第一像素点,基于所述第一像素点的第二方向角所处的角度范围,确定所述K种预设编码模式中所述第一像素点对应的预设编码模式,不同预设编码模式对应不同的角度范围;
将所述目标像素块中对应相同预设编码模式的所述第一像素点的第一亮度差异强度进行累加,得到各种预设编码模式下的第二亮度差异强度;
将目标亮度差异强度对应的预设编码模式确定为所述第一候选编码模式,所述目标亮度差异强度为各种预设编码模式下的第二亮度差异强度中最大的第二亮度差异强度。
本实施方式中,可以将每个第一像素点的预测方向角归类到相应的预设编码模式中,且同一种预设编码模式的边缘强度即第一亮度差异强度进行累加。
具体的,表1给出了预设编码模式和角度范围的对应关系,根据表1的对应关系,可以将第一像素点的预测方向角归纳到相应的预设编码模式中,比如,预测方向角为2π/16,则可以将其归纳至模式8中。
表1 预设编码模式和角度范围的对应关系表
预设编码模式 预测方向角的角度范围
模式8 (π/16,3π/16]
模式1 (-π/16,π/16]
模式6 (-3π/16,-π/16]
模式4 (-3π/16,-π/16]
模式5 (-7π/16,-5π/16]
模式0 (-9π/16,-7π/16]
模式7 (-11π/16,-9π/16]
模式3 (-13π/16,-11π/16]
同一种预设编码模式下的第一像素点的第一亮度差异强度进行累加。设当前第一像素点的预测方向角被归类到第k个模式即模式k,Stren(mode k)表征模式k下的亮度差异强度即边缘强度,则该边缘强度按照下式(19)进行更新。
Figure PCTCN2022107303-appb-000021
依次处理完目标像素块中的16个像素点之后,对各种预设编码模式下的累计边缘强度进行排序,在所有可用的预设编码模式中,选择累计边缘强度最大的预设编码模式,作为第一候选编码模式,记为intraPredMode。
本实施方式中,通过将每个第一像素点的预测方向角归类到相应的预设编码模式中,且同一种预设编码模式的边缘强度即第一亮度差异强度进行累加,并选择累计边缘强度最大的预设编码模式,作为第一候选编码模式。如此,可以依据这些第一像素点与第二像素点的亮度差异程度,确定目标像素块最佳的编码模式,以实现第一候选编码模式的选择。
可选的,所述基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式,包括:
在所述第一候选编码模式与所述第二候选编码模式相同的情况下,将所述第一候选编码模式确定所述目标编码模式;
在所述第一候选编码模式与所述第二候选编码模式不相同的情况下,将目标候选编码模式确定为所述目标编码模式;
其中,所述目标候选编码模式为L种候选编码模式中率失真代价函数值 最小的候选编码模式,所述L种候选编码模式包括所述第一候选编码模式和所述第二候选编码模式,L为大于1的整数。
本实施方式中,L种候选编码模式还可以包括模式2即DC均值预测,在第一候选编码模式与第二候选编码模式不相同的情况下,将第一候选编码模式intraPredMode、第二候选编码模式predIntraPredMode、DC均值预测作为3种候选编码模式,选择具有最小代价函数值的编码模式作为目标编码模式。如此,可以防止可能的候选编码模式的遗漏而造成编码质量的下降,从而可以保证视频编码的质量。
在该种预测编码场景下,当第一候选编码模式与第二候选编码模式不相同时,也只需要计算48次代价函数,相比全搜索的148次代价函数的计算,减少了67.6%,极大地提高了视频编码器中帧内预测模块的编码速度。
可选的,所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小,所述从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,包括:
确定所述K种预设编码模式下每种预设编码模式的绝对误差变换和代价函数值;
将所述K种预设编码模式中目标代价函数值对应的预设编码模式确定为所述目标编码模式,所述目标代价函数值为所述K种预设编码模式对应的绝对误差变换和代价函数值中,最小的代价函数值。
本实施方式中,基于16×16的像素块进行预测编码时,可以采用绝对误差变换和(Sum of Absolute Transform Difference,SATD)代价函数,来替代率失真代价函数。其中,SATD是经过变换的残差,既反映了失真,又能在一定程度上反映生成码流的大小,因此,可以将其作为编码模式选择的依据。
SATD代价函数如下式(20)所示。
J(s,c,IMODE)=SATD(s,c,IMODE)=Σ|T{s(x,y)-c(x,y)}|      (20)
其中,上式(20)中,IMODE是16×16的4种预测编码模式中的一种, T代表哈达玛变换,令Ha代表a阶哈达玛矩阵,则w的哈达玛变换T(w)可以用下式(21)表示,w={s(x,y)-c(x,y)}。
T(w)=H awH a       (21)
哈达玛矩阵可以采用下式(22)和(23)递推得到。
Figure PCTCN2022107303-appb-000022
Figure PCTCN2022107303-appb-000023
本实施方式中,可以将4种预设编码模式中SATD代价函数值最小的预设编码模式确定为目标候选模式,在减少代价函数值的计算量的同时可以实现目标编码模式的确定,如此可以避免不必要的代价函数计算,从而可以进一步降低预测编码算法的计算复杂度。在该种预测编码场景下,仅需要计算4次代价函数,相比全搜索的148次代价函数的计算,极大地提高了视频编码器中帧内预测模块的编码速度。
另外,若待编码图像为P帧,而P帧编码时,1个宏块可能采用帧内编码,也可能采用帧间编码,因此,需要分别对该宏块进行帧内预测和帧间预测,以确定是采用帧内编码还是采用帧间编码。在进行帧内预测时,亮度分量的像素块的预测编码和色度分量的像素块的预测编码是相互独立的,可以分别进行判决。
亮度分量的像素块在预测编码时目标编码模式的选择可以使用上述实施例的预测编码方法进行判决,色度分量的像素块在预测编码时目标编码模式的选择可以基于率失真代价函数进行判决。在得到亮度分量的像素块以及色度分量的像素块的目标编码模式之后,可以计算出宏块中总的帧内预测代价与帧间预测代价,并比较帧内预测代价与帧间预测代价的大小,以便进行帧内编码还是帧间编码的选取。
宏块中总的帧内预测代价计算使用下式(24)所示的拉格朗日模型,但是在计算平方误差和时,需要亮度分量的像素块和色度分量的像素块的平方误差和。
Figure PCTCN2022107303-appb-000024
上式(24)中,s Y表示亮度分量的像素块的原始像素值,c Y代表亮度重构值,s U代表色度分量U的原始像素值,c U代表色度分量U的重构值,s V代表色度分量V的原始像素值,c V代表色度分量V的重构值。R(s,c,MODE|QP)是采用目标编码模式时总的比特数,包含编码宏块头信息所用比特数和Y、U和V分量的像素块的变换系数的编码比特数。
需要说明的是,本申请实施例提供的预测编码方法,执行主体可以为预测编码装置,或者该预测编码装置中的用于执行预测编码方法的控制模块。本申请实施例中以预测编码装置执行预测编码方法为例,说明本申请实施例提供的预测编码装置。
参见图8,图8是本申请实施例提供的预测编码装置的结构图,如图8所示,预测编码装置800包括:
获取模块801,用于获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
第一确定模块802,用于确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
第二确定模块803,用于基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
选择模块804,用于从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
可选的,所述第一标准差信息包括第一目标标准差和第二标准差信息,所述第一目标标准差用于表征所述第一像素块在水平方向和垂直方向上的亮度离散程度,所述第二确定模块803包括:
第一确定子模块,用于在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;
第二确定子模块,用于在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。
可选的,所述第二确定子模块包括:
第一确定单元,用于在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;
第二确定单元,用于在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于所述第三阈值的情况下,基于所述第三标准差信息确定所述帧内编码类型。
可选的,所述第三标准差信息包括第四目标标准差和第五目标标准差,所述第四目标标准差用于表征所述第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,所述第五目标标准差用于表征所述第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,所述第二确定单元,具体用于:
在所述第四目标标准差小于或等于第四阈值,且所述第五目标标准差小于或等于第五阈值的情况下,确定所述帧内编码类型为所述第一类型;
在所述第四目标标准差大于所述第四阈值,或者所述第五目标标准差大于所述第五阈值的情况下,确定所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小。
可选的,所述装置还包括:
划分模块,用于将所述第一像素块划分为N个第三像素块,每个第三像素块中的像素点数量相等,N为大于1的整数;
亚采样模块,用于基于所述N个第三像素块进行亚采样,得到N个目标 像素点,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值;
所述第一确定模块,具体用于基于所述N个目标像素点所构成的像素块确定第一标准差信息。
可选的,所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小,所述选择模块804包括:
第三确定子模块,用于确定M个第二像素块中每个第二像素块的边缘矢量信息,所述第一像素块包括所述M个第二像素块,每个第二像素块的大小与所述帧内编码类型对应,M为大于1的整数;
选择子模块,用于基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,所述目标像素块为所述M个第二像素块中任一像素块;
第四确定子模块,用于基于所述待编码图像中第四像素块的编码模式和第五像素块的编码模式,确定所述目标像素块的第二候选编码模式,所述第四像素块为所述待编码图像中与所述目标像素块上方相邻的像素块,所述第五像素块为所述待编码图像中与所述目标像素块左方相邻的像素块;
第五确定子模块,用于基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式。
可选的,所述边缘矢量信息包括所述目标像素块中每个第一像素点的边缘矢量,所述边缘矢量用于表征所述第一像素点相对于第二像素点的亮度差异程度,所述第二像素点为所述待编码图像中与所述第一像素点相邻的像素点,所述选择子模块包括:
第三确定子单元,用于基于所述目标像素块的边缘矢量信息,确定每个所述第一像素点的第一亮度差异强度和第一方向角;
第四确定子单元,用于针对每个所述第一像素点,基于所述第一像素点的第一方向角,确定所述第一像素点的第二方向角,所述第二方向角与所述 预设编码模式的角度范围对应;
选择子单元,用于基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式。
可选的,所述选择子单元,具体用于:
针对每个所述第一像素点,基于所述第一像素点的第二方向角所处的角度范围,确定所述K种预设编码模式中所述第一像素点对应的预设编码模式,不同预设编码模式对应不同的角度范围;
将所述目标像素块中对应相同预设编码模式的所述第一像素点的第一亮度差异强度进行累加,得到各种预设编码模式下的第二亮度差异强度;
将目标亮度差异强度对应的预设编码模式确定为所述第一候选编码模式,所述目标亮度差异强度为各种预设编码模式下的第二亮度差异强度中最大的第二亮度差异强度。
可选的,所述第五确定子模块,具体用于:
在所述第一候选编码模式与所述第二候选编码模式相同的情况下,将所述第一候选编码模式确定所述目标编码模式;
在所述第一候选编码模式与所述第二候选编码模式不相同的情况下,将目标候选编码模式确定为所述目标编码模式;
其中,所述目标候选编码模式为L种候选编码模式中率失真代价函数值最小的候选编码模式,所述L种候选编码模式包括所述第一候选编码模式和所述第二候选编码模式,L为大于1的整数。
可选的,所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小,所述选择模块804包括:
第六确定子模块,用于确定所述K种预设编码模式下每种预设编码模式的绝对误差变换和代价函数值;
第七确定子模块,用于将所述K种预设编码模式中目标代价函数值对应的预设编码模式确定为所述目标编码模式,所述目标代价函数值为所述K种 预设编码模式对应的绝对误差变换和代价函数值中,最小的代价函数值。
本实施例中,通过获取模块801获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;通过第一确定模块802确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;通过第二确定模块803基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;通过选择模块804从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式。这样通过利用像素块的纹理结构的相似性,在保证编码质量基本不变的前提下,预先确定进行帧内编码的像素块大小,如此可以避免不必要的代价函数计算,从而可以降低预测编码算法的计算复杂度。
本申请实施例中的预测编码装置可以是装置,也可以是终端中的部件、集成电路、或芯片。该装置可以是移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,非移动电子设备可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。
本申请实施例中的预测编码装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。
本申请实施例提供的预测编码装置能够实现图1的方法实施例实现的各个过程,为避免重复,这里不再赘述。
可选地,如图9所示,本申请实施例还提供一种电子设备900,包括处理器901,存储器902,存储在存储器902上并可在所述处理器901上运行的程序或指令,该程序或指令被处理器901执行时实现上述预测编码方法实施 例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。
图10为实现本申请实施例的一种电子设备的硬件结构示意图。
该电子设备1000包括但不限于:射频单元1001、网络模块1002、音频输出单元1003、输入单元1004、传感器1005、显示单元1006、用户输入单元1007、接口单元1008、存储器1009、以及处理器1010等部件。
本领域技术人员可以理解,电子设备1000还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器1010逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图10中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。
其中,处理器1010,用于:
获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
本实施例中,通过处理器1010获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式。这样通过利 用像素块的纹理结构的相似性,在保证编码质量基本不变的前提下,预先确定进行帧内编码的像素块大小,如此可以避免不必要的代价函数计算,从而可以降低预测编码算法的计算复杂度。
可选地,所述第一标准差信息包括第一目标标准差和第二标准差信息,所述第一目标标准差用于表征所述第一像素块在水平方向和垂直方向上的亮度离散程度,处理器1010,还用于:
在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;
在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。
可选的,所述第二标准差信息包括第二目标标准差、第三目标标准差和第三标准差信息,所述第二目标标准差用于表征所述第一像素块在水平方向上的亮度离散程度,所述第三目标标准差用于表征所述第一像素块在垂直方向上的亮度离散程度,所述处理器1010,还用于:
在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;
在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于所述第三阈值的情况下,基于所述第三标准差信息确定所述帧内编码类型。
可选的,所述第三标准差信息包括第四目标标准差和第五目标标准差,所述第四目标标准差用于表征所述第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,所述第五目标标准差用于表征所述第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,处理器1010,还用于:
在所述第四目标标准差小于或等于第四阈值,且所述第五目标标准差小于或等于第五阈值的情况下,确定所述帧内编码类型为所述第一类型;
在所述第四目标标准差大于所述第四阈值,或者所述第五目标标准差大于所述第五阈值的情况下,确定所述帧内编码类型为第二类型,所述第二类 型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小。
可选的,处理器1010,还用于:
将所述第一像素块划分为N个第三像素块,每个第三像素块中的像素点数量相等,N为大于1的整数;
基于所述N个第三像素块进行亚采样,得到N个目标像素点,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值;
处理器1010,具体用于:
基于所述N个目标像素点所构成的像素块确定第一标准差信息。
可选的,所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小,处理器1010,还用于:
确定M个第二像素块中每个第二像素块的边缘矢量信息,所述第一像素块包括所述M个第二像素块,每个第二像素块的大小与所述帧内编码类型对应,M为大于1的整数;
基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,所述目标像素块为所述M个第二像素块中任一像素块;
基于所述待编码图像中第四像素块的编码模式和第五像素块的编码模式,确定所述目标像素块的第二候选编码模式,所述第四像素块为所述待编码图像中与所述目标像素块上方相邻的像素块,所述第五像素块为所述待编码图像中与所述目标像素块左方相邻的像素块;
基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式。
可选的,所述边缘矢量信息包括所述目标像素块中每个第一像素点的边缘矢量,所述边缘矢量用于表征所述第一像素点相对于第二像素点的亮度差异程度,所述第二像素点为所述待编码图像中与所述第一像素点相邻的像素 点,处理器1010,还用于:
基于所述目标像素块的边缘矢量信息,确定每个所述第一像素点的第一亮度差异强度和第一方向角;
针对每个所述第一像素点,基于所述第一像素点的第一方向角,确定所述第一像素点的第二方向角,所述第二方向角与所述预设编码模式的角度范围对应;
基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式。
可选的,处理器1010,还用于:
针对每个所述第一像素点,基于所述第一像素点的第二方向角所处的角度范围,确定所述K种预设编码模式中所述第一像素点对应的预设编码模式,不同预设编码模式对应不同的角度范围;
将所述目标像素块中对应相同预设编码模式的所述第一像素点的第一亮度差异强度进行累加,得到各种预设编码模式下的第二亮度差异强度;
将目标亮度差异强度对应的预设编码模式确定为所述第一候选编码模式,所述目标亮度差异强度为各种预设编码模式下的第二亮度差异强度中最大的第二亮度差异强度。
可选的,处理器1010,还用于:
在所述第一候选编码模式与所述第二候选编码模式相同的情况下,将所述第一候选编码模式确定所述目标编码模式;
在所述第一候选编码模式与所述第二候选编码模式不相同的情况下,将目标候选编码模式确定为所述目标编码模式;
其中,所述目标候选编码模式为L种候选编码模式中率失真代价函数值最小的候选编码模式,所述L种候选编码模式包括所述第一候选编码模式和所述第二候选编码模式,L为大于1的整数。
可选的,所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小,处理器1010, 还用于:
确定所述K种预设编码模式下每种预设编码模式的绝对误差变换和代价函数值;
将所述K种预设编码模式中目标代价函数值对应的预设编码模式确定为所述目标编码模式,所述目标代价函数值为所述K种预设编码模式对应的绝对误差变换和代价函数值中,最小的代价函数值。
应理解的是,本申请实施例中,输入单元1004可以包括图形处理器(Graphics Processing Unit,GPU)10041和麦克风10042,图形处理器10041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元1006可包括显示面板10061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板10061。用户输入单元1007包括触控面板10071以及其他输入设备10072。触控面板10071,也称为触摸屏。触控面板10071可包括触摸检测装置和触摸控制器两个部分。其他输入设备10072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。存储器1009可用于存储软件程序以及各种数据,包括但不限于应用程序和操作系统。处理器1010可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1010中。
本申请实施例还提供一种可读存储介质,所述可读存储介质可以是非易失的,也可以是易失的,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述预测编码方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述预测编码方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。
本申请实施例另提供了一种计算机程序产品,其中,所述计算机程序产品被存储在非瞬态的可读存储介质中,所述计算机程序产品被至少一个处理器执行以实现上述位置信息上报方法实施例中的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服 务器,或者网络设备等)执行本申请各个实施例所述的方法。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。

Claims (25)

  1. 一种预测编码方法,包括:
    获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
    确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
    基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
    从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
  2. 根据权利要求1所述的方法,其中,所述第一标准差信息包括第一目标标准差和第二标准差信息,所述第一目标标准差用于表征所述第一像素块在水平方向和垂直方向上的亮度离散程度,所述基于所述第一标准差信息确定所述第一像素块的帧内编码类型,包括:
    在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;
    在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。
  3. 根据权利要求2所述的方法,其中,所述第二标准差信息包括第二目标标准差、第三目标标准差和第三标准差信息,所述第二目标标准差用于表征所述第一像素块在水平方向上的亮度离散程度,所述第三目标标准差用于表征所述第一像素块在垂直方向上的亮度离散程度,所述基于所述第二标准差信息确定所述帧内编码类型,包括:
    在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差 小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;
    在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于所述第三阈值的情况下,基于所述第三标准差信息确定所述帧内编码类型。
  4. 根据权利要求3所述的方法,其中,所述第三标准差信息包括第四目标标准差和第五目标标准差,所述第四目标标准差用于表征所述第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,所述第五目标标准差用于表征所述第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,所述基于所述第三标准差信息确定所述帧内编码类型,包括:
    在所述第四目标标准差小于或等于第四阈值,且所述第五目标标准差小于或等于第五阈值的情况下,确定所述帧内编码类型为所述第一类型;
    在所述第四目标标准差大于所述第四阈值,或者所述第五目标标准差大于所述第五阈值的情况下,确定所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小。
  5. 根据权利要求2所述的方法,其中,所述确定第一标准差信息之前,所述方法还包括:
    将所述第一像素块划分为N个第三像素块,每个第三像素块中的像素点数量相等,N为大于1的整数;
    基于所述N个第三像素块进行亚采样,得到N个目标像素点,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值;
    所述确定第一标准差信息,包括:
    基于所述N个目标像素点所构成的像素块确定第一标准差信息。
  6. 根据权利要求1所述的方法,其中,所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小,所述从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,包括:
    确定M个第二像素块中每个第二像素块的边缘矢量信息,所述第一像素 块包括所述M个第二像素块,每个第二像素块的大小与所述帧内编码类型对应,M为大于1的整数;
    基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,所述目标像素块为所述M个第二像素块中任一像素块;
    基于所述待编码图像中第四像素块的编码模式和第五像素块的编码模式,确定所述目标像素块的第二候选编码模式,所述第四像素块为所述待编码图像中与所述目标像素块上方相邻的像素块,所述第五像素块为所述待编码图像中与所述目标像素块左方相邻的像素块;
    基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式。
  7. 根据权利要求6所述的方法,其中,所述边缘矢量信息包括所述目标像素块中每个第一像素点的边缘矢量,所述边缘矢量用于表征所述第一像素点相对于第二像素点的亮度差异程度,所述第二像素点为所述待编码图像中与所述第一像素点相邻的像素点,所述基于目标像素块的边缘矢量信息,从所述帧内编码类型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,包括:
    基于所述目标像素块的边缘矢量信息,确定每个所述第一像素点的第一亮度差异强度和第一方向角;
    针对每个所述第一像素点,基于所述第一像素点的第一方向角,确定所述第一像素点的第二方向角,所述第二方向角与所述预设编码模式的角度范围对应;
    基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式。
  8. 根据权利要求7所述的方法,其中,所述基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式,包括:
    针对每个所述第一像素点,基于所述第一像素点的第二方向角所处的角度范围,确定所述K种预设编码模式中所述第一像素点对应的预设编码模式,不同预设编码模式对应不同的角度范围;
    将所述目标像素块中对应相同预设编码模式的所述第一像素点的第一亮度差异强度进行累加,得到各种预设编码模式下的第二亮度差异强度;
    将目标亮度差异强度对应的预设编码模式确定为所述第一候选编码模式,所述目标亮度差异强度为各种预设编码模式下的第二亮度差异强度中最大的第二亮度差异强度。
  9. 根据权利要求6所述的方法,其中,所述基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式,包括:
    在所述第一候选编码模式与所述第二候选编码模式相同的情况下,将所述第一候选编码模式确定所述目标编码模式;
    在所述第一候选编码模式与所述第二候选编码模式不相同的情况下,将目标候选编码模式确定为所述目标编码模式;
    其中,所述目标候选编码模式为L种候选编码模式中率失真代价函数值最小的候选编码模式,所述L种候选编码模式包括所述第一候选编码模式和所述第二候选编码模式,L为大于1的整数。
  10. 根据权利要求1所述的方法,其中,所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小,所述从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,包括:
    确定所述K种预设编码模式下每种预设编码模式的绝对误差变换和代价函数值;
    将所述K种预设编码模式中目标代价函数值对应的预设编码模式确定为所述目标编码模式,所述目标代价函数值为所述K种预设编码模式对应的绝对误差变换和代价函数值中,最小的代价函数值。
  11. 一种预测编码装置,包括:
    获取模块,用于获取待编码图像,所述待编码图像包括宏块,所述宏块包括亮度分量的第一像素块;
    第一确定模块,用于确定第一标准差信息,所述第一标准差信息用于表征所述第一像素块中像素点的亮度离散程度;
    第二确定模块,用于基于所述第一标准差信息确定所述第一像素块的帧内编码类型,所述帧内编码类型用于表征所述第一像素块进行帧内编码时的像素块大小;
    选择模块,用于从所述帧内编码类型对应的K种预设编码模式中选择所述第一像素块的目标编码模式,K为大于1的整数。
  12. 根据权利要求11所述的装置,其中,所述第一标准差信息包括第一目标标准差和第二标准差信息,所述第一目标标准差用于表征所述第一像素块在水平方向和垂直方向上的亮度离散程度,所述第二确定模块包括:
    第一确定子模块,用于在所述第一标准差小于或等于第一阈值的情况下,确定所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小;
    第二确定子模块,用于在所述第一标准差大于所述第一阈值的情况下,基于所述第二标准差信息确定所述帧内编码类型。
  13. 根据权利要求12所述的装置,其中,所述第二标准差信息包括第二目标标准差、第三目标标准差和第三标准差信息,所述第二目标标准差用于表征所述第一像素块在水平方向上的亮度离散程度,所述第三目标标准差用于表征所述第一像素块在垂直方向上的亮度离散程度,所述第二确定子模块包括:
    第一确定单元,用于在所述第二目标标准差小于或等于第二阈值,或者所述第三目标标准差小于或等于第三阈值的情况下,确定所述帧内编码类型为所述第一类型;
    第二确定单元,用于在所述第二目标标准差大于所述第二阈值,且所述第三目标标准差大于所述第三阈值的情况下,基于所述第三标准差信息确定 所述帧内编码类型。
  14. 根据权利要求13所述的装置,其中,所述第三标准差信息包括第四目标标准差和第五目标标准差,所述第四目标标准差用于表征所述第一像素块在水平方向上每相邻两个像素点的差分亮度的离散程度,所述第五目标标准差用于表征所述第一像素块在垂直方向上每相邻两个像素点的差分亮度的离散程度,所述第二确定单元,具体用于:
    在所述第四目标标准差小于或等于第四阈值,且所述第五目标标准差小于或等于第五阈值的情况下,确定所述帧内编码类型为所述第一类型;
    在所述第四目标标准差大于所述第四阈值,或者所述第五目标标准差大于所述第五阈值的情况下,确定所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小。
  15. 根据权利要求12所述的装置,其中,所述装置还包括:
    划分模块,用于将所述第一像素块划分为N个第三像素块,每个第三像素块中的像素点数量相等,N为大于1的整数;
    亚采样模块,用于基于所述N个第三像素块进行亚采样,得到N个目标像素点,每个目标像素点的亮度值等于一个第三像素块中所有像素点的亮度值的均值;
    所述第一确定模块,具体用于基于所述N个目标像素点所构成的像素块确定第一标准差信息。
  16. 根据权利要求11所述的装置,其中,所述帧内编码类型为第二类型,所述第二类型表征所述第一像素块进行帧内编码时的像素块大小小于所述第一像素块的大小,所述选择模块包括:
    第三确定子模块,用于确定M个第二像素块中每个第二像素块的边缘矢量信息,所述第一像素块包括所述M个第二像素块,每个第二像素块的大小与所述帧内编码类型对应,M为大于1的整数;
    选择子模块,用于基于目标像素块的边缘矢量信息,从所述帧内编码类 型对应的K种预设编码模式中选择所述目标像素块的第一候选编码模式,所述目标像素块为所述M个第二像素块中任一像素块;
    第四确定子模块,用于基于所述待编码图像中第四像素块的编码模式和第五像素块的编码模式,确定所述目标像素块的第二候选编码模式,所述第四像素块为所述待编码图像中与所述目标像素块上方相邻的像素块,所述第五像素块为所述待编码图像中与所述目标像素块左方相邻的像素块;
    第五确定子模块,用于基于所述第一候选编码模式和所述第二候选编码模式,确定所述目标编码模式。
  17. 根据权利要求16所述的装置,其中,所述边缘矢量信息包括所述目标像素块中每个第一像素点的边缘矢量,所述边缘矢量用于表征所述第一像素点相对于第二像素点的亮度差异程度,所述第二像素点为所述待编码图像中与所述第一像素点相邻的像素点,所述选择子模块包括:
    第三确定子单元,用于基于所述目标像素块的边缘矢量信息,确定每个所述第一像素点的第一亮度差异强度和第一方向角;
    第四确定子单元,用于针对每个所述第一像素点,基于所述第一像素点的第一方向角,确定所述第一像素点的第二方向角,所述第二方向角与所述预设编码模式的角度范围对应;
    选择子单元,用于基于所述第一亮度差异强度和所述第二方向角,从所述K种预设编码模式中选择所述第一候选编码模式。
  18. 根据权利要求17所述的装置,其中,所述选择子单元,具体用于:
    针对每个所述第一像素点,基于所述第一像素点的第二方向角所处的角度范围,确定所述K种预设编码模式中所述第一像素点对应的预设编码模式,不同预设编码模式对应不同的角度范围;
    将所述目标像素块中对应相同预设编码模式的所述第一像素点的第一亮度差异强度进行累加,得到各种预设编码模式下的第二亮度差异强度;
    将目标亮度差异强度对应的预设编码模式确定为所述第一候选编码模式,所述目标亮度差异强度为各种预设编码模式下的第二亮度差异强度中最大的 第二亮度差异强度。
  19. 根据权利要求16所述的装置,其中,所述第五确定子模块,具体用于:
    在所述第一候选编码模式与所述第二候选编码模式相同的情况下,将所述第一候选编码模式确定所述目标编码模式;
    在所述第一候选编码模式与所述第二候选编码模式不相同的情况下,将目标候选编码模式确定为所述目标编码模式;
    其中,所述目标候选编码模式为L种候选编码模式中率失真代价函数值最小的候选编码模式,所述L种候选编码模式包括所述第一候选编码模式和所述第二候选编码模式,L为大于1的整数。
  20. 根据权利要求11所述的装置,其中,所述帧内编码类型为第一类型,所述第一类型表征所述第一像素块进行帧内编码时的像素块大小等于所述第一像素块的大小,所述选择模块包括:
    第六确定子模块,用于确定所述K种预设编码模式下每种预设编码模式的绝对误差变换和代价函数值;
    第七确定子模块,用于将所述K种预设编码模式中目标代价函数值对应的预设编码模式确定为所述目标编码模式,所述目标代价函数值为所述K种预设编码模式对应的绝对误差变换和代价函数值中,最小的代价函数值。
  21. 一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,其中,所述程序或指令被所述处理器执行时实现如权利要求1-10任一项所述的预测编码方法的步骤。
  22. 一种可读存储介质,所述可读存储介质上存储程序或指令,其中,所述程序或指令被处理器执行时实现如权利要求1-10任一项所述的预测编码方法的步骤。
  23. 一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,其中,所述处理器用于运行程序或指令,实现如权利要求1-10任一项所述的预测编码方法的步骤。
  24. 一种计算机程序产品,所述计算机程序产品存储在非瞬态的存储介质中,其中,所述计算机程序产品被至少一个处理器执行以实现如权利要求1-10任一项所述的预测编码方法的步骤。
  25. 一种通信设备,被配置为执行如权利要求1-10任一项所述的预测编码方法的步骤。
PCT/CN2022/107303 2021-07-29 2022-07-22 预测编码方法、装置和电子设备 WO2023005830A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110864260.3 2021-07-29
CN202110864260.3A CN113489976A (zh) 2021-07-29 2021-07-29 预测编码方法、装置和电子设备

Publications (1)

Publication Number Publication Date
WO2023005830A1 true WO2023005830A1 (zh) 2023-02-02

Family

ID=77943511

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/107303 WO2023005830A1 (zh) 2021-07-29 2022-07-22 预测编码方法、装置和电子设备

Country Status (2)

Country Link
CN (1) CN113489976A (zh)
WO (1) WO2023005830A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113489976A (zh) * 2021-07-29 2021-10-08 维沃移动通信有限公司 预测编码方法、装置和电子设备
CN115460382B (zh) * 2022-11-09 2023-03-24 苏州迈创信息技术有限公司 一种安防工程用监控数据安全传输方法

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1753500A (zh) * 2005-10-31 2006-03-29 连展科技(天津)有限公司 一种基于h.264/avc标准的帧图像的帧内预测模式选择方法
CN101964906A (zh) * 2009-07-22 2011-02-02 北京工业大学 基于纹理特性的快速帧内预测方法和装置
WO2011080925A1 (ja) * 2009-12-28 2011-07-07 パナソニック株式会社 画像符号化装置および方法
CN109640087A (zh) * 2018-12-30 2019-04-16 深圳市网心科技有限公司 一种帧内预测模式判决方法、装置及设备
CN111741299A (zh) * 2020-07-09 2020-10-02 腾讯科技(深圳)有限公司 帧内预测模式的选择方法、装置、设备及存储介质
CN113489976A (zh) * 2021-07-29 2021-10-08 维沃移动通信有限公司 预测编码方法、装置和电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW501022B (en) * 1998-03-16 2002-09-01 Mitsubishi Electric Corp Moving picture coding system
WO2002078355A1 (en) * 2001-03-23 2002-10-03 Nokia Corporation Variable length coding
JP2008283560A (ja) * 2007-05-11 2008-11-20 Canon Inc 画像処理装置およびその方法
CN101217663B (zh) * 2008-01-09 2010-09-08 上海华平信息技术股份有限公司 用于编码器的图像像素块编码模式的快速选择方法
CN101640802B (zh) * 2009-08-28 2012-06-20 北京工业大学 基于宏块特征和统计特性的视频帧间压缩编码方法
CN102186070B (zh) * 2011-04-20 2013-06-05 北京工业大学 分层结构预判的快速视频编码方法
US20150049821A1 (en) * 2013-08-16 2015-02-19 Qualcomm Incorporated In-loop depth map filtering for 3d video coding

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1753500A (zh) * 2005-10-31 2006-03-29 连展科技(天津)有限公司 一种基于h.264/avc标准的帧图像的帧内预测模式选择方法
CN101964906A (zh) * 2009-07-22 2011-02-02 北京工业大学 基于纹理特性的快速帧内预测方法和装置
WO2011080925A1 (ja) * 2009-12-28 2011-07-07 パナソニック株式会社 画像符号化装置および方法
CN109640087A (zh) * 2018-12-30 2019-04-16 深圳市网心科技有限公司 一种帧内预测模式判决方法、装置及设备
CN111741299A (zh) * 2020-07-09 2020-10-02 腾讯科技(深圳)有限公司 帧内预测模式的选择方法、装置、设备及存储介质
CN113489976A (zh) * 2021-07-29 2021-10-08 维沃移动通信有限公司 预测编码方法、装置和电子设备

Also Published As

Publication number Publication date
CN113489976A (zh) 2021-10-08

Similar Documents

Publication Publication Date Title
US11438618B2 (en) Method and apparatus for residual sign prediction in transform domain
WO2023005830A1 (zh) 预测编码方法、装置和电子设备
US20080126278A1 (en) Parallel processing motion estimation for H.264 video codec
WO2012008125A1 (ja) 動画像符号化装置、動画像復号装置、動画像符号化方法及び動画像復号方法
WO2009033152A2 (en) Real-time video coding/decoding
WO2021238540A1 (zh) 图像编码方法、图像解码方法及相关装置
JP2013524730A (ja) 幾何学的動き区分のための固定小数点実装形態
CN104125466A (zh) 一种基于gpu的hevc并行解码方法
WO2023131059A1 (zh) 图像编码方法、图像编码装置、电子设备和可读存储介质
WO2021185257A1 (zh) 图像编码方法、图像解码方法及相关装置
US20120218432A1 (en) Recursive adaptive intra smoothing for video coding
CN111164972A (zh) 用于在帧级别控制视频编码的系统和方法
WO2019104862A1 (en) System and method for reducing video coding fluctuation
WO2019104611A1 (en) System and method for controlling video coding within image frame
KR20160076309A (ko) 부호화 방법 및 장치와 복호화 방법 및 장치
US20220417511A1 (en) Methods and systems for performing combined inter and intra prediction
EP3350994A1 (en) Transform selection for non-baseband signal coding
EP3955569A1 (en) Image prediction method and apparatus, and computer-readable storage medium
CN110741636A (zh) 用于视频编码的变换块级扫描顺序选择
WO2022252222A1 (zh) 编码方法和编码装置
WO2021244197A1 (zh) 图像编码方法、图像解码方法及相关装置
JP2023513772A (ja) ビデオコーディングのための方法、装置およびコンピュータプログラム
WO2012118569A1 (en) Visually optimized quantization
CN107409211A (zh) 一种视频编解码方法及装置
CN116188603A (zh) 图像处理方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22848435

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE