WO2025118292A1 - Encoding and decoding method, code stream, decoder, encoder, and storage medium - Google Patents
Encoding and decoding method, code stream, decoder, encoder, and storage medium Download PDFInfo
- Publication number
- WO2025118292A1 WO2025118292A1 PCT/CN2023/137583 CN2023137583W WO2025118292A1 WO 2025118292 A1 WO2025118292 A1 WO 2025118292A1 CN 2023137583 W CN2023137583 W CN 2023137583W WO 2025118292 A1 WO2025118292 A1 WO 2025118292A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- block
- value
- chrominance
- chroma
- luminance
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/186—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/50—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
- H04N19/503—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
- H04N19/51—Motion estimation or motion compensation
- H04N19/513—Processing of motion vectors
- H04N19/517—Processing of motion vectors by encoding
- H04N19/52—Processing of motion vectors by encoding by predictive encoding
Definitions
- the embodiments of the present application relate to the field of video coding and decoding technology, and in particular, to a coding and decoding method, a bit stream, a decoder, an encoder, and a storage medium.
- TSCPM cross-component prediction mode
- a chroma block copy intra-frame prediction mode is proposed.
- the chroma block can directly use the block vector or string vector of the luminance co-located block for motion compensation without the need for additional motion estimation.
- the final chroma prediction value is obtained by copying the chroma reconstruction value pointed to by the block motion vector.
- the reconstructed pixels in one row and one column adjacent to the current chrominance block are usually used as the model derivation information source, which results in the current TSCPM being unable to flexibly cope with more complex encoding and decoding scenarios, thereby reducing the encoding and decoding efficiency of the chrominance block.
- the embodiments of the present application provide a coding and decoding method, a bit stream, a decoder, an encoder and a storage medium, which can improve the coding and decoding efficiency of chroma blocks.
- an embodiment of the present application provides a decoding method, which is applied to a decoder, and the method includes:
- the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra block copying technique, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block;
- an embodiment of the present application provides an encoding method, which is applied to an encoder, and the method includes:
- the cross-component prediction model Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
- an embodiment of the present application provides a code stream, which is generated by bit encoding according to information to be encoded; wherein the information to be encoded includes at least one of the following:
- the value of the first syntax identification information, the value of the second syntax identification information, the value of the third syntax identification information, and the quantized chroma residual value of the current chroma block wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; the second syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode; the third syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode or a cross-component prediction mode based on the chroma intra-frame block copy technology.
- an embodiment of the present application provides a decoder, the decoder comprising a decoding part and a first determining part, wherein:
- the decoding part is configured to parse the code stream and determine the first syntax identification information
- the first determining part is configured to indicate that the current chroma block adopts the chroma intra-frame block copying technology based on the first syntax identification information.
- an encoder comprising a second determining part, wherein:
- the second determining part is configured to determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block;
- the cross-component prediction model Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
- an embodiment of the present application provides a decoder, the decoder comprising a first memory and a first processor, wherein:
- the first memory is configured to store a computer program that can be executed on the first processor
- the first processor is configured to execute the method according to the first aspect when running the computer program.
- an encoder comprising a second memory and a second processor, wherein:
- the second memory is configured to store a computer program that can be executed on the second processor
- the second processor is configured to execute the method according to the second aspect when running the computer program.
- an embodiment of the present application provides a computer-readable storage medium, which stores a computer program.
- the computer program When executed, it implements the method described in the first aspect or the second aspect.
- the embodiments of the present application provide a coding and decoding method, a bit stream, a decoder, an encoder and a storage medium.
- the bit stream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; and according to the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined.
- a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined.
- the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
- FIG. 1a is a schematic diagram 1 of an optional method of adopting a YCbCr color space provided in an embodiment of the present application;
- FIG1b is a second schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application.
- FIG1c is a third schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application.
- FIG1d is a fourth schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application.
- FIG2 is a schematic block diagram of an optional encoder provided in an embodiment of the present application.
- FIG3 is a schematic block diagram of an optional decoder provided in an embodiment of the present application.
- FIG4 is a schematic diagram of a network architecture of an optional encoding and decoding system provided in an embodiment of the present application.
- FIG5 is a schematic diagram of a flow chart of an optional two-step cross-component prediction mode provided in an embodiment of the present application
- FIG6a is a schematic diagram 1 of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application
- FIG6b is a second schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application.
- FIG6c is a third schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application.
- FIG6d is a fourth schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application.
- FIG6e is a fifth schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application.
- FIG7 is a schematic diagram of an optional template selection method for adjacent blocks provided in an embodiment of the present application.
- FIG8 is a schematic diagram of an optional method for selecting brightness samples of a cross-component nonlinear prediction model provided in an embodiment of the present application.
- FIG9 is a schematic diagram of a reference motion vector of an optional intra-block copy prediction technology provided in an embodiment of the present application.
- FIG10 is a schematic diagram of a luma co-located block in an optional chroma block copy intra prediction mode provided in an embodiment of the present application;
- FIG11 is a schematic flow chart of an optional decoding method provided in an embodiment of the present application.
- FIG12a is a schematic diagram of an optional reference brightness block provided in an embodiment of the present application.
- FIG12b is a schematic diagram of an optional reference chromaticity block provided in an embodiment of the present application.
- FIG13a is a schematic diagram 1 of an optional preset sample point selection method provided in an embodiment of the present application.
- FIG13b is a second schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application.
- FIG13c is a third schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application.
- FIG13d is a fourth schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application.
- FIG13e is a fifth schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application.
- FIG14 is a schematic diagram of an optional multiple cross-component prediction sub-model provided in an embodiment of the present application.
- FIG15 is a schematic diagram of an optional six-tap filter provided in an embodiment of the present application.
- FIG16 is a schematic diagram of a flow chart of an optional encoding method provided in an embodiment of the present application.
- FIG17 is a schematic diagram of the composition structure of an optional decoder provided in an embodiment of the present application.
- FIG18 is a schematic diagram of a specific hardware structure of an optional decoder provided in an embodiment of the present application.
- FIG19 is a schematic diagram of the composition structure of an optional encoder provided in an embodiment of the present application.
- FIG20 is a schematic diagram of a specific hardware structure of an optional encoder provided in an embodiment of the present application.
- FIG. 21 is a schematic diagram of the composition structure of an optional encoding and decoding system provided in an embodiment of the present application.
- first ⁇ second ⁇ third involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that “first ⁇ second ⁇ third” can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
- Digital video compression technology is mainly used to compress huge digital video data for transmission and storage.
- digital video compression technology is a technology that saves storage space and transmission bandwidth by reducing the amount of video data.
- Video data usually takes up a lot of space, and compression technology can effectively reduce the file size while maintaining quality loss that is imperceptible to the human eye.
- the existing digital video compression standards can save a lot of video data, there is still a need to pursue better digital video compression technology to reduce the bandwidth and traffic pressure of digital video transmission.
- Video compression usually relies on specific coding standards. Common video coding standards include H.264/AVC, H.265/HEVC, VP9, AV1, etc. These standards define the algorithms and specifications for video compression to ensure the compatibility of videos on different devices. Video compression technology is mainly divided into intra-frame compression and inter-frame compression. Intra-frame compression relies on the encoding of a single video frame, while inter-frame compression exploits the similarity between frames. In inter-frame compression, motion compensation is a key technology. By detecting motion in adjacent frames and predicting the position of pixels based on motion information, the amount of data can be reduced while maintaining video quality. Quantization is the process of mapping pixel values in an image or video to a smaller set, thereby reducing the representation range of the data.
- Entropy coding optimizes the encoding process by utilizing statistical information in the data to further reduce the amount of data.
- Some applications have high real-time requirements for video transmission, such as video conferencing, real-time monitoring, etc. Therefore, some compression standards and technologies focus on providing low-latency solutions.
- digital video compression technology has been widely used in the multimedia field, which not only affects the efficiency of video storage and transmission, but also has a positive impact on the user experience of video applications.
- Video compression includes multiple modules such as intra-frame prediction (spatial domain) and/or inter-frame prediction (temporal domain) for reducing or removing inherent redundancy in the video, quantization and inverse quantization of residual information, loop filtering and entropy coding for improving subjective and objective reconstruction quality.
- Most mainstream video compression standards describe block-based compression technology.
- a video clip a frame of a picture or a series of pictures will be divided into basic units called CTUs, which are further divided into blocks called CUs.
- Intra-frame blocks are predicted using the pixels surrounding the block as a reference, while inter-frame blocks refer to the spatial neighboring block information and reference information in other frames.
- the residual information is transmitted in blocks. Transform, quantize and entropy encode into bitstream.
- Video devices can achieve more efficient video encoding and decoding and transmission and storage by implementing these technologies.
- digital video is a video recorded in digital form, which is composed of a series of digital images, each image is composed of a number of rows and columns of pixels, and each pixel is represented by a digital value.
- a mathematical model including RGB, YUV, etc.
- different color spaces are generated according to different processing methods and storage formats for different color data.
- Color space is a specific form of color organization, and color space defines a way to represent and organize color information. Different color spaces use different coordinate systems or parameters to describe colors, which makes it easy to represent, edit, analyze and process colors.
- the color space includes RGB format (Red Green Blue), YUV format (Luminance-Chrominance-Saturation), HSV format (Hue-Saturation-Value), Lab format and CMYK format (Cyan-Magenta-Yellow-Key).
- RGB format Red Green Blue
- YUV format Luminance-Chrominance-Saturation
- HSV format Human-Saturation-Value
- Lab format Lab format
- CMYK format Cyan-Magenta-Yellow-Key
- the RGB color space uses three components, red, green, and blue, to represent colors, and the value range of each component is usually 0 to 255.
- the RGB color space is widely used in computer graphics and display technology, and is used for displays, cameras, digital images, etc. RGB is characterized by being intuitive, easy to process and display, but the RGB color space in different devices and standards may be slightly different.
- the YUV color space includes three components: brightness (Y) and chrominance (U, V), which represent brightness information and chrominance information respectively.
- the YUV color space is mainly used in video coding, such as H.264, H.265, etc.
- the separation of chrominance information makes it easier to remove some color details that are not easily perceived by the human eye when compressing the video.
- the YUV color space is suitable for video coding, which separates brightness and chrominance and improves compression efficiency.
- the HSV color space uses three parameters: hue, saturation, and value to describe color.
- the HSV color space is mainly used in image editing and graphic design because it is more in line with human perception of color.
- the characteristics of the HSV color space are intuitive and easy to understand and adjust colors.
- Hue indicates the type of color
- saturation indicates the purity of the color
- value indicates the brightness of the color.
- the Lab color space includes brightness (L) and two chromaticity components (a, b).
- the Lab color space is used to describe the color differences perceived by human vision and is a device-independent color space.
- the Lab color space can more accurately describe the differences between colors and is widely used in applications such as color matching and color correction.
- the CMYK color space uses four color components, cyan, magenta, yellow, and black, which respectively represent the ink content of the ink cartridge.
- the CMYK color space is mainly used in the printing field to define printing colors.
- the CMYK color space is suitable for the printing process. Various colors can be obtained by adjusting the content of different color components.
- the color object is an objective object, and different color spaces only measure the same object from different angles, and do not change the nature of the color object.
- the color organization methods of color space are diverse and varied. According to incomplete statistics, there are 40 different models, the common ones are RGB, CMY (K), HSI, YUV, YIQ, YCbCr, etc. Among them, the models based on the three primary colors are mainly RGB and CMY (K), and the models based on brightness and chromaticity are mainly HIS, YUV, YIQ, and YCbCr. The main uses of different color space models are also different.
- RGB is mainly used in display systems
- CMY (K) is mainly used in printers
- YUV is used for PAL color TVs
- YIQ is used for NTSC color TVs
- YCbCr is used for digital color TVs.
- YCbCr color space is the main form of expression of digital video encoding source, where Y represents brightness, that is, grayscale value
- Cb represents the difference between the blue signal part and the brightness value
- Cr represents the difference between the red signal part and the brightness value.
- This format separates brightness information from color information, and uses the characteristics of human eyes that are sensitive to brightness but not to chrominance to compress some color information, thereby achieving the purpose of reducing bandwidth.
- YCbCr has many sampling formats, such as 4:4:4, 4:2:2, 4:1:1 and 4:2:0.
- FIG. 1a shows a schematic diagram of a sampling point of 4:4:4
- FIG. 1b shows a schematic diagram of a sampling point of 4:2:2
- FIG. 1c shows a schematic diagram of a sampling point of 4:1:1
- FIG. 1d shows a schematic diagram of a sampling point of 4:2:0.
- the sampling point of 4:4:4 means that the brightness (Y) component and the chrominance (Cb and Cr) components are sampled in units of each pixel in the horizontal and vertical directions, that is, each pixel has independent chrominance information and brightness information.
- the sampling method of 4:4:4 retains the highest color information and is suitable for scenes with high color accuracy requirements, but it also requires more storage and transmission bandwidth.
- the sampling point of 4:2:2 means that the sampling rate of the brightness (Y) component is 4 pixels per row, and the sampling rate of the chrominance (Cb and Cr) is 2 pixels per row.
- the sampling point is 4:4:4
- the Y component is sampled only once for every 4 pixels in the horizontal direction, that is, the brightness information is shared for each group of 4 pixels.
- the Cb and Cr components are sampled only once for every two pixel values in the horizontal direction, that is, the chrominance information is shared for every two pixels.
- this method can reduce the sampling rate of the chrominance component, thereby reducing the amount of data and saving storage and transmission bandwidth.
- the sampling point of 4:1:1 means that the luminance (Y) component is sampled in units of each pixel in the horizontal direction, while the chrominance (Cb and Cr) components are sampled once every 4 pixels in the horizontal direction, that is, each pixel has independent luminance information, and every 4 pixels share a set of chrominance information.
- the sampling method of 4:1:1 has a lower sampling rate for the chrominance component than the sampling method of 4:2:2, which can reduce the amount of data and save storage and transmission bandwidth.
- the sampling point of 4:2:0 means that the luminance (Y) component is sampled in units of each pixel in the horizontal and vertical directions, while the chrominance (Cb and Cr) components are sampled once every 2 pixels in the horizontal direction and once every 2 lines in the vertical direction, that is, each pixel has independent luminance information, and every 4 pixels share a set of chrominance information.
- the sampling method of 4:2:0 has a lower sampling rate for the chrominance component than the sampling method of 4:4:4, which can significantly reduce the amount of data and is suitable for video compression and transmission.
- TSCPM cross-component prediction mode
- the linear model parameters ⁇ and ⁇ are used to calculate a temporary luma prediction block of the same size.
- the goal of this step is to establish a linear relationship between the luma and chroma components.
- the linear model parameters ⁇ and ⁇ are calculated by analyzing the reference samples of the luma block and the corresponding chroma reference samples.
- the temporary luma prediction block is downsampled to obtain the corresponding chroma prediction value.
- the downsampling operation usually involves operating the luma block in the horizontal and vertical directions to match the resolution of the chroma component.
- the result of downsampling is used to generate the prediction block of the chroma component, which will be used for intra prediction.
- TSCPM establishes a linear relationship between luminance and chrominance components, first predicts luminance, and then obtains chrominance prediction through downsampling, thereby achieving efficient prediction of chrominance components. This method helps to improve the efficiency of video coding, reduce data redundancy, and improve compression performance.
- TSCPM is mainly used in modern video coding standards such as H.264, H.265, etc.
- video compression technology is also a traditional codec based on blocks, which can include multiple modules, such as block division, intra-frame prediction, inter-frame prediction, transformation, quantization, entropy coding, loop and post-processing filtering, etc.
- the embodiment of the present application mainly improves the prediction part to improve the coding performance of TSCPM.
- the prediction part may include multiple techniques, including luma prediction mode and chroma prediction mode.
- the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109 and a decoded image cache unit 110, etc.
- the filtering unit 108 may implement deblocking filtering and sample adaptive offset (Sample Adaptive Offset, SAO) filtering
- the encoding unit 109 may implement header information encoding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmetic Coding, CABAC).
- a video coding block can be obtained by dividing the coding tree unit (CTU), and then the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101 to transform the video coding block, including transforming the residual information from the pixel domain to the transform domain, and quantizing the obtained transform coefficients to further reduce the bit rate;
- the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block;
- the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information;
- the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, and the motion vector can estimate the motion of the video coding block, and then
- the motion vector determined by the motion estimation unit 105 performs motion compensation; after determining the intra-frame prediction mode, the intra-frame prediction unit 103 is also used to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; in addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the pixel domain, and the reconstructed residual block is removed by the filter control analysis unit 107 and the filtering unit 108.
- the encoding unit 109 is used to encode various coding parameters and quantized transform coefficients.
- the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode and output the code stream of the video signal; and the decoded image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
- the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image cache unit 206, etc., wherein the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering.
- the code of the video signal is output.
- the code stream is input into the decoder 200, and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and the data from the previously decoded blocks of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses the prediction information to generate the video being decoded.
- the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove the block effect artifacts, which can improve the video quality; and then the decoded video block is stored in the decoded image buffer unit 206, which stores the reference image for subsequent intra-frame prediction or motion compensation, and is also used for the output of the video signal, that is, the restored original video signal is obtained.
- the embodiment of the present application also provides a network architecture of a codec system including an encoder and a decoder, wherein FIG4 shows a schematic diagram of a network architecture of a codec system provided by an embodiment of the present application.
- the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01.
- the electronic device can be various types of devices with video codec functions during implementation, for example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensor device, a server, etc., and the embodiment of the present application is not specifically limited.
- the decoder or encoder described in the embodiment of the present application can be the above-mentioned electronic device.
- the method of the embodiment of the present application is mainly applied to the prediction part shown in Figure 4 and the prediction part shown in Figure 3. That is to say, the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited.
- the prediction part here can include an intra-frame prediction part and an inter-frame prediction part.
- the "current block” specifically refers to the encoding block currently to be subjected to chroma prediction; at the decoding end, the “current block” specifically refers to the decoding block currently to be subjected to chroma prediction.
- the current block can be a coding unit (Coding Unit, CU), a coding tree unit (Coding Tree Unit, CTU), or even a prediction unit (Prediction Unit, PU) or a transform unit (Transform Unit, TU), which is not specifically limited here.
- Two-step cross-component prediction mode is an inter-component prediction technology that removes inter-component redundancy by exploring the linear relationship between different components.
- TSCPM is performed in two steps, as shown in Figure 5.
- the luma block corresponding to the current chroma block to be encoded i.e., the co-located luma reconstruction block
- a temporary prediction block of the same size i.e., the intermediate predicted chroma block
- ⁇ and ⁇ the predicted value of the chroma component
- Final Chroma Prediction Block the predicted value of the chroma component
- the co-located luma reconstruction block can be expressed as RL (x, y)
- the final predicted chroma block can be expressed as Pc (x, y).
- the values of the linear model parameters ⁇ and ⁇ are calculated by reconstructing the luminance reference sample and the corresponding chrominance reference sample of the previous reference row and the left reference column of the current coding block.
- the specific derivation process is as follows:
- the availability of upper pixels and left pixels needs to be considered, which is divided into the following three cases:
- Case 3 If only left pixels are available in the current block, the four pixel pairs are all selected from the left side, and the selected positions are: 0/4, 1/4, 2/4, 3/4 of the height.
- the size of the chrominance block to be encoded is WxH, its width is W, and its height is H.
- the mean points of these two groups are used to derive the linear model parameters.
- the mean point value of the two points with larger brightness values is xMax
- the mean point value of the two points with smaller brightness values is xMin
- the corresponding larger and smaller mean points of the corresponding chromaticity points can be obtained, represented by yMax and yMin respectively
- the value of ⁇ is (yMax-yMin)/(xMax-xMin)
- the value of M is yMin- ⁇ *xMin.
- the division method for calculating the value of ⁇ can be replaced by a lookup table method to reduce the implementation complexity, and a shift precision value shift is added to ensure the calculation accuracy.
- the default values are used, where the default value of ⁇ is 0 and the default value of ⁇ is 1 ⁇ (BitDepth-1), where BitDepth represents the bit depth value of the sample.
- an intermediate prediction pixel block of the same size as the corresponding brightness block can be calculated.
- (x, y) represents the coordinate position of the pixel point of the chrominance block to be encoded
- RL (x, y) represents the luminance reconstructed pixel value with the coordinate position (x, y) in the co-located luminance block corresponding to the chrominance block to be encoded
- Pc ′(x, y) represents the pixel value of the intermediate prediction block.
- the intermediate predicted pixel value is downsampled, and a six-tap filter [1 2 1; 1 2 1] is used by default to downsample to obtain the predicted pixel value of the final chrominance block to be encoded.
- P c (x, y) is the predicted pixel value of the chrominance block to be encoded.
- the nonlinear cross-component model building process may include the following steps:
- Step 1 downsample the brightness of the current block (co-located brightness block) and the adjacent template area to obtain downsampled brightness samples.
- the present application takes the sampling format of 4:2:0 as an example for explanation, and downsampling in the following generally refers to dividing the width and height by 2 to obtain downsampled brightness samples.
- Step 2 Based on the neighboring templates, a cross-component prediction model of luminance (Y) and chrominance (U/V) is constructed.
- the template selection method of the neighboring block is shown in FIG7 , and the current chrominance block (shown as a white area in FIG7 ) is used as a reference: the upper left (i.e., area A), upper (i.e., area B), upper right (i.e., area C), left (i.e., area D), and lower left (i.e., area E) of the current block are selected to construct a template.
- the upper left i.e., area A
- upper i.e., area B
- upper right i.e., area C
- left i.e., area D
- lower left i.e., area E
- the width of area C is equal to the width of the current block (i.e., W)
- the height of area E is equal to the height of the current block (i.e., H)
- the template width ⁇ is fixedly set to 6 here, and will be adaptively adjusted according to the availability of neighboring samples; when the lower right corner of area C (area E) is not reconstructed or exceeds the image boundary, area C (area E) is unavailable.
- the model of the cross-component nonlinear prediction model selects the target chrominance sample (i.e., C) of the current chrominance block, the associated position C in the downsampled luminance image, and the downsampled luminance samples around it, and the surrounding downsampled luminance samples include: the sample above the associated position C (i.e., N), the sample below the associated position C (i.e., S), the sample to the left of the associated position C (i.e., W), and the sample to the right of the associated position C (i.e., E).
- sample points in the template area are selected for calculation of the cross-component nonlinear prediction model. Specifically, only sample points whose horizontal coordinates and vertical coordinates in the template area meet the following constraints are selected, that is, sample points whose horizontal coordinates and vertical coordinates are not odd numbers.
- multiple equations are constructed to solve the linear equations to obtain the model parameters of the cross-component nonlinear prediction model.
- the model is solved using the LDL solution method, and the entire process uses an integer calculation process.
- Step 3 Based on the cross-component model, the downsampled luminance samples corresponding to the current block in step 1 are input to obtain the predicted value of chrominance (U/V).
- IBC technology is similar to inter-frame image prediction, except that the prediction block of IBC is generated by the reconstructed block of the current encoded image frame.
- the white block on the lower right is the current Coding Unit (CU), and the coded white block on the upper left is the Predictor Block (PB).
- the current CU is similar to the prediction block. If the position of the upper left white block is found by searching at the encoder, only the position vectors (Block Vector, BV) of the two blocks (i.e., reference motion vectors) need to be transmitted. The decoder can obtain a more accurate prediction value through this information. Compared with the ordinary intra-frame prediction method, IBC can make better use of the redundant information within the frame, thereby improving the coding performance.
- a reference (Candidate) matching the current block is found through a hash search or a full search within a maximum range of 64*64.
- the hash search range is limited to the current CTU and the n CTUs to the left of the current CTU, where n varies according to the CTU size. If the CTU size is 128*128, then n is 1.
- the maximum allowed IBC size in the bitstream is 64*64, but the encoder currently only searches for blocks of 16*16 or less for acceleration.
- bv is transmitted with integer pixel precision, without prediction of bvp.
- the IBC mode only supports PB of 2N*2N, but the TB size can be N*N or 2N*2N.
- the Luma block and Chroma block are divided differently in some small blocks. If such division inconsistency occurs, the Chroma block is consistently restricted to intra mode.
- chroma pixels need to be interpolated, using 1:1 2tap interpolation.
- the chroma block copy intra prediction mode is a chroma intra prediction mode.
- AVS allows the use of a block partitioning structure of a local dual tree, which allows the luminance block and the chroma block to have different partitioning structures.
- the minimum length or width of the luminance block and the chroma block is at least 4 pixels.
- the chroma block is restricted to using only the intra prediction mode.
- an IBC prediction scheme specifically for chroma is proposed. Under this scheme, the chroma block can directly use the block vector or string vector of the luminance co-located block for motion compensation, without the need for additional motion estimation, and the final chroma prediction value is obtained by copying the chroma reconstruction value pointed to by the block motion vector.
- the process of chroma block copy intra prediction mode includes the following steps:
- Step 1 if the luminance sample located at the position ⁇ C, TL, TR, BL, BR ⁇ on the luminance co-located block corresponding to the CU of the chrominance block is a block copy intra-frame prediction mode or a normal string sub-mode of string copy intra-frame prediction, then the current block can use the chrominance block copy mode, where C represents the middle position, TL represents the upper left position, TR represents the upper right position, BL represents the lower position, and BR represents the lower right position.
- Step 2 If the luma sample has an available displacement vector, the chroma block uses the displacement vector for motion compensation.
- Step 3 Otherwise, if there is at least one available displacement vector among the default displacement vectors ⁇ (-w, 0), (0, -h) ⁇ , use the first available displacement vector for motion compensation.
- Step 4 Otherwise, if there is no available displacement vector, the prediction values of all samples of the current chroma block are set to 2 BitDepth-1 , where BitDepth is the coding sample precision.
- Step 5 The chroma block encodes a flag cibc_flag in the bitstream to indicate whether to use the chroma block copy intra prediction mode.
- an embodiment of the present application provides a coding and decoding method, a bit stream, an encoder, a decoder and a storage medium.
- the bit stream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; according to the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined.
- a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined.
- the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
- FIG. 11 is a schematic flow chart of an optional decoding method provided in an embodiment of the present application. As shown in FIG. 11 , the method may include S301 to S305:
- S301 parse a bitstream to determine first syntax identification information.
- the decoding method of the embodiment of the present application is applied to a decoder.
- the decoding method may specifically refer to a chrominance prediction method.
- this is mainly a technical improvement for a chrominance prediction mode, more specifically, it may be a cross-component prediction mode based on chrominance intra-frame block copy technology in the prediction mode, so as to avoid the problem that TSCPM in the related art cannot flexibly cope with more complex encoding and decoding scenarios, thereby reducing the encoding and decoding efficiency of the chrominance block.
- the decoder determines the first syntax identification information by parsing the bitstream, wherein the first syntax identification information is used to indicate whether the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology.
- the implementation of parsing the bitstream in S301 and determining the first syntax identification information may include the following two situations:
- the implementation before S301 may include: parsing the code stream to determine the second syntax identification information;
- the step of parsing the code stream to obtain the first syntax identification information is performed.
- parsing the code stream and determining the implementation of the second syntax identification information may include:
- the value of the second syntax identification information is the first value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode; or,
- the value of the second syntax identification information is the second value, it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode.
- the second syntax identification information may be represented as cibc_flag.
- the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form.
- the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.
- the value of the second syntax identification information when the value of the second syntax identification information is the first value, it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, and redundant information is reduced by intra-frame block copying, thereby achieving a compression effect.
- the value of the second syntax identification information is the second value, it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode, which can avoid or limit the use of chroma intra-frame block copying, improve decoding stability, or avoid performance problems in some specific situations.
- the implementation of parsing the code stream in S301 and determining the first syntax identification information may include:
- the value of the first syntax identification information is the third value, it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology; or,
- the value of the first syntax identification information is the fourth value, it is determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology.
- the first syntax identification information may be represented as tcibc_flag.
- the third value is different from the fourth value, and the third value and the fourth value can be in parameter form or in digital form.
- the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the third value can be set to 1 and the fourth value can be set to 0; or, the third value can be set to 0 and the fourth value can be set to 1; or, the third value can be set to true and the fourth value can be set to false; or, the third value can be set to false and the fourth value can be set to true; but this is not specifically limited here.
- the first syntax identification information plays the role of a switch, that is, when the first syntax identification information is the first value (for example, 1 or true), it indicates that the decoding algorithm described in the embodiment of the present application is not started, that is, the decoding algorithm described in the embodiment of the present application is not executed; when the first syntax identification information is a second value (such as 0 or false), it indicates that the decoding algorithm described in the embodiment of the present application is started, that is, the decoding algorithm described in the embodiment of the present application is executed.
- the first syntax identification information is the first value (for example, 1 or true)
- the first syntax identification information is a second value (such as 0 or false)
- Case 2 The implementation before S301 may include: parsing the code stream to determine the third syntax identification information;
- the step of parsing the code stream to obtain the first syntax identification information is performed.
- parsing the code stream and determining the third syntax identification information may include:
- the value of the third syntax identification information is the fifth value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology; or,
- the value of the third syntax identification information is the sixth value, it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology.
- the third syntax identification information may be represented as cibc_flag.
- the fifth value is different from the sixth value, and the fifth value and the sixth value can be in parameter form or in digital form.
- the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the fifth value can be set to 1 and the sixth value can be set to 0; or, the fifth value can be set to 0 and the sixth value can be set to 1; or, the fifth value can be set to true and the sixth value can be set to false; or, the fifth value can be set to false and the sixth value can be set to true; but no specific limitation is made here.
- the implementation of parsing the code stream in S301 and determining the first syntax identification information may include:
- the value of the first syntax identification information is the seventh value, it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology;
- the value of the first syntax identification information is the eighth value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode.
- the first syntax identification information may be represented as tcibc_flag.
- the seventh value is different from the eighth value, and the seventh value and the eighth value can be in parameter form or in digital form.
- the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the seventh value can be set to 1 and the eighth value can be set to 0; or, the seventh value can be set to 0 and the eighth value can be set to 1; or, the seventh value can be set to true and the eighth value can be set to false; or, the seventh value can be set to false and the eighth value can be set to true; but no specific limitation is made here.
- the first grammar identification information acts as a switch, that is, when the first grammar identification information is a first value (such as 1 or true), it indicates that the decoding algorithm described in the embodiment of the present application is not started, that is, the decoding algorithm described in the embodiment of the present application is not executed; when the first grammar identification information is a second value (such as 0 or false), it indicates that the decoding algorithm described in the embodiment of the present application is started, that is, the decoding algorithm described in the embodiment of the present application is executed.
- a first value such as 1 or true
- first value, the second value, the third value, the fourth value, the fifth value, the sixth value, the seventh value and the eighth value may be expressed in the same form (i.e., parameter form or digital form).
- first value, the third value, the fifth value and the seventh value may be 1 or True
- second value, the fourth value, the sixth value and the eighth value may be 0 or False.
- the current chroma block is also called the current block, the current block to be decoded, the current chroma block to be decoded, the block to be decoded, the chroma block to be decoded, etc., and the embodiment of the present application does not impose any limitation on this.
- the current chrominance block adopts the Cross-component prediction mode for chroma intra block copy technique.
- the co-located luminance block refers to a luminance block corresponding to the current chrominance block.
- the co-located luminance block refers to a luminance block corresponding to the current chrominance block.
- the co-located luminance block for each chrominance block (Cb or Cr block), there is a luminance block in the same position or relative position, and this luminance block is called the co-located luminance block.
- the image is divided into a brightness component (Y) and two chrominance components (Cb, Cr).
- the brightness component (Y) contains the black and white information of the image, while the chrominance components (Cb, Cr) contain color information.
- the sampling rate of the chrominance component is usually lower than that of the brightness component, which means that for each brightness block, there may be multiple chrominance blocks.
- For each chrominance block there is a co-location brightness block, which means that they have the same position or a certain relative position relationship in the image.
- the size of the brightness block is larger than the size of the chrominance block.
- a brightness block may correspond to a 4x4 or 8x8 pixel block, while the chrominance block may correspond to a smaller 2x2 or 4x4 pixel block.
- the reference motion vector is used to predict the motion information of the current image block.
- the current co-located luminance block corresponding to the current chrominance block has the same motion vector.
- the obtained motion vector is applied to the current chrominance block to predict the position of the current chrominance block. This prediction process helps to reduce the residual caused by motion and improve decoding efficiency.
- FIG12a shows the reference luminance block (Ref Luma) corresponding to the reference motion vector for the collocated luminance block (Col-Luma) corresponding to the current chrominance block (Current Block) under the luminance channel (Luma Channel).
- FIG12b shows the reference chrominance block (Ref Chroma) corresponding to the reference motion vector for the current chrominance block under the chrominance channel (Chroma Channel).
- whether the reference motion vector is valid can be determined from the following aspects:
- the reference motion vector is an integer value in pixels.
- the range of motion vectors specified by the H.264 standard is a specific number of pixels, usually with upper and lower limits in the horizontal and vertical directions.
- the decoded motion vector is within the specified range. If the value of the motion vector exceeds the specified range, it may indicate that the reference motion vector is invalid.
- the decoder may check this flag. If the flag indicates that the motion vector is invalid, the decoder will not use the vector for motion compensation.
- Motion vectors are usually relative to a reference frame. At the decoding end, it is necessary to ensure that the reference frame corresponding to the reference motion vector is available, that is, it has been decoded or is already in the cache. If the reference frame is not available, the motion vector cannot be correctly applied to the current frame. If the reference frame is not available, the decoder may need to adopt some error handling strategies, such as skipping motion compensation for the current block or using other strategies for intra-frame prediction.
- the invalidity (unavailable) here may specifically refer to:
- the reference luminance block and the reference chrominance block are not reconstructed, but usually, the area above and to the left of the current chrominance block (i.e., the template area), or the reference luminance block and the reference chrominance block have been reconstructed;
- condition setting is not met. Generally, some specially designed modes only allow the current block to use the pixels in the left template or only allow the current block to use the pixels in the upper template.
- the reference motion vector when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds, the reference motion vector is determined to be invalid; or,
- the reference motion vector is determined to be valid when the reference motion vector satisfies that the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector does not cross the boundary.
- the implementation of determining whether the reference motion vector is valid may include the following steps:
- Step 1 Check whether the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed.
- the reference block may not be reconstructed because the corresponding block in the reference frame has not been completely decoded, or the decoder has not completed decoding of the reference frame.
- the decoder may need to wait for the reference block to be completely reconstructed, or use some Error handling mechanism. For example, you can choose to skip motion compensation for the current block and temporarily use other methods to fill or interpolate to prevent errors caused by incomplete decoding.
- Step 2 Check whether the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches.
- the reference block may use a prediction mode that does not match the current block. This may occur in intra-frame prediction, where the reference block may use a different prediction mode.
- the decoder may need to detect and correct the prediction mode mismatch, which may involve trying to adjust the prediction mode of the reference block according to the prediction mode of the current block, or performing other error recovery strategies.
- Step 3 Check whether the reference motion vector is out of bounds.
- the value of the reference motion vector may exceed the specified range, which may be caused by a coding error, a transmission error or other abnormal situation.
- a coding error a transmission error or other abnormal situation.
- Possible processing methods include clipping the value of the motion vector to keep it within the valid range, or using other error handling methods.
- the above steps are to ensure the legitimacy of the reference motion vector and prevent erroneous or invalid reference motion vectors from affecting the decoding quality.
- the decoder ensures the accuracy and robustness of decoding by detecting and processing these situations, thereby improving the reliability of video decoding.
- S304 Determine a predicted chrominance value of the predicted chrominance block based on the cross-component prediction model.
- the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a relationship with the predicted chrominance value of the predicted chrominance block.
- the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with the predicted chrominance value of the predicted chrominance block.
- the linear cross-component prediction model can improve decoding efficiency and remove the redundancy of the chrominance component, so that the model can better fit the relationship between brightness and chrominance in actual scenes.
- the decoder can more accurately estimate the value of the chrominance component, thereby achieving better compression effect during the decoding process, which is beneficial to improving the performance and quality of video decoding.
- linear relationship can effectively capture the relationship between the same-position luminance block and the predicted chrominance block in many cases, there may sometimes be some nonlinear relationships.
- a more complex nonlinear model may also be used.
- whether to use a linear or nonlinear relationship model depends on the actual coding standard, application scenario, and optimization requirements. Linear models are usually simpler, but in some cases may not be sufficient to accurately express complex relationships. Nonlinear models are more flexible, but usually require more computing resources.
- the decoding method further includes S306:
- the sample accuracy of the current chrominance block refers to the representation accuracy of the chrominance component (Chroma), which is usually expressed in bits (Bit-Depth), and a higher sample accuracy is usually used to retain the details and color information in the image.
- Chroma chrominance component
- 8-bit sample accuracy means that each chrominance component is represented by 8 binary bits (or bits).
- Higher sample accuracy can provide more color levels, thereby improving color resolution. This is very important for retaining subtle color differences in images.
- High sample accuracy helps to more accurately represent colors in the real world and improve color fidelity. Selecting an appropriate sample accuracy also involves a balance in coding efficiency. Higher sample accuracy may require more bits to represent each pixel, thereby increasing the amount of encoded data.
- the sample accuracy of the current chroma block can be expressed as BitDepth.
- the sample accuracy of the current chroma block may include the following:
- 16-bit sample accuracy Each component is represented by 16 bits, which can provide very high accuracy and allow the representation of 65536 different brightness or chromaticity levels. This is usually used in special application areas such as medical imaging, which require extremely high image accuracy.
- sample accuracy listed above is only an example, and different sample accuracy is suitable for different application scenarios. Higher sample accuracy can usually provide richer color details and image quality, but also requires more storage space and transmission bandwidth. When selecting sample accuracy, it is necessary to balance image quality and data transmission efficiency according to the needs of specific applications. The embodiment of the present application does not impose any restrictions on sample accuracy, and it can be selected according to the actual scenario.
- the predicted chroma value of the predicted chroma block is determined according to the sample accuracy of the current chroma block.
- Implementation may include S3061 to S3062:
- the first preset value and the second preset value are pre-set values.
- the first preset value is 1 and the second preset value is 2.
- the fourth intermediate parameter can be expressed as BitDepth-1.
- the predicted chrominance value of each pixel in the predicted chrominance block can be expressed as 2 BitDepth-1 .
- the predicted chrominance value of each pixel in the predicted chrominance block is generated through sample precision, preset value and exponential operation. By adjusting the sample precision and different preset values, different predicted chrominance values can be explored, thereby providing more flexible adjustment and optimization options in video encoding, which helps to better adapt to different application scenarios and requirements in video decoding.
- the implementation of determining the reconstructed chroma value of the current chroma block according to the predicted chroma value of the predicted chroma block in S305 may include S3051 to S3053:
- the chrominance residual value represents the difference between the current chrominance block and the predicted value.
- These residual values are usually encoded and stored in the bit stream, and parsing the bit stream is to extract these residual values from the bit stream.
- the chrominance residual value may have been transformed and quantized, and in order to obtain the actual residual value, it is necessary to perform inverse transformation and inverse quantization.
- the purpose of this step is to restore the encoded residual value to the original difference value.
- the reconstructed chrominance value of the current chrominance block is obtained by adding the inverse quantized residual value to the predicted chrominance value. This is the last step of chrominance block reconstruction, and the obtained reconstructed chrominance value will be used to construct the final image frame.
- the inverse quantization and inverse transformation process helps to accurately restore the original chrominance residual information at the decoding end. This helps to improve the compression ratio of the video, that is, to reduce the file size while maintaining the image quality.
- the inverse quantization and inverse transformation process helps to minimize the distortion introduced by the encoding.
- the above process is intended to minimize the computational complexity in the encoding and decoding process while maintaining the image quality, which helps to improve the efficiency of encoding and decoding.
- a decoding method comprising: at a decoding end, parsing a bitstream to determine first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra-frame block copying technology, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chroma block corresponding to the reference motion vector; determining a predicted chroma value of the predicted chroma block based on the cross-component prediction model; and determining a reconstructed chroma value of the current chroma block according to the predicted chroma value of the predicted chroma block.
- the cross-component prediction model is determined by the reference luminance block and the reference chroma block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of an adjacent row and column of the current chroma block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chroma block.
- the reference motion vector is determined according to the current co-located luminance block corresponding to the current chrominance block. This step helps to introduce the information of the luminance block into the decoding process of the chrominance block to improve the accurate processing of motion correlation.
- the predicted chrominance value of the predicted chrominance block is determined, which makes full use of the information of the luminance block, helps to improve the prediction accuracy of the chrominance block, and helps to more accurately restore the chrominance information in the original image at the decoding end, thereby improving the image quality.
- the above process can improve the decoding accuracy of the chrominance block, enhance the image quality, and utilize cross-component correlation.
- the decoding process more comprehensively utilizes the association between different components in the video image, thereby improving the decoding effect.
- the implementation of determining the reference motion vector according to the current co-located luminance block corresponding to the current chrominance block in S302 may include S401:
- S401 Determine candidate reference samples that meet a preset prediction mode in a current co-located luminance block, and use motion vectors corresponding to the candidate reference samples as reference motion vectors.
- the preset prediction mode is: the candidate reference samples adopt the block copy intra prediction mode (Intra Block Copy, IBC) or the ordinary string mode of string copy intra prediction.
- IBC Intra Block Copy
- the decoder determines candidate reference samples that satisfy the block copy intra prediction mode or the common string sub-mode of string copy intra prediction in the current co-located luminance block, and uses the motion vector corresponding to the candidate reference sample as the reference motion vector.
- the decoder determines whether the current block adopts the block copy intra prediction mode or the common string sub-mode of the string copy intra prediction. If the current block adopts the block copy intra prediction mode or the common string sub-mode of the string copy intra prediction, the decoder will obtain the corresponding prediction mode parameters, which may include the direction of the block copy (horizontal or vertical) or the direction of the string mode. According to the prediction mode parameters, candidate reference samples satisfying the block copy intra prediction mode or the common string mode of the string copy intra prediction are determined in the current co-located luminance block. For the determined candidate reference samples, their corresponding motion vectors are used as reference motion vectors.
- the purpose of the above process is to accurately describe the relationship between the current block and the blocks in the reference frame during the decoding process to improve the accuracy of the prediction.
- the decoder can better restore the content of the current block and achieve better image quality.
- the prediction value of the current block is directly copied from the coded block in the adjacent area.
- the content of the current block is similar to the coded block adjacent to it, so the prediction can be performed by directly copying the pixel values of the adjacent block. This method can effectively improve the accuracy of the prediction in some cases.
- the ordinary string sub-mode of the string copy intra prediction is an intra prediction mode, which involves the copy relationship between the pixel values in the current block and the pixel values in the adjacent blocks.
- the generation of the prediction value involves the copying of the pixel values of the adjacent blocks, usually from left to right or from top to bottom, to form a "string". This method can be used for some linear or regular patterns.
- both the block copy intra prediction mode and the common string sub-mode of string copy intra prediction are designed for prediction within a frame.
- the block copy intra prediction mode mainly emphasizes the copying of the entire block, while the common string sub-mode of string copy intra prediction emphasizes the orderly concatenation of pixel values.
- the choice of which mode to use usually depends on the decoding standard and the specific image content.
- the preset sample point selection method is usually based on certain rules or algorithms, such as uniform distribution within a block, selection in a specific direction, and the like.
- a reference chrominance sample corresponding thereto is found according to the chrominance sampling structure (such as 4:2:0 or 4:4:4). If the sampling structure of the chrominance block is 4:2:0, the corresponding reference chrominance samples may be at adjacent positions in the horizontal and vertical directions.
- selecting at least two reference luminance sampling points and at least two reference luminance samples according to a preset sampling point selection method helps to establish a relationship between luminance and chrominance, thereby improving the accuracy of intra-frame prediction.
- the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
- the center position of the reference chromaticity block is first determined, and the center position may be calculated by the midpoint of the width and height of the block, and then the center position is selected as the reference chromaticity sample point. Further, according to the reference chromaticity sample point in the reference chromaticity block, the corresponding reference luminance sample point is determined in the reference luminance block.
- the reference chromaticity sample is determined by the vertical center line (e.g., the leftmost line) of the reference chromaticity block.
- the position of the vertical center line is usually obtained by combining half of the height of the block and the left edge of the block. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
- the reference chromaticity sample is determined by the horizontal center line of the reference chromaticity block.
- the position of the horizontal center line is usually obtained by combining half of the width of the reference chromaticity block and the top boundary of the block. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
- the reference chromaticity sample is determined by the diagonal of the upper left corner and the lower right corner of the reference chromaticity block. It is usually calculated by the diagonal midpoint of the width and height of the reference chromaticity sample. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
- the positions of the four vertices of the reference chromaticity block are determined. These vertices are usually the four corners of the reference chromaticity block. Then, according to the reference chromaticity sample points in the reference chromaticity block, the corresponding reference luminance sample points are determined in the reference luminance block.
- the chrominance samples corresponding to these luminance samples can be determined through the corresponding chrominance sampling structure to establish a relationship between luminance and chrominance. Such a relationship helps to improve the accuracy of intra-frame prediction, thereby better restoring the original video frame at the decoding end.
- different selection methods can better adapt to different image contents and motion patterns.
- a certain selection method may be more able to capture important information in the image, thereby improving coding efficiency.
- different selection methods may help provide more accurate motion vector information.
- motion can be estimated more accurately, thereby improving the accuracy of prediction.
- the clever selection of preset sample selection methods can improve the effect of intra-frame prediction.
- the relationship between brightness and chrominance can be better modeled, thereby improving the quality of intra-frame prediction.
- some selection methods may have lower complexity during decoding, allowing the decoder to perform prediction and motion estimation more efficiently, thereby reducing the overall decoding complexity.
- video decoders can better adapt to the needs of different scenarios, improve image quality, and reduce complexity while maintaining decoding efficiency.
- the preset sample point selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H.
- At least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
- the position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (1, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
- the position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-2, 0);
- the position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (1, H-1);
- the position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-2, H-1);
- the position coordinates of the first reference brightness sample point in the reference brightness block are (2, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
- the position coordinates of the second reference brightness sample point in the reference brightness block are (2 ⁇ (W-2), 0);
- the position coordinates of the third reference brightness sample point in the reference brightness block are (2,2 ⁇ (H-1));
- the position coordinates of the fourth reference luminance sample point in the reference luminance block are (2 ⁇ (W-2), 2 ⁇ (H-1)).
- the preset sample point selection method is a vertex selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
- At least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
- the position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (0, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
- the position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-1, 0);
- the position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (0, H-1);
- the position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-1, H-1);
- the position coordinates of the first reference brightness sample point in the reference brightness block are (0, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
- the position coordinates of the second reference brightness sample point in the reference brightness block are (2 ⁇ (W-1), 0);
- the position coordinates of the third reference brightness sample point in the reference brightness block are (0, 2 ⁇ (H-1));
- the position coordinates of the fourth reference luminance sample point in the reference luminance block are (2 ⁇ (W-1), 2 ⁇ (H-1)).
- center selection method and vertex selection method are only examples. In actual applications, other numbers of reference luminance samples and reference chrominance samples may be selected. In addition, other methods are also included for the coordinate positions of the selected reference luminance samples and reference chrominance samples. In other words, any one of the reference luminance samples and reference chrominance samples may be selected, and the specific selection method may be selected according to the actual application scenario, and the embodiments of the present application do not impose any limitation on this.
- the first reference chromaticity sample corresponds to the first reference luminance sample
- the second reference chromaticity sample corresponds to the second reference luminance sample
- the third reference chromaticity sample corresponds to the third reference luminance sample
- the fourth reference chromaticity sample corresponds to the fourth reference luminance sample.
- the setting method of vertex selection helps to establish a more accurate cross-component prediction model through the relationship between luma samples and chroma samples. During the decoding process, referring to these samples can improve the prediction accuracy of chroma information, thereby improving video quality.
- S3032. Determine a cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
- the cross-component prediction model is determined according to at least two reference luma samples and at least two reference chroma samples.
- the cross-component prediction model includes one or more cross-component prediction sub-models; determining the implementation of the cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples in S3032 may include S30321 to S30322:
- each reference sample point group includes at least two luminance sample points and at least two chrominance sample points; the at least two luminance sample points correspond to the at least two chrominance sample points; the at least two reference luminance sample points include at least two luminance sample points; the at least two reference chrominance sample points include at least two chrominance sample points; and at least one reference sample point group corresponds to a different preset luminance range.
- the luma samples and chroma samples contained therein have different preset luma ranges. This distinction may help to better adapt to the brightness changes in different areas of the video. By specifying a different preset luma range for each reference sample group, the brightness differences that may exist in the video can be handled more flexibly, thereby improving the adaptability and performance of decoding.
- At least one reference sample point group includes: a first sample point group, a second sample point group, a third sample point group and a fourth sample point group.
- the first sample point group corresponds to a brightness range of 0 to 50
- the second sample point group corresponds to a brightness range of 51 to 100
- the third sample point group corresponds to a brightness range of 101 to 150
- the fourth sample point group corresponds to a brightness range of 151 to 255.
- FIG. 14 a schematic diagram of multiple cross-component prediction sub-models is shown, where the horizontal axis is the reconstructed luminance value of the co-located luminance block, and the vertical axis is the predicted chrominance value of the predicted chrominance block corresponding to the current chrominance block.
- the cross-component prediction model includes two cross-component prediction sub-models, namely a first cross-component prediction sub-model and a second cross-component prediction sub-model.
- each reference sample point group in at least one reference sample point group determines a cross-component prediction sub-model corresponding to each reference sample point group according to at least two luma samples and at least two chroma samples in each reference sample point group.
- S30322 determines the implementation of the cross-component prediction sub-model corresponding to each reference sample group according to at least two luma samples and at least two chroma samples in each reference sample group, which may include:
- At least two brightness samples and at least two chrominance samples in each reference sample group are grouped to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one brightness sample and at least one chrominance sample; the at least one brightness sample corresponds to the at least one chrominance sample; and a reconstructed brightness value of at least one brightness sample in the first sample group is greater than or equal to a reconstructed brightness value of at least one brightness sample in the second sample group;
- the cross-component prediction sub-model corresponding to each reference sample point group is determined.
- the maximum reference brightness value can be expressed as xMax
- the first reference chromaticity value can be expressed as yMax
- the minimum reference brightness value can be expressed as xMin
- the second reference chromaticity value can be expressed as yMin.
- the scaling factor can be expressed as a
- the offset factor can be expressed as b.
- the process of grouping and sorting the at least two luma samples and the at least two chroma samples in each reference sample group is performed based on the luma values of the at least two luma samples, and the chroma values are operated according to the corresponding luma values. Therefore, the first reference chroma value corresponding to the maximum reference luma value is not necessarily the largest. Similarly, the second reference chroma value corresponding to the minimum reference luma value is not necessarily the smallest.
- the reconstructed luminance value of the first reference luminance sample is greater than or equal to the reconstructed luminance value of the second reference luminance sample
- the reconstructed luminance value of the second reference luminance sample is greater than or equal to the reconstructed luminance value of the third reference luminance sample
- the reconstructed luminance value of the third reference luminance sample is greater than or equal to the reconstructed luminance value of the fourth reference luminance sample
- the first reference luminance sample, the second reference luminance sample, the first reference chroma sample corresponding to the first reference luminance sample, and the second reference chroma sample corresponding to the second reference luminance sample are divided into a first sample group
- the third reference luminance sample, the fourth reference luminance sample, the third reference chroma sample corresponding to the third reference luminance sample, and the fourth reference chroma sample corresponding to the fourth reference luminance sample are divided into a second sample group.
- the average of the reconstructed luminance values of the first reference luminance sample and the second reference luminance sample is used as the maximum reference luminance value (xMax)
- the average of the reconstructed chroma values of the first reference chroma sample and the second reference chroma sample is used as the first reference chroma value (yMax)
- the average of the reconstructed luminance values of the third reference luminance sample and the fourth reference luminance sample is used as the minimum reference luminance value (xMin)
- the average of the reconstructed chroma values of the third reference chroma sample and the fourth reference chroma sample is used as the second reference chroma value (yMin).
- determining the scaling factor and the offset factor based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value, and the second reference chrominance value may include:
- the scaling factor (a) and the minimum reference brightness value (xMin) are multiplied to obtain a third intermediate parameter
- the second reference chromaticity value (yMin) and the third intermediate parameter are subtracted to obtain an offset factor (b).
- the first intermediate parameter can be expressed as yMax-yMin.
- the second intermediate parameter can be expressed as xMax-xMin.
- the third intermediate parameter can be expressed as a ⁇ xMin.
- the offset factor can be expressed as yMin-a ⁇ xMin.
- determining the scaling factor and the offset factor can map the reference luminance and chrominance values to a standard range, thereby achieving normalization, which helps to process luminance and chrominance information more consistently in different scenarios.
- the prediction model can be made more robust and adaptable to different luminance and chrominance conditions.
- By performing appropriate luminance and chrominance mapping data redundancy can be reduced, decoding efficiency can be improved, and image information can be represented more compactly.
- the scaling factor and the offset factor the relationship between luminance and chrominance can be better handled, and the decoding performance and image quality can be improved.
- the cross-component prediction model is a nonlinear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S304 may include:
- a cross-component prediction model is determined based on all or part of the reference chroma samples, reference luma samples in a reference luma block that respectively correspond to all or part of the reference chroma samples, and neighborhood reference luma samples of the reference luma samples.
- the reference luminance block is downsampled to obtain downsampled luminance samples.
- L(x, y) represents a pixel point in the reference luminance block
- L′(x, y) represents the downsampled luminance sample point corresponding to the pixel point L(x, y).
- the sampled reference luminance block and the reference chrominance block are used as templates for parameter derivation.
- the cross-component prediction model when the cross-component prediction model is a nonlinear model, the cross-component prediction model can be expressed by formula (4):
- p 0 , p 1 , p 2 , p 3 , p 4 , p 5 , B are model parameters of the cross-component prediction model
- C is the reconstructed luminance value of the target luminance sample corresponding to the target chrominance sample of the current chrominance block in the same luminance block
- N is the reconstructed luminance value of the luminance sample located above the target luminance sample
- S is the reconstructed luminance value of the luminance sample located below the target luminance sample
- W is the reconstructed luminance value of the luminance sample located to the left of the target luminance sample
- E is the reconstructed luminance value of the luminance sample located to the right of the target luminance sample.
- C′ is the predicted chrominance value corresponding to the target chrominance sample of the current chrominance block.
- all or part of the reference chroma samples are selected in the reference chroma block, and based on all or part of the reference chroma samples, the reference luminance samples corresponding to all or part of the reference chroma samples in the reference luminance block, and the neighborhood reference luminance samples of the reference luminance samples, multiple equations are constructed to solve the linear equation system, and the LDL solution method is used to obtain model parameters p0 , p1 , p2 , p3 , p4 , p5 , B of the cross-component prediction model, thereby obtaining a nonlinear cross-component prediction model.
- the adaptability of the prediction model can be enhanced to better adapt to video content of different types and scenes.
- Considering the neighborhood reference luma samples of the reference luma samples can more comprehensively capture the luma information, which helps to improve the accuracy of the prediction model, which may be important for processing information such as local features and textures in the image.
- By more accurately modeling cross-component relationships it can be expected to reduce the distortion introduced by the prediction, thereby improving the overall video quality, including higher compression efficiency and better visual quality.
- the neighborhood reference brightness samples include one or more of the following: a reference brightness sample (N) located above the reference brightness sample, a reference brightness sample (S) located below the reference brightness sample, a reference brightness sample (W) located to the left of the reference brightness sample, and a reference brightness sample (E) located to the right of the reference brightness sample.
- the context and local features of the brightness information can be more comprehensively captured, which helps to improve the accuracy and adaptability of the cross-component prediction model.
- Such information consideration can usually better simulate the changes and textures of the brightness components in the image.
- the implementation of determining candidate reference samples satisfying a preset prediction mode in the current co-located luminance block in S401 may include:
- the candidate reference sample points corresponding to the preset M position information are traversed in the current co-located luminance block to obtain the candidate reference sample points that meet the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is an integer less than M. Positive integer.
- M pieces of preset position information are provided, each of which may include information such as coordinates or indices, for specifying a certain position in the current co-located luminance block.
- a traversal operation is performed, and in each traversal, the candidate reference sample points corresponding to the position information are considered.
- the candidate reference sample points corresponding thereto are found, and these candidate reference sample points may be determined in the current co-located luminance block according to the coordinates or indices of the position information.
- it is checked whether it satisfies the preset prediction mode.
- the candidate reference sample points that satisfy the preset prediction mode are collected for subsequent use.
- the M pieces of location information include one or more of the following:
- the preset M position information can be expressed as ⁇ C, TL, TR, BL, BR ⁇ , where C represents the middle position of the current co-located luminance block, TL represents the upper left position of the current co-located luminance block, TR represents the upper right position of the current co-located luminance block, BL represents the lower left position of the current co-located luminance block, and BR represents the lower right position of the current co-located luminance block.
- candidate reference sample points corresponding to the preset M pieces of position information are traversed in the current co-located luminance block to obtain candidate reference sample points that meet the preset prediction mode, including:
- the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or,
- the i-th candidate reference sample point In the case that the i-th candidate reference sample point satisfies the preset prediction mode, the i-th candidate reference sample point is determined as a candidate reference sample point that satisfies the preset prediction mode.
- the i-th candidate reference sample corresponding thereto is considered. It is determined whether the i-th candidate reference sample in the current co-located luminance block satisfies the preset prediction mode. If the i-th candidate reference sample does not satisfy the preset prediction mode, then the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block is traversed. If the i-th candidate reference sample satisfies the preset prediction mode, then the i-th candidate reference sample is determined as a candidate reference sample that satisfies the preset prediction mode.
- the implementation of determining the predicted chroma value of the predicted chroma block based on the cross-component prediction model in S304 may include S3041 to S3042:
- the reconstructed luminance value of each pixel in the current co-located luminance block is input into a cross-component prediction model to obtain a candidate predicted chrominance value of the candidate chrominance prediction block.
- the cross-component prediction model includes at least one cross-component prediction sub-model; the implementation of determining the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model in S3041 may include:
- the reconstructed luminance value of each pixel is input into the corresponding cross-component prediction sub-model to obtain a candidate predicted chrominance value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model;
- At least one cross-component prediction submodel includes: a first cross-component prediction submodel, a second cross-component prediction submodel, a third cross-component prediction submodel and a fourth cross-component prediction submodel.
- the first cross-component prediction submodel corresponds to a brightness range of 0 to 50
- the second cross-component prediction submodel corresponds to a brightness range of 51 to 100
- the third cross-component prediction submodel corresponds to a brightness range of 101 to 200
- the fourth cross-component prediction submodel corresponds to a brightness range of 201 to 255.
- the luma sample uses the first cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample. If the pixel point of a luma sample in the current co-located luma block is 60, the luma sample uses the second cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample.
- the luma sample uses the third cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample. If the pixel point of a luma sample in the current co-located luma block is 220, the luma sample uses the fourth cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample.
- the use of different cross-component prediction sub-models for each pixel can better adapt to the brightness and chrominance characteristics of different areas in the image. This adaptability helps to improve the performance of the decoder in various image scenarios.
- the use of the preset brightness range corresponding to each pixel and the cross-component prediction sub-model provides fine-grained control of different pixels, which enables the decoder to better cope with subtle differences that may exist in the image and improves the flexibility of decoding.
- the above steps help to better capture the relationship between brightness and chrominance through a more refined cross-component prediction sub-model, thereby improving the quality of chrominance prediction and decoding efficiency.
- the candidate predicted chrominance values of the candidate chrominance prediction block are downsampled by a six-tap filter [1 2 1; 1 2 1].
- P chroma represents the predicted chroma value of the final predicted chroma block. Assuming that the size of the predicted chroma block is W ⁇ H, the value range of x is [0, W-1], and the value range of y is [0, H-1]. As shown in Figure 15, the relationship between the shape of the six-tap filter and the corresponding positions of the chroma block prediction pixels and the intermediate prediction block pixels (candidate prediction chroma values of the candidate chroma prediction block).
- the cross-component prediction model allows for better capture of the complex relationship between luminance and chrominance, and by using the reconstructed luminance value of the co-located luminance block, the predicted chrominance value can more accurately reflect the details and features in the image.
- this method can adapt in size, making the prediction more adaptable to the details and structures of different regions in the image.
- the above steps combine the advantages of information capture, size adaptability, and decoding efficiency, which helps to improve the quality of chrominance prediction and reduce the amount of data while maintaining efficient decoding.
- FIG16 a schematic flow chart of an encoding method provided in an embodiment of the present application is shown. As shown in FIG16 , the method may include S501 to S504:
- the co-located luminance block refers to a luminance block corresponding to the current chrominance block.
- the co-located luminance block refers to a luminance block corresponding to the current chrominance block.
- the co-located luminance block for each chrominance block (Cb or Cr block), there is a luminance block in the same position or relative position, and this luminance block is called the co-located luminance block.
- the image is divided into a brightness component (Y) and two chrominance components (Cb, Cr).
- the brightness component (Y) contains the black and white information of the image, while the chrominance components (Cb, Cr) contain color information.
- the sampling rate of the chrominance component is usually lower than that of the brightness component, which means that for each brightness block, there may be multiple chrominance blocks.
- For each chrominance block there is a co-location brightness block, which means that they have the same position or a certain relative position relationship in the image.
- the size of the brightness block is larger than the size of the chrominance block.
- a brightness block may correspond to a 4x4 or 8x8 pixel block, while the chrominance block may correspond to a smaller 2x2 or 4x4 pixel block.
- the reference motion vector is used to predict the motion information of the current image block.
- the current co-located luminance block corresponding to the current chrominance block has the same motion vector.
- the obtained motion vector is applied to the current chrominance block to predict the position of the current chrominance block. This prediction process helps to reduce the residual caused by motion and improve coding efficiency.
- the reference motion vector when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds, the reference motion vector is determined to be invalid; or,
- the reference motion vector is determined to be valid when the reference motion vector satisfies that the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector does not cross the boundary.
- the implementation of determining whether the reference motion vector is valid may include the following steps:
- Step 1 Check whether the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed.
- the corresponding block in the reference frame may not be fully encoded, or the encoder may not have completed
- the encoding of the reference frame results in the reference block not being reconstructed.
- the encoder may need to wait for the reference block to be fully reconstructed, or use some error handling mechanism. For example, it may choose to skip motion compensation for the current block and temporarily use other methods for filling or interpolation to prevent errors caused by incomplete encoding.
- Step 2 Check whether the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches.
- the reference block may use a prediction mode that does not match the current block. This may occur in intra-frame prediction, where the reference block may use a different prediction mode.
- the encoder may need to detect and correct the prediction mode mismatch, which may involve trying to adjust the prediction mode of the reference block according to the prediction mode of the current block, or performing other error recovery strategies.
- Step 3 Check whether the reference motion vector is out of bounds.
- the value of the reference motion vector may exceed the specified range, which may be caused by a coding error, a transmission error, or other abnormal conditions.
- a coding error a transmission error
- Possible processing methods include clipping the value of the motion vector to keep it within the valid range, or using other error handling methods.
- the above steps are to ensure the legitimacy of the reference motion vector and prevent erroneous or invalid reference motion vectors from affecting the encoding quality.
- the encoder ensures the accuracy and robustness of the encoding by detecting and processing these situations, thereby improving the reliability of video encoding.
- S503 Determine a predicted chroma value of a predicted chroma block based on a cross-component prediction model, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra-frame block copy technology.
- the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a relationship with the predicted chrominance value of the predicted chrominance block.
- the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with the predicted chrominance value of the predicted chrominance block.
- the linear cross-component prediction model can improve coding efficiency and remove the redundancy of chrominance components, so that the model can better fit the relationship between brightness and chrominance in actual scenes.
- the encoder can more accurately estimate the value of the chrominance component, thereby achieving better compression effect during the encoding process, which is beneficial to improving the performance and quality of video encoding.
- the implementation of determining the first syntax identification information according to the predicted chrominance value in S503 may include:
- rate-distortion cost calculation on the chroma residual value of the current chroma block to obtain a first rate-distortion cost value corresponding to the cross-component prediction mode based on the chroma intra-frame block copy technology adopted by the current chroma block;
- the first syntax identification information is determined according to the prediction mode adopted by the current chroma block.
- the original chromaticity value at the corresponding position is subtracted from the predicted chromaticity value to obtain the chromaticity residual (i.e., chromaticity residual value) of each pixel.
- This is to quantify the prediction error by comparing the difference between the actually observed chromaticity value and the value predicted by the model.
- the distortion between the original chrominance value and the reconstructed chrominance value of the current chrominance block is calculated.
- Various measurement methods can be used for distortion, common ones include mean square error (MSE) or other structural similarity index (SSI).
- MSE mean square error
- SSI structural similarity index
- This step represents the image quality loss introduced in compression and decompression.
- a common calculation method is to linearly combine the distortion and compression rate, or to perform a more sophisticated evaluation through some complex mathematical models.
- VBR variable bit rate
- CBR constant bit rate
- the first syntax identification information is encoded, and the obtained encoded bits are written into a bitstream.
- the implementation of determining the prediction mode adopted by the current chroma block according to the first rate-distortion cost value may include:
- the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes, it is determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology.
- the dynamic decision mechanism allows the system to adjust the prediction mode according to the actual situation, so as to better adapt to different types of content and scenes. Video coding efficiency can provide a better user experience under limited bandwidth and storage conditions.
- the one or more candidate prediction modes include: a chroma intra block copy prediction mode; when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes, determining that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology includes:
- the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to the chroma intra block copy prediction mode, it is determined that the current chroma block adopts the chroma intra block copy prediction mode.
- the implementation of determining the first syntax identification information according to the prediction mode adopted by the current chroma block may include:
- the value of the first syntax identification information is a fourth value.
- the first syntax identification information may be represented as tcibc_flag.
- the third value is different from the fourth value, and the third value and the fourth value can be in parameter form or in digital form.
- the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the third value can be set to 1 and the fourth value can be set to 0; or, the third value can be set to 0 and the fourth value can be set to 1; or, the third value can be set to true and the fourth value can be set to false; or, the third value can be set to false and the fourth value can be set to true; but this is not specifically limited here.
- the method further comprises:
- Determining the second grammar identification information includes:
- the value of the second syntax identification information is set to the first value
- the value of the second syntax identification information is set to the second value.
- the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form.
- the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.
- the prediction mode part of the current chroma block first encodes the CIBC related flag, then adds the related flag of the TSCPM_CIBC technology of this scheme, and then encodes other chroma intra-frame prediction mode flags.
- the structure of the first syntax identification information is shown in Table 1:
- the binary The binary string is 1.
- the binary string written to the bitstream is 01.
- the binary string written to the bitstream is 00*.
- the mode indicates whether to use the cross-component prediction mode based on the chroma intra-frame block copying technology by encoding a flag bit tcibc_flag in the current chroma block related code stream.
- tcibc_flag a flag bit tcibc_flag needs to be encoded in the bitstream to indicate whether the mode is used. If tcibc_flag is 1, it means that the current chroma block uses the TSCPM_CIBC mode, and there is no need to continue encoding flag bits for other modes. If tcibc_flag is 0, it means that the current chroma block does not use the TSCPM_CIBC mode, and it is necessary to continue encoding other flag bits related to determining the prediction mode.
- the implementation of determining the first syntax identification information according to the prediction mode adopted by the current chroma block may include:
- the value of the first syntax identification information is set to the seventh value.
- the value of the first syntax identification information is set to the eighth value.
- the first syntax identification information may be represented as tcibc_flag.
- the seventh value is different from the eighth value, and the seventh value and the eighth value can be in parameter form or in digital form.
- the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the seventh value can be set to 1 and the eighth value can be set to 0; or, the seventh value can be set to 0 and the eighth value can be set to 1; or, the seventh value can be set to true and the eighth value can be set to false; or, the seventh value can be set to false and the eighth value can be set to true; but no specific limitation is made here.
- the method further comprises:
- Determining third grammar identification information includes:
- the value of the third syntax identification information is set to the fifth value;
- the value of the third syntax identification information is set to the sixth value.
- the third syntax identification information may be represented as cibc_flag.
- the fifth value is different from the sixth value, and the fifth value and the sixth value can be in parameter form or in digital form.
- the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
- the fifth value can be set to 1 and the sixth value can be set to 0; or, the fifth value can be set to 0 and the sixth value can be set to 1; or, the fifth value can be set to true and the sixth value can be set to false; or, the fifth value can be set to false and the sixth value can be set to true; but no specific limitation is made here.
- first value, the second value, the third value, the fourth value, the fifth value, the sixth value, the seventh value and the eighth value may be expressed in the same form (i.e., parameter form or digital form).
- first value, the third value, the fifth value and the seventh value may be 1 or True
- second value, the fourth value, the sixth value and the eighth value may be 0 or False.
- the mode indicates whether to use the cross-component prediction mode based on the chroma intra-frame block copying technology by encoding a flag bit tcibc_flag in the current chroma block related code stream. If the value of the flag bit cibc_flag of the current chroma block is 0, the encoding of the CIBC mode and the TSCPM_CIBC mode is skipped. Other related flag bits for determining the prediction mode are continued to be encoded.
- the value of the flag bit cibc_flag of the current chroma block is 1, the value of tcibc_flag is continued to be encoded to indicate whether the CIBC or TSCPM_CIBC mode is specifically used. If the value of tcibc_flag is 0, the prediction mode of the current block is CIBC; if the value of tcibc_flag is 1, the prediction mode of the current block is TSCPM_CIBC.
- the encoding method further includes S506:
- the sample accuracy of the current chrominance block refers to the representation accuracy of the chrominance component (Chroma), which is usually expressed in bits (Bit-Depth), and a higher sample accuracy is usually used to retain the details and color information in the image.
- Chroma chrominance component
- 8-bit sample accuracy means that each chrominance component is represented by 8 binary bits (or bits).
- Higher sample accuracy can provide more color levels, thereby improving color resolution. This is very important for retaining subtle color differences in images.
- High sample accuracy helps to more accurately represent colors in the real world and improve color fidelity. Selecting an appropriate sample accuracy also involves a balance in coding efficiency. Higher sample accuracy may require more bits to represent each pixel, thereby increasing the amount of encoded data.
- the implementation of determining the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block in S506 may include S5061 to S5062:
- the first preset value and the second preset value are pre-set values.
- the first preset value is 1 and the second preset value is 2.
- the fourth intermediate parameter can be expressed as BitDepth-1.
- the predicted chrominance value of each pixel in the predicted chrominance block can be expressed as 2 BitDepth-1 .
- the predicted chrominance value of each pixel in the predicted chrominance block is generated through sample precision, preset value and exponential operation. By adjusting the sample precision and different preset values, different predicted chrominance values can be explored, thereby providing more flexible adjustment and optimization options in video encoding, which helps to better adapt to different application scenarios and requirements in video encoding.
- S504 Determine a reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
- the chroma residual value is transformed and quantized to obtain a quantized chroma residual value of the current chroma block
- the quantized chroma residual value of the current chroma block is encoded, and the obtained encoding bits are written into the bit stream.
- the chrominance residual value represents the difference between the original chrominance value and the predicted chrominance value of the current chrominance block, and these residual values need to be processed during encoding, including transformation and quantization.
- the chrominance residual value may change its representation through some transformations (such as discrete cosine transform, DCT). This transformation helps to represent the data as frequency domain coefficients, and usually improves the compression performance of the data by removing redundant information.
- the transformed frequency domain coefficients need to be quantized to reduce the amount of data. Quantization is achieved by mapping the coefficients to a discrete value domain, which introduces information loss. During the quantization process, different step sizes (quantization step sizes) can be used to control the compression level. Larger quantization step sizes will result in more information loss, but will also produce higher compression ratios.
- the quantized chrominance residual values obtained can be encoded and transmitted more efficiently because their data volume is small. Accordingly, at the decoding end, the received quantized chrominance residual values are inversely quantized and inversely transformed to restore the final reconstructed chrominance values. This process is a key step in compression coding, which is used to maintain image quality as much as possible while reducing the amount of data.
- a coding method comprising: at the coding end, determining a reference motion vector according to a current co-located luminance block corresponding to a current chrominance block; when the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector; determining a predicted chrominance value of the predicted chrominance block based on the cross-component prediction model, and determining first syntax identification information according to the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a chrominance frame-based
- the cross-component prediction mode of the intra-block copy technology according to the predicted chrominance value of the predicted chrominance block, the reconstructed chrominance value of the current chrominance block is determined.
- the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding scenarios, thereby improving the encoding efficiency of the current chrominance block.
- the reference motion vector is determined according to the current co-located luminance block corresponding to the current chrominance block. This step helps to introduce the information of the luminance block into the encoding process of the chrominance block to improve the accurate processing of motion correlation.
- the predicted chrominance value of the predicted chrominance block is determined, which makes full use of the information of the luminance block, helps to improve the prediction accuracy of the chrominance block, and helps to more accurately restore the chrominance information in the original image at the encoding end, thereby improving the image quality.
- the above process can improve the encoding accuracy of the chrominance block, enhance the image quality, and utilize cross-component correlation.
- the encoding process more comprehensively utilizes the correlation between different components in the video image, thereby improving the encoding effect.
- the implementation of determining the reference motion vector according to the current co-located luminance block corresponding to the current chrominance block in S502 may include S601:
- S601 Determine candidate reference samples that meet a preset prediction mode in a current co-located luminance block, and use motion vectors corresponding to the candidate reference samples as reference motion vectors.
- the preset prediction mode is: the candidate reference samples adopt the block copy intra prediction mode (Intra Block Copy, IBC) or the ordinary string sub-mode of string copy intra prediction.
- IBC Intra Block Copy
- the encoder determines candidate reference samples that satisfy the block copy intra prediction mode or the common string sub-mode of string copy intra prediction in the current co-located luminance block, and uses the motion vector corresponding to the candidate reference sample as the reference motion vector.
- the purpose of the above process is to accurately describe the relationship between the current block and the blocks in the reference frame during the encoding process to improve the accuracy of the prediction.
- the encoder can better restore the content of the current block and achieve better image quality.
- both the block copy intra prediction mode and the common string sub-mode of string copy intra prediction are designed for prediction within a frame.
- the block copy intra prediction mode mainly emphasizes the copying of the entire block, while the common string sub-mode of string copy intra prediction emphasizes the orderly concatenation of pixel values.
- the choice of which mode to use usually depends on the coding standard and the specific image content.
- the cross-component prediction model is a linear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S503 may include S5031 to S5032:
- S5031 Determine at least two reference luminance samples in a reference luminance block according to a preset sample selection method, and determine reference chrominance samples corresponding to the at least two reference luminance samples in a reference chrominance block according to a preset sample selection method.
- the preset sample point selection method is usually based on certain rules or algorithms, such as uniform distribution within a block, selection in a specific direction, and the like.
- a reference chrominance sample corresponding thereto is found according to the chrominance sampling structure (such as 4:2:0 or 4:4:4). If the sampling structure of the chrominance block is 4:2:0, the corresponding reference chrominance samples may be at adjacent positions in the horizontal and vertical directions.
- selecting at least two reference luminance sampling points and at least two reference luminance samples according to a preset sampling point selection method helps to establish a relationship between luminance and chrominance, thereby improving the accuracy of intra-frame prediction.
- the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
- different selection methods can better adapt to different image contents and motion modes.
- a certain selection method may be more able to capture important information in the image, thereby improving coding efficiency.
- different selection methods may help provide more accurate motion vector information.
- motion can be estimated more accurately, thereby improving the accuracy of prediction.
- the clever selection of preset sample selection methods can improve the effect of intra-frame prediction.
- the relationship between brightness and chrominance can be better modeled, thereby improving the quality of intra-frame prediction.
- some selection methods may have lower complexity during encoding, allowing the encoder to perform prediction and motion estimation more efficiently, thereby reducing the overall encoding complexity.
- the video encoder can better adapt to the needs of different scenes, improve image quality, and reduce complexity while maintaining coding efficiency.
- the preset sampling point selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
- the at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; and the reference chrominance samples corresponding to the at least two reference luminance samples include: a first reference chrominance sample, a second reference chrominance sample, a third reference chrominance sample, and a fourth reference luminance sample.
- the position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (1, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
- the position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-2, 0);
- the position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (1, H-1);
- the position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-2, H-1);
- the position coordinates of the first reference brightness sample point in the reference brightness block are (2, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
- the position coordinates of the second reference brightness sample point in the reference brightness block are (2 ⁇ (W-2), 0);
- the position coordinates of the third reference brightness sample point in the reference brightness block are (2,2 ⁇ (H-1));
- the position coordinates of the fourth reference luminance sample point in the reference luminance block are (2 ⁇ (W-2), 2 ⁇ (H-1)).
- the preset sample point selection method is a vertex selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
- At least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
- the position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (0, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
- the position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-1, 0);
- the position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (0, H-1);
- the position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-1, H-1);
- the position coordinates of the first reference brightness sample point in the reference brightness block are (0, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
- the position coordinates of the second reference brightness sample point in the reference brightness block are (2 ⁇ (W-1), 0);
- the position coordinates of the third reference brightness sample point in the reference brightness block are (0, 2 ⁇ (H-1));
- the position coordinates of the fourth reference luminance sample point in the reference luminance block are (2 ⁇ (W-1), 2 ⁇ (H-1)).
- center selection method and vertex selection method are only examples. In actual applications, other numbers of reference luminance samples and reference chrominance samples may be selected. In addition, other methods are also included for the coordinate positions of the selected reference luminance samples and reference chrominance samples. In other words, any one of the reference luminance samples and reference chrominance samples may be selected, and the specific selection method may be selected according to the actual application scenario, and the embodiments of the present application do not impose any limitation on this.
- the first reference chromaticity sample corresponds to the first reference luminance sample
- the second reference chromaticity sample corresponds to the second reference luminance sample
- the third reference chromaticity sample corresponds to the third reference luminance sample
- the fourth reference chromaticity sample corresponds to the fourth reference luminance sample.
- the setting method of vertex selection helps to establish a more accurate cross-component prediction model through the relationship between luma samples and chroma samples. During the encoding process, referring to these samples can improve the prediction accuracy of chroma information, thereby improving video quality.
- S5032 Determine a cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
- the cross-component prediction model includes one or more cross-component prediction sub-models; determining the implementation of the cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples in S5032 may include S50321 to S50322:
- each reference sample group includes at least two brightness samples and at least two chrominance samples; the at least two brightness samples correspond to the at least two chrominance samples; the at least two reference brightness samples include at least two brightness samples; the at least two reference chrominance samples include at least two chrominance samples; and at least one reference sample group corresponds to a different preset brightness range.
- the luma samples and chroma samples contained therein have different preset luma ranges. This distinction may help to better adapt to the brightness changes in different areas of the video. By specifying a different preset luma range for each reference sample group, the brightness differences that may exist in the video can be handled more flexibly, thereby improving the adaptability and performance of the encoding.
- At least one reference sample point group includes: a first sample point group, a second sample point group, a third sample point group and a fourth sample point group.
- the first sample point group corresponds to a brightness range of 0 to 50
- the second sample point group corresponds to a brightness range of 51 to 100
- the third sample point group corresponds to a brightness range of 101 to 150
- the fourth sample point group corresponds to a brightness range of 151 to 255.
- each reference sample point group in at least one reference sample point group determines a cross-component prediction sub-model corresponding to each reference sample point group according to at least two luma samples and at least two chroma samples in each reference sample point group.
- S50322 determines the implementation of the cross-component prediction sub-model corresponding to each reference sample group according to at least two luma samples and at least two chroma samples in each reference sample group, which may include:
- At least two brightness samples and at least two chrominance samples in each reference sample group are grouped to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one brightness sample and at least one chrominance sample; the at least one brightness sample corresponds to the at least one chrominance sample; and a reconstructed brightness value of at least one brightness sample in the first sample group is greater than or equal to a reconstructed brightness value of at least one brightness sample in the second sample group;
- the cross-component prediction sub-model corresponding to each reference sample point group is determined.
- the maximum reference brightness value can be expressed as xMax
- the first reference chromaticity value can be expressed as yMax
- the minimum reference brightness value can be expressed as xMin
- the second reference chromaticity value can be expressed as yMin.
- the scaling factor can be expressed as a
- the offset factor can be expressed as b.
- determining the scaling factor and the offset factor based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value, and the second reference chrominance value may include:
- the scaling factor (a) and the minimum reference brightness value (xMin) are multiplied to obtain a third intermediate parameter
- the second reference chromaticity value (yMin) and the third intermediate parameter are subtracted to obtain an offset factor (b).
- the first intermediate parameter can be expressed as yMax-yMin.
- the second intermediate parameter can be expressed as xMax-xMin.
- the third intermediate parameter can be expressed as a ⁇ xMin.
- the offset factor can be expressed as yMin-a ⁇ xMin.
- determining the scaling factor and the offset factor can map the reference luminance and chrominance values to a standard range, thereby achieving normalization, which helps to process luminance and chrominance information more consistently in different scenarios.
- the prediction model can be made more robust and adaptable to different luminance and chrominance conditions.
- By performing appropriate luminance and chrominance mapping data redundancy can be reduced, encoding efficiency can be improved, and image information can be represented more compactly.
- the scaling factor and the offset factor the relationship between luminance and chrominance can be better handled, and the encoding performance and image quality can be improved.
- the cross-component prediction model is a nonlinear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S304 may include:
- a cross-component prediction model is determined based on all or part of the reference chroma samples, reference luma samples in a reference luma block that respectively correspond to all or part of the reference chroma samples, and neighborhood reference luma samples of the reference luma samples.
- the cross-component prediction model when the cross-component prediction model is a nonlinear model, the cross-component prediction model can be expressed by formula (3).
- the adaptability of the prediction model can be enhanced to better adapt to video content of different types and scenes.
- Considering the neighborhood reference luma samples of the reference luma samples can more comprehensively capture the luma information, which helps to improve the accuracy of the prediction model, which may be important for processing information such as local features and textures in the image.
- By more accurately modeling cross-component relationships it can be expected to reduce the distortion introduced by the prediction, thereby improving the overall video quality, including higher compression efficiency and better visual quality.
- the neighborhood reference brightness samples include one or more of the following: a reference brightness sample (N) located above the reference brightness sample, a reference brightness sample (S) located below the reference brightness sample, a reference brightness sample (W) located to the left of the reference brightness sample, and a reference brightness sample (E) located to the right of the reference brightness sample.
- the context and local features of the brightness information can be more comprehensively captured, which helps to improve the accuracy and adaptability of the cross-component prediction model.
- Such information consideration can usually better simulate the changes and textures of the brightness components in the image.
- the implementation of determining candidate reference samples satisfying a preset prediction mode in the current co-located luminance block in S601 may include:
- the candidate reference sample points corresponding to the preset M position information are respectively selected in the current co-located brightness block. Traverse to obtain candidate reference sample points that meet the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
- the M pieces of location information include one or more of the following:
- the preset M position information can be expressed as ⁇ C, TL, TR, BL, BR ⁇ , where C represents the middle position of the current co-located luminance block, TL represents the upper left position of the current co-located luminance block, TR represents the upper right position of the current co-located luminance block, BL represents the lower left position of the current co-located luminance block, and BR represents the lower right position of the current co-located luminance block.
- candidate reference sample points corresponding to the preset M pieces of position information are traversed in the current co-located luminance block to obtain candidate reference sample points that meet the preset prediction mode, including:
- the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or,
- the i-th candidate reference sample point In the case that the i-th candidate reference sample point satisfies the preset prediction mode, the i-th candidate reference sample point is determined as a candidate reference sample point that satisfies the preset prediction mode.
- the i-th candidate reference sample corresponding thereto is considered. It is determined whether the i-th candidate reference sample in the current co-located luminance block satisfies the preset prediction mode. If the i-th candidate reference sample does not satisfy the preset prediction mode, then the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block is traversed. If the i-th candidate reference sample satisfies the preset prediction mode, then the i-th candidate reference sample is determined as a candidate reference sample that satisfies the preset prediction mode.
- the implementation of determining the predicted chroma value of the predicted chroma block based on the cross-component prediction model in S503 may include S5031 to S5032:
- the reconstructed luminance value of each pixel in the current co-located luminance block is input into a cross-component prediction model to obtain a candidate predicted chrominance value of the candidate chrominance prediction block.
- the cross-component prediction model includes at least one cross-component prediction sub-model; the implementation of determining the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model in S3041 may include:
- the reconstructed luminance value of each pixel is input into the corresponding cross-component prediction sub-model to obtain a candidate predicted chrominance value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model;
- the use of different cross-component prediction sub-models for each pixel can better adapt to the brightness and chrominance characteristics of different areas in the image. This adaptability helps to improve the performance of the encoder in various image scenarios.
- the use of the preset brightness range corresponding to each pixel and the cross-component prediction sub-model provides fine-grained control of different pixels, which enables the encoder to better cope with subtle differences that may exist in the image and improves the flexibility of encoding.
- the above steps help to better capture the relationship between brightness and chrominance through a more refined cross-component prediction sub-model, thereby improving the quality of chrominance prediction and coding efficiency.
- the candidate predicted chrominance values of the candidate chrominance prediction block are filtered by a six-tap filter [1 2 1; 1 2 1]. Sampling, the process can be expressed by formula (4).
- the cross-component prediction model allows for better capture of the complex relationship between luminance and chrominance, and by using the reconstructed luminance value of the co-located luminance block, the predicted chrominance value can more accurately reflect the details and features in the image.
- this method can adapt in size, making the prediction more adaptable to the details and structures of different regions in the image.
- the above steps combine the advantages of information capture, size adaptability, and coding efficiency, which helps to improve the quality of chrominance prediction and reduce the amount of data while maintaining efficient coding.
- a coding method is provided.
- the core idea of the method is to combine TSCPM with CIBC technology, which is hereinafter represented by TSCPM_CIBC.
- the main process includes four parts:
- luminance reference block i.e., reference luminance block
- chrominance reference block i.e., reference chrominance block
- the pixel value of the intermediate prediction block (i.e., the candidate prediction chrominance value of the candidate prediction block) is calculated based on the derived cross-component model and the reconstructed pixel value of the co-located luminance block (i.e., the current co-located luminance block) corresponding to the current chrominance block to be encoded (i.e., the current chrominance block);
- the encoding and decoding method may include the following steps:
- Step 1 the activation condition of this mode is similar to the CIBC technology, that is, if the luminance sample located at the position ⁇ C, TL, TR, BL, BR ⁇ on the luminance co-located block of the current chrominance block to be encoded is a block copy intra-frame prediction mode or a normal string sub-mode of string copy intra-frame prediction, then the current block can use the cross-component prediction mode based on the chrominance intra-frame block copy technology.
- the conditions for using the TSCPM_CIBC technology are met, first, according to the five preset positions ⁇ C, TL, TR, BL, BR ⁇ in the co-located luminance block corresponding to the current chrominance block to be encoded, they are traversed in a fixed order, and the BV at the luminance sample point that first meets the conditions is obtained as the reference BV of the current block, and the reference blocks corresponding to the luminance and chrominance are obtained respectively through the BV. If the BV is an invalid BV, that is, the valid reconstructed pixel value cannot be obtained through the BV, the prediction value of all samples of the current chrominance block is set to 2 BitDepth-1 .
- Step 2 Select sample points from the obtained luminance reference block and chrominance reference block for deriving a cross-component model, where the sample points can be all or part of the sample points of the reference block, and the derived cross-component model can be a linear model or a nonlinear model.
- the selection of sample points is changed from obtaining 4 pixel points from the reconstructed pixels in an adjacent row and column of the original current block to selecting 4 pixel points from the reference block pointed to by BV.
- the current pixel point selection scheme is specifically: pixel points in the four area positions of the upper left, upper right, lower left, and lower right of the current block.
- the chrominance block to be encoded is of size W ⁇ H, with a width of W and a height of H, x represents the horizontal coordinate, y represents the vertical coordinate, and the coordinate of the upper left corner of the current block is (0,0), then the positions of the four chrominance reconstruction pixels are (1,0), (w-2,0), (1,h-1), (w-2,h-1).
- the size of the corresponding luminance block to be encoded is 2W ⁇ 2H, and the positions of the corresponding four luminance reconstruction pixels are (2,0), (2 ⁇ (w-2),0), (2,2 ⁇ (h-1)), (2 ⁇ (w-2),2 ⁇ (h-1)).
- the luminance reconstruction pixels and chrominance reconstruction pixels at the four corresponding positions are bound to each other one by one, and the four selected luminance reconstruction pixels are sorted and grouped, with the two points with larger pixel values forming a group and the two points with smaller pixel values forming a group.
- the average value of the group with larger luminance reconstruction pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin.
- the values corresponding to the chromaticity reconstruction pixel values are calculated and recorded as yMax and yMin respectively.
- Step 3 Based on the derived linear model parameters a and b, and the reconstructed pixel values in the co-located luminance block corresponding to the current chrominance block to be encoded, an intermediate prediction block can be generated.
- the size of this block is the same as that of the co-located luminance block, i.e., 2W ⁇ 2H.
- the value range of x is [0, 2W-1], and the value range of y is [0, 2H-1].
- R Luma represents the reconstructed pixel value of the co-located luminance block
- P t represents the calculated intermediate prediction value of the intermediate prediction block.
- Step 4 Downsample the intermediate prediction block to obtain the final chrominance prediction block.
- a six-tap filter [1 2 1; 1 2 1] is used for downsampling, and the final chrominance prediction block is used as the prediction output under TSCPM_CIBC mode.
- an implementation of a decoding end including:
- the decoder obtains the bitstream information and parses the bitstream.
- the value of tcibc_flag is parsed. If the value of tcibc_flag is 0, other modes are used for prediction, and the prediction mode is set to the corresponding prediction mode; if tcibc_flag is 1, the prediction mode of the current chroma block is set to TSCPM_CIBC. Then continue to parse other related bitstream information.
- the prediction mode is TSCPM_CIBC
- the following prediction process is performed.
- the five preset positions ⁇ C, TL, TR, BL, BR ⁇ in the same luminance block corresponding to the current chroma block to be encoded they are traversed in a fixed order, and the BV at the luminance sample that first meets the conditions is obtained as the reference BV of the current block. If the BV is an invalid BV, the prediction values of all samples of the current chroma block are set to 2BitDepth-1. If the BV is a valid BV, the corresponding reference blocks of luminance and chroma are obtained through the BV.
- the size of the current chrominance block is WxH, and the positions of the four images (1,0), (w-2,0), (1,h-1), and (w-2,h-1) are obtained from the chrominance reference block.
- the chromaticity reconstructed pixel value of the pixel point, the brightness reconstructed pixel values of the four pixels at positions (2,0), (2 ⁇ (w-2),0), (2,2 ⁇ (h-1)), (2 ⁇ (w-2),2 ⁇ (h-1)) are obtained from the brightness reference block.
- the brightness reconstructed pixel points and the chromaticity reconstructed pixel points at the four corresponding positions are bound to each other one by one, and the four selected brightness reconstructed pixel points are sorted and grouped, with the two points with larger pixel values as one group and the two points with smaller pixel values as one group.
- the average value of the group with larger brightness reconstructed pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin.
- the values corresponding to the chromaticity reconstructed pixel values are calculated and recorded as yMax and yMin respectively.
- the cross-component model of this scheme is a linear model, the scaling factor is recorded as a, and the offset factor is recorded as b.
- an implementation of an encoding end including:
- the size of the current chroma block be WxH, and the chroma reconstructed pixel values of the four pixels at positions (1,0), (w-2,0), (1,h-1), and (w-2,h-1) are obtained from the chroma reference block, and the luma reconstructed pixel values of the four pixels at positions (2,0), (2 ⁇ (w-2),0), (2,2 ⁇ (h-1)), (2 ⁇ (w-2),2 ⁇ (h-1)) are obtained from the luma reference block.
- the brightness reconstruction pixels and chrominance reconstruction pixels at four corresponding positions are bound to each other one by one, and the four selected brightness reconstruction pixels are sorted and grouped, with the two pixels with larger pixel values forming one group and the two pixels with smaller pixel values forming one group.
- the average value of the group with larger brightness reconstruction pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin.
- the values corresponding to the chrominance reconstruction pixel values are calculated and recorded as yMax and yMin respectively.
- the cross-component model of this scheme is a linear model, with the scaling factor recorded as a and the offset factor recorded as b.
- the encoding and decoding method provided in the embodiment of the present application can effectively utilize the information of the chroma intra-frame block copy technology to obtain relatively matching luminance reference blocks and chroma reference blocks, and combine the spirit of the two-step cross-component prediction technology to derive a set of cross-component model parameters based on the obtained reference blocks, and apply them to the current block to be encoded to improve the accuracy of the prediction, thereby effectively improving the encoding performance without introducing additional complexity.
- a new cross-component prediction mode is proposed. This mode obtains a set of corresponding luminance reference blocks and chrominance reference blocks through the method of chrominance intra-frame block copy technology, and selects sample points from them to derive a set of cross-component models. Then, according to the methods of the two cross-component prediction modes, the cross-component model is applied to the co-located luminance block corresponding to the current chrominance block to be encoded to obtain an intermediate prediction block, and finally the final prediction block is generated by downsampling.
- the derivation process of the cross-component model is mainly carried out with reference to the original technology TSCPM of the AVS3 standard. Due to the different sources of the reference sample points, the methods for selecting the reference sample points are different.
- the sample point selection scheme in this scheme can be improved, including selecting 4 pixel points at different positions, or increasing the number of selected sample points, and changing the calculation scheme of the linear model.
- TSCPM there is only one linear model between the brightness and chrominance of the same coding block. If it is expanded to a multi-model cross-component linear model, multiple models can be provided for the same coding block. Adjacent brightness and chrominance pixels are divided into different categories according to the classification threshold, and the pixels in each category are used to calculate different model parameters.
- a code stream is provided, wherein the code stream is based on the code to be encoded.
- the information to be encoded is generated by bit encoding; wherein the information to be encoded includes at least one of the following:
- the value of the first syntax identification information, the value of the second syntax identification information, the value of the third syntax identification information, and the quantized chroma residual value of the current chroma block wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; the second syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode; the third syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode or a cross-component prediction mode based on the chroma intra-frame block copy technology.
- Figure 17 shows a schematic diagram of the composition structure of a decoder provided in an embodiment of the present application.
- the decoder 1000 includes a decoding part 1001 and a first determining part 1002, wherein:
- the decoding part 1001 is configured to parse the code stream and determine the first syntax identification information
- the first determining part 1002 is configured to determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block when the first syntax identification information indicates that the current chrominance block adopts a cross-component prediction mode based on a chrominance intra block copy technique;
- the cross-component prediction model characterizes that a reconstructed luminance value of a current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with a predicted chrominance value of the predicted chrominance block.
- the first determining part 1002 is further configured to determine candidate reference samples that meet a preset prediction mode in the current co-located luminance block, and use the motion vector corresponding to the candidate reference sample as a reference motion vector.
- the first determination part 1002 is further configured to determine at least two reference luma samples in the reference luma block according to a preset sample selection method, and to determine reference chroma samples corresponding to the at least two reference luma samples in the reference chroma block according to the preset sample selection method; determine the cross-component prediction model according to the at least two reference luma samples and the at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
- the cross-component prediction model includes one or more cross-component prediction sub-models; the first determination part 1002 is also configured to group the at least two reference luma samples and the at least two reference chroma samples according to the luma values of the at least two reference luma samples to obtain at least one reference sample group; wherein each reference sample group includes at least two luma samples and at least two chroma samples; the at least two luma samples correspond to the at least two chroma samples; the at least two reference luma samples include the at least two luma samples; the at least two reference chroma samples include the at least two chroma samples; the at least one reference sample group corresponds to a different preset luma range; for each reference sample group in the at least one reference sample group, the cross-component prediction sub-model corresponding to each reference sample group is determined according to the at least two luma samples and the at least two chroma samples in each reference sample group.
- the first determining part 1002 is further configured to group the at least two luma samples and the at least two chroma samples in each reference sample group according to the luma values of the at least two luma samples to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one luma sample and at least one chroma sample; the at least one luma sample corresponds to the at least one chroma sample; the reconstructed luma value of at least one luma sample in the first sample group is greater than or equal to the reconstructed luma value of at least one luma sample in the second sample group; according to the The maximum reference luminance value and the first reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the first sample point group; the minimum reference luminance value and the second reference chrominance value are determined respectively based on
- the first determination part 1002 is further configured to perform a subtraction operation on the first reference chromaticity value and the second reference chromaticity value to obtain a first intermediate parameter; perform a subtraction operation on the maximum reference luminance value and the minimum reference luminance value to obtain a second intermediate parameter; perform a division operation on the first intermediate parameter and the second intermediate parameter to obtain the scaling factor; perform a multiplication operation on the scaling factor and the minimum reference luminance value to obtain a third intermediate parameter; and perform a subtraction operation on the second reference chromaticity value and the third intermediate parameter to obtain the offset factor.
- the cross-component prediction model is a nonlinear model
- the first determination part 1002 is also configured to select all or part of the reference chroma samples in the reference chroma block; and determine the cross-component prediction model based on the all or part of the reference chroma samples, the reference luminance samples in the reference luminance block corresponding to the all or part of the reference chroma samples, and the neighborhood reference luminance samples of the reference luminance samples.
- the neighborhood reference luma samples include one or more of the following: a reference luma sample located above the reference luma sample, a reference luma sample located below the reference luma sample, a reference luma sample located to the left of the reference luma sample, and a reference luma sample located to the right of the reference luma sample.
- the first determination part 1002 is further configured to traverse the candidate reference sample points corresponding to each of the preset M position information in the current co-located luminance block according to the preset M position information, to obtain the candidate reference sample points that satisfy the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
- the first determining part 1002 is further configured to, for the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or, if the i-th candidate reference sample satisfies the preset prediction mode, determine the i-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode.
- the M positions information include one or more of the following: the middle position of the current co-located brightness block; the upper left position of the current co-located brightness block; the upper right position of the current co-located brightness block; the lower left position of the current co-located brightness block; and the lower right position of the current co-located brightness block.
- the preset prediction mode is: the candidate reference samples adopt a block copy intra prediction mode or a common string sub-mode of a string copy intra prediction.
- the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
- the preset sample selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H; the at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; the reference chroma samples corresponding to the at least two reference luminance samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample; wherein the position coordinates of the first reference chroma sample in the reference chroma block are (1,0); the first reference chroma sample is the chroma sample at the upper left corner of the reference chroma block; the second reference chroma sample is The position coordinates of the chromaticity sample in the reference chroma block
- the first determining part 1002 is further configured to determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block when the reference motion vector is invalid.
- the first determination part 1002 is further configured to perform a subtraction operation on the sample accuracy and a first preset value to obtain a fourth intermediate parameter; and perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
- the first determination part 1002 is further configured to determine that the reference motion vector is invalid when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds; or, determine that the reference motion vector is valid when the reference motion vector satisfies the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector is not out of bounds.
- the first determination part 1002 is further configured to determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model; wherein the candidate chrominance prediction block is different in size from the current chrominance block; and downsample the candidate predicted chrominance value of the candidate chrominance prediction block to obtain the predicted chrominance value of the predicted chrominance block.
- the cross-component prediction model includes at least one cross-component prediction sub-model; the first determination part 1002 is also configured to input the reconstructed luminance value of each pixel in the current co-located luminance block into the corresponding cross-component prediction sub-model to obtain the candidate predicted chromaticity value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model; and determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the candidate predicted chromaticity value corresponding to each pixel in the current co-located luminance block.
- the decoding part 1001 is further configured to parse the code stream to determine the second syntax identification information; when the second syntax identification information indicates that the current chroma block does not adopt the chroma intra block copy prediction mode, perform the parsing of the code stream to obtain the first The steps of the syntax identification information.
- the decoding part 1001 is further configured to determine that the current chroma block adopts the chroma intra-frame block copy prediction mode if the value of the second syntax identification information is a first value; or, if the value of the second syntax identification information is a second value, determine that the current chroma block does not adopt the chroma intra-frame block copy prediction mode.
- the decoding part 1001 is further configured to determine that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the first syntax identification information is a third value; or, if the value of the first syntax identification information is a fourth value, determine that the current chroma block does not adopt a cross-component prediction mode based on the chroma intra-frame block copy technology.
- the decoding part 1001 is also configured to parse the code stream to determine the third syntax identification information; when the third syntax identification information indicates that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, perform the step of parsing the code stream to obtain the first syntax identification information.
- the decoding part 1001 is further configured to determine that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the third syntax identification information is the fifth value; or, if the value of the third syntax identification information is the sixth value, determine that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology.
- the decoding part 1001 is also configured to determine that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the first syntax identification information is the seventh value; or, if the value of the first syntax identification information is the eighth value, determine that the current chroma block adopts the chroma intra-frame block copy prediction mode.
- the decoding part 1001 is further configured to parse the bit stream to obtain the chroma residual value of the current chroma block.
- the first determination part 1002 is further configured to perform inverse transformation and inverse quantization on the chroma residual value to obtain an inverse quantized chroma residual value of the current chroma block; and determine the reconstructed chroma value of the current chroma block based on the inverse quantized chroma residual value and the predicted chroma value.
- part can be a part of a circuit, a part of a processor, a part of a program or software, etc., and of course it can also be a module, or it can be non-modular.
- the components in the present embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
- the above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional module.
- the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the technical solution of this embodiment is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product.
- the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment.
- the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
- an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 1000.
- the computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, the method described in any one of the aforementioned embodiments is implemented.
- the decoder 1000 may include: a first communication interface 1101, a first memory 1102 and a first processor 1103; each component is coupled together through a first bus system 1104. It can be understood that the first bus system 1104 is used to achieve connection and communication between these components.
- the first bus system 1104 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as the first bus system 1104 in Figure 18. Among them,
- the first communication interface 1101 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
- a first memory 1102 used to store a computer program that can be run on the first processor 1103;
- the first processor 1103 is configured to, when running the computer program, execute:
- the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra block copying technique, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block;
- the first memory 1102 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
- the non-volatile memory can be a read-only memory (ROM), Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable Programmable ROM (EEPROM) or Flash memory.
- Volatile memory can be Random Access Memory (RAM), which is used as an external cache.
- RAM Static RAM
- DRAM Dynamic RAM
- SDRAM Synchronous DRAM
- DDRSDRAM Double Data Rate Synchronous Dynamic Random Access Memory
- ESDRAM Enhanced Synchronous Dynamic Random Access Memory
- SLDRAM Synchronous Link Dynamic Random Access Memory
- DRRAM Direct Rambus RAM
- the first memory 1102 of the system and method described in the present application is intended to include but is not limited to these and any other suitable types of memory.
- the first processor 1103 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the first processor 1103.
- the above-mentioned first processor 1103 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
- DSP Digital Signal Processor
- ASIC Application Specific Integrated Circuit
- FPGA Field Programmable Gate Array
- the methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed.
- the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
- the steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed.
- the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc.
- the storage medium is located in the first memory 1102, and the first processor 1103 reads the information in the first memory 1102 and completes the steps of the above method in combination with its hardware.
- the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSP Device, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.
- ASIC Application Specific Integrated Circuits
- DSP Digital Signal Processing
- DSP Device digital signal processing devices
- PLD programmable logic devices
- FPGA field programmable gate array
- general processors controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.
- the technology described in this application can be implemented by a module (such as a process, function, etc.) that performs the functions described in this application.
- the software code can be stored in a memory and executed by a processor.
- the memory can be implemented in the processor or outside the processor.
- the first processor 1103 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
- the present embodiment provides a decoder, in which, since the cross-component prediction model is determined by a reference luminance block and a reference chrominance block corresponding to a reference motion vector, compared to a cross-component prediction model derived based on reconstructed pixels in an adjacent row and column of a current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex decoding scenarios, thereby improving the decoding efficiency of the current chrominance block.
- FIG19 shows a schematic diagram of the composition structure of an encoder provided by an embodiment of the present application.
- the encoder 2000 may include a second determination part 2001 and an encoding part 2002; wherein,
- the second determining part 2001 is configured to determine a reference motion vector according to a current co-located luminance block corresponding to a current chrominance block;
- the cross-component prediction model Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
- the cross-component prediction model characterizes that a reconstructed luminance value of a current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with a predicted chrominance value of the predicted chrominance block.
- the second determining part 2001 is further configured to determine candidate reference samples that satisfy a preset prediction mode in the current co-located luminance block, and use the motion vector corresponding to the candidate reference sample as a reference motion vector.
- the second determination part 2001 is further configured to determine at least two reference luma samples in the reference luma block according to a preset sample selection method, and to determine reference chroma samples corresponding to the at least two reference luma samples in the reference chroma block according to the preset sample selection method; determine the cross-component prediction model according to the at least two reference luma samples and the at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
- the cross-component prediction model includes one or more cross-component prediction sub-models; the second determining part 2001, It is also configured to group the at least two reference luminance samples and the at least two reference chrominance samples according to the luminance values of the at least two reference luminance samples to obtain at least one reference sample group; wherein each reference sample group includes at least two luminance samples and at least two chrominance samples; the at least two luminance samples correspond to the at least two chrominance samples; the at least two reference luminance samples include the at least two luminance samples; the at least two reference chrominance samples include the at least two chrominance samples; the at least one reference sample group corresponds to a different preset luminance range; for each reference sample group in the at least one reference sample group, the cross-component prediction sub-model corresponding to each reference sample group is determined according to the at least two luminance samples and the at least two chrominance samples in the each reference sample group.
- the second determining part 2001 is further configured to group the at least two luma samples and the at least two chroma samples in each reference sample group according to the luma values of the at least two luma samples to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one luma sample and at least one chroma sample; the at least one luma sample corresponds to the at least one chroma sample; the reconstructed luma value of at least one luma sample in the first sample group is greater than or equal to the reconstructed luma value of at least one luma sample in the second sample group; and according to the The maximum reference luminance value and the first reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the first sample point group; the minimum reference luminance value and the second reference chrominance value are determined respectively based on
- the second determination part 2001 is further configured to subtract the first reference chromaticity value from the second reference chromaticity value to obtain a first intermediate parameter; subtract the maximum reference luminance value from the minimum reference luminance value to obtain a second intermediate parameter; divide the first intermediate parameter and the second intermediate parameter to obtain the scaling factor; multiply the scaling factor and the minimum reference luminance value to obtain a third intermediate parameter; and subtract the second reference chromaticity value from the third intermediate parameter to obtain the offset factor.
- the cross-component prediction model is a nonlinear model; the second determination part 2001 is also configured to select all or part of the reference chroma samples in the reference chroma block; and determine the cross-component prediction model based on the all or part of the reference chroma samples, the reference luminance samples in the reference luminance block corresponding to the all or part of the reference chroma samples, and the neighborhood reference luminance samples of the reference luminance samples.
- the neighborhood reference luma samples include one or more of the following: a reference luma sample located above the reference luma sample, a reference luma sample located below the reference luma sample, a reference luma sample located to the left of the reference luma sample, and a reference luma sample located to the right of the reference luma sample.
- the second determination part 2001 is further configured to traverse the candidate reference sample points corresponding to each of the preset M position information in the current co-located luminance block according to the preset M position information, to obtain the candidate reference sample points that satisfy the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
- the second determination part 2001 is further configured to, for the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or, if the i-th candidate reference sample satisfies the preset prediction mode, determine the i-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode.
- the M positions information include one or more of the following: the middle position of the current co-located brightness block; the upper left position of the current co-located brightness block; the upper right position of the current co-located brightness block; the lower left position of the current co-located brightness block; and the lower right position of the current co-located brightness block.
- the preset prediction mode is: the candidate reference samples adopt a block copy intra prediction mode or a common string sub-mode of a string copy intra prediction.
- the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
- the preset sample selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H; the at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; the reference chroma samples corresponding to the at least two reference luminance samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample; wherein the position coordinates of the first reference chroma sample in the reference chroma block are (1,0); the first reference chroma sample is the chroma sample at the upper left corner of the reference chroma block; the position coordinates of the second reference chroma sample in the reference chroma block are (W
- the second determining part 2001 is further configured to determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block when the reference motion vector is invalid.
- the second determination part 2001 is further configured to perform a subtraction operation on the sample accuracy and a first preset value to obtain a fourth intermediate parameter; and perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
- the second determination part 2001 is further configured to determine that the reference motion vector is invalid when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds; or, determine that the reference motion vector is valid when the reference motion vector satisfies the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector is not out of bounds.
- the second determination part 2001 is further configured to determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model; wherein the candidate chromaticity prediction block is different in size from the current chromaticity block; and downsample the candidate predicted chromaticity value of the candidate chromaticity prediction block to obtain the predicted chromaticity value of the predicted chromaticity block.
- the cross-component prediction model includes at least one cross-component prediction sub-model; the second determination part 2001 is also configured to input the reconstructed luminance value of each pixel in the current co-located luminance block into the corresponding cross-component prediction sub-model to obtain the candidate predicted chromaticity value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model; and determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the candidate predicted chromaticity value corresponding to each pixel in the current co-located luminance block.
- the second determination part 2001 is further configured to determine the chroma residual value of the current chroma block based on the original chroma value and the predicted chroma value of the current chroma block; perform rate-distortion cost calculation on the chroma residual value of the current chroma block to obtain a first rate-distortion cost value corresponding to the cross-component prediction mode based on the chroma intra-frame block copy technology adopted by the current chroma block; determine the prediction mode adopted by the current chroma block based on the first rate-distortion cost value; and determine the first syntax identification information based on the prediction mode adopted by the current chroma block.
- the encoding part 2002 is configured to encode the first syntax identification information and write the obtained encoded bits into a bit stream.
- the second determination part 2001 is further configured to determine that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology when the first rate-distortion cost value is less than or equal to the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes; or determine that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra-frame block copy technology when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes.
- the one or more candidate prediction modes include: a chroma intra block copy prediction mode; the second determination part 2001 is also configured to determine that the current chroma block adopts the chroma intra block copy prediction mode when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to the chroma intra block copy prediction mode.
- the second determination part 2001 is further configured to determine that the value of the first syntax identification information is a third value when it is determined that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; or to determine that the value of the first syntax identification information is a fourth value when it is determined that the current chroma block does not adopt a cross-component prediction mode based on the chroma intra-frame block copy technology.
- the second determining part 2001 is further configured to determine second grammar identification information.
- the second determination part 2001 is further configured to set the value of the second syntax identification information to the first value when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode; or to set the value of the second syntax identification information to the second value when it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode.
- the encoding part 2002 is further configured to encode the second syntax identification information and write the obtained encoded bits into a bit stream.
- the second determining part 2001 is further configured to, when it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, set the value of the first syntax identification information to the seventh value; or, when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, set the value of the first syntax identification information to The eighth value.
- the second determining part 2001 is further configured to determine third grammar identification information.
- the second determination part 2001 is further configured to set the value of the third syntax identification information to a fifth value when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology; or, when it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, set the value of the third syntax identification information to a sixth value.
- the encoding part 2002 is further configured to encode the third syntax identification information and write the obtained encoded bits into a bit stream.
- the second determination part 2001 is further configured to, when it is determined that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, transform and quantize the chroma residual value to obtain a quantized chroma residual value of the current chroma block.
- the encoding part 2002 is further configured to encode the quantized chroma residual value of the current chroma block and write the obtained coded bits into the bitstream.
- part can be a part of the circuit, a part of the processor, a part of the program or software, etc., and of course it can also be a module, or it can be non-modular.
- the components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
- the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional modules.
- the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
- this embodiment provides a computer-readable storage medium, which is applied to the encoder 2000, and the computer-readable storage medium stores a computer program. When the computer program is executed by the second processor, the method described in any one of the above embodiments is implemented.
- the encoder 2000 may include: a second communication interface 2101, a second memory 2102 and a second processor 2103; each component is coupled together through a second bus system 2104. It can be understood that the second bus system 2104 is used to realize the connection and communication between these components.
- the second bus system 2104 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as the second bus system 2104 in Figure 20. Among them,
- the second communication interface 2101 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
- the second memory 2102 is used to store a computer program that can be run on the second processor 2103;
- the second processor 2103 is configured to, when running the computer program, execute:
- the cross-component prediction model Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
- the second processor 2103 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
- the present embodiment provides an encoder, in which, since the cross-component prediction model is determined by a reference luminance block and a reference chrominance block corresponding to a reference motion vector, compared to a cross-component prediction model derived based on reconstructed pixels in an adjacent row and column of a current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex coding scenarios, thereby improving the coding efficiency of the current chrominance block.
- the coding and decoding system 3000 may include a decoder 3001 and an encoder 3002 .
- the decoder 3001 may be the decoder described in any one of the aforementioned embodiments
- the encoder 3002 may be the encoder described in any one of the aforementioned embodiments.
- the bitstream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; and based on the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined.
- a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined.
- the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Color Television Systems (AREA)
Abstract
Description
本申请实施例涉及视频编解码技术领域,尤其涉及一种编解码方法、码流、解码器、编码器以及存储介质。The embodiments of the present application relate to the field of video coding and decoding technology, and in particular, to a coding and decoding method, a bit stream, a decoder, an encoder, and a storage medium.
在最新视频编码标准AVS3的参考软件测试平台基础上,提出了两步跨分量预测模式(Two Step Cross-component Prediction Mode,TSCPM)。TSCPM是一种分量间预测技术,通过探索不同分量之间的线性关系去除分量间冗余。Based on the reference software test platform of the latest video coding standard AVS3, a two-step cross-component prediction mode (TSCPM) is proposed. TSCPM is an inter-component prediction technology that removes inter-component redundancy by exploring the linear relationship between different components.
在新一代视频编码标准AVS4的探索软件平台上,提出了一种色度块复制帧内预测模式,该方案下色度块能够直接使用亮度同位块的块矢量或串矢量进行运动补偿,不需要进行额外的运动估计,通过复制块运动矢量指向的色度重构值得到最终色度预测值。On the exploration software platform of the new generation video coding standard AVS4, a chroma block copy intra-frame prediction mode is proposed. Under this scheme, the chroma block can directly use the block vector or string vector of the luminance co-located block for motion compensation without the need for additional motion estimation. The final chroma prediction value is obtained by copying the chroma reconstruction value pointed to by the block motion vector.
目前,在TSCPM进行跨分量线性模型推导的过程中,通常使用当前色度块的相邻一行一列的重构像素作为模型推导信源。这样,导致目前的TSCPM不能灵活应对更多的复杂的编解码场景,从而降低了对色度块的编解码效率。At present, in the process of TSCPM performing cross-component linear model derivation, the reconstructed pixels in one row and one column adjacent to the current chrominance block are usually used as the model derivation information source, which results in the current TSCPM being unable to flexibly cope with more complex encoding and decoding scenarios, thereby reducing the encoding and decoding efficiency of the chrominance block.
发明内容Summary of the invention
本申请实施例提供一种编解码方法、码流、解码器、编码器以及存储介质,能够提升对色度块的编解码效率。The embodiments of the present application provide a coding and decoding method, a bit stream, a decoder, an encoder and a storage medium, which can improve the coding and decoding efficiency of chroma blocks.
本申请实施例的技术方案可以如下实现:The technical solution of the embodiment of the present application can be implemented as follows:
第一方面,本申请实施例提供了一种解码方法,应用于解码器,该方法包括:In a first aspect, an embodiment of the present application provides a decoding method, which is applied to a decoder, and the method includes:
解析码流,确定第一语法标识信息;Parsing the code stream to determine first syntax identification information;
在所述第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据所述当前色度块对应的当前同位亮度块,确定参考运动矢量;When the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra block copying technique, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;When the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值;Determining a predicted chroma value of a predicted chroma block based on the cross-component prediction model;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
第二方面,本申请实施例提供了一种编码方法,应用于编码器,该方法包括:In a second aspect, an embodiment of the present application provides an encoding method, which is applied to an encoder, and the method includes:
根据当前色度块对应的当前同位亮度块,确定参考运动矢量;Determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定所述跨分量预测模型;When the reference motion vector is valid, determining the cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值,并根据所述预测色度值,确定第一语法标识信息;其中,所述第一语法标识信息用于指示所述当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
第三方面,本申请实施例提供了一种码流,该码流是根据待编码信息进行比特编码生成的;其中,所述待编码信息包括下述至少一项:In a third aspect, an embodiment of the present application provides a code stream, which is generated by bit encoding according to information to be encoded; wherein the information to be encoded includes at least one of the following:
第一语法标识信息的取值、第二语法标识信息的取值、第三语法标识信息的取值、当前色度块的是量化色度残差值;其中,所述第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;所述第二语法标识信息用于指示当前色度块是否采用色度帧内块复制预测模式;所述第三语法标识信息用于指示当前色度块是否采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式。The value of the first syntax identification information, the value of the second syntax identification information, the value of the third syntax identification information, and the quantized chroma residual value of the current chroma block; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; the second syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode; the third syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode or a cross-component prediction mode based on the chroma intra-frame block copy technology.
第四方面,本申请实施例提供了一种解码器,该解码器包括解码部分和第一确定部分,其中:In a fourth aspect, an embodiment of the present application provides a decoder, the decoder comprising a decoding part and a first determining part, wherein:
所述解码部分,被配置为解析码流,确定第一语法标识信息;The decoding part is configured to parse the code stream and determine the first syntax identification information;
所述第一确定部分,被配置在所述第一语法标识信息指示当前色度块采用基于色度帧内块复制技 术的跨分量预测模式的情况下,根据所述当前色度块对应的当前同位亮度块,确定参考运动矢量;The first determining part is configured to indicate that the current chroma block adopts the chroma intra-frame block copying technology based on the first syntax identification information. In the case of a cross-component prediction mode of the current chrominance block, determining a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;When the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值;Determining a predicted chroma value of a predicted chroma block based on the cross-component prediction model;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
第五方面,本申请实施例提供了一种编码器,该编码器包括第二确定部分,其中:In a fifth aspect, an embodiment of the present application provides an encoder, the encoder comprising a second determining part, wherein:
所述第二确定部分,被配置为根据当前色度块对应的当前同位亮度块,确定参考运动矢量;The second determining part is configured to determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定所述跨分量预测模型;When the reference motion vector is valid, determining the cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值,并根据所述预测色度值,确定第一语法标识信息;其中,所述第一语法标识信息用于指示所述当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
第六方面,本申请实施例提供了一种解码器,该解码器包括第一存储器和第一处理器,其中:In a sixth aspect, an embodiment of the present application provides a decoder, the decoder comprising a first memory and a first processor, wherein:
所述第一存储器,被配置为存储能够在所述第一处理器上运行的计算机程序;The first memory is configured to store a computer program that can be executed on the first processor;
所述第一处理器,被配置为在运行所述计算机程序时,执行如第一方面所述的方法。The first processor is configured to execute the method according to the first aspect when running the computer program.
第七方面,本申请实施例提供了一种编码器,该编码器包括第二存储器和第二处理器,其中:In a seventh aspect, an embodiment of the present application provides an encoder, the encoder comprising a second memory and a second processor, wherein:
所述第二存储器,被配置为存储能够在所述第二处理器上运行的计算机程序;The second memory is configured to store a computer program that can be executed on the second processor;
所述第二处理器,被配置为在运行所述计算机程序时,执行如第二方面所述的方法。The second processor is configured to execute the method according to the second aspect when running the computer program.
第八方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,所述计算机程序被执行时实现如第一方面或第二方面所述的方法。In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, it implements the method described in the first aspect or the second aspect.
本申请实施例提供了一种编解码方法、码流、解码器、编码器以及存储介质,在解码端,解析码流,确定第一语法标识信息;在第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值;根据预测色度块的预测色度值,确定当前色度块的重建色度值。在编码端,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值,并根据预测色度值,确定第一语法标识信息;其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;根据预测色度块的预测色度值,确定当前色度块的重建色度值。由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编解码场景,从而提高了对当前色度块的编解码效率。The embodiments of the present application provide a coding and decoding method, a bit stream, a decoder, an encoder and a storage medium. At the decoding end, the bit stream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; and according to the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined. At the encoding end, a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined. Since the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
图1a为本申请实施例提供的一种可选的YcbCr颜色空间的采用方式的示意图一;FIG. 1a is a schematic diagram 1 of an optional method of adopting a YCbCr color space provided in an embodiment of the present application;
图1b为本申请实施例提供的一种可选的YcbCr颜色空间的采用方式的示意图二;FIG1b is a second schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application;
图1c为本申请实施例提供的一种可选的YcbCr颜色空间的采用方式的示意图三;FIG1c is a third schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application;
图1d为本申请实施例提供的一种可选的YcbCr颜色空间的采用方式的示意图四;FIG1d is a fourth schematic diagram of an optional YCbCr color space adoption method provided in an embodiment of the present application;
图2为本申请实施例提供的一种可选的编码器的组成框图示意图;FIG2 is a schematic block diagram of an optional encoder provided in an embodiment of the present application;
图3为本申请实施例提供的一种可选的解码器的组成框图示意图;FIG3 is a schematic block diagram of an optional decoder provided in an embodiment of the present application;
图4为本申请实施例提供的一种可选的编解码系统的网络架构的示意图;FIG4 is a schematic diagram of a network architecture of an optional encoding and decoding system provided in an embodiment of the present application;
图5为本申请实施例提供的一种可选的两步跨分量预测模式的流程示意图;FIG5 is a schematic diagram of a flow chart of an optional two-step cross-component prediction mode provided in an embodiment of the present application;
图6a为本申请实施例提供的一种可选的相邻参考样本点的选取方式的示意图一;FIG6a is a schematic diagram 1 of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application;
图6b为本申请实施例提供的一种可选的相邻参考样本点的选取方式的示意图二;FIG6b is a second schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application;
图6c为本申请实施例提供的一种可选的相邻参考样本点的选取方式的示意图三;FIG6c is a third schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application;
图6d为本申请实施例提供的一种可选的相邻参考样本点的选取方式的示意图四;FIG6d is a fourth schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application;
图6e为本申请实施例提供的一种可选的相邻参考样本点的选取方式的示意图五;FIG6e is a fifth schematic diagram of an optional method for selecting adjacent reference sample points provided in an embodiment of the present application;
图7为本申请实施例提供的一种可选的邻近块的模板选取方式的示意图;FIG7 is a schematic diagram of an optional template selection method for adjacent blocks provided in an embodiment of the present application;
图8为本申请实施例提供的一种可选的跨分量非线性预测模型的亮度样点的选取方式的示意图; FIG8 is a schematic diagram of an optional method for selecting brightness samples of a cross-component nonlinear prediction model provided in an embodiment of the present application;
图9为本申请实施例提供的一种可选的帧内块复制预测技术的参考运动矢量的示意图;FIG9 is a schematic diagram of a reference motion vector of an optional intra-block copy prediction technology provided in an embodiment of the present application;
图10为本申请实施例提供的一种可选的色度块复制帧内预测模式的亮度同位块的示意图;FIG10 is a schematic diagram of a luma co-located block in an optional chroma block copy intra prediction mode provided in an embodiment of the present application;
图11为本申请实施例提供的一种可选的解码方法的流程示意图;FIG11 is a schematic flow chart of an optional decoding method provided in an embodiment of the present application;
图12a为本申请实施例提供的一种可选的参考亮度块的示意图;FIG12a is a schematic diagram of an optional reference brightness block provided in an embodiment of the present application;
图12b为本申请实施例提供的一种可选的参考色度块的示意图;FIG12b is a schematic diagram of an optional reference chromaticity block provided in an embodiment of the present application;
图13a为本申请实施例提供的一种可选的预设样点选取方式的示意图一;FIG13a is a schematic diagram 1 of an optional preset sample point selection method provided in an embodiment of the present application;
图13b为本申请实施例提供的一种可选的预设样点选取方式的示意图二;FIG13b is a second schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application;
图13c为本申请实施例提供的一种可选的预设样点选取方式的示意图三;FIG13c is a third schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application;
图13d为本申请实施例提供的一种可选的预设样点选取方式的示意图四;FIG13d is a fourth schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application;
图13e为本申请实施例提供的一种可选的预设样点选取方式的示意图五;FIG13e is a fifth schematic diagram of an optional preset sample point selection method provided in an embodiment of the present application;
图14为本申请实施例提供的一种可选的多个跨分量预测子模型的示意图;FIG14 is a schematic diagram of an optional multiple cross-component prediction sub-model provided in an embodiment of the present application;
图15为本申请实施例提供的一种可选的六抽头滤波器的示意图;FIG15 is a schematic diagram of an optional six-tap filter provided in an embodiment of the present application;
图16为本申请实施例提供的一种可选的编码方法的流程示意图;FIG16 is a schematic diagram of a flow chart of an optional encoding method provided in an embodiment of the present application;
图17为本申请实施例提供的一种可选的解码器的组成结构示意图;FIG17 is a schematic diagram of the composition structure of an optional decoder provided in an embodiment of the present application;
图18为本申请实施例提供的一种可选的解码器的具体硬件结构示意图;FIG18 is a schematic diagram of a specific hardware structure of an optional decoder provided in an embodiment of the present application;
图19为本申请实施例提供的一种可选的编码器的组成结构示意图;FIG19 is a schematic diagram of the composition structure of an optional encoder provided in an embodiment of the present application;
图20为本申请实施例提供的一种可选的编码器的具体硬件结构示意图;FIG20 is a schematic diagram of a specific hardware structure of an optional encoder provided in an embodiment of the present application;
图21为本申请实施例提供的一种可选的编解码系统的组成结构示意图。FIG. 21 is a schematic diagram of the composition structure of an optional encoding and decoding system provided in an embodiment of the present application.
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
还需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅是用于区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。It should also be pointed out that the terms "first\second\third" involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
数字视频压缩技术主要是将庞大的数字影像视频数据进行压缩,以便于传输以及存储等。也就是说,数字视频压缩技术是一种通过减少视频数据量以节省存储空间和传输带宽的技术。视频数据通常占据大量空间,而压缩技术可以有效减小文件大小,同时保持对人眼不可察觉的质量损失。随着互联网视频的激增以及人们对视频清晰度的要求越来越高,尽管已有的数字视频压缩标准能够节省不少视频数据,但目前仍然需要追求更好的数字视频压缩技术,以减少数字视频传输的带宽和流量压力。Digital video compression technology is mainly used to compress huge digital video data for transmission and storage. In other words, digital video compression technology is a technology that saves storage space and transmission bandwidth by reducing the amount of video data. Video data usually takes up a lot of space, and compression technology can effectively reduce the file size while maintaining quality loss that is imperceptible to the human eye. With the surge in Internet videos and people's increasing requirements for video clarity, although the existing digital video compression standards can save a lot of video data, there is still a need to pursue better digital video compression technology to reduce the bandwidth and traffic pressure of digital video transmission.
视频压缩通常依赖于特定的编码标准。常见的视频编码标准包括H.264/AVC、H.265/HEVC、VP9、AV1等。这些标准定义了视频压缩的算法和规范,确保视频在不同设备上的兼容性。视频压缩技术主要分为帧内压缩(Intra-Frame Compression)和帧间压缩(Inter-Frame Compression)。帧内压缩依赖于单个视频帧的编码,而帧间压缩则利用帧与帧之间的相似性。在帧间压缩中,运动补偿是一项关键技术。通过检测相邻帧中的运动,并根据运动信息预测像素的位置,可以在保持视频质量的同时减小数据量。量化是将图像或视频中的像素值映射到较小的集合的过程,从而减小数据的表示范围。熵编码则通过利用数据中的统计信息来优化编码过程,以进一步减小数据量。视频中的相邻像素之间通常存在空间和时间上的相关性。压缩算法利用这些相关性,通过预测和差异编码的方式来减小数据冗余。压缩技术通常允许用户在保持可接受质量的前提下选择不同的分辨率和比特率。这使得在存储和传输时能够更好地适应不同的需求。某些应用对视频传输的实时性要求较高,例如视频会议、实时监控等。因此,一些压缩标准和技术专注于提供低延迟的解决方案。总的来说,数字视频压缩技术在多媒体领域得到了广泛应用,它不仅影响了视频存储和传输的效率,还对视频应用的用户体验产生了积极影响。Video compression usually relies on specific coding standards. Common video coding standards include H.264/AVC, H.265/HEVC, VP9, AV1, etc. These standards define the algorithms and specifications for video compression to ensure the compatibility of videos on different devices. Video compression technology is mainly divided into intra-frame compression and inter-frame compression. Intra-frame compression relies on the encoding of a single video frame, while inter-frame compression exploits the similarity between frames. In inter-frame compression, motion compensation is a key technology. By detecting motion in adjacent frames and predicting the position of pixels based on motion information, the amount of data can be reduced while maintaining video quality. Quantization is the process of mapping pixel values in an image or video to a smaller set, thereby reducing the representation range of the data. Entropy coding optimizes the encoding process by utilizing statistical information in the data to further reduce the amount of data. There are usually spatial and temporal correlations between adjacent pixels in a video. Compression algorithms use these correlations to reduce data redundancy through prediction and difference coding. Compression technology usually allows users to choose different resolutions and bit rates while maintaining acceptable quality. This allows for better adaptation to different needs during storage and transmission. Some applications have high real-time requirements for video transmission, such as video conferencing, real-time monitoring, etc. Therefore, some compression standards and technologies focus on providing low-latency solutions. In general, digital video compression technology has been widely used in the multimedia field, which not only affects the efficiency of video storage and transmission, but also has a positive impact on the user experience of video applications.
视频压缩包括用于减少或取出视频内在冗余的帧内预测(空域)和或帧间预测(时域),残差信息的变化量化和反量化反变化,提高主客观重建质量的环路滤波和熵编码等多个模块。主流的视频压缩标准大都描述的是以块为基础的压缩技术。一个视频片,一帧图片或一系列图片会被划分成以CTU的基本单元,以此为基础进一步被划分成以CU为单位的块。帧内块通过块周边像素作为参考进行预测,帧间块则参考空间上的邻近块信息和其他帧里的参考信息。与预测信号相对,残差信息通过以块为单位的 变换,量化和熵编码成码流。这些技术被描述在标准里并实施在的各种与视频压缩相关的领域。国际上,目前主流的标准有H.264/Advanced Video Coding(AVC),H.265/High Efficiency Video Coding(HEVC)standard,H.266/Versatile Video Coding(VVC)以及这些标准的拓展等,视频设备可以通过实施这些技术来达到更高效的视频编解码和传输储存。Video compression includes multiple modules such as intra-frame prediction (spatial domain) and/or inter-frame prediction (temporal domain) for reducing or removing inherent redundancy in the video, quantization and inverse quantization of residual information, loop filtering and entropy coding for improving subjective and objective reconstruction quality. Most mainstream video compression standards describe block-based compression technology. A video clip, a frame of a picture or a series of pictures will be divided into basic units called CTUs, which are further divided into blocks called CUs. Intra-frame blocks are predicted using the pixels surrounding the block as a reference, while inter-frame blocks refer to the spatial neighboring block information and reference information in other frames. Compared with the prediction signal, the residual information is transmitted in blocks. Transform, quantize and entropy encode into bitstream. These technologies are described in standards and implemented in various fields related to video compression. Internationally, the current mainstream standards include H.264/Advanced Video Coding (AVC), H.265/High Efficiency Video Coding (HEVC) standard, H.266/Versatile Video Coding (VVC) and the extensions of these standards. Video devices can achieve more efficient video encoding and decoding and transmission and storage by implementing these technologies.
在一些实施例中,数字视频就是以数字的形式记录的视频,其由一幅幅数字图像组成,每幅图像由若干行若干列的像素组成,每个像素由数字化的数值表示。为了表达人眼观察的颜色,人们从数学模型上定义了一系列不同的颜色模型,包括RGB、YUV等,为了把这些颜色模型投射到对应的数学表达,根据对不同颜色数据的不同处理方式、存储格式,产生了不同的颜色空间。颜色空间是一种特定的颜色组织形式,颜色空间定义了一种方式来表示和组织颜色信息。不同的颜色空间使用不同的坐标系或者参数来描述颜色,这样可以方便地进行颜色的表示、编辑、分析和处理。In some embodiments, digital video is a video recorded in digital form, which is composed of a series of digital images, each image is composed of a number of rows and columns of pixels, and each pixel is represented by a digital value. In order to express the colors observed by the human eye, people have defined a series of different color models from a mathematical model, including RGB, YUV, etc. In order to project these color models to the corresponding mathematical expressions, different color spaces are generated according to different processing methods and storage formats for different color data. Color space is a specific form of color organization, and color space defines a way to represent and organize color information. Different color spaces use different coordinate systems or parameters to describe colors, which makes it easy to represent, edit, analyze and process colors.
在一些实施例中,颜色空间包括RGB格式(Red Green Blue,红绿蓝)、YUV格式(亮度-色度-饱和度,Luminance-Chrominance-Saturation)、HSV格式(色相-饱和度-明度,Hue-Saturation-Value)、Lab格式和CMYK格式(青色-品红色-黄色-黑色,Cyan-Magenta-Yellow-Key)。需要说明的是,上述列举的颜色空间各自有其特定的应用领域和优势,选择适当的颜色空间取决于具体的需求和应用场景。在实际应用中,在图像处理、计算机视觉和多媒体领域,经常需要在不同的颜色空间之间进行转换和处理,以满足不同设备和任务的要求。In some embodiments, the color space includes RGB format (Red Green Blue), YUV format (Luminance-Chrominance-Saturation), HSV format (Hue-Saturation-Value), Lab format and CMYK format (Cyan-Magenta-Yellow-Key). It should be noted that the color spaces listed above each have their specific application fields and advantages, and the selection of an appropriate color space depends on specific needs and application scenarios. In practical applications, in the fields of image processing, computer vision and multimedia, it is often necessary to convert and process between different color spaces to meet the requirements of different devices and tasks.
在一些实施例中,RGB颜色空间使用红、绿、蓝三个分量表示颜色,每个分量的取值范围通常是0到255。RGB颜色空间在计算机图形学和显示技术中广泛应用,用于显示器、摄像头、数字图像等。RGB的特点在于直观,易于处理和显示,但不同设备和标准中的RGB颜色空间可能略有差异。In some embodiments, the RGB color space uses three components, red, green, and blue, to represent colors, and the value range of each component is usually 0 to 255. The RGB color space is widely used in computer graphics and display technology, and is used for displays, cameras, digital images, etc. RGB is characterized by being intuitive, easy to process and display, but the RGB color space in different devices and standards may be slightly different.
在一些实施例中,YUV颜色空间包含亮度(Y)和色度(U、V)三个分量,分别表示亮度信息和色度信息。YUV颜色空间主要在视频编码中使用,如H.264、H.265等,色度信息的分离使得在压缩视频时更容易去掉一些人眼不容易察觉的颜色细节。YUV颜色空间适用于视频编码,对亮度和色度进行分离,提高了压缩效率。In some embodiments, the YUV color space includes three components: brightness (Y) and chrominance (U, V), which represent brightness information and chrominance information respectively. The YUV color space is mainly used in video coding, such as H.264, H.265, etc. The separation of chrominance information makes it easier to remove some color details that are not easily perceived by the human eye when compressing the video. The YUV color space is suitable for video coding, which separates brightness and chrominance and improves compression efficiency.
在一些实施例中,HSV颜色空间用色相(Hue)、饱和度(Saturation)和明度(Value)三个参数描述颜色。HSV颜色空间主要在图像编辑和图形设计中使用,因为它更符合人类对颜色的感知。HSV颜色空间的特点直观,易于理解和调整颜色,色相表示颜色的种类,饱和度表示颜色的纯度,明度表示颜色的亮度。In some embodiments, the HSV color space uses three parameters: hue, saturation, and value to describe color. The HSV color space is mainly used in image editing and graphic design because it is more in line with human perception of color. The characteristics of the HSV color space are intuitive and easy to understand and adjust colors. Hue indicates the type of color, saturation indicates the purity of the color, and value indicates the brightness of the color.
在一些实施例中,Lab颜色空间包含亮度(L)和两个色度分量(a、b),Lab颜色空间用于描述人类视觉感知的颜色差异,是一种无关于设备的颜色空间。Lab颜色空间能够更准确地描述颜色之间的差异,被广泛用于颜色匹配、颜色校正等应用。In some embodiments, the Lab color space includes brightness (L) and two chromaticity components (a, b). The Lab color space is used to describe the color differences perceived by human vision and is a device-independent color space. The Lab color space can more accurately describe the differences between colors and is widely used in applications such as color matching and color correction.
在一些实施例中,CMYK颜色空间使用青、洋红、黄、黑四个颜色分量,分别表示墨盒的油墨含量,CMYK颜色空间主要在印刷领域中使用,用于定义印刷颜色,CMYK颜色空间适用于印刷过程,通过调整不同颜色分量的含量,可以得到各种颜色。In some embodiments, the CMYK color space uses four color components, cyan, magenta, yellow, and black, which respectively represent the ink content of the ink cartridge. The CMYK color space is mainly used in the printing field to define printing colors. The CMYK color space is suitable for the printing process. Various colors can be obtained by adjusting the content of different color components.
在一些实施例中,颜色对象是客观的对象,不同颜色空间只是从不同的角度去衡量同一个对象,并不改变颜色对象的本质。颜色空间的颜色组织方式多样、种类繁多。根据不完全统计有40种不同模型,常见的有RGB、CMY(K)、HSI、YUV、YIQ、YCbCr等,其中,基于三基色的模型主要有RGB和CMY(K),基于亮度与色度的模型主要有HIS、YUV、YIQ、YCbCr。不同颜色空间模型其主要用途也不相同,RGB主要用于显示系统,CMY(K)主要用于打印机,YUV用于PAL制式的彩色电视机,YIQ用于NTSC制式的彩色电视机,YCbCr用于数字彩色电视机。目前YCbCr颜色空间是数字视频编码源的主要表现形式,其中Y表示明亮度,也就是灰度值,Cb表示蓝色信号部分与亮度值之间的差异,Cr表示红色信号部分与亮度值之间的差异,这种格式将亮度信息与色彩信息分开,利用人眼对亮度敏感对色度不敏感的特性将一些颜色信息压缩,从而达到降低带宽的目的。YCbCr有许多取样格式,如4∶4∶4、4∶2∶2、4∶1∶1和4∶2∶0。In some embodiments, the color object is an objective object, and different color spaces only measure the same object from different angles, and do not change the nature of the color object. The color organization methods of color space are diverse and varied. According to incomplete statistics, there are 40 different models, the common ones are RGB, CMY (K), HSI, YUV, YIQ, YCbCr, etc. Among them, the models based on the three primary colors are mainly RGB and CMY (K), and the models based on brightness and chromaticity are mainly HIS, YUV, YIQ, and YCbCr. The main uses of different color space models are also different. RGB is mainly used in display systems, CMY (K) is mainly used in printers, YUV is used for PAL color TVs, YIQ is used for NTSC color TVs, and YCbCr is used for digital color TVs. At present, YCbCr color space is the main form of expression of digital video encoding source, where Y represents brightness, that is, grayscale value, Cb represents the difference between the blue signal part and the brightness value, and Cr represents the difference between the red signal part and the brightness value. This format separates brightness information from color information, and uses the characteristics of human eyes that are sensitive to brightness but not to chrominance to compress some color information, thereby achieving the purpose of reducing bandwidth. YCbCr has many sampling formats, such as 4:4:4, 4:2:2, 4:1:1 and 4:2:0.
图1a示出的为采样点为4∶4∶4的示意图,图1b示出的为采样点为4∶2∶2的示意图,图1c示出的为采样点为4∶1∶1的示意图,图1d示出的为采样点为4∶2∶0的示意图。其中,采样点为4∶4∶4表示亮度(Y)分量和色度(Cb和Cr)分量在水平和垂直方向上都以每个像素为单位进行采样,即每个像素都有独立的色度信息和亮度信息。4∶4∶4的采样方式保留了最高的颜色信息,适用于对颜色精度要求较高的场景,但同时也需要更多的存储和传输带宽。采样点为4∶2∶2表示亮度(Y)分量的采样率为每行4个像素,而色度(Cb和Cr)的采样率为每行2个像素。具体的,在采样点为4∶4∶4的情况下,对于Y分量在水平方向上每4个像素只采样一次,即亮度信息对每组4个像素共享。Cb和Cr分量在水平方向上每2个像素值只采样一次,即色度信息对每2个像素共享。这种方式相对于采样点为4∶4∶4的采样方式,可以降低色度分量的采样率,从而减小数据量,节省存储和传输带宽。采 样点为4∶1∶1表示亮度(Y)分量在水平方向上都以每个像素为单位采样,而色度(Cb和Cr)分量在水平方向上以每4个像素采样一个,即每一个像素都有独立的亮度信息,每4个像素共享一组色度信息。4∶1∶1的采样方式相对于4∶2∶2的采样方式色度分量的采样率更低,可以降低数据量,节省存储和传输带宽。采样点为4∶2∶0表示亮度(Y)分量在水平和垂直方向上以每个像素为单位进行采样,而色度(Cb和Cr)分量在水平方向上每2个像素采样一次,在垂直方向上每2行采样一次,即每一个像素都有独立的亮度信息,每4个像素共享一组色度信息。4∶2∶0的采样方式相对于4∶4∶4的采样方式色度分量的采样率更低,可以显著减小数据量,适用于视频压缩和传输。FIG. 1a shows a schematic diagram of a sampling point of 4:4:4, FIG. 1b shows a schematic diagram of a sampling point of 4:2:2, FIG. 1c shows a schematic diagram of a sampling point of 4:1:1, and FIG. 1d shows a schematic diagram of a sampling point of 4:2:0. Wherein, the sampling point of 4:4:4 means that the brightness (Y) component and the chrominance (Cb and Cr) components are sampled in units of each pixel in the horizontal and vertical directions, that is, each pixel has independent chrominance information and brightness information. The sampling method of 4:4:4 retains the highest color information and is suitable for scenes with high color accuracy requirements, but it also requires more storage and transmission bandwidth. The sampling point of 4:2:2 means that the sampling rate of the brightness (Y) component is 4 pixels per row, and the sampling rate of the chrominance (Cb and Cr) is 2 pixels per row. Specifically, when the sampling point is 4:4:4, the Y component is sampled only once for every 4 pixels in the horizontal direction, that is, the brightness information is shared for each group of 4 pixels. The Cb and Cr components are sampled only once for every two pixel values in the horizontal direction, that is, the chrominance information is shared for every two pixels. Compared with the sampling method with a sampling point of 4:4:4, this method can reduce the sampling rate of the chrominance component, thereby reducing the amount of data and saving storage and transmission bandwidth. The sampling point of 4:1:1 means that the luminance (Y) component is sampled in units of each pixel in the horizontal direction, while the chrominance (Cb and Cr) components are sampled once every 4 pixels in the horizontal direction, that is, each pixel has independent luminance information, and every 4 pixels share a set of chrominance information. The sampling method of 4:1:1 has a lower sampling rate for the chrominance component than the sampling method of 4:2:2, which can reduce the amount of data and save storage and transmission bandwidth. The sampling point of 4:2:0 means that the luminance (Y) component is sampled in units of each pixel in the horizontal and vertical directions, while the chrominance (Cb and Cr) components are sampled once every 2 pixels in the horizontal direction and once every 2 lines in the vertical direction, that is, each pixel has independent luminance information, and every 4 pixels share a set of chrominance information. The sampling method of 4:2:0 has a lower sampling rate for the chrominance component than the sampling method of 4:4:4, which can significantly reduce the amount of data and is suitable for video compression and transmission.
以探究下一代数字视频压缩技术为目的,在最新视频编码标准H.266/VVC的参考软件测试平台(VVC Test Model,VTM)为基础上,提出了两步跨分量预测模式(Two Step Cross-component Prediction Mode,TSCPM)。TSCPM是一种分量间预测技术,通过探索不同分量之间的线性关系去除分量间冗余。TSCPM的工作流程主要包括以下两个步骤:With the purpose of exploring the next generation of digital video compression technology, a two-step cross-component prediction mode (TSCPM) is proposed based on the reference software test platform (VVC Test Model, VTM) of the latest video coding standard H.266/VVC. TSCPM is an inter-component prediction technology that removes inter-component redundancy by exploring the linear relationship between different components. The workflow of TSCPM mainly includes the following two steps:
1)亮度预测(Luma Prediction)1) Luma Prediction
首先,使用当前待编码的色度块对应的亮度块。通过线性模型参数α和β,以及亮度块的参考样本,计算得到尺寸相同的临时亮度预测块。这一步的目标是建立亮度和色度分量之间的线性关系。线性模型参数α和β是通过分析亮度块的参考样本和对应的色度参考样本计算得到的。First, use the luma block corresponding to the current chroma block to be encoded. The linear model parameters α and β, as well as the reference samples of the luma block, are used to calculate a temporary luma prediction block of the same size. The goal of this step is to establish a linear relationship between the luma and chroma components. The linear model parameters α and β are calculated by analyzing the reference samples of the luma block and the corresponding chroma reference samples.
2)色度预测(Chroma Prediction)2) Chroma Prediction
在完成亮度预测后,对临时亮度预测块进行下采样操作,以得到相应的色度预测值。下采样操作通常涉及对亮度块的水平和垂直方向进行操作,以匹配色度分量的分辨率。下采样得到的结果用于生成色度分量的预测块,这将用于帧内预测。After the luma prediction is completed, the temporary luma prediction block is downsampled to obtain the corresponding chroma prediction value. The downsampling operation usually involves operating the luma block in the horizontal and vertical directions to match the resolution of the chroma component. The result of downsampling is used to generate the prediction block of the chroma component, which will be used for intra prediction.
总的来说,TSCPM通过建立亮度和色度分量之间的线性关系,先进行亮度预测,然后通过下采样得到色度预测,从而实现对色度分量的高效预测。这种方法有助于提高视频编码的效率,减小数据冗余,提高压缩性能。TSCPM主要应用于现代视频编码标准,如H.264、H.265等。In general, TSCPM establishes a linear relationship between luminance and chrominance components, first predicts luminance, and then obtains chrominance prediction through downsampling, thereby achieving efficient prediction of chrominance components. This method helps to improve the efficiency of video coding, reduce data redundancy, and improve compression performance. TSCPM is mainly used in modern video coding standards such as H.264, H.265, etc.
目前,视频压缩技术也是基于块为基础而进行的传统编解码,它可以包括多个模块,例如块划分、帧内预测、帧间预测、变换、量化、熵编码、环路和后处理滤波等等。本申请实施例主要是在预测部分进行改进,以提升TSCPM的编码性能。At present, video compression technology is also a traditional codec based on blocks, which can include multiple modules, such as block division, intra-frame prediction, inter-frame prediction, transformation, quantization, entropy coding, loop and post-processing filtering, etc. The embodiment of the present application mainly improves the prediction part to improve the coding performance of TSCPM.
在这里,预测部分可以包括多种技术,其中包含亮度预测模式和色度预测模式。Here, the prediction part may include multiple techniques, including luma prediction mode and chroma prediction mode.
参见图2,其示出了本申请实施例提供的一种编码器的组成框图示意图。如图2所示,编码器100可以包括变换与量化单元101、帧内估计单元102、帧内预测单元103、运动补偿单元104、运动估计单元105、反变换与反量化单元106、滤波器控制分析单元107、滤波单元108、编码单元109和解码图像缓存单元110等,其中,滤波单元108可以实现去方块滤波及样本自适应缩进(Sample Adaptive Offset,SAO)滤波,编码单元109可以实现头信息编码及基于上下文的自适应二进制算术编码(Context-based Adaptive Binary Arithmetic Coding,CABAC)。针对输入的原始视频信号,通过编码树单元(Coding Tree Unit,CTU)的划分可以得到一个视频编码块,然后对经过帧内或帧间预测后得到的残差像素信息通过变换与量化单元101对该视频编码块进行变换,包括将残差信息从像素域变换到变换域,并对所得的变换系数进行量化,用以进一步减少比特率;帧内估计单元102和帧内预测单元103是用于对该视频编码块进行帧内预测;明确地说,帧内估计单元102和帧内预测单元103用于确定待用以编码该视频编码块的帧内预测模式;运动补偿单元104和运动估计单元105用于执行所接收的视频编码块相对于一或多个参考帧中的一或多个块的帧间预测编码以提供时间预测信息;由运动估计单元105执行的运动估计为产生运动向量的过程,所述运动向量可以估计该视频编码块的运动,然后由运动补偿单元104基于由运动估计单元105所确定的运动向量执行运动补偿;在确定帧内预测模式之后,帧内预测单元103还用于将所选择的帧内预测数据提供到编码单元109,而且运动估计单元105将所计算确定的运动向量数据也发送到编码单元109;此外,反变换与反量化单元106是用于该视频编码块的重构建,在像素域中重构建残差块,该重构建残差块通过滤波器控制分析单元107和滤波单元108去除方块效应伪影,然后将该重构残差块添加到解码图像缓存单元110的帧中的一个预测性块,用以产生经重构建的视频编码块;编码单元109是用于编码各种编码参数及量化后的变换系数,在基于CABAC的编码算法中,上下文内容可基于相邻编码块,可用于编码指示所确定的帧内预测模式的信息,输出该视频信号的码流;而解码图像缓存单元110是用于存放重构建的视频编码块,用于预测参考。随着视频图像编码的进行,会不断生成新的重构建的视频编码块,这些重构建的视频编码块都会被存放在解码图像缓存单元110中。Referring to Fig. 2, it shows a schematic block diagram of a composition of an encoder provided by an embodiment of the present application. As shown in Fig. 2, the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109 and a decoded image cache unit 110, etc., wherein the filtering unit 108 may implement deblocking filtering and sample adaptive offset (Sample Adaptive Offset, SAO) filtering, and the encoding unit 109 may implement header information encoding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmetic Coding, CABAC). For the input original video signal, a video coding block can be obtained by dividing the coding tree unit (CTU), and then the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101 to transform the video coding block, including transforming the residual information from the pixel domain to the transform domain, and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, and the motion vector can estimate the motion of the video coding block, and then the motion compensation unit 104 is based on the motion vector obtained by the motion estimation unit 105. The motion vector determined by the motion estimation unit 105 performs motion compensation; after determining the intra-frame prediction mode, the intra-frame prediction unit 103 is also used to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; in addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the pixel domain, and the reconstructed residual block is removed by the filter control analysis unit 107 and the filtering unit 108. The block effect artifacts are then removed, and the reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block; the encoding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode and output the code stream of the video signal; and the decoded image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .
参见图3,其示出了本申请实施例提供的一种解码器的组成框图示意图。如图3所示,解码器200包括解码单元201、反变换与反量化单元202、帧内预测单元203、运动补偿单元204、滤波单元205和解码图像缓存单元206等,其中,解码单元201可以实现头信息解码以及CABAC解码,滤波单元205可以实现去方块滤波以及SAO滤波。输入的视频信号经过图2的编码处理之后,输出该视频信号的码 流;该码流输入解码器200中,首先经过解码单元201,用于得到解码后的变换系数;针对该变换系数通过反变换与反量化单元202进行处理,以便在像素域中产生残差块;帧内预测单元203可用于基于所确定的帧内预测模式和来自当前帧或图片的先前经解码块的数据而产生当前视频解码块的预测数据;运动补偿单元204是通过剖析运动向量和其他关联语法元素来确定用于视频解码块的预测信息,并使用该预测信息以产生正被解码的视频解码块的预测性块;通过对来自反变换与反量化单元202的残差块与由帧内预测单元203或运动补偿单元204产生的对应预测性块进行求和,而形成解码的视频块;该解码的视频信号通过滤波单元205以便去除方块效应伪影,可以改善视频质量;然后将经解码的视频块存储于解码图像缓存单元206中,解码图像缓存单元206存储用于后续帧内预测或运动补偿的参考图像,同时也用于视频信号的输出,即得到了所恢复的原始视频信号。Refer to FIG3 , which shows a schematic block diagram of a decoder provided by an embodiment of the present application. As shown in FIG3 , the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image cache unit 206, etc., wherein the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal is encoded in FIG2 , the code of the video signal is output. The code stream is input into the decoder 200, and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and the data from the previously decoded blocks of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses the prediction information to generate the video being decoded. The decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove the block effect artifacts, which can improve the video quality; and then the decoded video block is stored in the decoded image buffer unit 206, which stores the reference image for subsequent intra-frame prediction or motion compensation, and is also used for the output of the video signal, that is, the restored original video signal is obtained.
进一步地,本申请实施例还提供了一种包含编码器和解码器的编解码系统的网络架构,其中,图4示出了本申请实施例提供的一种编解码系统的网络架构示意图。如图4所示,该网络架构包括一个或多个电子设备13至1N和通信网络01,其中,电子设备13至1N可以通过通信网络01进行视频交互。电子设备在实施的过程中可以为各种类型的具有视频编解码功能的设备,例如,所述电子设备可以包括智能手机、平板电脑、个人计算机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、服务器等,本申请实施例不作具体限定。在这里,本申请实施例所述的解码器或编码器就可以为上述电子设备。Further, the embodiment of the present application also provides a network architecture of a codec system including an encoder and a decoder, wherein FIG4 shows a schematic diagram of a network architecture of a codec system provided by an embodiment of the present application. As shown in FIG4, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. The electronic device can be various types of devices with video codec functions during implementation, for example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensor device, a server, etc., and the embodiment of the present application is not specifically limited. Here, the decoder or encoder described in the embodiment of the present application can be the above-mentioned electronic device.
需要说明的是,本申请实施例的方法主要应用在如图4所示的预测部分和如图3所示的预测部分。也就是说,本申请实施例既可以应用于编码器,也可以应用于解码器,甚至还可以同时应用于编码器和解码器,但是本申请实施例不作具体限定。另外,这里的预测部分可以包括帧内预测部分和帧间预测部分。It should be noted that the method of the embodiment of the present application is mainly applied to the prediction part shown in Figure 4 and the prediction part shown in Figure 3. That is to say, the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited. In addition, the prediction part here can include an intra-frame prediction part and an inter-frame prediction part.
还需要说明的是,在编码端,“当前块”具体是指当前待进行色度预测的编码块;在解码端,“当前块”具体是指当前待进行色度预测的解码块。这里的,当前块可以是一个编码单元(Coding Unit,CU),也可以是一个编码树单元(Coding Tree Unit,CTU),甚至还可以是一个预测单元(Prediction Unit,PU)或者转换单元(Transform Unit,TU),这里不作具体限定。It should also be noted that, at the encoding end, the "current block" specifically refers to the encoding block currently to be subjected to chroma prediction; at the decoding end, the "current block" specifically refers to the decoding block currently to be subjected to chroma prediction. Here, the current block can be a coding unit (Coding Unit, CU), a coding tree unit (Coding Tree Unit, CTU), or even a prediction unit (Prediction Unit, PU) or a transform unit (Transform Unit, TU), which is not specifically limited here.
为便于理解本申请实施例的技术方案,以下对本申请实施例的相关技术进行说明,以下相关技术作为可选方案与本申请实施例的技术方案可以进行任意结合,其均属于本申请实施例的保护范围。To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
1、两步跨分量预测模式1. Two-step cross-component prediction mode
两步跨分量预测模式(TSCPM)是一种分量间预测技术,通过探索不同分量之间的线性关系去除分量间冗余。TSCPM分为两个步骤执行,如图5所示。首先使用当前待编码色度块对应的亮度块(即同位亮度重建块)(Co-located Luma Reconstruction Block)通过参数α和β生成尺寸相同的临时预测块(即中间预测色度块)(Temporary Chroma Prediction Block),再进行下采样,得到色度分量的预测值(即最终的预测色度块)(Final Chroma Prediction Block)。其中,同位亮度重建块可以表示为RL(x,y),中间预测色度块可以表示为P'c(x,y)=α*RL(x,y)+β,最终的预测色度块可以表示为Pc(x,y)。Two-step cross-component prediction mode (TSCPM) is an inter-component prediction technology that removes inter-component redundancy by exploring the linear relationship between different components. TSCPM is performed in two steps, as shown in Figure 5. First, the luma block corresponding to the current chroma block to be encoded (i.e., the co-located luma reconstruction block) is used to generate a temporary prediction block of the same size (i.e., the intermediate predicted chroma block) through parameters α and β, and then down-sampled to obtain the predicted value of the chroma component (i.e., the final predicted chroma block) (Final Chroma Prediction Block). Among them, the co-located luma reconstruction block can be expressed as RL (x, y), the intermediate predicted chroma block can be expressed as P'c (x, y) = α* RL (x, y) + β, and the final predicted chroma block can be expressed as Pc (x, y).
1)线性模型1) Linear Model
在一些实施例中,线性模型参数α和β的数值大致为通过当前编码块上一参考行和左一参考列的重建亮度参考样本和对应的色度参考样本计算得到。具体的推导过程如下所述:In some embodiments, the values of the linear model parameters α and β are calculated by reconstructing the luminance reference sample and the corresponding chrominance reference sample of the previous reference row and the left reference column of the current coding block. The specific derivation process is as follows:
首先根据相邻块像素的可用性分为了3种情况来得到4个可用的像素点对,通过4个可用的像素点对来计算alpha和beta,当得到alpha和beta后,根据亮度和色度之间的线性关系,通过亮度重构像素得到色度预测值。First, according to the availability of adjacent block pixels, we divide them into three cases to get four available pixel pairs. We calculate alpha and beta through the four available pixel pairs. After getting alpha and beta, we reconstruct the pixels with brightness to get the chromaticity prediction value according to the linear relationship between brightness and chromaticity.
在一些实施例中,在选取4对可用像素点时,需要考虑上侧像素和左侧像素的可用性,分为一下3种情况:In some embodiments, when selecting four pairs of available pixels, the availability of upper pixels and left pixels needs to be considered, which is divided into the following three cases:
情况1:如果当前块的正上侧和正左侧像素均“可用”,则2个像素点对从上侧选择,2个像素点对从左侧选择。Case 1: If both the upper and left pixels of the current block are "available", 2 pixel pairs are selected from the upper side and 2 pixel pairs are selected from the left side.
情况2:如果当前块只有上侧可用,则4个像素点对均从正上侧选择,选择的位置宽度为:0/4,1/4,2/4,3/4处。Case 2: If only the upper side of the current block is available, the four pixel pairs are all selected from the upper side, and the selected position widths are: 0/4, 1/4, 2/4, 3/4.
情况3:如果当前块只有左侧像素可用,则4个像素点对均从正左侧选择,选择的位置为高度的:0/4,1/4,2/4,3/4处。Case 3: If only left pixels are available in the current block, the four pixel pairs are all selected from the left side, and the selected positions are: 0/4, 1/4, 2/4, 3/4 of the height.
在一些实施例中,假设待编码色度块的大小为WxH,其宽为W,高为H。定义其上参考行和左参考列分别为row[i](0<=i<=M-1)和col[j](0<=j<=N-1),则相邻参考样本点x[k](0<=k<=4)的选取方式有以下几种情况:In some embodiments, it is assumed that the size of the chrominance block to be encoded is WxH, its width is W, and its height is H. The upper reference row and the left reference column are defined as row[i] (0<=i<=M-1) and col[j] (0<=j<=N-1), respectively. Then, the selection methods of the adjacent reference sample point x[k] (0<=k<=4) are as follows:
情况1:当row[i]和col[j]均“可用”时:Case 1: When both row[i] and col[j] are "available":
●如图6a所示,当W=H时:x[0]=row[0],x[1]=row[W-1],x[3]=col[0],x[4]=col[H-1]; ● As shown in Figure 6a, when W = H: x[0] = row[0], x[1] = row[W-1], x[3] = col[0], x[4] = col[H-1];
●如图6b所示,当W>H时:x[0]=row[0],x[1]=row[W-W/H],x[3]=col[0],x[4]=col[H-1];● As shown in Figure 6b, when W>H: x[0]=row[0], x[1]=row[W-W/H], x[3]=col[0], x[4]=col[H-1];
●如图6c所示,当W<H时:x[0]=row[0],x[1]=row[W-1],x[3]=col[0],x[4]=col[H-H/W]。●As shown in Figure 6c, when W<H: x[0]=row[0], x[1]=row[W-1], x[3]=col[0], x[4]=col[H-H/W].
情况2:如图6d所示,当row[i]“可用”且col[j]“不可用”时:
x[0]=row[0],x[1]=row[W/4],x[3]=row[2×W/4],x[4]=row[3×W/4]。Case 2: As shown in Figure 6d, when row[i] is "available" and col[j] is "unavailable":
x[0]=row[0], x[1]=row[W/4], x[3]=row[2×W/4], x[4]=row[3×W/4].
情况3:如图6e所示,当row[i]“不可用”且col[j]“可用”时:
x[0]=col[0],x[1]=col[H/4],x[3]=col[2×H/4],x[4]=col[3×H/4]。Case 3: As shown in Figure 6e, when row[i] is "unavailable" and col[j] is "available":
x[0]=col[0], x[1]=col[H/4], x[3]=col[2×H/4], x[4]=col[3×H/4].
在一些实施例中,获取4个相邻参考样本点后,通过4次快速比较,获得亮度值较大的两个点和亮度值较小的两个点,并用这两组的均值点进行线性模型参数推导。假设亮度值较大的两个点的均值点的值为xMax,亮度值较小的两个点的均值点的值为xMin,同样的,可以获得对应色度点相应的较大较小的均值点,分别用yMax和yMin表示,则α的值为(yMax-yMin)/(xMax-xMin),M的值为yMin-α*xMin。在实际实现过程中,计算α的值的除法可由查找表法代替以降低实现复杂度,同时添加移位精度值shift以确保计算精度。In some embodiments, after acquiring four adjacent reference sample points, four quick comparisons are performed to obtain two points with larger brightness values and two points with smaller brightness values, and the mean points of these two groups are used to derive the linear model parameters. Assuming that the mean point value of the two points with larger brightness values is xMax, and the mean point value of the two points with smaller brightness values is xMin, similarly, the corresponding larger and smaller mean points of the corresponding chromaticity points can be obtained, represented by yMax and yMin respectively, then the value of α is (yMax-yMin)/(xMax-xMin), and the value of M is yMin-α*xMin. In the actual implementation process, the division method for calculating the value of α can be replaced by a lookup table method to reduce the implementation complexity, and a shift precision value shift is added to ensure the calculation accuracy.
在一些实施例中,当row[i]和col[j]都“不可用”时,则使用默认值,其中α的默认值为0、β的默认值为1<<(BitDepth-1),BitDepth表示样本的比特深度值。In some embodiments, when both row[i] and col[j] are "unavailable", the default values are used, where the default value of α is 0 and the default value of β is 1<<(BitDepth-1), where BitDepth represents the bit depth value of the sample.
在一些实施例中,根据线性模型参数α和β,以及对应位置的亮度重构像素值,可以计算得到与对应亮度块相同大小的中间预测像素块,计算过程可以通过公式(1)示出:
Pc′(x,y)=α×RL(x,y)+β (1)In some embodiments, according to the linear model parameters α and β, and the brightness reconstruction pixel value at the corresponding position, an intermediate prediction pixel block of the same size as the corresponding brightness block can be calculated. The calculation process can be shown by formula (1):
P c ′(x,y)=α×R L (x,y)+β (1)
在公式(1)中,(x,y)表示待编码色度块的像素点的坐标位置,RL(x,y)表示待编码色度块对应的同位亮度块中坐标位置为(x,y)的亮度重构像素值,Pc′(x,y)表示中间预测块的像素值。In formula (1), (x, y) represents the coordinate position of the pixel point of the chrominance block to be encoded, RL (x, y) represents the luminance reconstructed pixel value with the coordinate position (x, y) in the co-located luminance block corresponding to the chrominance block to be encoded, and Pc ′(x, y) represents the pixel value of the intermediate prediction block.
在一些实施例中,对中间预测像素值进行下采样,默认使用六抽头滤波器[1 2 1;1 2 1]进行下采样,得到最终的待编码色度块的预测像素值,计算过程可以通过公式(2)示出:
Pc(x,y)=(2×P′c(2x,2y)+2×P′c(2x,2y+1)+P′c(2x-1,2y)+P′c(2x+1,2y)+
P′c(2x-1,2y+1)+P′c(2x+1,2y-1)+4)>>3 (2)In some embodiments, the intermediate predicted pixel value is downsampled, and a six-tap filter [1 2 1; 1 2 1] is used by default to downsample to obtain the predicted pixel value of the final chrominance block to be encoded. The calculation process can be shown by formula (2):
P c (x,y)=(2×P′ c (2x,2y)+2×P′ c (2x,2y+1)+P′ c (2x-1,2y)+P′ c (2x+1,2y)+
P′ c (2x-1,2y+1)+P′ c (2x+1,2y-1)+4)>>3 (2)
在公式(2)中,Pc(x,y)为待编码色度块的预测像素值。In formula (2), P c (x, y) is the predicted pixel value of the chrominance block to be encoded.
2)非线性模型2) Nonlinear Model
在一些实施例中,非线性的跨分量模型构建过程可以包括以下步骤:In some embodiments, the nonlinear cross-component model building process may include the following steps:
步骤一、对当前块的亮度(同位亮度块)以及邻近模板区域进行下采样得到下采样亮度样点。Step 1: downsample the brightness of the current block (co-located brightness block) and the adjacent template area to obtain downsampled brightness samples.
在一些实施例中,本申请中以4:2:0的采样格式为例进行说明,则下文中下采样通常指宽和高各除以2得到下采样亮度样点。In some embodiments, the present application takes the sampling format of 4:2:0 as an example for explanation, and downsampling in the following generally refers to dividing the width and height by 2 to obtain downsampled brightness samples.
步骤二、根据邻近模板,构建亮度(Y)和色度(U/V)的跨分量预测模型。Step 2: Based on the neighboring templates, a cross-component prediction model of luminance (Y) and chrominance (U/V) is constructed.
在一些实施例中,邻近块的模板选取方式图7所示,以当前色度块(图7中以白色区域示出)为基准:选取当前块的左上方(即A区)、上方(即B区)、右上方(即C区)、左方(即D区)、左下方(即E区)构建模板。其中,C区的宽度等于当前块的宽度(即W),E区的高度等于当前块的高度(即H);模板宽度θ这里固定设置为6,具体会根据邻近样点可用性进行自适应调整;当C区(E区)右下角未重建或者超出图像边界,则C区(E区)不可用。In some embodiments, the template selection method of the neighboring block is shown in FIG7 , and the current chrominance block (shown as a white area in FIG7 ) is used as a reference: the upper left (i.e., area A), upper (i.e., area B), upper right (i.e., area C), left (i.e., area D), and lower left (i.e., area E) of the current block are selected to construct a template. Among them, the width of area C is equal to the width of the current block (i.e., W), and the height of area E is equal to the height of the current block (i.e., H); the template width θ is fixedly set to 6 here, and will be adaptively adjusted according to the availability of neighboring samples; when the lower right corner of area C (area E) is not reconstructed or exceeds the image boundary, area C (area E) is unavailable.
在一些实施例中,如图8所示,跨分量非线性预测模型的模型共选取了当前色度块的目标色度样点(即C)、下采样亮度图像中关联位置C以及其周围的下采样亮度样点,周围的下采样亮度样点包括:关联位置C的上方的样点(即N)、关联位置C的下方的样点(即S)、关联位置C的左方的样点(即W)和关联位置C的右方的样点(即E)。In some embodiments, as shown in Figure 8, the model of the cross-component nonlinear prediction model selects the target chrominance sample (i.e., C) of the current chrominance block, the associated position C in the downsampled luminance image, and the downsampled luminance samples around it, and the surrounding downsampled luminance samples include: the sample above the associated position C (i.e., N), the sample below the associated position C (i.e., S), the sample to the left of the associated position C (i.e., W), and the sample to the right of the associated position C (i.e., E).
在一些实施例中,为了降低模板计算的复杂度,仅选用模板区域部分样点进行跨分量非线性预测模型的计算。具体得,仅选取模板区域中水平坐标和竖直坐标满足以下约束的样点,即水平坐标和竖直坐标均不是奇数的样点。上述过程可以表示为:!(x%2==1&&y%2==1)。In some embodiments, in order to reduce the complexity of template calculation, only some sample points in the template area are selected for calculation of the cross-component nonlinear prediction model. Specifically, only sample points whose horizontal coordinates and vertical coordinates in the template area meet the following constraints are selected, that is, sample points whose horizontal coordinates and vertical coordinates are not odd numbers. The above process can be expressed as:! (x%2==1&&y%2==1).
在一些实施例中,构建多个等式求解线性方程组,即可得到跨分量非线性预测模型的模型参数。其中,模型求解采用LDL求解方法,整个过程采用了整数化的计算过程。In some embodiments, multiple equations are constructed to solve the linear equations to obtain the model parameters of the cross-component nonlinear prediction model. The model is solved using the LDL solution method, and the entire process uses an integer calculation process.
步骤三、基于跨分量模型,输入步骤一中的当前块对应的下采样亮度样点得到色度(U/V)色度的预测值。Step 3: Based on the cross-component model, the downsampled luminance samples corresponding to the current block in step 1 are input to obtain the predicted value of chrominance (U/V).
2、帧内块复制预测技术(Intra Block Copy,IBC)2. Intra Block Copy (IBC)
在一些实施例中,对于文字、图形等屏幕内容序列,同一帧中存在很多重复纹理,即具有较强的空间相关性。如果在编码当前块时,能够参考当前帧已编码完的块,则能大大提升编码效针对屏幕图像空间相关性强的特点。这种参考当前帧的已编码的块,并用于当前块预测值的技术,即被称为IBC技术。IBC和帧间图像预测类似,只不过IBC的预测块是由当前编码图像帧的重建块产生的。如图9所示, 在编码树单元(Coding Tree Unit,CTU)中,右下方的白色块为当前编码单元(Coding Unit,CU),左上方已编码的白色块为预测块(Predictor Block,PB)。当前CU和预测块相似,若此时在编码端通过搜索方法找到左上方白色块位置,仅需要传输两个块的位置矢量(Block Vector,BV)(即参考运动矢量),解码端可以通过这一信息在获得更加准确的预测值。与普通的帧内预测方式相比,IBC可以更好的利用帧内的冗余信息,从而获得编码性能提升。In some embodiments, for screen content sequences such as text and graphics, there are many repeated textures in the same frame, that is, there is a strong spatial correlation. If the encoded block of the current frame can be referenced when encoding the current block, the encoding efficiency can be greatly improved in view of the strong spatial correlation of the screen image. This technology of referring to the encoded block of the current frame and using it for the prediction value of the current block is called IBC technology. IBC is similar to inter-frame image prediction, except that the prediction block of IBC is generated by the reconstructed block of the current encoded image frame. As shown in Figure 9, In the Coding Tree Unit (CTU), the white block on the lower right is the current Coding Unit (CU), and the coded white block on the upper left is the Predictor Block (PB). The current CU is similar to the prediction block. If the position of the upper left white block is found by searching at the encoder, only the position vectors (Block Vector, BV) of the two blocks (i.e., reference motion vectors) need to be transmitted. The decoder can obtain a more accurate prediction value through this information. Compared with the ordinary intra-frame prediction method, IBC can make better use of the redundant information within the frame, thereby improving the coding performance.
在一些实施例中,通过哈希(Hash)搜索,或最大64*64范围内的全搜索找到与当前块匹配的参考(Candidate)。In some embodiments, a reference (Candidate) matching the current block is found through a hash search or a full search within a maximum range of 64*64.
在一些实施例中,Hash搜索范围被限制在当前CTU及当前CTU左边n个CTU范围内,n根据CTU大小变化。若CTU size为128*128,则n为1。In some embodiments, the hash search range is limited to the current CTU and the n CTUs to the left of the current CTU, where n varies according to the CTU size. If the CTU size is 128*128, then n is 1.
在一些实施例中,码流中最大允许的IBC size为64*64,但编码端目前仅对16*16或以下的块进行搜索以加速。In some embodiments, the maximum allowed IBC size in the bitstream is 64*64, but the encoder currently only searches for blocks of 16*16 or less for acceleration.
在一些实施例中,bv以整像素精度传输,无bvp的预测。In some embodiments, bv is transmitted with integer pixel precision, without prediction of bvp.
在一些实施例中,IBC模式仅支持2N*2N的PB,但TB size可以N*N或2N*2N。In some embodiments, the IBC mode only supports PB of 2N*2N, but the TB size can be N*N or 2N*2N.
在一些实施例中,因AVS3中chroma不允许出现2*N的块,因此在某些小块Luma块与Chroma块划分不同。若出现这种划分不一致的情况,Chroma块一致限制为intra mode。In some embodiments, because 2*N blocks are not allowed in AVS3, the Luma block and Chroma block are divided differently in some small blocks. If such division inconsistency occurs, the Chroma block is consistently restricted to intra mode.
在一些实施例中,若bv为奇数,则对于420yuv,chroma像素需要插值,采用1:1的2tap插值。In some embodiments, if bv is an odd number, then for 420yuv, chroma pixels need to be interpolated, using 1:1 2tap interpolation.
3、色度块复制帧内预测模式3. Chroma block copy intra prediction mode
在一些实施例中,色度块复制帧内预测模式是一种色度帧内预测模式,AVS中允许使用local dual tree的块划分结构,该结构允许亮度块和色度块具有不一样的划分结构。目前亮度块和色度块的最小长度或宽度至少为4个像素,编码单元在进行块划分时,如果划分后的块大小小于最小值,则不会执行划分,因此可能会出现色度块已经停止划分而亮度块继续划分的情况。在这种块划分结构下,亮度块和色度块将分别进行编码。这种情况下的色度块被限制为只能使用帧内预测模式。为解决IBC技术不能用于特定色度块这一问题,一种专门用于色度的IBC预测方案被提出,该方案下色度块能够直接使用亮度同位块的块矢量或串矢量进行运动补偿,不需要进行额外的运动估计,通过复制块运动矢量指向的色度重构值得到最终色度预测值。In some embodiments, the chroma block copy intra prediction mode is a chroma intra prediction mode. AVS allows the use of a block partitioning structure of a local dual tree, which allows the luminance block and the chroma block to have different partitioning structures. Currently, the minimum length or width of the luminance block and the chroma block is at least 4 pixels. When the coding unit performs block partitioning, if the block size after the partition is less than the minimum value, the partitioning will not be performed. Therefore, it may occur that the chroma block has stopped partitioning while the luminance block continues to be partitioned. Under this block partitioning structure, the luminance block and the chroma block will be encoded separately. In this case, the chroma block is restricted to using only the intra prediction mode. In order to solve the problem that the IBC technology cannot be used for specific chroma blocks, an IBC prediction scheme specifically for chroma is proposed. Under this scheme, the chroma block can directly use the block vector or string vector of the luminance co-located block for motion compensation, without the need for additional motion estimation, and the final chroma prediction value is obtained by copying the chroma reconstruction value pointed to by the block motion vector.
在一些实施例中,色度块复制帧内预测模式的流程包括以下步骤:In some embodiments, the process of chroma block copy intra prediction mode includes the following steps:
步骤一、如图10所示,如果色度块的CU对应的亮度同位块上的位于{C,TL,TR,BL,BR}位置的亮度样点为块复制帧内预测模式或串复制帧内预测的普通串子模式,则当前块能够使用色度块复制模式,其中C表示中间位置,TL表示左上位置,TR表示右上位置,BL表示坐下位置,BR表示右下位置。Step 1, as shown in Figure 10, if the luminance sample located at the position {C, TL, TR, BL, BR} on the luminance co-located block corresponding to the CU of the chrominance block is a block copy intra-frame prediction mode or a normal string sub-mode of string copy intra-frame prediction, then the current block can use the chrominance block copy mode, where C represents the middle position, TL represents the upper left position, TR represents the upper right position, BL represents the lower position, and BR represents the lower right position.
步骤二、如果亮度样点具有可用的位移矢量,则色度块使用该位移矢量进行运动补偿。Step 2: If the luma sample has an available displacement vector, the chroma block uses the displacement vector for motion compensation.
步骤三、否则,如果默认的位移矢量{(-w,0),(0,-h)}中存在至少一个可用的位移矢量,使用其中第一个可用的位移矢量进行运动补偿。Step 3: Otherwise, if there is at least one available displacement vector among the default displacement vectors {(-w, 0), (0, -h)}, use the first available displacement vector for motion compensation.
步骤四、否则,如果不存在可用的位移矢量,否则当前色度块所有样点的预测值设置为2BitDepth-1,其中BitDepth是编码样本精度。Step 4: Otherwise, if there is no available displacement vector, the prediction values of all samples of the current chroma block are set to 2 BitDepth-1 , where BitDepth is the coding sample precision.
步骤五、该色度块在码流中编码一个标志cibc_flag指示是否使用色度块复制帧内预测模式。Step 5: The chroma block encodes a flag cibc_flag in the bitstream to indicate whether to use the chroma block copy intra prediction mode.
现有技术中,TSCPM技术在进行跨分量线性模型推导的时候,仅使用当前块相邻一行一列的重构像素作为模型推导信源,不能够灵活应对各种复杂的编码场景。这样,导致目前的TSCPM不能灵活应对更多的复杂的编解码场景,从而降低了对色度块的编解码效率。In the prior art, when the TSCPM technology is performing cross-component linear model derivation, only the reconstructed pixels in one row and one column adjacent to the current block are used as the model derivation information source, which cannot flexibly cope with various complex encoding scenarios. As a result, the current TSCPM cannot flexibly cope with more complex encoding and decoding scenarios, thereby reducing the encoding and decoding efficiency of the chrominance block.
基于此,本申请实施例提供了一种编解码方法、码流、编码器、解码器以及存储介质,在解码端,解析码流,确定第一语法标识信息;在第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值;根据预测色度块的预测色度值,确定当前色度块的重建色度值。在编码端,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值,并根据预测色度值,确定第一语法标识信息;其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;根据预测色度块的预测色度值,确定当前色度块的重建色度值。由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编解码场景,从而提高了对当前色度块的编解码效率。 Based on this, an embodiment of the present application provides a coding and decoding method, a bit stream, an encoder, a decoder and a storage medium. At the decoding end, the bit stream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; according to the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined. At the encoding end, a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined. Since the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
下面将结合附图对本申请各实施例进行详细说明。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
图11为本申请实施例提供的一种可选的解码方法的流程示意图,如图11所示,该方法可以包括S301至S305:FIG. 11 is a schematic flow chart of an optional decoding method provided in an embodiment of the present application. As shown in FIG. 11 , the method may include S301 to S305:
S301、解析码流,确定第一语法标识信息。S301: parse a bitstream to determine first syntax identification information.
需要说明的是,本申请实施例的解码方法应用于解码器。另外,该解码方法具体可以是指一种色度预测方法。其中,在色度预测模式中,这里主要是针对一种色度的预测模式的技术改进,更具体地,可以是为预测模式中的基于色度帧内块复制技术的跨分量预测模式,以避免相关技术中TSCPM不能灵活应对更多的复杂的编解码场景,从而降低了对色度块的编解码效率的问题。It should be noted that the decoding method of the embodiment of the present application is applied to a decoder. In addition, the decoding method may specifically refer to a chrominance prediction method. Among them, in the chrominance prediction mode, this is mainly a technical improvement for a chrominance prediction mode, more specifically, it may be a cross-component prediction mode based on chrominance intra-frame block copy technology in the prediction mode, so as to avoid the problem that TSCPM in the related art cannot flexibly cope with more complex encoding and decoding scenarios, thereby reducing the encoding and decoding efficiency of the chrominance block.
在本申请实施例中,解码器通过解析码流,确定第一语法标识信息。其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式。In the embodiment of the present application, the decoder determines the first syntax identification information by parsing the bitstream, wherein the first syntax identification information is used to indicate whether the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology.
在本申请实施例中,S301中解析码流,确定第一语法标识信息之前的实现可以包括以下两种情况:In the embodiment of the present application, the implementation of parsing the bitstream in S301 and determining the first syntax identification information may include the following two situations:
情况1:在本申请的一些实施例中,S301之前的实现可以包括:解析码流,确定第二语法标识信息;Case 1: In some embodiments of the present application, the implementation before S301 may include: parsing the code stream to determine the second syntax identification information;
在第二语法标识信息指示当前色度块不采用色度帧内块复制预测模式的情况下,执行解析码流,得到第一语法标识信息的步骤。When the second syntax identification information indicates that the current chroma block does not adopt the chroma intra block copy prediction mode, the step of parsing the code stream to obtain the first syntax identification information is performed.
在本申请的一些实施例中,解析码流,确定第二语法标识信息的实现,可以包括:In some embodiments of the present application, parsing the code stream and determining the implementation of the second syntax identification information may include:
若第二语法标识信息的取值为第一值,则确定当前色度块采用色度帧内块复制预测模式;或者,If the value of the second syntax identification information is the first value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode; or,
若第二语法标识信息的取值为第二值,则确定当前色度块不采用色度帧内块复制预测模式。If the value of the second syntax identification information is the second value, it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode.
示例性的,第二语法标识信息可以表示为cibc_flag。Exemplarily, the second syntax identification information may be represented as cibc_flag.
需要说明的是,在本申请实施例中,第一值与第二值不同,而且第一值和第二值可以是参数形式,也可以是数字形式。具体地,第二语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form. Specifically, the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第一值和第二值而言,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为true,第二值可以设置为false;或者,第一值可以设置为false,第二值可以设置为true;但是这里并不作具体限定。Exemplarily, for the first value and the second value, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.
在本申请实施例中,以写入码流中的flag为例,假设第一值设置为1(true),第二值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定当前色度块采用色度帧内块复制预测模式,即无需执行本申请实施例所述的解码方法;如果第二语法标识信息的取值为1(true),那么可以确定当前色度块不采用色度帧内块复制预测模式,即可能需要执行本申请实施例所述的解码方法。In the embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the first value is set to 1 (true) and the second value is set to 0 (false), if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, that is, there is no need to execute the decoding method described in the embodiment of the present application; if the value of the second syntax identification information is 1 (true), then it can be determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode, that is, it may be necessary to execute the decoding method described in the embodiment of the present application.
可以理解的是,在第二语法标识信息的取值为第一值的情况下,确定当前色度块采用色度帧内块复制预测模式,通过帧内块复制来减少冗余信息,从而达到压缩效果。在第二语法标识信息的取值为第二值的情况下,确定当前色度块不采用色度帧内块复制预测模式,可以避免或限制色度帧内块复制的使用,可以提高解码的稳定性或避免一些特定情况下的性能问题。It can be understood that, when the value of the second syntax identification information is the first value, it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, and redundant information is reduced by intra-frame block copying, thereby achieving a compression effect. When the value of the second syntax identification information is the second value, it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode, which can avoid or limit the use of chroma intra-frame block copying, improve decoding stability, or avoid performance problems in some specific situations.
在本申请的一些实施例中,针对情况1,S301中解析码流,确定第一语法标识信息的实现可以包括:In some embodiments of the present application, for situation 1, the implementation of parsing the code stream in S301 and determining the first syntax identification information may include:
若第一语法标识信息的取值为第三值,则确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式;或者,If the value of the first syntax identification information is the third value, it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology; or,
若第一语法标识信息的取值为第四值,则确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式。If the value of the first syntax identification information is the fourth value, it is determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology.
示例性的,第一语法标识信息可以表示为tcibc_flag。Exemplarily, the first syntax identification information may be represented as tcibc_flag.
需要说明的是,在本申请实施例中,第三值与第四值不同,而且第三值和第四值可以是参数形式,也可以是数字形式。具体地,第一语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the third value is different from the fourth value, and the third value and the fourth value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第三值和第四值而言,第三值可以设置为1,第四值可以设置为0;或者,第三值可以设置为0,第四值可以设置为1;或者,第三值可以设置为true,第四值可以设置为false;或者,第三值可以设置为false,第四值可以设置为true;但是这里并不作具体限定。Exemplarily, for the third value and the fourth value, the third value can be set to 1 and the fourth value can be set to 0; or, the third value can be set to 0 and the fourth value can be set to 1; or, the third value can be set to true and the fourth value can be set to false; or, the third value can be set to false and the fourth value can be set to true; but this is not specifically limited here.
在本申请实施例中,以写入码流中的flag为例,假设第三值设置为1(true),第四值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式,即无需执行本申请实施例所述的解码方法;如果第一语法标识信息的取值为1(true),那么可以确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式,即需要执行本申请实施例所述的解码方法。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the third value is set to 1 (true) and the fourth value is set to 0 (false), if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra-frame block copy technology, that is, there is no need to execute the decoding method described in the embodiment of the present application; if the value of the first syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, that is, it is necessary to execute the decoding method described in the embodiment of the present application.
在本申请实施例中,第一语法标识信息起着开关的作用,即当第一语法标识信息为第一值(比如1 或真)时,表示不启动本申请实施例所述的解码算法,即不执行本申请实施例所述的解码算法;当第一语法标识信息为第二值(比如0或假)时,表示启动本申请实施例所述的解码算法,即执行本申请实施例所述的解码算法。In the embodiment of the present application, the first syntax identification information plays the role of a switch, that is, when the first syntax identification information is the first value (for example, 1 or true), it indicates that the decoding algorithm described in the embodiment of the present application is not started, that is, the decoding algorithm described in the embodiment of the present application is not executed; when the first syntax identification information is a second value (such as 0 or false), it indicates that the decoding algorithm described in the embodiment of the present application is started, that is, the decoding algorithm described in the embodiment of the present application is executed.
情况2:S301之前的实现可以包括:解析码流,确定第三语法标识信息;Case 2: The implementation before S301 may include: parsing the code stream to determine the third syntax identification information;
在第三语法标识信息指示当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,执行解析码流,得到第一语法标识信息的步骤。When the third syntax identification information indicates that the current chroma block adopts the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology, the step of parsing the code stream to obtain the first syntax identification information is performed.
在本申请的一些实施例中,解析码流,确定第三语法标识信息可以包括:In some embodiments of the present application, parsing the code stream and determining the third syntax identification information may include:
若第三语法标识信息的取值为第五值,则确定当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式;或者,If the value of the third syntax identification information is the fifth value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology; or,
若第三语法标识信息的取值为第六值,则确定当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式。If the value of the third syntax identification information is the sixth value, it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology.
示例性的,第三语法标识信息可以表示为cibc_flag。Exemplarily, the third syntax identification information may be represented as cibc_flag.
需要说明的是,在本申请实施例中,第五值与第六值不同,而且第五值和第六值可以是参数形式,也可以是数字形式。具体地,第二语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the fifth value is different from the sixth value, and the fifth value and the sixth value can be in parameter form or in digital form. Specifically, the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第五值和第六值而言,第五值可以设置为1,第六值可以设置为0;或者,第五值可以设置为0,第六值可以设置为1;或者,第五值可以设置为true,第六值可以设置为false;或者,第五值可以设置为false,第六值可以设置为true;但是这里并不作具体限定。Exemplarily, for the fifth value and the sixth value, the fifth value can be set to 1 and the sixth value can be set to 0; or, the fifth value can be set to 0 and the sixth value can be set to 1; or, the fifth value can be set to true and the sixth value can be set to false; or, the fifth value can be set to false and the sixth value can be set to true; but no specific limitation is made here.
在本申请实施例中,以写入码流中的flag为例,假设第五值设置为1(true),第六值设置为0(false),这时候如果第三语法标识信息的取值为0(false),那么可以确定当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式,即无需执行本申请实施例所述的解码方法;如果第二语法标识信息的取值为1(true),那么可以确定当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式,即可能需要执行本申请实施例所述的解码方法。In the embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the fifth value is set to 1 (true) and the sixth value is set to 0 (false), if the value of the third syntax identification information is 0 (false), then it can be determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, that is, there is no need to execute the decoding method described in the embodiment of the present application; if the value of the second syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, that is, it may be necessary to execute the decoding method described in the embodiment of the present application.
在本申请的一些实施例中,针对情况2,S301中解析码流,确定第一语法标识信息的实现可以包括:In some embodiments of the present application, for situation 2, the implementation of parsing the code stream in S301 and determining the first syntax identification information may include:
若所述第一语法标识信息的取值为第七值,则确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式;或者,If the value of the first syntax identification information is the seventh value, it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology; or
若所述第一语法标识信息的取值为第八值,则确定所述当前色度块采用色度帧内块复制预测模式。If the value of the first syntax identification information is the eighth value, it is determined that the current chroma block adopts the chroma intra block copy prediction mode.
示例性的,第一语法标识信息可以表示为tcibc_flag。Exemplarily, the first syntax identification information may be represented as tcibc_flag.
需要说明的是,在本申请实施例中,第七值与第八值不同,而且第七值和第八值可以是参数形式,也可以是数字形式。具体地,第一语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the seventh value is different from the eighth value, and the seventh value and the eighth value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第七值和第八值而言,第七值可以设置为1,第八值可以设置为0;或者,第七值可以设置为0,第八值可以设置为1;或者,第七值可以设置为true,第八值可以设置为false;或者,第七值可以设置为false,第八值可以设置为true;但是这里并不作具体限定。Exemplarily, for the seventh value and the eighth value, the seventh value can be set to 1 and the eighth value can be set to 0; or, the seventh value can be set to 0 and the eighth value can be set to 1; or, the seventh value can be set to true and the eighth value can be set to false; or, the seventh value can be set to false and the eighth value can be set to true; but no specific limitation is made here.
在本申请实施例中,以写入码流中的flag为例,假设第七值设置为1(true),第八值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定所述当前色度块采用色度帧内块复制预测模式,即无需执行本申请实施例所述的解码方法;如果第一语法标识信息的取值为1(true),那么可以确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式,即需要执行本申请实施例所述的解码方法。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the seventh value is set to 1 (true) and the eighth value is set to 0 (false), if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, that is, there is no need to execute the decoding method described in the embodiment of the present application; if the value of the first syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, that is, it is necessary to execute the decoding method described in the embodiment of the present application.
在本申请实施例中,第一语法标识信息起着开关的作用,即当第一语法标识信息为第一值(比如1或真)时,表示不启动本申请实施例所述的解码算法,即不执行本申请实施例所述的解码算法;当第一语法标识信息为第二值(比如0或假)时,表示启动本申请实施例所述的解码算法,即执行本申请实施例所述的解码算法。In the embodiment of the present application, the first grammar identification information acts as a switch, that is, when the first grammar identification information is a first value (such as 1 or true), it indicates that the decoding algorithm described in the embodiment of the present application is not started, that is, the decoding algorithm described in the embodiment of the present application is not executed; when the first grammar identification information is a second value (such as 0 or false), it indicates that the decoding algorithm described in the embodiment of the present application is started, that is, the decoding algorithm described in the embodiment of the present application is executed.
需要说明的是,上述的第一值、第二值、第三值、第四值、第五值、第六值、第七值和第八值,可以采用相同的表示形式(即参数形式或数字形式)。示例性的,第一值、第三值、第五值和第七值可以取1或True,第二值、第四值、第六值和第八值可以取0或False。It should be noted that the first value, the second value, the third value, the fourth value, the fifth value, the sixth value, the seventh value and the eighth value may be expressed in the same form (i.e., parameter form or digital form). For example, the first value, the third value, the fifth value and the seventh value may be 1 or True, and the second value, the fourth value, the sixth value and the eighth value may be 0 or False.
S302、在第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据当前色度块对应的当前同位亮度块,确定参考运动矢量。S302: When the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on the chroma intra block copy technology, determine a reference motion vector according to a current co-located luminance block corresponding to the current chroma block.
在本申请实施例中,当前色度块也成为当前块、当前待解码块、当前待解码色度块、待解码块、待解码色度块等,本申请实施例对此不作任何限定。In the embodiment of the present application, the current chroma block is also called the current block, the current block to be decoded, the current chroma block to be decoded, the block to be decoded, the chroma block to be decoded, etc., and the embodiment of the present application does not impose any limitation on this.
在本申请实施例中,在第一语法标识信息的取值为1或True的情况下,确定当前色度块采用基于 色度帧内块复制技术的跨分量预测模式。In the embodiment of the present application, when the value of the first syntax identification information is 1 or True, it is determined that the current chrominance block adopts the Cross-component prediction mode for chroma intra block copy technique.
在本申请实施例中,同位亮度块是指与当前色度块对应的亮度块。示例性的,在YCbCr颜色空间中,对于每个色度块(Cb或Cr块),存在一个相同位置或相对位置的亮度块,这个亮度块被称为同位亮度块。In the embodiment of the present application, the co-located luminance block refers to a luminance block corresponding to the current chrominance block. For example, in the YCbCr color space, for each chrominance block (Cb or Cr block), there is a luminance block in the same position or relative position, and this luminance block is called the co-located luminance block.
在本申请实施例中,色度块和亮度块之间存在一种同位关系。示例性的,在YCbCr颜色空间中,图像被分为亮度分量(Y)和两个色度分量(Cb、Cr),亮度分量(Y)包含图像的黑白信息,而色度分量(Cb、Cr)包含颜色信息,色度分量的采样率通常比亮度分量低,这意味着对于每个亮度块,可能对应多个色度块。对于每个色度块,存在一个同位的亮度块,这意味着它们在图像中具有相同的位置或者一定的相对位置关系。通常,亮度块的大小比色度块的大小大,例如,一个亮度块可能对应一个4x4或8x8的像素块,而色度块可能对应较小的2x2或4x4的像素块。In an embodiment of the present application, there is a co-location relationship between the chrominance block and the brightness block. Exemplarily, in the YCbCr color space, the image is divided into a brightness component (Y) and two chrominance components (Cb, Cr). The brightness component (Y) contains the black and white information of the image, while the chrominance components (Cb, Cr) contain color information. The sampling rate of the chrominance component is usually lower than that of the brightness component, which means that for each brightness block, there may be multiple chrominance blocks. For each chrominance block, there is a co-location brightness block, which means that they have the same position or a certain relative position relationship in the image. Usually, the size of the brightness block is larger than the size of the chrominance block. For example, a brightness block may correspond to a 4x4 or 8x8 pixel block, while the chrominance block may correspond to a smaller 2x2 or 4x4 pixel block.
在本申请实施例中,参考运动矢量是用于预测当前图像块的运动信息。通常情况下,当前色度块对应的当前同位亮度块具有相同的运动矢量。将获取的运动矢量应用于当前色度块,以预测当前色度块的位置。这个预测过程有助于减小运动引起的残差,提高解码效率。In the embodiment of the present application, the reference motion vector is used to predict the motion information of the current image block. Generally, the current co-located luminance block corresponding to the current chrominance block has the same motion vector. The obtained motion vector is applied to the current chrominance block to predict the position of the current chrominance block. This prediction process helps to reduce the residual caused by motion and improve decoding efficiency.
S303、在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型。S303: When the reference motion vector is valid, determine a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector.
在本申请实施例中,如图12a所示,其示出了针对亮度通道(Luma Channel)下的当前色度块(Current Block)对应的同位亮度块(Col-Luma),参考运动矢量对应的参考亮度块(Ref Luma)。如图12b所示,其示出了针对色度通道(Chroma Channel)下的当前色度块,参考运动矢量对应的参考色度块(Ref Chroma)。In the embodiment of the present application, as shown in FIG12a, it shows the reference luminance block (Ref Luma) corresponding to the reference motion vector for the collocated luminance block (Col-Luma) corresponding to the current chrominance block (Current Block) under the luminance channel (Luma Channel). As shown in FIG12b, it shows the reference chrominance block (Ref Chroma) corresponding to the reference motion vector for the current chrominance block under the chrominance channel (Chroma Channel).
在本申请实施例中,判断参考运动矢量是否有效可以从以下几个方面进行考量:In the embodiment of the present application, whether the reference motion vector is valid can be determined from the following aspects:
1)、参考运动矢量的范围:1) Range of reference motion vector:
在本申请实施例中,参考运动矢量是以像素为单位的整数值。例如,H.264标准规定的运动矢量范围为特定的像素数,通常是在水平和垂直方向上都有上下限。在解码端,需要检查解码得到的运动矢量是否在规定的范围内。如果运动矢量的值超出了规定范围,可能表明参考运动矢量无效。In the embodiment of the present application, the reference motion vector is an integer value in pixels. For example, the range of motion vectors specified by the H.264 standard is a specific number of pixels, usually with upper and lower limits in the horizontal and vertical directions. At the decoding end, it is necessary to check whether the decoded motion vector is within the specified range. If the value of the motion vector exceeds the specified range, it may indicate that the reference motion vector is invalid.
2)、参考运动矢量的标志位:2) Reference motion vector flag:
在本申请实施例中,在码流中,可能有一个标志位或特殊的标记,用于指示当前块的运动矢量是否有效。这个标志位通常包含在块的头部信息中。在解码端,解码器会检查这个标志位,如果标志位指示运动矢量无效,那么解码器就不会使用该矢量进行运动补偿。In the embodiment of the present application, there may be a flag or a special mark in the bitstream to indicate whether the motion vector of the current block is valid. This flag is usually included in the header information of the block. At the decoding end, the decoder will check this flag. If the flag indicates that the motion vector is invalid, the decoder will not use the vector for motion compensation.
3)、参考运动矢量对应的参考帧的可用性:3) Availability of the reference frame corresponding to the reference motion vector:
运动矢量通常是相对于参考帧的。在解码端,需要确保参考运动矢量对应的参考帧是可用的,即已经解码或者已经在缓存中。如果参考帧不可用,运动矢量就不能被正确地应用于当前帧。如果参考帧不可用,解码器可能需要采取一些错误处理策略,例如跳过当前块的运动补偿或使用其他策略进行帧内预测。Motion vectors are usually relative to a reference frame. At the decoding end, it is necessary to ensure that the reference frame corresponding to the reference motion vector is available, that is, it has been decoded or is already in the cache. If the reference frame is not available, the motion vector cannot be correctly applied to the current frame. If the reference frame is not available, the decoder may need to adopt some error handling strategies, such as skipping motion compensation for the current block or using other strategies for intra-frame prediction.
在本申请的一些实施例中,这里的无效(不可用)具体可以指:In some embodiments of the present application, the invalidity (unavailable) here may specifically refer to:
1)、未重建,即参考亮度块和参考色度块(也可指前文提到的当前色度块的模板区域)未重建,但通常情况下,当前色度块的上方和左方的区域(即模板区域),或者参考亮度块和参考色度块都已重建完成;1) Not reconstructed, that is, the reference luminance block and the reference chrominance block (also referred to as the template area of the current chrominance block mentioned above) are not reconstructed, but usually, the area above and to the left of the current chrominance block (i.e., the template area), or the reference luminance block and the reference chrominance block have been reconstructed;
2)、越界,即原始图像不存在或硬件设备上超出可以获取像素点的范围;2) Out of bounds, that is, the original image does not exist or the hardware device exceeds the range of pixels that can be obtained;
3)、不满足条件设定,一般情况下,一些特定设计的模式只允许当前块使用左方模板中的像素或者允许只允许当前块使用上方模板中的像素。3) The condition setting is not met. Generally, some specially designed modes only allow the current block to use the pixels in the left template or only allow the current block to use the pixels in the upper template.
可以理解的是,上述的判断参考运动矢量是否有效的影响因素仅为一种示例,在实际应用场景中还可以包括其他影响因素,本申请实施例对此不作任何限定。It can be understood that the above-mentioned influencing factors for determining whether the reference motion vector is valid are only examples, and other influencing factors may also be included in actual application scenarios, and the embodiments of the present application do not impose any limitation on this.
在本申请的一些实施例中,在参考运动矢量满足参考运动矢量对应的参考亮度块或参考色度块未重建完成、参考运动矢量对应的参考亮度块或参考色度块的预测模式不匹配,以及参考运动矢量越界中至少一项的情况下,确定参考运动矢量为无效;或者,In some embodiments of the present application, when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds, the reference motion vector is determined to be invalid; or,
在参考运动矢量满足参考运动矢量对应的参考亮度块或参考色度块已重建完成、参考运动矢量对应的参考亮度块或参考色度块的预测模式相匹配,以及参考运动矢量未越界的情况下,确定参考运动矢量为有效。The reference motion vector is determined to be valid when the reference motion vector satisfies that the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector does not cross the boundary.
在本申请实施例中,判断参考运动矢量是否有效的实现可以包括步骤:In the embodiment of the present application, the implementation of determining whether the reference motion vector is valid may include the following steps:
步骤一、参考运动矢量对应的参考亮度块或参考色度块是否重建完成。Step 1: Check whether the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed.
在本申请实施例中,在解码端,可能由于参考帧中的相应块尚未被完全解码,或者解码器尚未完成对参考帧的解码,导致参考块未重建完成。这时,解码器可能需要等待参考块完全重建,或者采用一些 错误处理机制。例如,可以选择跳过当前块的运动补偿,暂时使用其他方式进行填充或插值,以防止由于未完成的解码引起的错误。In the embodiment of the present application, at the decoding end, the reference block may not be reconstructed because the corresponding block in the reference frame has not been completely decoded, or the decoder has not completed decoding of the reference frame. In this case, the decoder may need to wait for the reference block to be completely reconstructed, or use some Error handling mechanism. For example, you can choose to skip motion compensation for the current block and temporarily use other methods to fill or interpolate to prevent errors caused by incomplete decoding.
步骤二、参考运动矢量对应的参考亮度块或参考色度块的预测模式是否匹配。Step 2: Check whether the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches.
在本申请实施例中,参考块可能使用了与当前块不匹配的预测模式,这可能发生在帧内预测中,参考块可能使用了不同的预测模式。这时,解码器可能需要检测并纠正预测模式不匹配的情况,可能涉及到尝试根据当前块的预测模式调整参考块的预测模式,或者进行其他的错误恢复策略。In the embodiments of the present application, the reference block may use a prediction mode that does not match the current block. This may occur in intra-frame prediction, where the reference block may use a different prediction mode. At this time, the decoder may need to detect and correct the prediction mode mismatch, which may involve trying to adjust the prediction mode of the reference block according to the prediction mode of the current block, or performing other error recovery strategies.
步骤三、参考运动矢量是否越界。Step 3: Check whether the reference motion vector is out of bounds.
在本申请实施例中,参考运动矢量的值可能超出了规定的范围,这可能是由于编码错误、传输错误或其他异常情况引起的。在解码端,需要检测并处理越界的情况。可能的处理方式包括裁剪运动矢量的值,使其保持在有效的范围内,或者采用其他的错误处理手段。In the embodiment of the present application, the value of the reference motion vector may exceed the specified range, which may be caused by a coding error, a transmission error or other abnormal situation. At the decoding end, it is necessary to detect and handle the out-of-bounds situation. Possible processing methods include clipping the value of the motion vector to keep it within the valid range, or using other error handling methods.
可以理解的是,上述步骤是为了确保参考运动矢量的合法性,防止错误或无效的参考运动矢量影响解码质量。解码器通过检测和处理这些情况,保证了解码的准确性和鲁棒性,从而提高了视频解码的可靠性。It is understandable that the above steps are to ensure the legitimacy of the reference motion vector and prevent erroneous or invalid reference motion vectors from affecting the decoding quality. The decoder ensures the accuracy and robustness of decoding by detecting and processing these situations, thereby improving the reliability of video decoding.
S304、基于跨分量预测模型,确定预测色度块的预测色度值。S304: Determine a predicted chrominance value of the predicted chrominance block based on the cross-component prediction model.
在本申请实施例中,跨分量预测模型表征当前色度块对应的当前同位亮度块的重建亮度值与预测色度块的预测色度值具有关系。In the embodiment of the present application, the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a relationship with the predicted chrominance value of the predicted chrominance block.
在本申请的一些实施例中,跨分量预测模型表征当前色度块对应的当前同位亮度块的重建亮度值与预测色度块的预测色度值具有线性或者非线性关系。In some embodiments of the present application, the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with the predicted chrominance value of the predicted chrominance block.
需要说明的是,线性的跨分量预测模型可以提高解码效率并去除色度分量的冗余,以使得该模型在实际场景中能够较好地拟合亮度和色度之间的关系。通过使用线性的跨分量预测模型,解码器可以更准确地估计色度分量的值,从而在解码过程中实现更好的压缩效果,这对于提高视频解码的性能和质量是有益的。It should be noted that the linear cross-component prediction model can improve decoding efficiency and remove the redundancy of the chrominance component, so that the model can better fit the relationship between brightness and chrominance in actual scenes. By using a linear cross-component prediction model, the decoder can more accurately estimate the value of the chrominance component, thereby achieving better compression effect during the decoding process, which is beneficial to improving the performance and quality of video decoding.
在本申请实施例中,虽然线性关系在很多情况下能够有效地捕捉到同位亮度块与预测色度块之间的关系,但有时候也可能存在一些非线性关系。为了更准确地建模非线性关系,也可能采用更复杂的非线性模型。总体而言,具体采用线性还是非线性关系的模型取决于实际的编码标准、应用场景以及优化的需求。线性模型通常更简单,但在某些情况下可能不足以准确表达复杂的关系。非线性模型则更为灵活,但通常需要更多的计算资源。In the embodiments of the present application, although the linear relationship can effectively capture the relationship between the same-position luminance block and the predicted chrominance block in many cases, there may sometimes be some nonlinear relationships. In order to more accurately model the nonlinear relationship, a more complex nonlinear model may also be used. In general, whether to use a linear or nonlinear relationship model depends on the actual coding standard, application scenario, and optimization requirements. Linear models are usually simpler, but in some cases may not be sufficient to accurately express complex relationships. Nonlinear models are more flexible, but usually require more computing resources.
在本申请的一些实施例中,解码方法还包括S306:In some embodiments of the present application, the decoding method further includes S306:
S306、参考运动矢量为无效的情况下,根据当前色度块的样本精度,确定预测色度块的预测色度值。S306: When the reference motion vector is invalid, determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block.
在本申请实施例中,当前色度块的样本精度指的是色度分量(Chroma)的表示精度,通常以位数(Bit-Depth)为单位来表示,通常使用较高的样本精度来保留图像中的细节和色彩信息。例如,8位样本精度表示每个色度分量用8个二进制位(或比特)来表示。这样,每个色度分量可以有2^8=256个不同的离散级别。这些级别对应于颜色的变化,因此更高的样本精度意味着能够表示更多的颜色细节。更高的样本精度可以提供更多的颜色级别,从而提高颜色分辨率。这对于保留图像中的细微色彩差异非常重要。高样本精度有助于更准确地表示真实世界中的颜色,提高色彩保真度。选择适当的样本精度也涉及到编码效率的平衡。更高的样本精度可能需要更多的比特来表示每个像素,从而增加了编码后的数据量。In an embodiment of the present application, the sample accuracy of the current chrominance block refers to the representation accuracy of the chrominance component (Chroma), which is usually expressed in bits (Bit-Depth), and a higher sample accuracy is usually used to retain the details and color information in the image. For example, 8-bit sample accuracy means that each chrominance component is represented by 8 binary bits (or bits). In this way, each chrominance component can have 2^8=256 different discrete levels. These levels correspond to color changes, so higher sample accuracy means that more color details can be represented. Higher sample accuracy can provide more color levels, thereby improving color resolution. This is very important for retaining subtle color differences in images. High sample accuracy helps to more accurately represent colors in the real world and improve color fidelity. Selecting an appropriate sample accuracy also involves a balance in coding efficiency. Higher sample accuracy may require more bits to represent each pixel, thereby increasing the amount of encoded data.
在本申请实施例中,当前色度块的样本精度可以表示为BitDepth。In the embodiment of the present application, the sample accuracy of the current chroma block can be expressed as BitDepth.
在本申请实施例中,当前色度块的样本精度可以包括以下几种:In the embodiment of the present application, the sample accuracy of the current chroma block may include the following:
1)、8位样本精度:每个分量使用8个位表示。这是最为常见的样本精度,广泛应用于许多实时视频传输和存储应用中,提供256个不同的亮度或色度级别。1) 8-bit sample accuracy: Each component is represented by 8 bits. This is the most common sample accuracy, widely used in many real-time video transmission and storage applications, providing 256 different brightness or chrominance levels.
2)、10位样本精度:每个分量使用10个位表示。比8位样本精度提供更高的精度,允许表示1024个不同的亮度或色度级别,这通常在一些专业视频和影视制作中使用。2) 10-bit sample precision: Each component is represented using 10 bits, which provides higher precision than 8-bit sample precision and allows the representation of 1024 different brightness or chrominance levels, which is often used in some professional video and film production.
3)、12位样本精度:每个分量使用12个位表示,可以提供更高的精度,允许表示4096个不同的亮度或色度级别,这通常在专业领域和特殊需求下使用。3) 12-bit sample accuracy: Each component is represented by 12 bits, which can provide higher accuracy and allow 4096 different brightness or chromaticity levels to be represented. This is usually used in professional fields and for special needs.
4)、16位样本精度:每个分量使用16个位表示,可以提供非常高的精度,允许表示65536个不同的亮度或色度级别,这通常在特殊应用领域,如医学成像等,需要极高的图像精度时使用。4) 16-bit sample accuracy: Each component is represented by 16 bits, which can provide very high accuracy and allow the representation of 65536 different brightness or chromaticity levels. This is usually used in special application areas such as medical imaging, which require extremely high image accuracy.
需要说明的是,上述列举的样本精度仅为一种示例,不同的样本精度适用于不同的应用场景。更高的样本精度通常可以提供更丰富的颜色细节和图像质量,但也需要更多的存储空间和传输带宽。在选择样本精度时,需要根据具体应用的需求平衡图像质量和数据传输效率。本申请实施例对样本精度不作任何限制,具体可以根据实际场景进行选择。It should be noted that the sample accuracy listed above is only an example, and different sample accuracy is suitable for different application scenarios. Higher sample accuracy can usually provide richer color details and image quality, but also requires more storage space and transmission bandwidth. When selecting sample accuracy, it is necessary to balance image quality and data transmission efficiency according to the needs of specific applications. The embodiment of the present application does not impose any restrictions on sample accuracy, and it can be selected according to the actual scenario.
在本申请的一些实施例中,S306中根据当前色度块的样本精度,确定预测色度块的预测色度值的 实现,可以包括S3061至S3062:In some embodiments of the present application, in S306, the predicted chroma value of the predicted chroma block is determined according to the sample accuracy of the current chroma block. Implementation may include S3061 to S3062:
S3061、将样本精度与第一预设值进行减法运算,得到第四中间参数。S3061. Perform a subtraction operation on the sample accuracy and the first preset value to obtain a fourth intermediate parameter.
S3062、将第二预设值与第四中间参数进行指数运算,得到预测色度块中各个像素点的预测色度值。S3062. Perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
在本申请实施例中,第一预设值和第二预设值为预先设置好的值,示例性的,第一预设值为1,第二预设值为2。In the embodiment of the present application, the first preset value and the second preset value are pre-set values. For example, the first preset value is 1 and the second preset value is 2.
在本申请实施例中,第四中间参数可以表示为BitDepth-1。In the embodiment of the present application, the fourth intermediate parameter can be expressed as BitDepth-1.
在本申请实施例中,预测色度块中各个像素点的预测色度值可以表示为2BitDepth-1。In the embodiment of the present application, the predicted chrominance value of each pixel in the predicted chrominance block can be expressed as 2 BitDepth-1 .
可以理解的是,通过样本精度、预设值和指数运算来生成预测色度块中各个像素点的预测色度值。通过调整样本精度和不同的预设值,可以探索不同的预测色度值,从而在视频编码中提供更灵活的调整和优化选项,有助于在视频解码中更好地适应不同的应用场景和需求。It can be understood that the predicted chrominance value of each pixel in the predicted chrominance block is generated through sample precision, preset value and exponential operation. By adjusting the sample precision and different preset values, different predicted chrominance values can be explored, thereby providing more flexible adjustment and optimization options in video encoding, which helps to better adapt to different application scenarios and requirements in video decoding.
S305、根据预测色度块的预测色度值,确定当前色度块的重建色度值。S305 . Determine a reconstructed chrominance value of a current chrominance block according to the predicted chrominance value of the predicted chrominance block.
在本申请的一些实施例中,S305中根据预测色度块的预测色度值,确定当前色度块的重建色度值的实现,可以包括S3051至S3053:In some embodiments of the present application, the implementation of determining the reconstructed chroma value of the current chroma block according to the predicted chroma value of the predicted chroma block in S305 may include S3051 to S3053:
S3051、解析码流,得到当前色度块的色度残差值;S3051, parsing the bit stream to obtain the chroma residual value of the current chroma block;
S3052、对色度残差值进行反变换处理和反量化处理,得到当前色度块的反量化色度残差值;S3052, performing inverse transformation and inverse quantization on the chroma residual value to obtain an inverse quantized chroma residual value of the current chroma block;
S3053、根据反量化色度残差值和预测色度值,确定当前色度块的重建色度值。S3053. Determine the reconstructed chroma value of the current chroma block according to the inverse quantized chroma residual value and the predicted chroma value.
在本申请实施例中,色度残差值表示了当前色度块与预测值之间的差异。这些残差值通常经过编码,存储在码流中,解析码流即是从码流中提取这些残差值。In the embodiment of the present application, the chrominance residual value represents the difference between the current chrominance block and the predicted value. These residual values are usually encoded and stored in the bit stream, and parsing the bit stream is to extract these residual values from the bit stream.
在本申请实施例中,色度残差值可能经过了变换和量化,为了得到实际的残差值,需要进行反变换和反量化的处理。这一步骤的目的是将编码后的残差值还原成原始的差异值。In the embodiment of the present application, the chrominance residual value may have been transformed and quantized, and in order to obtain the actual residual value, it is necessary to perform inverse transformation and inverse quantization. The purpose of this step is to restore the encoded residual value to the original difference value.
在本申请实施例中,通过将反量化的残差值加到预测色度值上来得到当前色度块的重建色度值。这是色度块重建的最后一步,得到的重建色度值将用于构建最终的图像帧。In the embodiment of the present application, the reconstructed chrominance value of the current chrominance block is obtained by adding the inverse quantized residual value to the predicted chrominance value. This is the last step of chrominance block reconstruction, and the obtained reconstructed chrominance value will be used to construct the final image frame.
可以理解的是,一方面,反量化和反变换过程有助于在解码端准确还原原始的色度残差信息。这有助于提高视频的压缩比,即在保持图像质量的同时减小文件大小。反量化和反变换的处理有助于尽量减小编码引入的失真。一方面,通过在解码端正确还原残差信息,可以更准确地还原原始图像,提高图像的质量。一方面,上述过程旨在在保持图像质量的同时最大限度地减小编解码过程中的计算复杂性,这有助于提高编解码的效率。It can be understood that, on the one hand, the inverse quantization and inverse transformation process helps to accurately restore the original chrominance residual information at the decoding end. This helps to improve the compression ratio of the video, that is, to reduce the file size while maintaining the image quality. The inverse quantization and inverse transformation process helps to minimize the distortion introduced by the encoding. On the one hand, by correctly restoring the residual information at the decoding end, the original image can be restored more accurately and the image quality can be improved. On the one hand, the above process is intended to minimize the computational complexity in the encoding and decoding process while maintaining the image quality, which helps to improve the efficiency of encoding and decoding.
在本申请实施例中,提供了一种解码方法,该方法包括:在解码端,解析码流,确定第一语法标识信息;在第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值;根据预测色度块的预测色度值,确定当前色度块的重建色度值。。由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编解码场景,从而提高了对当前色度块的编解码效率。In an embodiment of the present application, a decoding method is provided, the method comprising: at a decoding end, parsing a bitstream to determine first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra-frame block copying technology, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chroma block corresponding to the reference motion vector; determining a predicted chroma value of the predicted chroma block based on the cross-component prediction model; and determining a reconstructed chroma value of the current chroma block according to the predicted chroma value of the predicted chroma block. . Since the cross-component prediction model is determined by the reference luminance block and the reference chroma block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of an adjacent row and column of the current chroma block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chroma block.
可以理解的是,一方面,根据当前色度块对应的当前同位亮度块,确定参考运动矢量。这一步骤有助于将亮度块的信息引入到色度块的解码过程中,以提高对运动相关性的准确处理。一方面,基于跨分量预测模型,确定预测色度块的预测色度值,充分利用了亮度块的信息,帮助提高了对色度块的预测准确性,有助于在解码端更准确地还原原始图像中的色度信息,提高图像质量。总的来说,通过上述过程可以提高对色度块的解码准确性、增强图像质量、利用跨分量相关性等方面。通过引入亮度块的信息,解码过程更全面地利用了视频图像中不同分量之间的关联,从而提高了解码效果。It can be understood that, on the one hand, the reference motion vector is determined according to the current co-located luminance block corresponding to the current chrominance block. This step helps to introduce the information of the luminance block into the decoding process of the chrominance block to improve the accurate processing of motion correlation. On the one hand, based on the cross-component prediction model, the predicted chrominance value of the predicted chrominance block is determined, which makes full use of the information of the luminance block, helps to improve the prediction accuracy of the chrominance block, and helps to more accurately restore the chrominance information in the original image at the decoding end, thereby improving the image quality. In general, the above process can improve the decoding accuracy of the chrominance block, enhance the image quality, and utilize cross-component correlation. By introducing the information of the luminance block, the decoding process more comprehensively utilizes the association between different components in the video image, thereby improving the decoding effect.
在本申请的一些实施例中,S302中根据当前色度块对应的当前同位亮度块,确定参考运动矢量的实现,可以包括S401:In some embodiments of the present application, the implementation of determining the reference motion vector according to the current co-located luminance block corresponding to the current chrominance block in S302 may include S401:
S401、在当前同位亮度块中确定满足预设的预测模式的候选参考样点,并将候选参考样点对应的运动矢量作为参考运动矢量。S401: Determine candidate reference samples that meet a preset prediction mode in a current co-located luminance block, and use motion vectors corresponding to the candidate reference samples as reference motion vectors.
在本申请的一些实施例中,预设的预测模式:候选参考样点采用块复制帧内预测模式(Intra Block Copy,IBC)或者串复制帧内预测的普通串子模式。In some embodiments of the present application, the preset prediction mode is: the candidate reference samples adopt the block copy intra prediction mode (Intra Block Copy, IBC) or the ordinary string mode of string copy intra prediction.
在本申请实施例中,解码器在当前同位亮度块中确定满足块复制帧内预测模式或串复制帧内预测的普通串子模式的候选参考样点,并将候选参考样点对应的运动矢量作为参考运动矢量。In an embodiment of the present application, the decoder determines candidate reference samples that satisfy the block copy intra prediction mode or the common string sub-mode of string copy intra prediction in the current co-located luminance block, and uses the motion vector corresponding to the candidate reference sample as the reference motion vector.
在本申请实施例中,通过解析视频码流中的相应语法元素或标识信息,解码器确定当前块是否采用了块复制帧内预测模式或串复制帧内预测的普通串子模式。如果当前块采用了块复制帧内预测模式或串复制帧内预测的普通串子模式,解码器会获取相应的预测模式参数,这可能包括块复制的方向(横向 或纵向)或者串子模式的方向。根据预测模式参数,在当前同位亮度块中确定满足块复制帧内预测模式或串复制帧内预测的普通串子模式的候选参考样点。对于确定的候选参考样点,将它们对应的运动矢量作为参考运动矢量。In the embodiment of the present application, by parsing the corresponding syntax elements or identification information in the video bitstream, the decoder determines whether the current block adopts the block copy intra prediction mode or the common string sub-mode of the string copy intra prediction. If the current block adopts the block copy intra prediction mode or the common string sub-mode of the string copy intra prediction, the decoder will obtain the corresponding prediction mode parameters, which may include the direction of the block copy (horizontal or vertical) or the direction of the string mode. According to the prediction mode parameters, candidate reference samples satisfying the block copy intra prediction mode or the common string mode of the string copy intra prediction are determined in the current co-located luminance block. For the determined candidate reference samples, their corresponding motion vectors are used as reference motion vectors.
可以理解的是,上述过程的目的是为了在解码过程中能够准确地描述当前块与参考帧中的块之间的关系,以提高预测的准确性。通过确定候选参考样点和相应的运动矢量,解码器能够更好地还原当前块的内容,实现更好的图像质量。It is understandable that the purpose of the above process is to accurately describe the relationship between the current block and the blocks in the reference frame during the decoding process to improve the accuracy of the prediction. By determining the candidate reference samples and the corresponding motion vectors, the decoder can better restore the content of the current block and achieve better image quality.
在本申请实施例中,在块复制帧内预测模式(IBC)中,当前块的预测值是从相邻区域的已编码块中直接复制过来。这意味着当前块的内容与其相邻的已编码块相似,因此可以通过直接复制邻近块的像素值来进行预测。这种方式在一些情况下能够有效地提高预测的准确性。In the embodiment of the present application, in the block copy intra prediction mode (IBC), the prediction value of the current block is directly copied from the coded block in the adjacent area. This means that the content of the current block is similar to the coded block adjacent to it, so the prediction can be performed by directly copying the pixel values of the adjacent block. This method can effectively improve the accuracy of the prediction in some cases.
在本申请实施例中,串复制帧内预测的普通串子模式是一种帧内预测模式,它涉及到当前块中的像素值与其相邻块中的像素值之间的复制关系。在这个模式中,预测值的生成涉及到相邻块的像素值的复制,通常是从左到右或者从上到下的复制过程,形成一个“串”(string)。这种方式可用于一些具有线性或规律性的图案。In the embodiment of the present application, the ordinary string sub-mode of the string copy intra prediction is an intra prediction mode, which involves the copy relationship between the pixel values in the current block and the pixel values in the adjacent blocks. In this mode, the generation of the prediction value involves the copying of the pixel values of the adjacent blocks, usually from left to right or from top to bottom, to form a "string". This method can be used for some linear or regular patterns.
需要说明的是,块复制帧内预测模式和串复制帧内预测的普通串子模式都是为了在帧内进行预测而设计的,通过对已编码块中的像素值进行复制,提供了一种基于相邻块的简单而有效的预测方式。块复制帧内预测模式主要强调整个块的复制,而串复制帧内预测的普通串子模式更强调像素值的有序串联。选择使用哪种模式通常依赖于解码标准和具体的图像内容。这些帧内预测模式有助于提高视频解码的效率,减小数据量,从而实现更好的压缩性能。It should be noted that both the block copy intra prediction mode and the common string sub-mode of string copy intra prediction are designed for prediction within a frame. By copying the pixel values in the encoded block, a simple and effective prediction method based on adjacent blocks is provided. The block copy intra prediction mode mainly emphasizes the copying of the entire block, while the common string sub-mode of string copy intra prediction emphasizes the orderly concatenation of pixel values. The choice of which mode to use usually depends on the decoding standard and the specific image content. These intra prediction modes help improve the efficiency of video decoding and reduce the amount of data, thereby achieving better compression performance.
在本申请的一些实施例中,跨分量预测模型为线性模型;S303中基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型的实现,可以包括S3031至S3032:In some embodiments of the present application, the cross-component prediction model is a linear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S303 may include S3031 to S3032:
S3031、按照预设样点选取方式在参考亮度块中确定至少两个参考亮度样点,以及按照预设样点选取方式在参考色度块中确定与至少两个参考亮度样点各自对应的参考色度样点。S3031. Determine at least two reference luminance samples in a reference luminance block according to a preset sample selection method, and determine reference chrominance samples corresponding to the at least two reference luminance samples in a reference chrominance block according to a preset sample selection method.
在本申请实施例中,预设样点选取方式通常是根据一定的规则或算法,比如在块内均匀分布、按特定方向选取等方式。In the embodiments of the present application, the preset sample point selection method is usually based on certain rules or algorithms, such as uniform distribution within a block, selection in a specific direction, and the like.
在本申请实施例中,对于在参考亮度块中确定的每个参考亮度样点,根据色度采样结构(如4:2:0或4:4:4),找到与其对应的参考色度样点。如果色度块的采样结构是4:2:0,则对应的参考色度样点可能在水平和垂直方向上的相邻位置。In the embodiment of the present application, for each reference luminance sample determined in the reference luminance block, a reference chrominance sample corresponding thereto is found according to the chrominance sampling structure (such as 4:2:0 or 4:4:4). If the sampling structure of the chrominance block is 4:2:0, the corresponding reference chrominance samples may be at adjacent positions in the horizontal and vertical directions.
可以理解的是,按照预设样点选取方式选择至少两个参考亮度样点和至少两个参考亮度样,有助于建立亮度与色度之间的关系,提高帧内预测的准确性。It can be understood that selecting at least two reference luminance sampling points and at least two reference luminance samples according to a preset sampling point selection method helps to establish a relationship between luminance and chrominance, thereby improving the accuracy of intra-frame prediction.
在本申请的一些实施例中,预设样点选取方式包括以下任意一种:居中选取方式、垂直选取方式、水平选取方式、对角线选取方式和顶点选取方式。In some embodiments of the present application, the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
在本申请实施例中,如图13a所示,在居中选取方式中,首先确定参考色度块的中心位置,该中心位置可能通过块的宽度和高度的中点计算得到,然后,选取该中心位置作为参考色度样点。进一步,根据参考色度块中的参考色度样点,在参考亮度块中确定对应的参考亮度样点。In the embodiment of the present application, as shown in FIG13a, in the center selection method, the center position of the reference chromaticity block is first determined, and the center position may be calculated by the midpoint of the width and height of the block, and then the center position is selected as the reference chromaticity sample point. Further, according to the reference chromaticity sample point in the reference chromaticity block, the corresponding reference luminance sample point is determined in the reference luminance block.
在本申请实施例中,如图13b所示,在垂直选取方式中,通过参考色度块的垂直中心线(比如最左边的线)确定参考色度样点。通常是通过块的高度的一半和块的左侧边界相结合,得到垂直中心线的位置。然后,根据参考色度块中的参考色度样点,在参考亮度块中确定对应的参考亮度样点。In the embodiment of the present application, as shown in FIG. 13b , in the vertical selection mode, the reference chromaticity sample is determined by the vertical center line (e.g., the leftmost line) of the reference chromaticity block. The position of the vertical center line is usually obtained by combining half of the height of the block and the left edge of the block. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
在本申请实施例中,如图13c所示,在水平选取方式中,通过参考色度块的水平中心线确定参考色度样点。通常是通过参考色度块的宽度的一半和块的顶部边界相结合,得到水平中心线的位置。然后,根据参考色度块中的参考色度样点,在参考亮度块中确定对应的参考亮度样点。In the embodiment of the present application, as shown in FIG13c, in the horizontal selection mode, the reference chromaticity sample is determined by the horizontal center line of the reference chromaticity block. The position of the horizontal center line is usually obtained by combining half of the width of the reference chromaticity block and the top boundary of the block. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
在本申请实施例中,如图13d所示,在对角线选取方式中,通过参考色度块的左上角和右下角的对角线确定参考色度样点。通常是通过参考色度样点的宽度和高度的对角线中点计算得到。然后,根据参考色度块中的参考色度样点,在参考亮度块中确定对应的参考亮度样点。In the embodiment of the present application, as shown in FIG. 13d , in the diagonal selection method, the reference chromaticity sample is determined by the diagonal of the upper left corner and the lower right corner of the reference chromaticity block. It is usually calculated by the diagonal midpoint of the width and height of the reference chromaticity sample. Then, according to the reference chromaticity sample in the reference chromaticity block, the corresponding reference luminance sample is determined in the reference luminance block.
在本申请实施例中,如图13e所示,在顶点选取方式中,确定参考色度块的四个顶点的位置。这些顶点通常是参考色度块的四个角。然后,根据参考色度块中的参考色度样点,在参考亮度块中确定对应的参考亮度样点。In an embodiment of the present application, as shown in FIG. 13e , in the vertex selection method, the positions of the four vertices of the reference chromaticity block are determined. These vertices are usually the four corners of the reference chromaticity block. Then, according to the reference chromaticity sample points in the reference chromaticity block, the corresponding reference luminance sample points are determined in the reference luminance block.
可以理解的是,在确定了这些参考亮度样点后,可以通过相应的色度采样结构确定与这些亮度样点对应的色度样点,建立亮度与色度之间的关系。这样的关系有助于提高帧内预测的准确性,从而在解码端更好地还原原始视频帧。It is understandable that after determining these reference luminance samples, the chrominance samples corresponding to these luminance samples can be determined through the corresponding chrominance sampling structure to establish a relationship between luminance and chrominance. Such a relationship helps to improve the accuracy of intra-frame prediction, thereby better restoring the original video frame at the decoding end.
可以理解的是,一方面,不同的选取方式可以更好地适应不同图像内容和运动模式,在一些场景中,某种选取方式可能更能捕捉到图像中的重要信息,从而提高编码效率。一方面,不同的选取方式可能有助于提供更准确的运动矢量信息,通过选择适当的样点,可以更精确地估计运动,从而提高预测的准确 性。一方面,预设样点选取方式的巧妙选择可以改善帧内预测的效果,通过选择合适的样点,可以更好地建模亮度与色度之间的关系,从而提高帧内预测的质量。一方面,某些选取方式可能在解码时具有较低的复杂度,使得解码器能够更高效地执行预测和运动估计,从而降低整体的解码复杂度。总的来说,通过选择适当的预设样点选取方式,视频解码器可以更好地适应不同场景的需求,提高图像质量,并在保持解码效率的同时降低复杂度。It is understandable that, on the one hand, different selection methods can better adapt to different image contents and motion patterns. In some scenes, a certain selection method may be more able to capture important information in the image, thereby improving coding efficiency. On the other hand, different selection methods may help provide more accurate motion vector information. By selecting appropriate samples, motion can be estimated more accurately, thereby improving the accuracy of prediction. On the one hand, the clever selection of preset sample selection methods can improve the effect of intra-frame prediction. By selecting appropriate samples, the relationship between brightness and chrominance can be better modeled, thereby improving the quality of intra-frame prediction. On the other hand, some selection methods may have lower complexity during decoding, allowing the decoder to perform prediction and motion estimation more efficiently, thereby reducing the overall decoding complexity. In general, by selecting appropriate preset sample selection methods, video decoders can better adapt to the needs of different scenarios, improve image quality, and reduce complexity while maintaining decoding efficiency.
在本申请的一些实施例中,预设样点选取方式为居中选取方式;参考色度块的宽度为W,参考色度块的高度为H;参考亮度块的宽度为2W,参考亮度块的高度为2H。In some embodiments of the present application, the preset sample point selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H.
在本申请的一些实施例中,至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色度样点、第三参考色度样点和第四参考色度样点。In some embodiments of the present application, at least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
第一参考色度样点在参考色度块的位置坐标为(1,0);第一参考色度样点为参考色度块的左上角的色度样点;The position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (1, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
第二参考色度样点在参考色度块的位置坐标为(W-2,0);The position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-2, 0);
第三参考色度样点在参考色度块的位置坐标为(1,H-1);The position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (1, H-1);
第四参考色度样点在参考色度块的位置坐标为(W-2,H-1);The position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-2, H-1);
第一参考亮度样点在参考亮度块的位置坐标为(2,0);第一参考亮度样点为参考亮度块的左上角的亮度样点;The position coordinates of the first reference brightness sample point in the reference brightness block are (2, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
第二参考亮度样点在参考亮度块的位置坐标为(2×(W-2),0);The position coordinates of the second reference brightness sample point in the reference brightness block are (2×(W-2), 0);
第三参考亮度样点在参考亮度块的位置坐标为(2,2×(H-1));The position coordinates of the third reference brightness sample point in the reference brightness block are (2,2×(H-1));
第四参考亮度样点在参考亮度块的位置坐标为(2×(W-2),2×(H-1))。The position coordinates of the fourth reference luminance sample point in the reference luminance block are (2×(W-2), 2×(H-1)).
在本申请的一些实施例中,预设样点选取方式为顶点选取方式;参考色度块的宽度为W,参考色度块的高度为H;参考亮度块的宽度为2W,参考亮度块的高度为2H;In some embodiments of the present application, the preset sample point selection method is a vertex selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
在本申请的一些实施例中,至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色度样点、第三参考色度样点和第四参考色度样点。In some embodiments of the present application, at least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
第一参考色度样点在参考色度块的位置坐标为(0,0);第一参考色度样点为参考色度块的左上角的色度样点;The position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (0, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
第二参考色度样点在参考色度块的位置坐标为(W-1,0);The position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-1, 0);
第三参考色度样点在参考色度块的位置坐标为(0,H-1);The position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (0, H-1);
第四参考色度样点在参考色度块的位置坐标为(W-1,H-1);The position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-1, H-1);
第一参考亮度样点在参考亮度块的位置坐标为(0,0);第一参考亮度样点为参考亮度块的左上角的亮度样点;The position coordinates of the first reference brightness sample point in the reference brightness block are (0, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
第二参考亮度样点在参考亮度块的位置坐标为(2×(W-1),0);The position coordinates of the second reference brightness sample point in the reference brightness block are (2×(W-1), 0);
第三参考亮度样点在参考亮度块的位置坐标为(0,2×(H-1));The position coordinates of the third reference brightness sample point in the reference brightness block are (0, 2×(H-1));
第四参考亮度样点在参考亮度块的位置坐标为(2×(W-1),2×(H-1))。The position coordinates of the fourth reference luminance sample point in the reference luminance block are (2×(W-1), 2×(H-1)).
需要说明的是,上述列举的居中选取方式和顶点选取方式仅为一种示例,在实际应用中,还可选择其他数量的参考亮度样点和参考色度样点。另外,对于选取的参考亮度样点和参考色度样点的坐标点位还包括其他方式。也就是说,参考亮度样点和参考色度样点中的任意一个样点都可以选取,具体的选取方式可以根据实际应用场景进行选择,本申请实施例对此不作任何限定。It should be noted that the above-listed center selection method and vertex selection method are only examples. In actual applications, other numbers of reference luminance samples and reference chrominance samples may be selected. In addition, other methods are also included for the coordinate positions of the selected reference luminance samples and reference chrominance samples. In other words, any one of the reference luminance samples and reference chrominance samples may be selected, and the specific selection method may be selected according to the actual application scenario, and the embodiments of the present application do not impose any limitation on this.
在本申请实施例中,第一参考色度样点与第一参考亮度样点相对应,第二参考色度样点与第二参考亮度样点相对应,第三参考色度样点与第三参考亮度样点相对应,第四参考色度样点与第四参考亮度样点相对应。In the embodiment of the present application, the first reference chromaticity sample corresponds to the first reference luminance sample, the second reference chromaticity sample corresponds to the second reference luminance sample, the third reference chromaticity sample corresponds to the third reference luminance sample, and the fourth reference chromaticity sample corresponds to the fourth reference luminance sample.
可以理解的是,顶点选取方式的设置方式有助于通过亮度样点和色度样点之间的关系,建立更准确的跨分量预测模型。在解码过程中,参考这些样点可以提高对色度信息的预测准确性,从而改善视频质量。It is understandable that the setting method of vertex selection helps to establish a more accurate cross-component prediction model through the relationship between luma samples and chroma samples. During the decoding process, referring to these samples can improve the prediction accuracy of chroma information, thereby improving video quality.
S3032、根据至少两个参考亮度样点以及至少两个参考色度样点,确定跨分量预测模型;其中,至少两个参考亮度样点与至少两个参考色度样点相对应。S3032. Determine a cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
在本申请实施例中,在当前色度块对应一个跨分量预测模型的情况下,根据至少两个参考亮度样点以及至少两个参考色度样点,确定跨分量预测模型。In an embodiment of the present application, when the current chroma block corresponds to a cross-component prediction model, the cross-component prediction model is determined according to at least two reference luma samples and at least two reference chroma samples.
在本申请的一些实施例中,跨分量预测模型包括一个或多个跨分量预测子模型;S3032中根据至少两个参考亮度样点以及至少两个参考色度样点,确定跨分量预测模型的实现,可以包括S30321至S30322:In some embodiments of the present application, the cross-component prediction model includes one or more cross-component prediction sub-models; determining the implementation of the cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples in S3032 may include S30321 to S30322:
S30321、按照至少两个参考亮度样点的亮度值,将至少两个参考亮度样点以及至少两个参考色度样 点进行分组,得到至少一个参考样点组;其中,每一个参考样点组包括至少两个亮度样点以及至少两个色度样点;至少两个亮度样点与至少两个色度样点相对应;至少两个参考亮度样点包括至少两个亮度样点;至少两个参考色度样点包括至少两个色度样点;至少一个参考样点组对应不同的预设亮度范围。S30321, according to the brightness values of at least two reference brightness samples, at least two reference brightness samples and at least two reference chrominance samples The points are grouped to obtain at least one reference sample point group; wherein each reference sample point group includes at least two luminance sample points and at least two chrominance sample points; the at least two luminance sample points correspond to the at least two chrominance sample points; the at least two reference luminance sample points include at least two luminance sample points; the at least two reference chrominance sample points include at least two chrominance sample points; and at least one reference sample point group corresponds to a different preset luminance range.
在本申请实施例中,对于不同的参考样点组,其包含的亮度样点和色度样点具有不同的预设亮度范围。这种区分可能有助于更好地适应视频中不同区域的亮度变化。通过为每个参考样点组指定不同的预设亮度范围,可以更灵活地处理视频中可能存在的亮度差异,从而提高解码的适应性和性能。In the embodiment of the present application, for different reference sample groups, the luma samples and chroma samples contained therein have different preset luma ranges. This distinction may help to better adapt to the brightness changes in different areas of the video. By specifying a different preset luma range for each reference sample group, the brightness differences that may exist in the video can be handled more flexibly, thereby improving the adaptability and performance of decoding.
示例性的,至少一个参考样点组包括:第一样点组、第二样点组、第三样点组和第四样点组。第一样点组对应0~50的亮度范围,第二样点组对应51~100的亮度范围,第三样点组对应101~150的亮度范围,第四样点组对应151~255的亮度范围。Exemplarily, at least one reference sample point group includes: a first sample point group, a second sample point group, a third sample point group and a fourth sample point group. The first sample point group corresponds to a brightness range of 0 to 50, the second sample point group corresponds to a brightness range of 51 to 100, the third sample point group corresponds to a brightness range of 101 to 150, and the fourth sample point group corresponds to a brightness range of 151 to 255.
在本申请实施例中,如图14所示,其示出了多个跨分量预测子模型的示意图,横轴为同位亮度块的重建亮度值,纵轴为当前色度块对应的预测色度块的预测色度值。可以看出,跨分量预测模型包括两个跨分量预测子模型,即第一跨分量预测子模型和第二跨分量预测子模型。其中,第一跨分量预测子模型对应的缩放因子为1(α1=1),偏移因子为1(β1=1),第二跨分量预测子模型对应的缩放因子为1/2(α2=1/2),偏移因子为1(β2=1)。因此,通过多个跨分量预测子模型,可以将为不同的同位亮度块的重建亮度值匹配不同的跨分量预测子模型,这样,可以提高解码的适应性和性能。In an embodiment of the present application, as shown in FIG. 14 , a schematic diagram of multiple cross-component prediction sub-models is shown, where the horizontal axis is the reconstructed luminance value of the co-located luminance block, and the vertical axis is the predicted chrominance value of the predicted chrominance block corresponding to the current chrominance block. It can be seen that the cross-component prediction model includes two cross-component prediction sub-models, namely a first cross-component prediction sub-model and a second cross-component prediction sub-model. Among them, the scaling factor corresponding to the first cross-component prediction sub-model is 1 (α 1 =1), and the offset factor is 1 (β 1 =1), and the scaling factor corresponding to the second cross-component prediction sub-model is 1/2 (α 2 =1/2), and the offset factor is 1 (β 2 =1). Therefore, through multiple cross-component prediction sub-models, the reconstructed luminance values of different co-located luminance blocks can be matched to different cross-component prediction sub-models, so that the adaptability and performance of decoding can be improved.
S30322、针对至少一个参考样点组中的每一参考样点组,根据每一参考样点组中的至少两个亮度样点以及至少两个色度样点,确定每一参考样点组对应的跨分量预测子模型。S30322. For each reference sample point group in at least one reference sample point group, determine a cross-component prediction sub-model corresponding to each reference sample point group according to at least two luma samples and at least two chroma samples in each reference sample point group.
在本申请的一些实施例中,S30322根据每一参考样点组中的至少两个亮度样点以及至少两个色度样点,确定每一参考样点组对应的跨分量预测子模型的实现,可以包括:In some embodiments of the present application, S30322 determines the implementation of the cross-component prediction sub-model corresponding to each reference sample group according to at least two luma samples and at least two chroma samples in each reference sample group, which may include:
按照至少两个亮度样点的亮度值,将每一参考样点组中的至少两个亮度样点以及至少两个色度样点进行分组,得到第一样点组和第二样点组;其中,第一样点组和第二样点组中各自包括至少一个亮度样点和至少一个色度样点;至少一个亮度样点与至少一个色度样点相对应;第一样点组中的至少一个亮度样点的重建亮度值大于或者等于第二样点组中的至少一个亮度样点的重建亮度值;According to the brightness values of the at least two brightness samples, at least two brightness samples and at least two chrominance samples in each reference sample group are grouped to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one brightness sample and at least one chrominance sample; the at least one brightness sample corresponds to the at least one chrominance sample; and a reconstructed brightness value of at least one brightness sample in the first sample group is greater than or equal to a reconstructed brightness value of at least one brightness sample in the second sample group;
根据第一样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最大参考亮度值和第一参考色度值;Determine a maximum reference luminance value and a first reference chrominance value according to a reconstructed luminance value of at least one luminance sample point and a reconstructed chrominance value of at least one chrominance sample point in the first sample point group, respectively;
根据第二样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最小参考亮度值和第二参考色度值;Determine a minimum reference luminance value and a second reference chrominance value according to a reconstructed luminance value of at least one luminance sample point and a reconstructed chrominance value of at least one chrominance sample point in the second sample point group;
基于最大参考亮度值、第一参考色度值、最小参考亮度值和第二参考色度值,确定缩放因子和偏移因子;Determining a scaling factor and an offset factor based on a maximum reference luminance value, a first reference chrominance value, a minimum reference luminance value, and a second reference chrominance value;
根据缩放因子和偏移因子,确定每一参考样点组对应的跨分量预测子模型。According to the scaling factor and the offset factor, the cross-component prediction sub-model corresponding to each reference sample point group is determined.
在本申请实施例中,最大参考亮度值可以表示为xMax,第一参考色度值可以表示为yMax,最小参考亮度值可以表示为xMin,第二参考色度值可以表示为yMin。缩放因子可以表示为a,偏移因子可以表示为b。In the embodiment of the present application, the maximum reference brightness value can be expressed as xMax, the first reference chromaticity value can be expressed as yMax, the minimum reference brightness value can be expressed as xMin, and the second reference chromaticity value can be expressed as yMin. The scaling factor can be expressed as a, and the offset factor can be expressed as b.
需要说明的是,对每一参考样点组中的至少两个亮度样点以及至少两个色度样点进行分组和排序的过程都是依据至少两个亮度样点的亮度值来进行的,色度值按照相应的亮度值进行操作。因此,最大参考亮度值对应的第一参考色度值不一定是最大的。同样,最小参考亮度值对应的第二参考色度值也不一定是最小的。It should be noted that the process of grouping and sorting the at least two luma samples and the at least two chroma samples in each reference sample group is performed based on the luma values of the at least two luma samples, and the chroma values are operated according to the corresponding luma values. Therefore, the first reference chroma value corresponding to the maximum reference luma value is not necessarily the largest. Similarly, the second reference chroma value corresponding to the minimum reference luma value is not necessarily the smallest.
示例性的,当第一参考亮度样点的重建亮度值大于或等于第二参考亮度样点的重建亮度值、第二参考亮度样点的重建亮度值大于或等于第三参考亮度样点的重建亮度值,以及第三参考亮度样点的重建亮度值大于或等于第四参考亮度样点的重建亮度值的情况下,将第一参考亮度样点、第二参考亮度样点、第一参考亮度样点对应的第一参考色度样点,以及第二参考亮度样点对应的第二参考色度样点划分为第一样本组,将第三参考亮度样点、第四参考亮度样点、第三参考亮度样点对应的第三参考色度样点,以及第四参考亮度样点对应的第四参考色度样点划分为第二样本组。进一步,将第一参考亮度样点和第二参考亮度样点的重建亮度值的均值作为最大参考亮度值(xMax),将第一参考色度样点和第二参考色度样点的重建色度值的均值作为第一参考色度值(yMax),将第三参考亮度样点和第四参考亮度样点的重建亮度值的均值作为最小参考亮度值(xMin),将第三参考色度样点和第四参考色度样点的重建色度值的均值作为第二参考色度值(yMin)。Exemplarily, when the reconstructed luminance value of the first reference luminance sample is greater than or equal to the reconstructed luminance value of the second reference luminance sample, the reconstructed luminance value of the second reference luminance sample is greater than or equal to the reconstructed luminance value of the third reference luminance sample, and the reconstructed luminance value of the third reference luminance sample is greater than or equal to the reconstructed luminance value of the fourth reference luminance sample, the first reference luminance sample, the second reference luminance sample, the first reference chroma sample corresponding to the first reference luminance sample, and the second reference chroma sample corresponding to the second reference luminance sample are divided into a first sample group, and the third reference luminance sample, the fourth reference luminance sample, the third reference chroma sample corresponding to the third reference luminance sample, and the fourth reference chroma sample corresponding to the fourth reference luminance sample are divided into a second sample group. Further, the average of the reconstructed luminance values of the first reference luminance sample and the second reference luminance sample is used as the maximum reference luminance value (xMax), the average of the reconstructed chroma values of the first reference chroma sample and the second reference chroma sample is used as the first reference chroma value (yMax), the average of the reconstructed luminance values of the third reference luminance sample and the fourth reference luminance sample is used as the minimum reference luminance value (xMin), and the average of the reconstructed chroma values of the third reference chroma sample and the fourth reference chroma sample is used as the second reference chroma value (yMin).
在本申请的一些实施例中,基于最大参考亮度值、第一参考色度值、最小参考亮度值和第二参考色度值,确定缩放因子和偏移因子,可以包括:In some embodiments of the present application, determining the scaling factor and the offset factor based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value, and the second reference chrominance value may include:
将第一参考色度值(yMax)与第二参考色度值(yMin)进行减法运算,得到第一中间参数;Subtracting the first reference chromaticity value (yMax) from the second reference chromaticity value (yMin) to obtain a first intermediate parameter;
将最大参考亮度值(xMax)与最小参考亮度值(xMin)进行减法运算,得到第二中间参数;Subtracting the maximum reference brightness value (xMax) from the minimum reference brightness value (xMin) to obtain a second intermediate parameter;
将第一中间参数和第二中间参数进行除法运算,得到缩放因子(a); Dividing the first intermediate parameter by the second intermediate parameter to obtain a scaling factor (a);
将缩放因子(a)和最小参考亮度值(xMin)进行乘法运算,得到第三中间参数;The scaling factor (a) and the minimum reference brightness value (xMin) are multiplied to obtain a third intermediate parameter;
将第二参考色度值(yMin)和第三中间参数进行减法运算,得到偏移因子(b)。The second reference chromaticity value (yMin) and the third intermediate parameter are subtracted to obtain an offset factor (b).
在本申请实施例中,第一中间参数可以表示为yMax-yMin。第二中间参数可以表示为xMax-xMin。缩放因子可以表示为a=(yMax-yMin)/(xMax-xMin)。第三中间参数可以表示为a×xMin。偏移因子可以表示为yMin-a×xMin。In the embodiment of the present application, the first intermediate parameter can be expressed as yMax-yMin. The second intermediate parameter can be expressed as xMax-xMin. The scaling factor can be expressed as a=(yMax-yMin)/(xMax-xMin). The third intermediate parameter can be expressed as a×xMin. The offset factor can be expressed as yMin-a×xMin.
可以理解的是,确定缩放因子和偏移因子可以将参考亮度和色度的值映射到一个标准的范围,从而实现归一化,有助于在不同场景下更一致地处理亮度和色度信息。通过确定缩放因子和偏移因子,可以使预测模型更具鲁棒性,适应不同的亮度和色度条件。通过进行合适的亮度和色度映射,可以降低数据冗余,提高解码效率,有助于更紧凑地表示图像信息。总的来说,通过确定缩放因子和偏移因子,可以更好地处理亮度和色度之间的关系,提高解码的性能和图像质量。It is understandable that determining the scaling factor and the offset factor can map the reference luminance and chrominance values to a standard range, thereby achieving normalization, which helps to process luminance and chrominance information more consistently in different scenarios. By determining the scaling factor and the offset factor, the prediction model can be made more robust and adaptable to different luminance and chrominance conditions. By performing appropriate luminance and chrominance mapping, data redundancy can be reduced, decoding efficiency can be improved, and image information can be represented more compactly. In general, by determining the scaling factor and the offset factor, the relationship between luminance and chrominance can be better handled, and the decoding performance and image quality can be improved.
在本申请的一些实施例中,跨分量预测模型为非线性模型;S304中基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型的实现,可以包括:In some embodiments of the present application, the cross-component prediction model is a nonlinear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S304 may include:
在参考色度块中选取全部或部分参考色度样点;Selecting all or part of the reference chromaticity samples in the reference chromaticity block;
根据全部或部分参考色度样点、参考亮度块中的与全部或部分参考色度样点各自对应的参考亮度样点,以及参考亮度样点的邻域参考亮度样点,确定跨分量预测模型。A cross-component prediction model is determined based on all or part of the reference chroma samples, reference luma samples in a reference luma block that respectively correspond to all or part of the reference chroma samples, and neighborhood reference luma samples of the reference luma samples.
在本申请实施例中,在参考亮度块和参考色度块的大小不一致的情况下,将参考亮度块进行下采样,得到下采样亮度样点,下采样的过程可以表示为:
L′(x,y)=(L(x-1,y)+2L(x,y)+L(x+1,y)+L(x-1,y+1)+2L(x,y+1)+
L(x+1,y+1))/8 (3)In the embodiment of the present application, when the sizes of the reference luminance block and the reference chrominance block are inconsistent, the reference luminance block is downsampled to obtain downsampled luminance samples. The downsampling process can be expressed as:
L′(x,y)=(L(x-1,y)+2L(x,y)+L(x+1,y)+L(x-1,y+1)+2L(x,y+1)+
L(x+1,y+1))/8 (3)
在公式(3)中,L(x,y)表示参考亮度块中的像素点,L′(x,y)表示该像素点L(x,y)对应的下采样亮度样点。In formula (3), L(x, y) represents a pixel point in the reference luminance block, and L′(x, y) represents the downsampled luminance sample point corresponding to the pixel point L(x, y).
在本申请实施例中,将采样后的参考亮度块以及参考色度块作为参数推导的模板。In an embodiment of the present application, the sampled reference luminance block and the reference chrominance block are used as templates for parameter derivation.
在本申请实施例中,在跨分量预测模型为非线性模型的情况下,跨分量预测模型可以通过公式(4)表示:
In the embodiment of the present application, when the cross-component prediction model is a nonlinear model, the cross-component prediction model can be expressed by formula (4):
在公式(4)中,p0、p1、p2、p3、p4、p5、B为跨分量预测模型的模型参数,C为同位亮度块中的与当前色度块的目标色度样点对应的目标亮度样点的重建亮度值,N为位于目标亮度样点上方的亮度样点的重建亮度值,S为位于目标亮度样点下方的亮度样点的重建亮度值,W为位于目标亮度样点左方的亮度样点的重建亮度值,E为位于目标亮度样点右方的亮度样点的重建亮度值。C′为当前色度块的目标色度样点对应的预测色度值。In formula (4), p 0 , p 1 , p 2 , p 3 , p 4 , p 5 , B are model parameters of the cross-component prediction model, C is the reconstructed luminance value of the target luminance sample corresponding to the target chrominance sample of the current chrominance block in the same luminance block, N is the reconstructed luminance value of the luminance sample located above the target luminance sample, S is the reconstructed luminance value of the luminance sample located below the target luminance sample, W is the reconstructed luminance value of the luminance sample located to the left of the target luminance sample, and E is the reconstructed luminance value of the luminance sample located to the right of the target luminance sample. C′ is the predicted chrominance value corresponding to the target chrominance sample of the current chrominance block.
在本申请实施例中,在参考色度块中选取全部或部分参考色度样点,根据全部或部分参考色度样点、参考亮度块中的与全部或部分参考色度样点各自对应的参考亮度样点,以及参考亮度样点的邻域参考亮度样点,构建多个等式求解线性方程组,采用LDL求解方法,得到跨分量预测模型的模型参数p0、p1、p2、p3、p4、p5、B,从而得到非线性的跨分量预测模型。In an embodiment of the present application, all or part of the reference chroma samples are selected in the reference chroma block, and based on all or part of the reference chroma samples, the reference luminance samples corresponding to all or part of the reference chroma samples in the reference luminance block, and the neighborhood reference luminance samples of the reference luminance samples, multiple equations are constructed to solve the linear equation system, and the LDL solution method is used to obtain model parameters p0 , p1 , p2 , p3 , p4 , p5 , B of the cross-component prediction model, thereby obtaining a nonlinear cross-component prediction model.
在本申请实施例中,可以在参考亮度块和参考色度块中选择水平坐标和竖直坐标满足预设约束的样点,即水平坐标和竖直坐标均不是奇数的样点。可以表示为:!(x%2==1&&y%2==1)。In the embodiment of the present application, samples whose horizontal coordinates and vertical coordinates satisfy preset constraints can be selected in the reference luminance block and the reference chrominance block, that is, samples whose horizontal coordinates and vertical coordinates are not odd numbers. It can be expressed as: (x%2==1&&y%2==1).
可以理解的是,通过根据参考色度样点和相应的参考亮度样点建立跨分量预测模型,可以增强预测模型的适应性,使其更好地适应不同类型和场景的视频内容。考虑参考亮度样点的邻域参考亮度样点可以更全面地捕捉亮度信息,有助于改善预测模型的精度,这对于处理图像中的局部特征和纹理等信息可能很重要。通过更准确地建模跨分量关系,可以期望减少预测引入的失真,从而提高整体视频质量,包括更高的压缩效率和更好的视觉质量。It can be understood that by establishing a cross-component prediction model based on reference chrominance samples and corresponding reference luma samples, the adaptability of the prediction model can be enhanced to better adapt to video content of different types and scenes. Considering the neighborhood reference luma samples of the reference luma samples can more comprehensively capture the luma information, which helps to improve the accuracy of the prediction model, which may be important for processing information such as local features and textures in the image. By more accurately modeling cross-component relationships, it can be expected to reduce the distortion introduced by the prediction, thereby improving the overall video quality, including higher compression efficiency and better visual quality.
在本申请的一些实施例中,邻域参考亮度样点包括以下一项或多项:位于参考亮度样点上方的参考亮度样点(N)、位于参考亮度样点下方的参考亮度样点(S)、位于参考亮度样点左方的参考亮度样点(W)和位于参考亮度样点右方的参考亮度样点(E)。In some embodiments of the present application, the neighborhood reference brightness samples include one or more of the following: a reference brightness sample (N) located above the reference brightness sample, a reference brightness sample (S) located below the reference brightness sample, a reference brightness sample (W) located to the left of the reference brightness sample, and a reference brightness sample (E) located to the right of the reference brightness sample.
在本申请实施例中,通过考虑上述邻域参考亮度样点,可以更全面地捕捉亮度信息的上下文和局部特征,有助于提高跨分量预测模型的准确性和适应性,这样的信息考虑通常能够更好地模拟亮度分量在图像中的变化和纹理。In an embodiment of the present application, by considering the above-mentioned neighborhood reference brightness samples, the context and local features of the brightness information can be more comprehensively captured, which helps to improve the accuracy and adaptability of the cross-component prediction model. Such information consideration can usually better simulate the changes and textures of the brightness components in the image.
在本申请的一些实施例中,S401中在当前同位亮度块中确定满足预设的预测模式的候选参考样点的实现,可以包括:In some embodiments of the present application, the implementation of determining candidate reference samples satisfying a preset prediction mode in the current co-located luminance block in S401 may include:
根据预设的M个位置信息,在当前同位亮度块中对预设的M个位置信息各自对应的候选参考样点进行遍历,得到满足预设的预测模式的候选参考样点;其中,M为大于等于1的正整数,i为小于M的 正整数。According to the preset M position information, the candidate reference sample points corresponding to the preset M position information are traversed in the current co-located luminance block to obtain the candidate reference sample points that meet the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is an integer less than M. Positive integer.
在本申请实施例中,预设的M个位置信息,每个位置信息可能包括坐标或索引等信息,用于指定在当前同位亮度块中的某个位置。针对每一个预设的位置信息,进行遍历操作,在每次遍历中,会考虑该位置信息对应的候选参考样点。针对每个位置信息,找到与之对应的候选参考样点,这些候选参考样点可能根据位置信息的坐标或索引在当前同位亮度块中确定。对于每个候选参考样点,检查其是否满足预设的预测模式。将满足预设预测模式的候选参考样点收集起来,以备后续使用。In an embodiment of the present application, M pieces of preset position information are provided, each of which may include information such as coordinates or indices, for specifying a certain position in the current co-located luminance block. For each preset position information, a traversal operation is performed, and in each traversal, the candidate reference sample points corresponding to the position information are considered. For each position information, the candidate reference sample points corresponding thereto are found, and these candidate reference sample points may be determined in the current co-located luminance block according to the coordinates or indices of the position information. For each candidate reference sample point, it is checked whether it satisfies the preset prediction mode. The candidate reference sample points that satisfy the preset prediction mode are collected for subsequent use.
在本申请的一些实施例中,M个位置信息包括以下一项或多项:In some embodiments of the present application, the M pieces of location information include one or more of the following:
当前同位亮度块的中间的位置;The position of the middle of the current co-located luminance block;
当前同位亮度块的左上方的位置;The upper left position of the current co-located luminance block;
当前同位亮度块的右上方的位置;The upper right position of the current co-located luminance block;
当前同位亮度块的左下方的位置;The lower left position of the current co-located luminance block;
当前同位亮度块的右下方的位置。The lower right position of the current co-located luma block.
在本申请实施例中,预设的M个位置信息可以表示为{C,TL,TR,BL,BR}。其中,C表示当前同位亮度块的中间的位置,TL表示当前同位亮度块的左上方的位置,TR表示当前同位亮度块的右上方的位置,BL表示当前同位亮度块的左下方的位置,BR表示当前同位亮度块的右下方的位置。In the embodiment of the present application, the preset M position information can be expressed as {C, TL, TR, BL, BR}, where C represents the middle position of the current co-located luminance block, TL represents the upper left position of the current co-located luminance block, TR represents the upper right position of the current co-located luminance block, BL represents the lower left position of the current co-located luminance block, and BR represents the lower right position of the current co-located luminance block.
在本申请的一些实施例中,根据预设的M个位置信息,在当前同位亮度块中对预设的M个位置信息各自对应的候选参考样点进行遍历,得到满足预设的预测模式的候选参考样点,包括:In some embodiments of the present application, according to the preset M pieces of position information, candidate reference sample points corresponding to the preset M pieces of position information are traversed in the current co-located luminance block to obtain candidate reference sample points that meet the preset prediction mode, including:
针对预设的M个位置信息中的第i个位置信息,在当前同位亮度块中的与第i个位置信息对应的第i个候选参考样点不满足预设的预测模式的情况下,继续遍历当前同位亮度块中的与第i+1个位置信息对应的第i+1个候选参考样点,直至第i+1个候选参考样点满足预设的预测模式为止,将第i+1个候选参考样点确定为满足预设的预测模式的候选参考样点;或者,For the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or,
在第i个候选参考样点满足预设的预测模式的情况下,将第i个候选参考样点确定为满足预设的预测模式的候选参考样点。In the case that the i-th candidate reference sample point satisfies the preset prediction mode, the i-th candidate reference sample point is determined as a candidate reference sample point that satisfies the preset prediction mode.
在本申请实施例中,针对预设的M个位置信息中的第i个位置信息,考虑与之对应的第i个候选参考样点。判断当前同位亮度块中的第i个候选参考样点是否满足预设的预测模式,如果第i个候选参考样点不满足预设的预测模式,那么继续遍历当前同位亮度块中的与第i+1个位置信息对应的第i+1个候选参考样点。如果第i个候选参考样点满足预设的预测模式,那么将第i个候选参考样点确定为满足预设的预测模式的候选参考样点。In the embodiment of the present application, for the i-th position information among the preset M position information, the i-th candidate reference sample corresponding thereto is considered. It is determined whether the i-th candidate reference sample in the current co-located luminance block satisfies the preset prediction mode. If the i-th candidate reference sample does not satisfy the preset prediction mode, then the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block is traversed. If the i-th candidate reference sample satisfies the preset prediction mode, then the i-th candidate reference sample is determined as a candidate reference sample that satisfies the preset prediction mode.
可以理解的是,一方面,通过逐一检查每个位置信息,可以确保选取的候选参考样点在预测模式上更好地匹配预设的条件,提高了预测的准确性。一方面,选择满足预设条件的候选参考样点有助于提高图像块的预测质量,从而提升整体图像的视觉质量。一方面,通过预设的位置信息和条件,可以根据不同场景和要求选择合适的候选参考样点,使得预测模式更具灵活性和适应性。一方面,有效选择候选参考样点可以降低冗余信息,从而在视频压缩中提高解码的效率和性能。总的来说,上述步骤有助于提高视频编码中跨分量预测模型的性能,使其更好地适应不同的预测场景和要求。It can be understood that, on the one hand, by checking each position information one by one, it can be ensured that the selected candidate reference samples better match the preset conditions in the prediction mode, thereby improving the accuracy of the prediction. On the one hand, selecting candidate reference samples that meet the preset conditions helps to improve the prediction quality of the image block, thereby improving the visual quality of the overall image. On the one hand, through the preset position information and conditions, appropriate candidate reference samples can be selected according to different scenarios and requirements, making the prediction mode more flexible and adaptable. On the one hand, the effective selection of candidate reference samples can reduce redundant information, thereby improving the efficiency and performance of decoding in video compression. In general, the above steps help to improve the performance of the cross-component prediction model in video coding, so that it can better adapt to different prediction scenarios and requirements.
在本申请的一些实施例中,S304中基于跨分量预测模型,确定预测色度块的预测色度值的实现,可以包括S3041至S3042:In some embodiments of the present application, the implementation of determining the predicted chroma value of the predicted chroma block based on the cross-component prediction model in S304 may include S3041 to S3042:
S3041、通过跨分量预测模型,根据当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值;其中,候选色度预测块与当前色度块的大小不同。S3041. Determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through a cross-component prediction model; wherein the size of the candidate chrominance prediction block is different from that of the current chrominance block.
在本申请实施例中,将当前同位亮度块中的各个像素点的重建亮度值输入至跨分量预测模型中,得到候选色度预测块的候选预测色度值。In an embodiment of the present application, the reconstructed luminance value of each pixel in the current co-located luminance block is input into a cross-component prediction model to obtain a candidate predicted chrominance value of the candidate chrominance prediction block.
在本申请的一些实施例中,跨分量预测模型包括至少一个跨分量预测子模型;S3041中通过跨分量预测模型,根据当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值的实现,可以包括:In some embodiments of the present application, the cross-component prediction model includes at least one cross-component prediction sub-model; the implementation of determining the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model in S3041 may include:
针对当前同位亮度块中的每一像素点的重建亮度值,将每一像素点的重建亮度值输入至相对应的跨分量预测子模型中,得到每一像素点对应的候选预测色度值;其中,每一像素点的重建亮度值对应的预设亮度范围与跨分量预测子模型相匹配;For each pixel in the current co-located luminance block, the reconstructed luminance value of each pixel is input into the corresponding cross-component prediction sub-model to obtain a candidate predicted chrominance value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model;
根据当前同位亮度块中的各个像素点对应的候选预测色度值,确定候选色度预测块的候选预测色度值。Determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the candidate predicted chrominance value corresponding to each pixel in the current co-located luminance block.
示例性的,至少一个跨分量预测子模型包括:第一跨分量预测子模型、第二跨分量预测子模型、第三跨分量预测子模型和第四跨分量预测子模型。其中,第一跨分量预测子模型对应的亮度范围为0~50,第二跨分量预测子模型对应的亮度范围为51~100,第三跨分量预测子模型对应的亮度范围为101~200,第四跨分量预测子模型对应的亮度范围为201~255。那么,若当前同位亮度块中的某一亮度样点的像素 点为40,则该亮度样点采用第一跨分量预测子模型来得到该亮度样点对应的色度样点的候选预测色度值。若当前同位亮度块中的某一亮度样点的像素点为60,则该亮度样点采用第二跨分量预测子模型来得到该亮度样点对应的色度样点的候选预测色度值。若当前同位亮度块中的某一亮度样点的像素点为155,则该亮度样点采用第三跨分量预测子模型来得到该亮度样点对应的色度样点的候选预测色度值。若当前同位亮度块中的某一亮度样点的像素点为220,则该亮度样点采用第四跨分量预测子模型来得到该亮度样点对应的色度样点的候选预测色度值。Exemplarily, at least one cross-component prediction submodel includes: a first cross-component prediction submodel, a second cross-component prediction submodel, a third cross-component prediction submodel and a fourth cross-component prediction submodel. The first cross-component prediction submodel corresponds to a brightness range of 0 to 50, the second cross-component prediction submodel corresponds to a brightness range of 51 to 100, the third cross-component prediction submodel corresponds to a brightness range of 101 to 200, and the fourth cross-component prediction submodel corresponds to a brightness range of 201 to 255. Then, if the pixel of a brightness sample in the current co-located brightness block If the pixel point of a luma sample in the current co-located luma block is 40, the luma sample uses the first cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample. If the pixel point of a luma sample in the current co-located luma block is 60, the luma sample uses the second cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample. If the pixel point of a luma sample in the current co-located luma block is 155, the luma sample uses the third cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample. If the pixel point of a luma sample in the current co-located luma block is 220, the luma sample uses the fourth cross-component prediction sub-model to obtain the candidate predicted chroma value of the chroma sample corresponding to the luma sample.
可以理解的是,一方面,针对每个像素点使用不同的跨分量预测子模型,可以更好地适应图像中不同区域的亮度和色度特性,这种适应性有助于提高解码器在各种图像场景下的性能。一方面,每个像素点对应的预设亮度范围与跨分量预测子模型的使用,提供了对不同像素点的细粒度控制,这使得解码器能够更好地应对图像中可能存在的细微差异,提高解码的灵活性。总的来说,通过上述步骤有助于通过更精细的跨分量预测子模型,从而可以更好地捕捉亮度和色度之间的关系,进而提高了色度预测的质量和解码效率。It can be understood that, on the one hand, the use of different cross-component prediction sub-models for each pixel can better adapt to the brightness and chrominance characteristics of different areas in the image. This adaptability helps to improve the performance of the decoder in various image scenarios. On the one hand, the use of the preset brightness range corresponding to each pixel and the cross-component prediction sub-model provides fine-grained control of different pixels, which enables the decoder to better cope with subtle differences that may exist in the image and improves the flexibility of decoding. In general, the above steps help to better capture the relationship between brightness and chrominance through a more refined cross-component prediction sub-model, thereby improving the quality of chrominance prediction and decoding efficiency.
S3042、对候选色度预测块的候选预测色度值进行下采样,得到预测色度块的预测色度值。S3042. Downsample the candidate predicted chroma values of the candidate chroma prediction block to obtain predicted chroma values of the predicted chroma block.
在本申请实施例中,通过六抽头滤波器[1 2 1;1 2 1],对候选色度预测块的候选预测色度值进行下采样,该过程可以通过公式(5)表示:
Pchroma(x,y)=(Pt(2x-1,2y)+2×Pt(2x,2y)+Pt(2x+1,2y)+Pt(2x-1,2y+1)+
2×Pt(2x,2y+1)+Pt(2x+1,2y-1)+4)>>3 (5)In the embodiment of the present application, the candidate predicted chrominance values of the candidate chrominance prediction block are downsampled by a six-tap filter [1 2 1; 1 2 1]. This process can be expressed by formula (5):
P chroma (x,y)=(P t (2x-1,2y)+2×P t (2x,2y)+P t (2x+1,2y)+P t (2x-1,2y+1)+
2×P t (2x,2y+1)+P t (2x+1,2y-1)+4)>>3 (5)
在公式(5)中,Pchroma表示最终的预测色度块的预测色度值,假设预测色度块的大小为W×H,则x的取值范围为[0,W-1],y的取值范围为[0,H-1]。如图15所示,六抽头滤波器形状以及色度块预测像素点与中间预测块像素点(候选色度预测块的候选预测色度值)的对应位置的关系。In formula (5), P chroma represents the predicted chroma value of the final predicted chroma block. Assuming that the size of the predicted chroma block is W×H, the value range of x is [0, W-1], and the value range of y is [0, H-1]. As shown in Figure 15, the relationship between the shape of the six-tap filter and the corresponding positions of the chroma block prediction pixels and the intermediate prediction block pixels (candidate prediction chroma values of the candidate chroma prediction block).
可以理解的是,一方面,跨分量预测模型允许更好地捕捉亮度和色度之间的复杂关系,通过使用同位亮度块的重建亮度值,预测的色度值更能够准确地反映出图像中的细节和特征。一方面,由于候选色度预测块的大小不同于当前色度块,这种方法可以在尺寸上进行适应,使得预测更能够适应图像中不同区域的细节和结构。总的来说,上述步骤综合了信息捕捉、尺寸适应性和解码效率的优势,有助于提高色度预测的质量,并在保持高效解码的同时减小数据量。It can be understood that, on the one hand, the cross-component prediction model allows for better capture of the complex relationship between luminance and chrominance, and by using the reconstructed luminance value of the co-located luminance block, the predicted chrominance value can more accurately reflect the details and features in the image. On the other hand, since the size of the candidate chrominance prediction block is different from the current chrominance block, this method can adapt in size, making the prediction more adaptable to the details and structures of different regions in the image. In general, the above steps combine the advantages of information capture, size adaptability, and decoding efficiency, which helps to improve the quality of chrominance prediction and reduce the amount of data while maintaining efficient decoding.
在本申请的另一实施例中,参见图16其示出了本申请实施例提供的一种编码方法的流程示意图。如图16所示,该方法可以包括S501至S504:In another embodiment of the present application, referring to FIG16 , a schematic flow chart of an encoding method provided in an embodiment of the present application is shown. As shown in FIG16 , the method may include S501 to S504:
S501、根据当前色度块对应的当前同位亮度块,确定参考运动矢量。S501. Determine a reference motion vector according to a current co-located luminance block corresponding to a current chrominance block.
在本申请实施例中,同位亮度块是指与当前色度块对应的亮度块。示例性的,在YCbCr颜色空间中,对于每个色度块(Cb或Cr块),存在一个相同位置或相对位置的亮度块,这个亮度块被称为同位亮度块。In the embodiment of the present application, the co-located luminance block refers to a luminance block corresponding to the current chrominance block. For example, in the YCbCr color space, for each chrominance block (Cb or Cr block), there is a luminance block in the same position or relative position, and this luminance block is called the co-located luminance block.
在本申请实施例中,色度块和亮度块之间存在一种同位关系。示例性的,在YCbCr颜色空间中,图像被分为亮度分量(Y)和两个色度分量(Cb、Cr),亮度分量(Y)包含图像的黑白信息,而色度分量(Cb、Cr)包含颜色信息,色度分量的采样率通常比亮度分量低,这意味着对于每个亮度块,可能对应多个色度块。对于每个色度块,存在一个同位的亮度块,这意味着它们在图像中具有相同的位置或者一定的相对位置关系。通常,亮度块的大小比色度块的大小大,例如,一个亮度块可能对应一个4x4或8x8的像素块,而色度块可能对应较小的2x2或4x4的像素块。In an embodiment of the present application, there is a co-location relationship between the chrominance block and the brightness block. Exemplarily, in the YCbCr color space, the image is divided into a brightness component (Y) and two chrominance components (Cb, Cr). The brightness component (Y) contains the black and white information of the image, while the chrominance components (Cb, Cr) contain color information. The sampling rate of the chrominance component is usually lower than that of the brightness component, which means that for each brightness block, there may be multiple chrominance blocks. For each chrominance block, there is a co-location brightness block, which means that they have the same position or a certain relative position relationship in the image. Usually, the size of the brightness block is larger than the size of the chrominance block. For example, a brightness block may correspond to a 4x4 or 8x8 pixel block, while the chrominance block may correspond to a smaller 2x2 or 4x4 pixel block.
在本申请实施例中,参考运动矢量是用于预测当前图像块的运动信息。通常情况下,当前色度块对应的当前同位亮度块具有相同的运动矢量。将获取的运动矢量应用于当前色度块,以预测当前色度块的位置。这个预测过程有助于减小运动引起的残差,提高编码效率。In the embodiment of the present application, the reference motion vector is used to predict the motion information of the current image block. Usually, the current co-located luminance block corresponding to the current chrominance block has the same motion vector. The obtained motion vector is applied to the current chrominance block to predict the position of the current chrominance block. This prediction process helps to reduce the residual caused by motion and improve coding efficiency.
S502、在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型。S502: When the reference motion vector is valid, determine a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector.
在本申请的一些实施例中,在参考运动矢量满足参考运动矢量对应的参考亮度块或参考色度块未重建完成、参考运动矢量对应的参考亮度块或参考色度块的预测模式不匹配,以及参考运动矢量越界中至少一项的情况下,确定参考运动矢量为无效;或者,In some embodiments of the present application, when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds, the reference motion vector is determined to be invalid; or,
在参考运动矢量满足参考运动矢量对应的参考亮度块或参考色度块已重建完成、参考运动矢量对应的参考亮度块或参考色度块的预测模式相匹配,以及参考运动矢量未越界的情况下,确定参考运动矢量为有效。The reference motion vector is determined to be valid when the reference motion vector satisfies that the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector does not cross the boundary.
在本申请实施例中,判断参考运动矢量是否有效的实现可以包括步骤:In the embodiment of the present application, the implementation of determining whether the reference motion vector is valid may include the following steps:
步骤一、参考运动矢量对应的参考亮度块或参考色度块是否重建完成。Step 1: Check whether the reference luminance block or reference chrominance block corresponding to the reference motion vector has been reconstructed.
在本申请实施例中,在编码端,可能由于参考帧中的相应块尚未被完全编码,或者编码器尚未完成 对参考帧的编码,导致参考块未重建完成。这时,编码器可能需要等待参考块完全重建,或者采用一些错误处理机制。例如,可以选择跳过当前块的运动补偿,暂时使用其他方式进行填充或插值,以防止由于未完成的编码引起的错误。In the embodiment of the present application, at the encoding end, the corresponding block in the reference frame may not be fully encoded, or the encoder may not have completed The encoding of the reference frame results in the reference block not being reconstructed. At this point, the encoder may need to wait for the reference block to be fully reconstructed, or use some error handling mechanism. For example, it may choose to skip motion compensation for the current block and temporarily use other methods for filling or interpolation to prevent errors caused by incomplete encoding.
步骤二、参考运动矢量对应的参考亮度块或参考色度块的预测模式是否匹配。Step 2: Check whether the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches.
在本申请实施例中,参考块可能使用了与当前块不匹配的预测模式,这可能发生在帧内预测中,参考块可能使用了不同的预测模式。这时,编码器可能需要检测并纠正预测模式不匹配的情况,可能涉及到尝试根据当前块的预测模式调整参考块的预测模式,或者进行其他的错误恢复策略。In an embodiment of the present application, the reference block may use a prediction mode that does not match the current block. This may occur in intra-frame prediction, where the reference block may use a different prediction mode. At this time, the encoder may need to detect and correct the prediction mode mismatch, which may involve trying to adjust the prediction mode of the reference block according to the prediction mode of the current block, or performing other error recovery strategies.
步骤三、参考运动矢量是否越界。Step 3: Check whether the reference motion vector is out of bounds.
在本申请实施例中,参考运动矢量的值可能超出了规定的范围,这可能是由于编码错误、传输错误或其他异常情况引起的。在编码端,需要检测并处理越界的情况。可能的处理方式包括裁剪运动矢量的值,使其保持在有效的范围内,或者采用其他的错误处理手段。In an embodiment of the present application, the value of the reference motion vector may exceed the specified range, which may be caused by a coding error, a transmission error, or other abnormal conditions. At the encoding end, it is necessary to detect and handle the out-of-bounds situation. Possible processing methods include clipping the value of the motion vector to keep it within the valid range, or using other error handling methods.
可以理解的是,上述步骤是为了确保参考运动矢量的合法性,防止错误或无效的参考运动矢量影响编码质量。编码器通过检测和处理这些情况,保证了编码的准确性和鲁棒性,从而提高了视频编码的可靠性。It is understandable that the above steps are to ensure the legitimacy of the reference motion vector and prevent erroneous or invalid reference motion vectors from affecting the encoding quality. The encoder ensures the accuracy and robustness of the encoding by detecting and processing these situations, thereby improving the reliability of video encoding.
S503、基于跨分量预测模型,确定预测色度块的预测色度值,并根据预测色度值,确定第一语法标识信息;其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式。S503. Determine a predicted chroma value of a predicted chroma block based on a cross-component prediction model, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra-frame block copy technology.
在本申请实施例中,跨分量预测模型表征当前色度块对应的当前同位亮度块的重建亮度值与预测色度块的预测色度值具有关系。In the embodiment of the present application, the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a relationship with the predicted chrominance value of the predicted chrominance block.
在本申请的一些实施例中,跨分量预测模型表征当前色度块对应的当前同位亮度块的重建亮度值与预测色度块的预测色度值具有线性或者非线性关系。In some embodiments of the present application, the cross-component prediction model characterizes that the reconstructed luminance value of the current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with the predicted chrominance value of the predicted chrominance block.
需要说明的是,线性的跨分量预测模型可以提高编码效率并去除色度分量的冗余,以使得该模型在实际场景中能够较好地拟合亮度和色度之间的关系。通过使用线性的跨分量预测模型,编码器可以更准确地估计色度分量的值,从而在编码过程中实现更好的压缩效果,这对于提高视频编码的性能和质量是有益的。It should be noted that the linear cross-component prediction model can improve coding efficiency and remove the redundancy of chrominance components, so that the model can better fit the relationship between brightness and chrominance in actual scenes. By using a linear cross-component prediction model, the encoder can more accurately estimate the value of the chrominance component, thereby achieving better compression effect during the encoding process, which is beneficial to improving the performance and quality of video encoding.
在本申请的一些实施例中,S503中根据预测色度值,确定第一语法标识信息的实现,可以包括:In some embodiments of the present application, the implementation of determining the first syntax identification information according to the predicted chrominance value in S503 may include:
根据当前色度块的原始色度值和预测色度值,确定当前色度块的色度残差值;Determine a chroma residual value of the current chroma block according to an original chroma value and a predicted chroma value of the current chroma block;
对当前色度块的色度残差值进行率失真代价计算,得到当前色度块采用基于色度帧内块复制技术的跨分量预测模式对应的第一率失真代价值;Performing rate-distortion cost calculation on the chroma residual value of the current chroma block to obtain a first rate-distortion cost value corresponding to the cross-component prediction mode based on the chroma intra-frame block copy technology adopted by the current chroma block;
根据第一率失真代价值,确定当前色度块采用的预测模式;Determining a prediction mode adopted by a current chroma block according to a first rate-distortion cost value;
根据当前色度块采用的预测模式,确定第一语法标识信息。The first syntax identification information is determined according to the prediction mode adopted by the current chroma block.
在本申请实施例中,将对应位置上的原始色度值与预测色度值相减,得到每个像素点的色度残差(即色度残差值)。这是通过比较实际观察到的色度值和模型预测的值之间的差异来量化预测误差。In the embodiment of the present application, the original chromaticity value at the corresponding position is subtracted from the predicted chromaticity value to obtain the chromaticity residual (i.e., chromaticity residual value) of each pixel. This is to quantify the prediction error by comparing the difference between the actually observed chromaticity value and the value predicted by the model.
在本申请实施例中,计算当前色度块的原始色度值与重建色度值之间的失真。失真可以使用各种测量方法,常见的包括均方误差(Mean Squared Error,MSE)或其他的结构相似性指数(Structural Similarity Index,SSI)等。这一步表示了在压缩和解压缩中引入的图像质量损失。计算用于表示色度残差值的比特数。这个比特数通常通过编码器的输出数据的长度来测量,它表示了在传输或存储中所需的比特数,用于表示当前色度块的色度残差。将失真和压缩率结合起来,形成一个综合的评价指标。常见的计算方式是将失真与压缩率进行线性组合,或者通过一些复杂的数学模型进行更精细的评估。In an embodiment of the present application, the distortion between the original chrominance value and the reconstructed chrominance value of the current chrominance block is calculated. Various measurement methods can be used for distortion, common ones include mean square error (MSE) or other structural similarity index (SSI). This step represents the image quality loss introduced in compression and decompression. Calculate the number of bits used to represent the chrominance residual value. This number of bits is usually measured by the length of the output data of the encoder, which represents the number of bits required in transmission or storage to represent the chrominance residual of the current chrominance block. Combine the distortion and compression rate to form a comprehensive evaluation index. A common calculation method is to linearly combine the distortion and compression rate, or to perform a more sophisticated evaluation through some complex mathematical models.
在本申请实施例中,通常会使用一些常见的率失真优化算法,例如变量比特率(Variable Bit Rate,VBR)和固定比特率(Constant Bit Rate,CBR),以在满足给定比特率或质量要求的前提下最小化失真。这有助于实现更有效的视频压缩和传输。In the embodiments of the present application, some common rate-distortion optimization algorithms, such as variable bit rate (VBR) and constant bit rate (CBR), are usually used to minimize distortion while meeting a given bit rate or quality requirement. This helps to achieve more efficient video compression and transmission.
在本申请的一些实施例中,将第一语法标识信息进行编码处理,将所得到的编码比特写入码流。In some embodiments of the present application, the first syntax identification information is encoded, and the obtained encoded bits are written into a bitstream.
在本申请的一些实施例中,根据第一率失真代价值,确定当前色度块采用的预测模式的实现,可以包括:In some embodiments of the present application, the implementation of determining the prediction mode adopted by the current chroma block according to the first rate-distortion cost value may include:
在第一率失真代价值小于或者等于预设的一个或多个候选预测模式各自对应的第二率失真代价值的情况下,确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式;When the first rate-distortion cost value is less than or equal to the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes, determining that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology;
在第一率失真代价值大于预设的一个或多个候选预测模式各自对应的第二率失真代价值的情况下,确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式。When the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes, it is determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology.
可以理解的是,一方面,通过选择合适的预测模式,可以减少图像或视频的失真,提高视觉质量。一方面,通过选择合适的预测模式,可以减少图像或视频的失真,提高视觉质量。一方面,动态决策机制允许系统根据实际情况调整预测模式,从而更好地适应不同类型的内容和场景。一方面,通过提高视 频编码效率,可以在有限的带宽和存储条件下提供更好的用户体验。It can be understood that, on the one hand, by selecting an appropriate prediction mode, the distortion of the image or video can be reduced and the visual quality can be improved. On the one hand, by selecting an appropriate prediction mode, the distortion of the image or video can be reduced and the visual quality can be improved. On the one hand, the dynamic decision mechanism allows the system to adjust the prediction mode according to the actual situation, so as to better adapt to different types of content and scenes. Video coding efficiency can provide a better user experience under limited bandwidth and storage conditions.
在本申请的一些实施例中,一个或多个候选预测模式包括:色度帧内块复制预测模式;在第一率失真代价值大于预设的一个或多个候选预测模式各自对应的第二率失真代价值的情况下,确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式,包括:In some embodiments of the present application, the one or more candidate prediction modes include: a chroma intra block copy prediction mode; when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes, determining that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology includes:
在第一率失真代价值大于色度帧内块复制预测模式对应的第二率失真代价值的情况下,确定当前色度块采用色度帧内块复制预测模式。When the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to the chroma intra block copy prediction mode, it is determined that the current chroma block adopts the chroma intra block copy prediction mode.
在本申请的一些实施例中,根据当前色度块采用的预测模式,确定第一语法标识信息的实现,可以包括:In some embodiments of the present application, the implementation of determining the first syntax identification information according to the prediction mode adopted by the current chroma block may include:
在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,确定第一语法标识信息的取值为第三值;或者,In the case where it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology, determining that the value of the first syntax identification information is a third value; or,
在确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式的情况下,确定第一语法标识信息的取值为第四值。When it is determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra block copy technology, it is determined that the value of the first syntax identification information is a fourth value.
示例性的,第一语法标识信息可以表示为tcibc_flag。Exemplarily, the first syntax identification information may be represented as tcibc_flag.
需要说明的是,在本申请实施例中,第三值与第四值不同,而且第三值和第四值可以是参数形式,也可以是数字形式。具体地,第一语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the third value is different from the fourth value, and the third value and the fourth value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第三值和第四值而言,第三值可以设置为1,第四值可以设置为0;或者,第三值可以设置为0,第四值可以设置为1;或者,第三值可以设置为true,第四值可以设置为false;或者,第三值可以设置为false,第四值可以设置为true;但是这里并不作具体限定。Exemplarily, for the third value and the fourth value, the third value can be set to 1 and the fourth value can be set to 0; or, the third value can be set to 0 and the fourth value can be set to 1; or, the third value can be set to true and the fourth value can be set to false; or, the third value can be set to false and the fourth value can be set to true; but this is not specifically limited here.
在本申请实施例中,以写入码流中的flag为例,假设第三值设置为1(true),第四值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定当前色度块不采用基于色度帧内块复制技术的跨分量预测模式;如果第一语法标识信息的取值为1(true),那么可以确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the third value is set to 1 (true) and the fourth value is set to 0 (false), at this time if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra-frame block copy technology; if the value of the first syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology.
在本申请的一些实施例中,方法还包括:In some embodiments of the present application, the method further comprises:
确定第二语法标识信息;Determining second grammar identification information;
将第二语法标识信息进行编码处理,将所得到的编码比特写入码流;Encoding the second syntax identification information, and writing the obtained coded bits into the bitstream;
确定第二语法标识信息,包括:Determining the second grammar identification information includes:
在确定当前色度块采用色度帧内块复制预测模式的情况下,则将第二语法标识信息的取值设置为第一值;或者,When it is determined that the current chroma block adopts the chroma intra block copy prediction mode, the value of the second syntax identification information is set to the first value; or,
在确定当前色度块不采用色度帧内块复制预测模式的情况下,则将第二语法标识信息的取值设置为第二值。When it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode, the value of the second syntax identification information is set to the second value.
需要说明的是,在本申请实施例中,第一值与第二值不同,而且第一值和第二值可以是参数形式,也可以是数字形式。具体地,第二语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form. Specifically, the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第一值和第二值而言,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为true,第二值可以设置为false;或者,第一值可以设置为false,第二值可以设置为true;但是这里并不作具体限定。Exemplarily, for the first value and the second value, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.
在本申请实施例中,以写入码流中的flag为例,假设第一值设置为1(true),第二值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定当前色度块采用色度帧内块复制预测模式;如果第二语法标识信息的取值为1(true),那么可以确定当前色度块不采用色度帧内块复制预测模式。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the first value is set to 1 (true) and the second value is set to 0 (false), if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode; if the value of the second syntax identification information is 1 (true), then it can be determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode.
在本申请实施例中,在AVS4探索阶段参考软件EVM-0.2中,当前色度块的预测模式部分,首先编码CIBC相关标志位,其次加入本方案TSCPM_CIBC技术的相关标志位,再然后编码其他色度帧内预测模式标志位,第一语法标识信息的结构如表1所示:In the embodiment of the present application, in the AVS4 exploration phase reference software EVM-0.2, the prediction mode part of the current chroma block first encodes the CIBC related flag, then adds the related flag of the TSCPM_CIBC technology of this scheme, and then encodes other chroma intra-frame prediction mode flags. The structure of the first syntax identification information is shown in Table 1:
表1
Table 1
在表1中,可以看出,在确定当前色度块采用色度帧内块复制预测模式的情况下,写入码流的二进 制字符串为1,在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,写入码流的二进制字符串为01,在确定当前色度块采用其他色度帧内预测模式的情况下,写入码流的二进制字符串为00*。In Table 1, it can be seen that when it is determined that the current chroma block adopts the chroma intra block copy prediction mode, the binary The binary string is 1. When it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, the binary string written to the bitstream is 01. When it is determined that the current chroma block adopts other chroma intra-frame prediction modes, the binary string written to the bitstream is 00*.
在本申请实施例中,针对表1所示的第一语法标识信息的结构,该模式通过在当前色度块相关码流中编码一个标志位tcibc_flag指示是否使用基于色度帧内块复制技术的跨分量预测模式。In an embodiment of the present application, with respect to the structure of the first syntax identification information shown in Table 1, the mode indicates whether to use the cross-component prediction mode based on the chroma intra-frame block copying technology by encoding a flag bit tcibc_flag in the current chroma block related code stream.
具体地,若当前色度块不使用CIBC模式,即cibc_flag为0的情况下,并且满足TSCPM_CIBC技术的开启条件,此时需要在码流中编码一个标志位tcibc_flag用于指示是否使用该模式。若tcibc_flag为1,表示当前色度块使用TSCPM_CIBC模式,则无需继续编码其他模式的标志位。若tcibc_flag为0,表示当前色度块不使用TSCPM_CIBC模式,需要继续编码其他确定预测模式的相关标志位。Specifically, if the current chroma block does not use the CIBC mode, that is, cibc_flag is 0, and the conditions for starting the TSCPM_CIBC technology are met, a flag bit tcibc_flag needs to be encoded in the bitstream to indicate whether the mode is used. If tcibc_flag is 1, it means that the current chroma block uses the TSCPM_CIBC mode, and there is no need to continue encoding flag bits for other modes. If tcibc_flag is 0, it means that the current chroma block does not use the TSCPM_CIBC mode, and it is necessary to continue encoding other flag bits related to determining the prediction mode.
在本申请的一些实施例中,根据当前色度块采用的预测模式,确定第一语法标识信息的实现,可以包括:In some embodiments of the present application, the implementation of determining the first syntax identification information according to the prediction mode adopted by the current chroma block may include:
在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,则将第一语法标识信息的取值设置为第七值;或者,When it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology, the value of the first syntax identification information is set to the seventh value; or,
在确定当前色度块采用色度帧内块复制预测模式的情况下,则将第一语法标识信息的取值设置为第八值。When it is determined that the current chroma block adopts the chroma intra block copy prediction mode, the value of the first syntax identification information is set to the eighth value.
示例性的,第一语法标识信息可以表示为tcibc_flag。Exemplarily, the first syntax identification information may be represented as tcibc_flag.
需要说明的是,在本申请实施例中,第七值与第八值不同,而且第七值和第八值可以是参数形式,也可以是数字形式。具体地,第一语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the seventh value is different from the eighth value, and the seventh value and the eighth value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第七值和第八值而言,第七值可以设置为1,第八值可以设置为0;或者,第七值可以设置为0,第八值可以设置为1;或者,第七值可以设置为true,第八值可以设置为false;或者,第七值可以设置为false,第八值可以设置为true;但是这里并不作具体限定。Exemplarily, for the seventh value and the eighth value, the seventh value can be set to 1 and the eighth value can be set to 0; or, the seventh value can be set to 0 and the eighth value can be set to 1; or, the seventh value can be set to true and the eighth value can be set to false; or, the seventh value can be set to false and the eighth value can be set to true; but no specific limitation is made here.
在本申请实施例中,以写入码流中的flag为例,假设第七值设置为1(true),第八值设置为0(false),这时候如果第二语法标识信息的取值为0(false),那么可以确定所述当前色度块采用色度帧内块复制预测模式;如果第一语法标识信息的取值为1(true),那么可以确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the seventh value is set to 1 (true) and the eighth value is set to 0 (false), at this time if the value of the second syntax identification information is 0 (false), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode; if the value of the first syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology.
在本申请的一些实施例中,方法还包括:In some embodiments of the present application, the method further comprises:
确定第三语法标识信息;Determining third grammar identification information;
将第三语法标识信息进行编码处理,将所得到的编码比特写入码流;Encoding the third syntax identification information, and writing the obtained coded bits into a bit stream;
确定第三语法标识信息,包括:Determining third grammar identification information includes:
在确定当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,则将第三语法标识信息的取值设置为第五值;或者,When it is determined that the current chroma block adopts the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology, the value of the third syntax identification information is set to the fifth value; or,
在确定当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,则将第三语法标识信息的取值设置为第六值。When it is determined that the current chroma block does not adopt the chroma intra block copy prediction mode or the cross-component prediction mode based on the chroma intra block copy technology, the value of the third syntax identification information is set to the sixth value.
示例性的,第三语法标识信息可以表示为cibc_flag。Exemplarily, the third syntax identification information may be represented as cibc_flag.
需要说明的是,在本申请实施例中,第五值与第六值不同,而且第五值和第六值可以是参数形式,也可以是数字形式。具体地,第二语法标识信息可以是写入在概述(profile)中的参数,也可以是一个标志(flag)的取值,这里对此不作具体限定。It should be noted that, in the embodiment of the present application, the fifth value is different from the sixth value, and the fifth value and the sixth value can be in parameter form or in digital form. Specifically, the second syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.
示例性地,对于第五值和第六值而言,第五值可以设置为1,第六值可以设置为0;或者,第五值可以设置为0,第六值可以设置为1;或者,第五值可以设置为true,第六值可以设置为false;或者,第五值可以设置为false,第六值可以设置为true;但是这里并不作具体限定。Exemplarily, for the fifth value and the sixth value, the fifth value can be set to 1 and the sixth value can be set to 0; or, the fifth value can be set to 0 and the sixth value can be set to 1; or, the fifth value can be set to true and the sixth value can be set to false; or, the fifth value can be set to false and the sixth value can be set to true; but no specific limitation is made here.
在本申请实施例中,以写入码流中的flag为例,假设第五值设置为1(true),第六值设置为0(false),这时候如果第三语法标识信息的取值为0(false),那么可以确定当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式;如果第二语法标识信息的取值为1(true),那么可以确定当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式。In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the fifth value is set to 1 (true) and the sixth value is set to 0 (false), at this time if the value of the third syntax identification information is 0 (false), then it can be determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology; if the value of the second syntax identification information is 1 (true), then it can be determined that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology.
需要说明的是,上述的第一值、第二值、第三值、第四值、第五值、第六值、第七值和第八值,可以采用相同的表示形式(即参数形式或数字形式)。示例性的,第一值、第三值、第五值和第七值可以取1或True,第二值、第四值、第六值和第八值可以取0或False。It should be noted that the first value, the second value, the third value, the fourth value, the fifth value, the sixth value, the seventh value and the eighth value may be expressed in the same form (i.e., parameter form or digital form). For example, the first value, the third value, the fifth value and the seventh value may be 1 or True, and the second value, the fourth value, the sixth value and the eighth value may be 0 or False.
在本申请实施例中,在AVS4探索阶段参考软件EVM-0.2中,针对当前色度块的预测模式部分,第一语法标识信息的结构如表2所示:In the embodiment of the present application, in the AVS4 exploration phase reference software EVM-0.2, for the prediction mode part of the current chroma block, the structure of the first syntax identification information is shown in Table 2:
表2
Table 2
在表2中,可以看出,在确定当前色度块采用色度帧内块复制预测模式的情况下,写入码流的二进制字符串为10,在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,写入码流的二进制字符串为11,在确定当前色度块采用其他色度帧内预测模式的情况下,写入码流的二进制字符串为0*。In Table 2, it can be seen that when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, the binary string written to the code stream is 10, when it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, the binary string written to the code stream is 11, and when it is determined that the current chroma block adopts other chroma intra-frame prediction modes, the binary string written to the code stream is 0*.
在本申请实施例中,针对表2所示的第一语法标识信息的结构,该模式通过在当前色度块相关码流中编码一个标志位tcibc_flag指示是否使用基于色度帧内块复制技术的跨分量预测模式。若当前色度块的标志位cibc_flag的值为0,跳过CIBC模式和TSCPM_CIBC模式的编码。继续编码其他确定预测模式的相关标志位。若当前色度块的标志位cibc_flag的值为1,则继续编码tcibc_flag的值指示具体使用CIBC或TSCPM_CIBC模式,若tcibc_flag的值为0,则当前块的预测模式为CIBC;若tcibc_flag的值为1,则当前块的预测模式为TSCPM_CIBC。In an embodiment of the present application, with respect to the structure of the first syntax identification information shown in Table 2, the mode indicates whether to use the cross-component prediction mode based on the chroma intra-frame block copying technology by encoding a flag bit tcibc_flag in the current chroma block related code stream. If the value of the flag bit cibc_flag of the current chroma block is 0, the encoding of the CIBC mode and the TSCPM_CIBC mode is skipped. Other related flag bits for determining the prediction mode are continued to be encoded. If the value of the flag bit cibc_flag of the current chroma block is 1, the value of tcibc_flag is continued to be encoded to indicate whether the CIBC or TSCPM_CIBC mode is specifically used. If the value of tcibc_flag is 0, the prediction mode of the current block is CIBC; if the value of tcibc_flag is 1, the prediction mode of the current block is TSCPM_CIBC.
在本申请的一些实施例中,编码方法还包括S506:In some embodiments of the present application, the encoding method further includes S506:
S506、参考运动矢量为无效的情况下,根据当前色度块的样本精度,确定预测色度块的预测色度值。S506: When the reference motion vector is invalid, determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block.
在本申请实施例中,当前色度块的样本精度指的是色度分量(Chroma)的表示精度,通常以位数(Bit-Depth)为单位来表示,通常使用较高的样本精度来保留图像中的细节和色彩信息。例如,8位样本精度表示每个色度分量用8个二进制位(或比特)来表示。这样,每个色度分量可以有2^8=256个不同的离散级别。这些级别对应于颜色的变化,因此更高的样本精度意味着能够表示更多的颜色细节。更高的样本精度可以提供更多的颜色级别,从而提高颜色分辨率。这对于保留图像中的细微色彩差异非常重要。高样本精度有助于更准确地表示真实世界中的颜色,提高色彩保真度。选择适当的样本精度也涉及到编码效率的平衡。更高的样本精度可能需要更多的比特来表示每个像素,从而增加了编码后的数据量。In an embodiment of the present application, the sample accuracy of the current chrominance block refers to the representation accuracy of the chrominance component (Chroma), which is usually expressed in bits (Bit-Depth), and a higher sample accuracy is usually used to retain the details and color information in the image. For example, 8-bit sample accuracy means that each chrominance component is represented by 8 binary bits (or bits). In this way, each chrominance component can have 2^8=256 different discrete levels. These levels correspond to color changes, so higher sample accuracy means that more color details can be represented. Higher sample accuracy can provide more color levels, thereby improving color resolution. This is very important for retaining subtle color differences in images. High sample accuracy helps to more accurately represent colors in the real world and improve color fidelity. Selecting an appropriate sample accuracy also involves a balance in coding efficiency. Higher sample accuracy may require more bits to represent each pixel, thereby increasing the amount of encoded data.
在本申请的一些实施例中,S506中根据当前色度块的样本精度,确定预测色度块的预测色度值的实现,可以包括S5061至S5062:In some embodiments of the present application, the implementation of determining the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block in S506 may include S5061 to S5062:
S5061、将样本精度与第一预设值进行减法运算,得到第四中间参数。S5061. Perform a subtraction operation on the sample accuracy and the first preset value to obtain a fourth intermediate parameter.
S5062、将第二预设值与第四中间参数进行指数运算,得到预测色度块中各个像素点的预测色度值。S5062. Perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
在本申请实施例中,第一预设值和第二预设值为预先设置好的值,示例性的,第一预设值为1,第二预设值为2。In the embodiment of the present application, the first preset value and the second preset value are pre-set values. For example, the first preset value is 1 and the second preset value is 2.
在本申请实施例中,第四中间参数可以表示为BitDepth-1。In the embodiment of the present application, the fourth intermediate parameter can be expressed as BitDepth-1.
在本申请实施例中,预测色度块中各个像素点的预测色度值可以表示为2BitDepth-1。In the embodiment of the present application, the predicted chrominance value of each pixel in the predicted chrominance block can be expressed as 2 BitDepth-1 .
可以理解的是,通过样本精度、预设值和指数运算来生成预测色度块中各个像素点的预测色度值。通过调整样本精度和不同的预设值,可以探索不同的预测色度值,从而在视频编码中提供更灵活的调整和优化选项,有助于在视频编码中更好地适应不同的应用场景和需求。It can be understood that the predicted chrominance value of each pixel in the predicted chrominance block is generated through sample precision, preset value and exponential operation. By adjusting the sample precision and different preset values, different predicted chrominance values can be explored, thereby providing more flexible adjustment and optimization options in video encoding, which helps to better adapt to different application scenarios and requirements in video encoding.
S504、根据预测色度块的预测色度值,确定当前色度块的重建色度值。S504: Determine a reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
在本申请的一些实施例中,在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,对色度残差值进行变换处理和量化处理,得到当前色度块的量化色度残差值;In some embodiments of the present application, when it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra block copy technology, the chroma residual value is transformed and quantized to obtain a quantized chroma residual value of the current chroma block;
将当前色度块的是量化色度残差值进行编码处理,将所得到的编码比特写入码流。The quantized chroma residual value of the current chroma block is encoded, and the obtained encoding bits are written into the bit stream.
在本申请实施例中,色度残差值表示了当前色度块的原始色度值与预测色度值之间的差异,这些残差值在编码时需要进行处理,包括变换和量化。色度残差值可能通过一些变换(如离散余弦变换,DCT)来改变其表示形式,这个变换有助于将数据表示为频域系数,通常通过去除冗余信息来提高数据的压缩性能。变换后的频域系数需要量化,以减小数据量。量化是通过将系数映射到离散的值域来实现的,这会引入信息损失。在量化过程中,可以使用不同的步长(量化步长)来控制压缩水平。较大的量化步长会导致更多的信息损失,但也会产生更高的压缩比。In an embodiment of the present application, the chrominance residual value represents the difference between the original chrominance value and the predicted chrominance value of the current chrominance block, and these residual values need to be processed during encoding, including transformation and quantization. The chrominance residual value may change its representation through some transformations (such as discrete cosine transform, DCT). This transformation helps to represent the data as frequency domain coefficients, and usually improves the compression performance of the data by removing redundant information. The transformed frequency domain coefficients need to be quantized to reduce the amount of data. Quantization is achieved by mapping the coefficients to a discrete value domain, which introduces information loss. During the quantization process, different step sizes (quantization step sizes) can be used to control the compression level. Larger quantization step sizes will result in more information loss, but will also produce higher compression ratios.
可以理解的是,通过上述步骤,得到的量化色度残差值可以更有效地编码和传输,因为它们的数据量较小。相应的,在解码端,接收到的量化色度残差值会被逆量化和逆变换,以还原为最终的重建色度值。该过程是压缩编码中的一个关键步骤,用于在减小数据量的同时尽可能地保持图像质量。It can be understood that through the above steps, the quantized chrominance residual values obtained can be encoded and transmitted more efficiently because their data volume is small. Accordingly, at the decoding end, the received quantized chrominance residual values are inversely quantized and inversely transformed to restore the final reconstructed chrominance values. This process is a key step in compression coding, which is used to maintain image quality as much as possible while reducing the amount of data.
在本申请实施例中,提供了一种编码方法,该方法包括:在编码端,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值,并根据预测色度值,确定第一语法标识信息;其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧 内块复制技术的跨分量预测模式;根据预测色度块的预测色度值,确定当前色度块的重建色度值。由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编码场景,从而提高了对当前色度块的编码效率。In an embodiment of the present application, a coding method is provided, the method comprising: at the coding end, determining a reference motion vector according to a current co-located luminance block corresponding to a current chrominance block; when the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector; determining a predicted chrominance value of the predicted chrominance block based on the cross-component prediction model, and determining first syntax identification information according to the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a chrominance frame-based The cross-component prediction mode of the intra-block copy technology; according to the predicted chrominance value of the predicted chrominance block, the reconstructed chrominance value of the current chrominance block is determined. Since the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding scenarios, thereby improving the encoding efficiency of the current chrominance block.
可以理解的是,一方面,根据当前色度块对应的当前同位亮度块,确定参考运动矢量。这一步骤有助于将亮度块的信息引入到色度块的编码过程中,以提高对运动相关性的准确处理。一方面,基于跨分量预测模型,确定预测色度块的预测色度值,充分利用了亮度块的信息,帮助提高了对色度块的预测准确性,有助于在编码端更准确地还原原始图像中的色度信息,提高图像质量。总的来说,通过上述过程可以提高对色度块的编码准确性、增强图像质量、利用跨分量相关性等方面。通过引入亮度块的信息,编码过程更全面地利用了视频图像中不同分量之间的关联,从而提高了编码效果。It can be understood that, on the one hand, the reference motion vector is determined according to the current co-located luminance block corresponding to the current chrominance block. This step helps to introduce the information of the luminance block into the encoding process of the chrominance block to improve the accurate processing of motion correlation. On the one hand, based on the cross-component prediction model, the predicted chrominance value of the predicted chrominance block is determined, which makes full use of the information of the luminance block, helps to improve the prediction accuracy of the chrominance block, and helps to more accurately restore the chrominance information in the original image at the encoding end, thereby improving the image quality. In general, the above process can improve the encoding accuracy of the chrominance block, enhance the image quality, and utilize cross-component correlation. By introducing the information of the luminance block, the encoding process more comprehensively utilizes the correlation between different components in the video image, thereby improving the encoding effect.
在本申请的一些实施例中,S502中根据当前色度块对应的当前同位亮度块,确定参考运动矢量的实现,可以包括S601:In some embodiments of the present application, the implementation of determining the reference motion vector according to the current co-located luminance block corresponding to the current chrominance block in S502 may include S601:
S601、在当前同位亮度块中确定满足预设的预测模式的候选参考样点,并将候选参考样点对应的运动矢量作为参考运动矢量。S601: Determine candidate reference samples that meet a preset prediction mode in a current co-located luminance block, and use motion vectors corresponding to the candidate reference samples as reference motion vectors.
在本申请的一些实施例中,预设的预测模式:候选参考样点采用块复制帧内预测模式(Intra Block Copy,IBC)或者串复制帧内预测的普通串子模式。In some embodiments of the present application, the preset prediction mode is: the candidate reference samples adopt the block copy intra prediction mode (Intra Block Copy, IBC) or the ordinary string sub-mode of string copy intra prediction.
在本申请实施例中,编码器在当前同位亮度块中确定满足块复制帧内预测模式或串复制帧内预测的普通串子模式的候选参考样点,并将候选参考样点对应的运动矢量作为参考运动矢量。In an embodiment of the present application, the encoder determines candidate reference samples that satisfy the block copy intra prediction mode or the common string sub-mode of string copy intra prediction in the current co-located luminance block, and uses the motion vector corresponding to the candidate reference sample as the reference motion vector.
可以理解的是,上述过程的目的是为了在编码过程中能够准确地描述当前块与参考帧中的块之间的关系,以提高预测的准确性。通过确定候选参考样点和相应的运动矢量,编码器能够更好地还原当前块的内容,实现更好的图像质量。It is understandable that the purpose of the above process is to accurately describe the relationship between the current block and the blocks in the reference frame during the encoding process to improve the accuracy of the prediction. By determining the candidate reference samples and the corresponding motion vectors, the encoder can better restore the content of the current block and achieve better image quality.
需要说明的是,块复制帧内预测模式和串复制帧内预测的普通串子模式都是为了在帧内进行预测而设计的,通过对已编码块中的像素值进行复制,提供了一种基于相邻块的简单而有效的预测方式。块复制帧内预测模式主要强调整个块的复制,而串复制帧内预测的普通串子模式更强调像素值的有序串联。选择使用哪种模式通常依赖于编码标准和具体的图像内容。这些帧内预测模式有助于提高视频编码的效率,减小数据量,从而实现更好的压缩性能。It should be noted that both the block copy intra prediction mode and the common string sub-mode of string copy intra prediction are designed for prediction within a frame. By copying the pixel values in the coded block, a simple and effective prediction method based on adjacent blocks is provided. The block copy intra prediction mode mainly emphasizes the copying of the entire block, while the common string sub-mode of string copy intra prediction emphasizes the orderly concatenation of pixel values. The choice of which mode to use usually depends on the coding standard and the specific image content. These intra prediction modes help improve the efficiency of video coding and reduce the amount of data, thereby achieving better compression performance.
在本申请的一些实施例中,跨分量预测模型为线性模型;S503中基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型的实现,可以包括S5031至S5032:In some embodiments of the present application, the cross-component prediction model is a linear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S503 may include S5031 to S5032:
S5031、按照预设样点选取方式在参考亮度块中确定至少两个参考亮度样点,以及按照预设样点选取方式在参考色度块中确定与至少两个参考亮度样点各自对应的参考色度样点。S5031. Determine at least two reference luminance samples in a reference luminance block according to a preset sample selection method, and determine reference chrominance samples corresponding to the at least two reference luminance samples in a reference chrominance block according to a preset sample selection method.
在本申请实施例中,预设样点选取方式通常是根据一定的规则或算法,比如在块内均匀分布、按特定方向选取等方式。In the embodiments of the present application, the preset sample point selection method is usually based on certain rules or algorithms, such as uniform distribution within a block, selection in a specific direction, and the like.
在本申请实施例中,对于在参考亮度块中确定的每个参考亮度样点,根据色度采样结构(如4:2:0或4:4:4),找到与其对应的参考色度样点。如果色度块的采样结构是4:2:0,则对应的参考色度样点可能在水平和垂直方向上的相邻位置。In the embodiment of the present application, for each reference luminance sample determined in the reference luminance block, a reference chrominance sample corresponding thereto is found according to the chrominance sampling structure (such as 4:2:0 or 4:4:4). If the sampling structure of the chrominance block is 4:2:0, the corresponding reference chrominance samples may be at adjacent positions in the horizontal and vertical directions.
可以理解的是,按照预设样点选取方式选择至少两个参考亮度样点和至少两个参考亮度样,有助于建立亮度与色度之间的关系,提高帧内预测的准确性。It can be understood that selecting at least two reference luminance sampling points and at least two reference luminance samples according to a preset sampling point selection method helps to establish a relationship between luminance and chrominance, thereby improving the accuracy of intra-frame prediction.
在本申请的一些实施例中,预设样点选取方式包括以下任意一种:居中选取方式、垂直选取方式、水平选取方式、对角线选取方式和顶点选取方式。In some embodiments of the present application, the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
可以理解的是,一方面,不同的选取方式可以更好地适应不同图像内容和运动模式,在一些场景中,某种选取方式可能更能捕捉到图像中的重要信息,从而提高编码效率。一方面,不同的选取方式可能有助于提供更准确的运动矢量信息,通过选择适当的样点,可以更精确地估计运动,从而提高预测的准确性。一方面,预设样点选取方式的巧妙选择可以改善帧内预测的效果,通过选择合适的样点,可以更好地建模亮度与色度之间的关系,从而提高帧内预测的质量。一方面,某些选取方式可能在编码时具有较低的复杂度,使得编码器能够更高效地执行预测和运动估计,从而降低整体的编码复杂度。总的来说,通过选择适当的预设样点选取方式,视频编码器可以更好地适应不同场景的需求,提高图像质量,并在保持编码效率的同时降低复杂度。It is understandable that, on the one hand, different selection methods can better adapt to different image contents and motion modes. In some scenes, a certain selection method may be more able to capture important information in the image, thereby improving coding efficiency. On the one hand, different selection methods may help provide more accurate motion vector information. By selecting appropriate samples, motion can be estimated more accurately, thereby improving the accuracy of prediction. On the one hand, the clever selection of preset sample selection methods can improve the effect of intra-frame prediction. By selecting appropriate samples, the relationship between brightness and chrominance can be better modeled, thereby improving the quality of intra-frame prediction. On the one hand, some selection methods may have lower complexity during encoding, allowing the encoder to perform prediction and motion estimation more efficiently, thereby reducing the overall encoding complexity. In general, by selecting an appropriate preset sample selection method, the video encoder can better adapt to the needs of different scenes, improve image quality, and reduce complexity while maintaining coding efficiency.
在本申请的一些实施例中,预设样点选取方式为居中选取方式;参考色度块的宽度为W,参考色度块的高度为H;参考亮度块的宽度为2W,参考亮度块的高度为2H;In some embodiments of the present application, the preset sampling point selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色 度样点、第三参考色度样点和第四参考色度样点;其中,The at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; and the reference chrominance samples corresponding to the at least two reference luminance samples include: a first reference chrominance sample, a second reference chrominance sample, a third reference chrominance sample, and a fourth reference luminance sample. A reference chrominance sample point, a third reference chrominance sample point and a fourth reference chrominance sample point; wherein,
第一参考色度样点在参考色度块的位置坐标为(1,0);第一参考色度样点为参考色度块的左上角的色度样点;The position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (1, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
第二参考色度样点在参考色度块的位置坐标为(W-2,0);The position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-2, 0);
第三参考色度样点在参考色度块的位置坐标为(1,H-1);The position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (1, H-1);
第四参考色度样点在参考色度块的位置坐标为(W-2,H-1);The position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-2, H-1);
第一参考亮度样点在参考亮度块的位置坐标为(2,0);第一参考亮度样点为参考亮度块的左上角的亮度样点;The position coordinates of the first reference brightness sample point in the reference brightness block are (2, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
第二参考亮度样点在参考亮度块的位置坐标为(2×(W-2),0);The position coordinates of the second reference brightness sample point in the reference brightness block are (2×(W-2), 0);
第三参考亮度样点在参考亮度块的位置坐标为(2,2×(H-1));The position coordinates of the third reference brightness sample point in the reference brightness block are (2,2×(H-1));
第四参考亮度样点在参考亮度块的位置坐标为(2×(W-2),2×(H-1))。The position coordinates of the fourth reference luminance sample point in the reference luminance block are (2×(W-2), 2×(H-1)).
在本申请的一些实施例中,预设样点选取方式为顶点选取方式;参考色度块的宽度为W,参考色度块的高度为H;参考亮度块的宽度为2W,参考亮度块的高度为2H;In some embodiments of the present application, the preset sample point selection method is a vertex selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H;
在本申请的一些实施例中,至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色度样点、第三参考色度样点和第四参考色度样点。In some embodiments of the present application, at least two reference luma samples include: a first reference luma sample, a second reference luma sample, a third reference luma sample, and a fourth reference luma sample; and the reference chroma samples corresponding to the at least two reference luma samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample.
第一参考色度样点在参考色度块的位置坐标为(0,0);第一参考色度样点为参考色度块的左上角的色度样点;The position coordinates of the first reference chromaticity sample point in the reference chromaticity block are (0, 0); the first reference chromaticity sample point is the chromaticity sample point at the upper left corner of the reference chromaticity block;
第二参考色度样点在参考色度块的位置坐标为(W-1,0);The position coordinates of the second reference chromaticity sample point in the reference chromaticity block are (W-1, 0);
第三参考色度样点在参考色度块的位置坐标为(0,H-1);The position coordinates of the third reference chromaticity sample point in the reference chromaticity block are (0, H-1);
第四参考色度样点在参考色度块的位置坐标为(W-1,H-1);The position coordinates of the fourth reference chromaticity sample point in the reference chromaticity block are (W-1, H-1);
第一参考亮度样点在参考亮度块的位置坐标为(0,0);第一参考亮度样点为参考亮度块的左上角的亮度样点;The position coordinates of the first reference brightness sample point in the reference brightness block are (0, 0); the first reference brightness sample point is the brightness sample point at the upper left corner of the reference brightness block;
第二参考亮度样点在参考亮度块的位置坐标为(2×(W-1),0);The position coordinates of the second reference brightness sample point in the reference brightness block are (2×(W-1), 0);
第三参考亮度样点在参考亮度块的位置坐标为(0,2×(H-1));The position coordinates of the third reference brightness sample point in the reference brightness block are (0, 2×(H-1));
第四参考亮度样点在参考亮度块的位置坐标为(2×(W-1),2×(H-1))。The position coordinates of the fourth reference luminance sample point in the reference luminance block are (2×(W-1), 2×(H-1)).
需要说明的是,上述列举的居中选取方式和顶点选取方式仅为一种示例,在实际应用中,还可选择其他数量的参考亮度样点和参考色度样点。另外,对于选取的参考亮度样点和参考色度样点的坐标点位还包括其他方式。也就是说,参考亮度样点和参考色度样点中的任意一个样点都可以选取,具体的选取方式可以根据实际应用场景进行选择,本申请实施例对此不作任何限定。It should be noted that the above-listed center selection method and vertex selection method are only examples. In actual applications, other numbers of reference luminance samples and reference chrominance samples may be selected. In addition, other methods are also included for the coordinate positions of the selected reference luminance samples and reference chrominance samples. In other words, any one of the reference luminance samples and reference chrominance samples may be selected, and the specific selection method may be selected according to the actual application scenario, and the embodiments of the present application do not impose any limitation on this.
在本申请实施例中,第一参考色度样点与第一参考亮度样点相对应,第二参考色度样点与第二参考亮度样点相对应,第三参考色度样点与第三参考亮度样点相对应,第四参考色度样点与第四参考亮度样点相对应。In the embodiment of the present application, the first reference chromaticity sample corresponds to the first reference luminance sample, the second reference chromaticity sample corresponds to the second reference luminance sample, the third reference chromaticity sample corresponds to the third reference luminance sample, and the fourth reference chromaticity sample corresponds to the fourth reference luminance sample.
可以理解的是,顶点选取方式的设置方式有助于通过亮度样点和色度样点之间的关系,建立更准确的跨分量预测模型。在编码过程中,参考这些样点可以提高对色度信息的预测准确性,从而改善视频质量。It is understandable that the setting method of vertex selection helps to establish a more accurate cross-component prediction model through the relationship between luma samples and chroma samples. During the encoding process, referring to these samples can improve the prediction accuracy of chroma information, thereby improving video quality.
S5032、根据至少两个参考亮度样点以及至少两个参考色度样点,确定跨分量预测模型;其中,至少两个参考亮度样点与至少两个参考色度样点相对应。S5032. Determine a cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
在本申请的一些实施例中,跨分量预测模型包括一个或多个跨分量预测子模型;S5032中根据至少两个参考亮度样点以及至少两个参考色度样点,确定跨分量预测模型的实现,可以包括S50321至S50322:In some embodiments of the present application, the cross-component prediction model includes one or more cross-component prediction sub-models; determining the implementation of the cross-component prediction model according to at least two reference luma samples and at least two reference chroma samples in S5032 may include S50321 to S50322:
S50321、按照至少两个参考亮度样点的亮度值,将至少两个参考亮度样点以及至少两个参考色度样点进行分组,得到至少一个参考样点组;其中,每一个参考样点组包括至少两个亮度样点以及至少两个色度样点;至少两个亮度样点与至少两个色度样点相对应;至少两个参考亮度样点包括至少两个亮度样点;至少两个参考色度样点包括至少两个色度样点;至少一个参考样点组对应不同的预设亮度范围。S50321. According to the brightness values of the at least two reference brightness samples, group the at least two reference brightness samples and the at least two reference chrominance samples to obtain at least one reference sample group; wherein each reference sample group includes at least two brightness samples and at least two chrominance samples; the at least two brightness samples correspond to the at least two chrominance samples; the at least two reference brightness samples include at least two brightness samples; the at least two reference chrominance samples include at least two chrominance samples; and at least one reference sample group corresponds to a different preset brightness range.
在本申请实施例中,对于不同的参考样点组,其包含的亮度样点和色度样点具有不同的预设亮度范围。这种区分可能有助于更好地适应视频中不同区域的亮度变化。通过为每个参考样点组指定不同的预设亮度范围,可以更灵活地处理视频中可能存在的亮度差异,从而提高编码的适应性和性能。In the embodiment of the present application, for different reference sample groups, the luma samples and chroma samples contained therein have different preset luma ranges. This distinction may help to better adapt to the brightness changes in different areas of the video. By specifying a different preset luma range for each reference sample group, the brightness differences that may exist in the video can be handled more flexibly, thereby improving the adaptability and performance of the encoding.
示例性的,至少一个参考样点组包括:第一样点组、第二样点组、第三样点组和第四样点组。第一样点组对应0~50的亮度范围,第二样点组对应51~100的亮度范围,第三样点组对应101~150的亮度范围,第四样点组对应151~255的亮度范围。Exemplarily, at least one reference sample point group includes: a first sample point group, a second sample point group, a third sample point group and a fourth sample point group. The first sample point group corresponds to a brightness range of 0 to 50, the second sample point group corresponds to a brightness range of 51 to 100, the third sample point group corresponds to a brightness range of 101 to 150, and the fourth sample point group corresponds to a brightness range of 151 to 255.
S50322、针对至少一个参考样点组中的每一参考样点组,根据每一参考样点组中的至少两个亮度样点以及至少两个色度样点,确定每一参考样点组对应的跨分量预测子模型。 S50322. For each reference sample point group in at least one reference sample point group, determine a cross-component prediction sub-model corresponding to each reference sample point group according to at least two luma samples and at least two chroma samples in each reference sample point group.
在本申请的一些实施例中,S50322根据每一参考样点组中的至少两个亮度样点以及至少两个色度样点,确定每一参考样点组对应的跨分量预测子模型的实现,可以包括:In some embodiments of the present application, S50322 determines the implementation of the cross-component prediction sub-model corresponding to each reference sample group according to at least two luma samples and at least two chroma samples in each reference sample group, which may include:
按照至少两个亮度样点的亮度值,将每一参考样点组中的至少两个亮度样点以及至少两个色度样点进行分组,得到第一样点组和第二样点组;其中,第一样点组和第二样点组中各自包括至少一个亮度样点和至少一个色度样点;至少一个亮度样点与至少一个色度样点相对应;第一样点组中的至少一个亮度样点的重建亮度值大于或者等于第二样点组中的至少一个亮度样点的重建亮度值;According to the brightness values of the at least two brightness samples, at least two brightness samples and at least two chrominance samples in each reference sample group are grouped to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one brightness sample and at least one chrominance sample; the at least one brightness sample corresponds to the at least one chrominance sample; and a reconstructed brightness value of at least one brightness sample in the first sample group is greater than or equal to a reconstructed brightness value of at least one brightness sample in the second sample group;
根据第一样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最大参考亮度值和第一参考色度值;Determine a maximum reference luminance value and a first reference chrominance value according to a reconstructed luminance value of at least one luminance sample point and a reconstructed chrominance value of at least one chrominance sample point in the first sample point group, respectively;
根据第二样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最小参考亮度值和第二参考色度值;Determine a minimum reference luminance value and a second reference chrominance value according to a reconstructed luminance value of at least one luminance sample point and a reconstructed chrominance value of at least one chrominance sample point in the second sample point group;
基于最大参考亮度值、第一参考色度值、最小参考亮度值和第二参考色度值,确定缩放因子和偏移因子;Determining a scaling factor and an offset factor based on a maximum reference luminance value, a first reference chrominance value, a minimum reference luminance value, and a second reference chrominance value;
根据缩放因子和偏移因子,确定每一参考样点组对应的跨分量预测子模型。According to the scaling factor and the offset factor, the cross-component prediction sub-model corresponding to each reference sample point group is determined.
在本申请实施例中,最大参考亮度值可以表示为xMax,第一参考色度值可以表示为yMax,最小参考亮度值可以表示为xMin,第二参考色度值可以表示为yMin。缩放因子可以表示为a,偏移因子可以表示为b。In the embodiment of the present application, the maximum reference brightness value can be expressed as xMax, the first reference chromaticity value can be expressed as yMax, the minimum reference brightness value can be expressed as xMin, and the second reference chromaticity value can be expressed as yMin. The scaling factor can be expressed as a, and the offset factor can be expressed as b.
在本申请的一些实施例中,基于最大参考亮度值、第一参考色度值、最小参考亮度值和第二参考色度值,确定缩放因子和偏移因子,可以包括:In some embodiments of the present application, determining the scaling factor and the offset factor based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value, and the second reference chrominance value may include:
将第一参考色度值(yMax)与第二参考色度值(yMin)进行减法运算,得到第一中间参数;Subtracting the first reference chromaticity value (yMax) from the second reference chromaticity value (yMin) to obtain a first intermediate parameter;
将最大参考亮度值(xMax)与最小参考亮度值(xMin)进行减法运算,得到第二中间参数;Subtracting the maximum reference brightness value (xMax) from the minimum reference brightness value (xMin) to obtain a second intermediate parameter;
将第一中间参数和第二中间参数进行除法运算,得到缩放因子(a);Dividing the first intermediate parameter by the second intermediate parameter to obtain a scaling factor (a);
将缩放因子(a)和最小参考亮度值(xMin)进行乘法运算,得到第三中间参数;The scaling factor (a) and the minimum reference brightness value (xMin) are multiplied to obtain a third intermediate parameter;
将第二参考色度值(yMin)和第三中间参数进行减法运算,得到偏移因子(b)。The second reference chromaticity value (yMin) and the third intermediate parameter are subtracted to obtain an offset factor (b).
在本申请实施例中,第一中间参数可以表示为yMax-yMin。第二中间参数可以表示为xMax-xMin。缩放因子可以表示为a=(yMax-yMin)/(xMax-xMin)。第三中间参数可以表示为a×xMin。偏移因子可以表示为yMin-a×xMin。In the embodiment of the present application, the first intermediate parameter can be expressed as yMax-yMin. The second intermediate parameter can be expressed as xMax-xMin. The scaling factor can be expressed as a=(yMax-yMin)/(xMax-xMin). The third intermediate parameter can be expressed as a×xMin. The offset factor can be expressed as yMin-a×xMin.
可以理解的是,确定缩放因子和偏移因子可以将参考亮度和色度的值映射到一个标准的范围,从而实现归一化,有助于在不同场景下更一致地处理亮度和色度信息。通过确定缩放因子和偏移因子,可以使预测模型更具鲁棒性,适应不同的亮度和色度条件。通过进行合适的亮度和色度映射,可以降低数据冗余,提高编码效率,有助于更紧凑地表示图像信息。总的来说,通过确定缩放因子和偏移因子,可以更好地处理亮度和色度之间的关系,提高编码的性能和图像质量。It is understandable that determining the scaling factor and the offset factor can map the reference luminance and chrominance values to a standard range, thereby achieving normalization, which helps to process luminance and chrominance information more consistently in different scenarios. By determining the scaling factor and the offset factor, the prediction model can be made more robust and adaptable to different luminance and chrominance conditions. By performing appropriate luminance and chrominance mapping, data redundancy can be reduced, encoding efficiency can be improved, and image information can be represented more compactly. In general, by determining the scaling factor and the offset factor, the relationship between luminance and chrominance can be better handled, and the encoding performance and image quality can be improved.
在本申请的一些实施例中,跨分量预测模型为非线性模型;S304中基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型的实现,可以包括:In some embodiments of the present application, the cross-component prediction model is a nonlinear model; determining the implementation of the cross-component prediction model based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector in S304 may include:
在参考色度块中选取全部或部分参考色度样点;Selecting all or part of the reference chromaticity samples in the reference chromaticity block;
根据全部或部分参考色度样点、参考亮度块中的与全部或部分参考色度样点各自对应的参考亮度样点,以及参考亮度样点的邻域参考亮度样点,确定跨分量预测模型。A cross-component prediction model is determined based on all or part of the reference chroma samples, reference luma samples in a reference luma block that respectively correspond to all or part of the reference chroma samples, and neighborhood reference luma samples of the reference luma samples.
在本申请实施例中,在跨分量预测模型为非线性模型的情况下,跨分量预测模型可以通过公式(3)表示。In the embodiment of the present application, when the cross-component prediction model is a nonlinear model, the cross-component prediction model can be expressed by formula (3).
可以理解的是,通过根据参考色度样点和相应的参考亮度样点建立跨分量预测模型,可以增强预测模型的适应性,使其更好地适应不同类型和场景的视频内容。考虑参考亮度样点的邻域参考亮度样点可以更全面地捕捉亮度信息,有助于改善预测模型的精度,这对于处理图像中的局部特征和纹理等信息可能很重要。通过更准确地建模跨分量关系,可以期望减少预测引入的失真,从而提高整体视频质量,包括更高的压缩效率和更好的视觉质量。It can be understood that by establishing a cross-component prediction model based on reference chrominance samples and corresponding reference luma samples, the adaptability of the prediction model can be enhanced to better adapt to video content of different types and scenes. Considering the neighborhood reference luma samples of the reference luma samples can more comprehensively capture the luma information, which helps to improve the accuracy of the prediction model, which may be important for processing information such as local features and textures in the image. By more accurately modeling cross-component relationships, it can be expected to reduce the distortion introduced by the prediction, thereby improving the overall video quality, including higher compression efficiency and better visual quality.
在本申请的一些实施例中,邻域参考亮度样点包括以下一项或多项:位于参考亮度样点上方的参考亮度样点(N)、位于参考亮度样点下方的参考亮度样点(S)、位于参考亮度样点左方的参考亮度样点(W)和位于参考亮度样点右方的参考亮度样点(E)。In some embodiments of the present application, the neighborhood reference brightness samples include one or more of the following: a reference brightness sample (N) located above the reference brightness sample, a reference brightness sample (S) located below the reference brightness sample, a reference brightness sample (W) located to the left of the reference brightness sample, and a reference brightness sample (E) located to the right of the reference brightness sample.
在本申请实施例中,通过考虑上述邻域参考亮度样点,可以更全面地捕捉亮度信息的上下文和局部特征,有助于提高跨分量预测模型的准确性和适应性,这样的信息考虑通常能够更好地模拟亮度分量在图像中的变化和纹理。In an embodiment of the present application, by considering the above-mentioned neighborhood reference brightness samples, the context and local features of the brightness information can be more comprehensively captured, which helps to improve the accuracy and adaptability of the cross-component prediction model. Such information consideration can usually better simulate the changes and textures of the brightness components in the image.
在本申请的一些实施例中,S601中在当前同位亮度块中确定满足预设的预测模式的候选参考样点的实现,可以包括:In some embodiments of the present application, the implementation of determining candidate reference samples satisfying a preset prediction mode in the current co-located luminance block in S601 may include:
根据预设的M个位置信息,在当前同位亮度块中对预设的M个位置信息各自对应的候选参考样点 进行遍历,得到满足预设的预测模式的候选参考样点;其中,M为大于等于1的正整数,i为小于M的正整数。According to the preset M position information, the candidate reference sample points corresponding to the preset M position information are respectively selected in the current co-located brightness block. Traverse to obtain candidate reference sample points that meet the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
在本申请的一些实施例中,M个位置信息包括以下一项或多项:In some embodiments of the present application, the M pieces of location information include one or more of the following:
当前同位亮度块的中间的位置;The position of the middle of the current co-located luminance block;
当前同位亮度块的左上方的位置;The upper left position of the current co-located luminance block;
当前同位亮度块的右上方的位置;The upper right position of the current co-located luminance block;
当前同位亮度块的左下方的位置;The lower left position of the current co-located luminance block;
当前同位亮度块的右下方的位置。The lower right position of the current co-located luma block.
在本申请实施例中,预设的M个位置信息可以表示为{C,TL,TR,BL,BR}。其中,C表示当前同位亮度块的中间的位置,TL表示当前同位亮度块的左上方的位置,TR表示当前同位亮度块的右上方的位置,BL表示当前同位亮度块的左下方的位置,BR表示当前同位亮度块的右下方的位置。In the embodiment of the present application, the preset M position information can be expressed as {C, TL, TR, BL, BR}, where C represents the middle position of the current co-located luminance block, TL represents the upper left position of the current co-located luminance block, TR represents the upper right position of the current co-located luminance block, BL represents the lower left position of the current co-located luminance block, and BR represents the lower right position of the current co-located luminance block.
在本申请的一些实施例中,根据预设的M个位置信息,在当前同位亮度块中对预设的M个位置信息各自对应的候选参考样点进行遍历,得到满足预设的预测模式的候选参考样点,包括:In some embodiments of the present application, according to the preset M pieces of position information, candidate reference sample points corresponding to the preset M pieces of position information are traversed in the current co-located luminance block to obtain candidate reference sample points that meet the preset prediction mode, including:
针对预设的M个位置信息中的第i个位置信息,在当前同位亮度块中的与第i个位置信息对应的第i个候选参考样点不满足预设的预测模式的情况下,继续遍历当前同位亮度块中的与第i+1个位置信息对应的第i+1个候选参考样点,直至第i+1个候选参考样点满足预设的预测模式为止,将第i+1个候选参考样点确定为满足预设的预测模式的候选参考样点;或者,For the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or,
在第i个候选参考样点满足预设的预测模式的情况下,将第i个候选参考样点确定为满足预设的预测模式的候选参考样点。In the case that the i-th candidate reference sample point satisfies the preset prediction mode, the i-th candidate reference sample point is determined as a candidate reference sample point that satisfies the preset prediction mode.
在本申请实施例中,针对预设的M个位置信息中的第i个位置信息,考虑与之对应的第i个候选参考样点。判断当前同位亮度块中的第i个候选参考样点是否满足预设的预测模式,如果第i个候选参考样点不满足预设的预测模式,那么继续遍历当前同位亮度块中的与第i+1个位置信息对应的第i+1个候选参考样点。如果第i个候选参考样点满足预设的预测模式,那么将第i个候选参考样点确定为满足预设的预测模式的候选参考样点。In the embodiment of the present application, for the i-th position information among the preset M position information, the i-th candidate reference sample corresponding thereto is considered. It is determined whether the i-th candidate reference sample in the current co-located luminance block satisfies the preset prediction mode. If the i-th candidate reference sample does not satisfy the preset prediction mode, then the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block is traversed. If the i-th candidate reference sample satisfies the preset prediction mode, then the i-th candidate reference sample is determined as a candidate reference sample that satisfies the preset prediction mode.
可以理解的是,一方面,通过逐一检查每个位置信息,可以确保选取的候选参考样点在预测模式上更好地匹配预设的条件,提高了预测的准确性。一方面,选择满足预设条件的候选参考样点有助于提高图像块的预测质量,从而提升整体图像的视觉质量。一方面,通过预设的位置信息和条件,可以根据不同场景和要求选择合适的候选参考样点,使得预测模式更具灵活性和适应性。一方面,有效选择候选参考样点可以降低冗余信息,从而在视频压缩中提高编码的效率和性能。总的来说,上述步骤有助于提高视频编码中跨分量预测模型的性能,使其更好地适应不同的预测场景和要求。It can be understood that, on the one hand, by checking each position information one by one, it can be ensured that the selected candidate reference samples better match the preset conditions in the prediction mode, thereby improving the accuracy of the prediction. On the one hand, selecting candidate reference samples that meet the preset conditions helps to improve the prediction quality of the image block, thereby improving the visual quality of the overall image. On the one hand, through the preset position information and conditions, appropriate candidate reference samples can be selected according to different scenarios and requirements, making the prediction mode more flexible and adaptable. On the one hand, the effective selection of candidate reference samples can reduce redundant information, thereby improving the efficiency and performance of encoding in video compression. In general, the above steps help to improve the performance of the cross-component prediction model in video coding, so that it can better adapt to different prediction scenarios and requirements.
在本申请的一些实施例中,S503中基于跨分量预测模型,确定预测色度块的预测色度值的实现,可以包括S5031至S5032:In some embodiments of the present application, the implementation of determining the predicted chroma value of the predicted chroma block based on the cross-component prediction model in S503 may include S5031 to S5032:
S5031、通过跨分量预测模型,根据当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值;其中,候选色度预测块与当前色度块的大小不同。S5031. Determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through a cross-component prediction model; wherein the candidate chrominance prediction block is different in size from the current chrominance block.
在本申请实施例中,将当前同位亮度块中的各个像素点的重建亮度值输入至跨分量预测模型中,得到候选色度预测块的候选预测色度值。In an embodiment of the present application, the reconstructed luminance value of each pixel in the current co-located luminance block is input into a cross-component prediction model to obtain a candidate predicted chrominance value of the candidate chrominance prediction block.
在本申请的一些实施例中,跨分量预测模型包括至少一个跨分量预测子模型;S3041中通过跨分量预测模型,根据当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值的实现,可以包括:In some embodiments of the present application, the cross-component prediction model includes at least one cross-component prediction sub-model; the implementation of determining the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model in S3041 may include:
针对当前同位亮度块中的每一像素点的重建亮度值,将每一像素点的重建亮度值输入至相对应的跨分量预测子模型中,得到每一像素点对应的候选预测色度值;其中,每一像素点的重建亮度值对应的预设亮度范围与跨分量预测子模型相匹配;For each pixel in the current co-located luminance block, the reconstructed luminance value of each pixel is input into the corresponding cross-component prediction sub-model to obtain a candidate predicted chrominance value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model;
根据当前同位亮度块中的各个像素点对应的候选预测色度值,确定候选色度预测块的候选预测色度值。Determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the candidate predicted chrominance value corresponding to each pixel in the current co-located luminance block.
可以理解的是,一方面,针对每个像素点使用不同的跨分量预测子模型,可以更好地适应图像中不同区域的亮度和色度特性,这种适应性有助于提高编码器在各种图像场景下的性能。一方面,每个像素点对应的预设亮度范围与跨分量预测子模型的使用,提供了对不同像素点的细粒度控制,这使得编码器能够更好地应对图像中可能存在的细微差异,提高编码的灵活性。总的来说,通过上述步骤有助于通过更精细的跨分量预测子模型,从而可以更好地捕捉亮度和色度之间的关系,进而提高了色度预测的质量和编码效率。It can be understood that, on the one hand, the use of different cross-component prediction sub-models for each pixel can better adapt to the brightness and chrominance characteristics of different areas in the image. This adaptability helps to improve the performance of the encoder in various image scenarios. On the one hand, the use of the preset brightness range corresponding to each pixel and the cross-component prediction sub-model provides fine-grained control of different pixels, which enables the encoder to better cope with subtle differences that may exist in the image and improves the flexibility of encoding. In general, the above steps help to better capture the relationship between brightness and chrominance through a more refined cross-component prediction sub-model, thereby improving the quality of chrominance prediction and coding efficiency.
S5032、对候选色度预测块的候选预测色度值进行下采样,得到预测色度块的预测色度值。S5032. Downsample the candidate predicted chrominance values of the candidate chrominance prediction block to obtain predicted chrominance values of the predicted chrominance block.
在本申请实施例中,通过六抽头滤波器[1 2 1;1 2 1],对候选色度预测块的候选预测色度值进行下 采样,该过程可以通过公式(4)表示。In the embodiment of the present application, the candidate predicted chrominance values of the candidate chrominance prediction block are filtered by a six-tap filter [1 2 1; 1 2 1]. Sampling, the process can be expressed by formula (4).
可以理解的是,一方面,跨分量预测模型允许更好地捕捉亮度和色度之间的复杂关系,通过使用同位亮度块的重建亮度值,预测的色度值更能够准确地反映出图像中的细节和特征。一方面,由于候选色度预测块的大小不同于当前色度块,这种方法可以在尺寸上进行适应,使得预测更能够适应图像中不同区域的细节和结构。总的来说,上述步骤综合了信息捕捉、尺寸适应性和编码效率的优势,有助于提高色度预测的质量,并在保持高效编码的同时减小数据量。It can be understood that, on the one hand, the cross-component prediction model allows for better capture of the complex relationship between luminance and chrominance, and by using the reconstructed luminance value of the co-located luminance block, the predicted chrominance value can more accurately reflect the details and features in the image. On the other hand, since the size of the candidate chrominance prediction block is different from the current chrominance block, this method can adapt in size, making the prediction more adaptable to the details and structures of different regions in the image. In general, the above steps combine the advantages of information capture, size adaptability, and coding efficiency, which helps to improve the quality of chrominance prediction and reduce the amount of data while maintaining efficient coding.
在本申请又一实施例中,提供了一种编解码方法,该方法的核心思想在于将TSCPM与CIBC技术结合,后续用TSCPM_CIBC表示,其主要流程包含四个部分:In another embodiment of the present application, a coding method is provided. The core idea of the method is to combine TSCPM with CIBC technology, which is hereinafter represented by TSCPM_CIBC. The main process includes four parts:
1)、获取块运动矢量(即参考运动矢量)对应的亮度参考块(即参考亮度块)和色度参考块(即参考色度块);1) Obtain the luminance reference block (i.e., reference luminance block) and chrominance reference block (i.e., reference chrominance block) corresponding to the block motion vector (i.e., reference motion vector);
2)、根据获取的亮度参考块和色度参考块推导跨分量模型(即跨分量预测模型);2) Derivation of a cross-component model (i.e., a cross-component prediction model) based on the acquired luminance reference block and chrominance reference block;
3)、由推导的跨分量模型以及当前待编码色度块(即当前色度块)对应的同位亮度块(即当前同位亮度块)的重构像素值,计算得到中间预测块的像素值(即候选预测块的候选预测色度值);3) The pixel value of the intermediate prediction block (i.e., the candidate prediction chrominance value of the candidate prediction block) is calculated based on the derived cross-component model and the reconstructed pixel value of the co-located luminance block (i.e., the current co-located luminance block) corresponding to the current chrominance block to be encoded (i.e., the current chrominance block);
4)、将中间预测块下采样得到最终色度预测块(即预测色度块的预测色度值)。4) Downsample the intermediate prediction block to obtain the final chrominance prediction block (i.e., the predicted chrominance value of the predicted chrominance block).
在本申请实施例中,编解码方法可以包括以下步骤:In an embodiment of the present application, the encoding and decoding method may include the following steps:
步骤一、首先,该模式的开启条件与CIBC技术类似,即如果当前待编码色度块的亮度同位块上位于{C,TL,TR,BL,BR}位置的亮度样点为块复制帧内预测模式或串复制帧内预测的普通串子模式,则当前块能够使用基于色度帧内块复制技术的跨分量预测模式。Step 1. First, the activation condition of this mode is similar to the CIBC technology, that is, if the luminance sample located at the position {C, TL, TR, BL, BR} on the luminance co-located block of the current chrominance block to be encoded is a block copy intra-frame prediction mode or a normal string sub-mode of string copy intra-frame prediction, then the current block can use the cross-component prediction mode based on the chrominance intra-frame block copy technology.
在本申请实施例中,若满足TSCPM_CIBC技术的使用条件,首先根据当前待编码色度块对应的同位亮度块中预设五种位置{C,TL,TR,BL,BR}按照固定先后顺序依次遍历,获取最先满足条件的亮度样点处的BV作为当前块的参考BV,通过该BV分别取得亮度、色度相应的参考块。若该BV为无效BV,即无法通过该BV取得有效的重构像素值,则当前色度块所有样点的预测值设置为2BitDepth-1。In the embodiment of the present application, if the conditions for using the TSCPM_CIBC technology are met, first, according to the five preset positions {C, TL, TR, BL, BR} in the co-located luminance block corresponding to the current chrominance block to be encoded, they are traversed in a fixed order, and the BV at the luminance sample point that first meets the conditions is obtained as the reference BV of the current block, and the reference blocks corresponding to the luminance and chrominance are obtained respectively through the BV. If the BV is an invalid BV, that is, the valid reconstructed pixel value cannot be obtained through the BV, the prediction value of all samples of the current chrominance block is set to 2 BitDepth-1 .
步骤二、从获取的亮度参考块和色度参考块中选择样本点用于推导跨分量模型,其中样本点的选取可以是参考块的全部样本点或部分样本点,推导出的跨分量模型可以是线性模型也可以是非线性模型。Step 2: Select sample points from the obtained luminance reference block and chrominance reference block for deriving a cross-component model, where the sample points can be all or part of the sample points of the reference block, and the derived cross-component model can be a linear model or a nonlinear model.
在本申请实施例中,参照AVS3原有技术TSCPM的实施方案,将样本点的选取由原来的当前块相邻一行一列的重构像素中获取4个像素点改为从BV指向的参考块中选取4个像素点,当前像素点的选取方案具体为:当前块的左上,右上,左下,右下四个区域位置内的像素点。In an embodiment of the present application, referring to the implementation scheme of the original AVS3 technology TSCPM, the selection of sample points is changed from obtaining 4 pixel points from the reconstructed pixels in an adjacent row and column of the original current block to selecting 4 pixel points from the reference block pointed to by BV. The current pixel point selection scheme is specifically: pixel points in the four area positions of the upper left, upper right, lower left, and lower right of the current block.
在本申请实施例中,设大小为W×H的待编码色度块,其宽为W,高为H,x表示水平坐标,y表示垂直坐标,当前块左上角坐标为(0,0),则四个色度重构像素点的位置为(1,0)、(w-2,0)、(1,h-1)、(w-2,h-1)。则对应待编码亮度块的大小为2W×2H,对应的四个亮度重构像素点对应的位置为(2,0)、(2×(w-2),0)、(2,2×(h-1))、(2×(w-2),2×(h-1))。四个对应位置的亮度重构像素点和色度重构像素点一一互相绑定,将选取的四个亮度重构像素点排序分组,像素值较大的两个点为一组,像素值较小的两个点为一组。亮度重构像素值较大的一组取平均值记为xMax,像素值较小的一组取平均值记为xMin。同理计算得出色度重构像素值对应的值并分别记为yMax,yMin。本方案的跨分量模型为线性模型,缩放因子记为a,偏移因子记为b。则可得a=(yMax-yMin)/(xMax-xMin),b=yMin-a×xMin。In the embodiment of the present application, assume that the chrominance block to be encoded is of size W×H, with a width of W and a height of H, x represents the horizontal coordinate, y represents the vertical coordinate, and the coordinate of the upper left corner of the current block is (0,0), then the positions of the four chrominance reconstruction pixels are (1,0), (w-2,0), (1,h-1), (w-2,h-1). The size of the corresponding luminance block to be encoded is 2W×2H, and the positions of the corresponding four luminance reconstruction pixels are (2,0), (2×(w-2),0), (2,2×(h-1)), (2×(w-2),2×(h-1)). The luminance reconstruction pixels and chrominance reconstruction pixels at the four corresponding positions are bound to each other one by one, and the four selected luminance reconstruction pixels are sorted and grouped, with the two points with larger pixel values forming a group and the two points with smaller pixel values forming a group. The average value of the group with larger luminance reconstruction pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin. Similarly, the values corresponding to the chromaticity reconstruction pixel values are calculated and recorded as yMax and yMin respectively. The cross-component model of this scheme is a linear model, the scaling factor is recorded as a, and the offset factor is recorded as b. Then we can get a = (yMax-yMin)/(xMax-xMin), b = yMin-a×xMin.
步骤三、依据推导出的线性模型参数a和b,以及当前待编码色度块对应的同位亮度块中的重构像素值可以生成出一个中间预测块,该块大小与同位亮度块大小相同,即2W×2H,中间预测块的像素值由公式Pt(x,y)=a×RLuma(x,y)+b计算得到,其中(x,y)表示对应像素点的水平垂直坐标,且均为整数,x的取值范围为[0,2W-1],y的取值范围为[0,2H-1]。RLuma表示同位亮度块的重构像素值,Pt表示计算得出的中间预测块的中间预测值。Step 3: Based on the derived linear model parameters a and b, and the reconstructed pixel values in the co-located luminance block corresponding to the current chrominance block to be encoded, an intermediate prediction block can be generated. The size of this block is the same as that of the co-located luminance block, i.e., 2W×2H. The pixel values of the intermediate prediction block are calculated by the formula P t (x, y) = a×R Luma (x, y) + b, where (x, y) represents the horizontal and vertical coordinates of the corresponding pixel points, and both are integers. The value range of x is [0, 2W-1], and the value range of y is [0, 2H-1]. R Luma represents the reconstructed pixel value of the co-located luminance block, and P t represents the calculated intermediate prediction value of the intermediate prediction block.
步骤四、对中间预测块进行下采样操作,得到最终的色度预测块,本方案中使用六抽头滤波器[1 2 1;1 2 1]进行下采样,将最终色度预测块做为TSCPM_CIBC模式下的预测输出。Step 4: Downsample the intermediate prediction block to obtain the final chrominance prediction block. In this scheme, a six-tap filter [1 2 1; 1 2 1] is used for downsampling, and the final chrominance prediction block is used as the prediction output under TSCPM_CIBC mode.
在本申请实施例中,提供一种解码端的实现,包括:In an embodiment of the present application, an implementation of a decoding end is provided, including:
解码端获取码流信息,解析码流过程中,在解析当前待编码色度块的帧内预测模式时,解析tcibc_flag的值,若tcibc_flag的值为0,使用其他模式进行预测,并将预测模式设置为相应预测模式;若tcibc_flag为1,则将当前色度块的预测模式设置为TSCPM_CIBC。随后继续解析其他相关码流信息。The decoder obtains the bitstream information and parses the bitstream. When parsing the intra-frame prediction mode of the current chroma block to be encoded, the value of tcibc_flag is parsed. If the value of tcibc_flag is 0, other modes are used for prediction, and the prediction mode is set to the corresponding prediction mode; if tcibc_flag is 1, the prediction mode of the current chroma block is set to TSCPM_CIBC. Then continue to parse other related bitstream information.
当前编码色度块在预测解码过程中,若预测模式为TSCPM_CIBC。进行如下预测过程,根据当前待编码色度块对应的同位亮度块中预设五种位置{C,TL,TR,BL,BR}按照固定先后顺序依次遍历,获取最先满足条件的亮度样点处的BV作为当前块的参考BV,若该BV为无效BV,则当前色度块所有样点的预测值设置为2BitDepth-1。若该BV为有效BV,通过该BV分别取得亮度、色度相应的参考块。During the prediction decoding process of the current coded chroma block, if the prediction mode is TSCPM_CIBC, the following prediction process is performed. According to the five preset positions {C, TL, TR, BL, BR} in the same luminance block corresponding to the current chroma block to be encoded, they are traversed in a fixed order, and the BV at the luminance sample that first meets the conditions is obtained as the reference BV of the current block. If the BV is an invalid BV, the prediction values of all samples of the current chroma block are set to 2BitDepth-1. If the BV is a valid BV, the corresponding reference blocks of luminance and chroma are obtained through the BV.
记当前色度块的大小为WxH,从色度参考块中获取位置为(1,0)、(w-2,0)、(1,h-1)、(w-2,h-1)4个像 素点的色度重构像素值,从亮度参考块中获取位置为(2,0)、(2×(w-2),0)、(2,2×(h-1))、(2×(w-2),2×(h-1))4个像素点的亮度重构像素值。四个对应位置的亮度重构像素点和色度重构像素点一一互相绑定,将选取的四个亮度重构像素点排序分组,像素值较大的两个点为一组,像素值较小的两个点为一组。亮度重构像素值较大的一组取平均值记为xMax,像素值较小的一组取平均值记为xMin。同理计算得出色度重构像素值对应的值并分别记为yMax,yMin。本方案的跨分量模型为线性模型,缩放因子记为a,偏移因子记为b。则可得a=(yMax-yMin)/(xMax-xMin),b=yMin-a×xMin。依据推导出的线性模型参数a和b,由公式Pt(x,y)=a×RLuma(x,y)+b计算得到中间预测块,最后使用六抽头滤波器[1 2 1;1 2 1]对中间预测块进行下采样操作,得到最终的色度预测块。随后继续进行反变换、反量化等操作。Note that the size of the current chrominance block is WxH, and the positions of the four images (1,0), (w-2,0), (1,h-1), and (w-2,h-1) are obtained from the chrominance reference block. The chromaticity reconstructed pixel value of the pixel point, the brightness reconstructed pixel values of the four pixels at positions (2,0), (2×(w-2),0), (2,2×(h-1)), (2×(w-2),2×(h-1)) are obtained from the brightness reference block. The brightness reconstructed pixel points and the chromaticity reconstructed pixel points at the four corresponding positions are bound to each other one by one, and the four selected brightness reconstructed pixel points are sorted and grouped, with the two points with larger pixel values as one group and the two points with smaller pixel values as one group. The average value of the group with larger brightness reconstructed pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin. Similarly, the values corresponding to the chromaticity reconstructed pixel values are calculated and recorded as yMax and yMin respectively. The cross-component model of this scheme is a linear model, the scaling factor is recorded as a, and the offset factor is recorded as b. Then we can get a=(yMax-yMin)/(xMax-xMin), b=yMin-a×xMin. According to the derived linear model parameters a and b, the intermediate prediction block is calculated by the formula P t (x, y) = a × R Luma (x, y) + b, and finally a six-tap filter [1 2 1; 1 2 1] is used to downsample the intermediate prediction block to obtain the final chrominance prediction block. Then, the inverse transformation and inverse quantization operations are continued.
在本申请实施例中,提供一种编码端的实现,包括:In an embodiment of the present application, an implementation of an encoding end is provided, including:
首先根据当前待编码色度块对应的同位亮度块中预设五种位置{C,TL,TR,BL,BR}按照固定先后顺序依次遍历,获取最先满足条件的亮度样点处的BV作为当前块的参考BV,若该BV为无效BV,即无法通过该BV取得有效的重构像素值,则当前色度块所有样点的预测值设置为2BitDepth-1。若该BV为有效BV,通过该BV分别取得亮度、色度相应的参考块。记当前色度块的大小为WxH,从色度参考块中获取位置为(1,0)、(w-2,0)、(1,h-1)、(w-2,h-1)4个像素点的色度重构像素值,从亮度参考块中获取位置为(2,0)、(2×(w-2),0)、(2,2×(h-1))、(2×(w-2),2×(h-1))4个像素点的亮度重构像素值。四个对应位置的亮度重构像素点和色度重构像素点一一互相绑定,将选取的四个亮度重构像素点排序分组,像素值较大的两个点为一组,像素值较小的两个点为一组。亮度重构像素值较大的一组取平均值记为xMax,像素值较小的一组取平均值记为xMin。同理计算得出色度重构像素值对应的值并分别记为yMax,yMin。本方案的跨分量模型为线性模型,缩放因子记为a,偏移因子记为b。则可得a=(yMax-yMin)/(xMax-xMin),b=yMin-a×xMin。依据推导出的线性模型参数a和b,由公式Pt(x,y)=a×RLuma(x,y)+b计算得到中间预测块,最后使用六抽头滤波器[1 2 1;1 2 1]对中间预测块进行下采样操作,得到最终的色度预测块。First, according to the preset five positions {C, TL, TR, BL, BR} in the same position luma block corresponding to the current chroma block to be encoded, traverse in a fixed order, and obtain the BV at the luma sample that first meets the conditions as the reference BV of the current block. If the BV is an invalid BV, that is, it is impossible to obtain a valid reconstructed pixel value through the BV, then the prediction value of all samples of the current chroma block is set to 2BitDepth-1. If the BV is a valid BV, the corresponding reference blocks of luma and chroma are obtained through the BV. Let the size of the current chroma block be WxH, and the chroma reconstructed pixel values of the four pixels at positions (1,0), (w-2,0), (1,h-1), and (w-2,h-1) are obtained from the chroma reference block, and the luma reconstructed pixel values of the four pixels at positions (2,0), (2×(w-2),0), (2,2×(h-1)), (2×(w-2),2×(h-1)) are obtained from the luma reference block. The brightness reconstruction pixels and chrominance reconstruction pixels at four corresponding positions are bound to each other one by one, and the four selected brightness reconstruction pixels are sorted and grouped, with the two pixels with larger pixel values forming one group and the two pixels with smaller pixel values forming one group. The average value of the group with larger brightness reconstruction pixel values is recorded as xMax, and the average value of the group with smaller pixel values is recorded as xMin. Similarly, the values corresponding to the chrominance reconstruction pixel values are calculated and recorded as yMax and yMin respectively. The cross-component model of this scheme is a linear model, with the scaling factor recorded as a and the offset factor recorded as b. Then a=(yMax-yMin)/(xMax-xMin), b=yMin-a×xMin. Based on the derived linear model parameters a and b, the intermediate prediction block is calculated by the formula P t (x,y)=a×R Luma (x,y)+b, and finally a six-tap filter [1 2 1; 1 2 1] is used to downsample the intermediate prediction block to obtain the final chrominance prediction block.
比较当前色度预测块与原始色度块,计算得到像素失真值SAD,估计编码码流比特开销bits,根据以上信息计算得到该模式的RDCost,并与其他预测模式的率失真代价进行比较,若TSCPM_CIBC模式的率失真代价最小,则将tcibc_flag的值设为1,反之,将tcibc_flag的值设为0。最后在编码码流阶段,将标志位tcibc_flag的值写入码流。Compare the current chroma prediction block with the original chroma block, calculate the pixel distortion value SAD, estimate the bit overhead bits of the coded bitstream, calculate the RDCost of this mode based on the above information, and compare it with the rate distortion cost of other prediction modes. If the rate distortion cost of the TSCPM_CIBC mode is the smallest, set the value of tcibc_flag to 1, otherwise, set the value of tcibc_flag to 0. Finally, in the coded bitstream stage, write the value of the flag bit tcibc_flag into the bitstream.
本申请实施例提供的编解码方法在AVS4探索阶段参考软件EVM-0.2上,按照屏幕内容编码通用测试条件设置下的性能测试情况如下表3所示:The performance test results of the encoding and decoding method provided in the embodiment of the present application on the AVS4 exploration phase reference software EVM-0.2, according to the general test conditions for screen content encoding, are shown in Table 3 below:
表3
Table 3
可以看出,本申请实施例提供的编解码方法,能够有效利用色度帧内块复制技术的信息,获取比较匹配的亮度参考块和色度参考块,并结合两步跨分量预测技术的精神,根据获取到的参考块推导出一套跨分量模型参数,并应用在当前待编码块上,以提高预测的精准度,从而在不引入额外复杂度的情况下有效提升编码性能。It can be seen that the encoding and decoding method provided in the embodiment of the present application can effectively utilize the information of the chroma intra-frame block copy technology to obtain relatively matching luminance reference blocks and chroma reference blocks, and combine the spirit of the two-step cross-component prediction technology to derive a set of cross-component model parameters based on the obtained reference blocks, and apply them to the current block to be encoded to improve the accuracy of the prediction, thereby effectively improving the encoding performance without introducing additional complexity.
在本申请实施例中,提出一种新的跨分量预测模式,该模式通过色度帧内块复制技术的方法获取一组对应的亮度参考块和色度参考块,并从中选取样本点推导出一套跨分量模型,再根据两本跨分量预测模式的方法将该跨分量模型应用在当前待编码色度块对应的同位亮度块上,得到中间预测块,最后再通过下采样生成最终的预测块。In an embodiment of the present application, a new cross-component prediction mode is proposed. This mode obtains a set of corresponding luminance reference blocks and chrominance reference blocks through the method of chrominance intra-frame block copy technology, and selects sample points from them to derive a set of cross-component models. Then, according to the methods of the two cross-component prediction modes, the cross-component model is applied to the co-located luminance block corresponding to the current chrominance block to be encoded to obtain an intermediate prediction block, and finally the final prediction block is generated by downsampling.
在本申请实施例中,跨分量模型的推导过程主要参照AVS3标准原有技术TSCPM进行,由于参考样本点的来源不同,参考样点的选取方法有所不同,本方案中样本点的选取方案可以进行改进,包括选择不同位置的4个像素点,或者增加选取样本点的个数,以及改变线性模型的计算方案。In the embodiment of the present application, the derivation process of the cross-component model is mainly carried out with reference to the original technology TSCPM of the AVS3 standard. Due to the different sources of the reference sample points, the methods for selecting the reference sample points are different. The sample point selection scheme in this scheme can be improved, including selecting 4 pixel points at different positions, or increasing the number of selected sample points, and changing the calculation scheme of the linear model.
在本申请实施例中,在TSCPM中,同一个编码块的亮度和色度之间只有一个线性模型。若扩展为多模型跨分量线性模型,可以为同一个编码块提供多个模型。相邻的亮度和色度像素根据分类阈值被分为不同类别,每个类别中的像素分别用于求不同的模型参数。In an embodiment of the present application, in TSCPM, there is only one linear model between the brightness and chrominance of the same coding block. If it is expanded to a multi-model cross-component linear model, multiple models can be provided for the same coding block. Adjacent brightness and chrominance pixels are divided into different categories according to the classification threshold, and the pixels in each category are used to calculate different model parameters.
在本申请的一实施例中,基于前述实施例相同的发明构思,提供一种码流,所述码流是根据待编码 信息进行比特编码生成的;其中,所述待编码信息包括下述至少一项:In one embodiment of the present application, based on the same inventive concept as the above embodiment, a code stream is provided, wherein the code stream is based on the code to be encoded. The information to be encoded is generated by bit encoding; wherein the information to be encoded includes at least one of the following:
第一语法标识信息的取值、第二语法标识信息的取值、第三语法标识信息的取值、当前色度块的是量化色度残差值;其中,所述第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;所述第二语法标识信息用于指示当前色度块是否采用色度帧内块复制预测模式;所述第三语法标识信息用于指示当前色度块是否采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式。The value of the first syntax identification information, the value of the second syntax identification information, the value of the third syntax identification information, and the quantized chroma residual value of the current chroma block; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; the second syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode; the third syntax identification information is used to indicate whether the current chroma block adopts a chroma intra-frame block copy prediction mode or a cross-component prediction mode based on the chroma intra-frame block copy technology.
在本申请的再一实施例中,基于前述实施例相同的发明构思,参见图17,其示出了本申请实施例提供的一种解码器的组成结构示意图。如图17所示,所述解码器1000包括解码部分1001和第一确定部分1002,其中:In another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, refer to Figure 17, which shows a schematic diagram of the composition structure of a decoder provided in an embodiment of the present application. As shown in Figure 17, the decoder 1000 includes a decoding part 1001 and a first determining part 1002, wherein:
所述解码部分1001,被配置为解析码流,确定第一语法标识信息;The decoding part 1001 is configured to parse the code stream and determine the first syntax identification information;
所述第一确定部分1002,被配置为在所述第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据所述当前色度块对应的当前同位亮度块,确定参考运动矢量;The first determining part 1002 is configured to determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block when the first syntax identification information indicates that the current chrominance block adopts a cross-component prediction mode based on a chrominance intra block copy technique;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;When the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值;Determining a predicted chroma value of a predicted chroma block based on the cross-component prediction model;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
在一些实施例中,所述跨分量预测模型表征所述当前色度块对应的当前同位亮度块的重建亮度值与所述预测色度块的预测色度值具有线性或者非线性关系。In some embodiments, the cross-component prediction model characterizes that a reconstructed luminance value of a current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with a predicted chrominance value of the predicted chrominance block.
在一些实施例中,所述第一确定部分1002,还被配置为在所述当前同位亮度块中确定满足预设的预测模式的候选参考样点,并将所述候选参考样点对应的运动矢量作为参考运动矢量。In some embodiments, the first determining part 1002 is further configured to determine candidate reference samples that meet a preset prediction mode in the current co-located luminance block, and use the motion vector corresponding to the candidate reference sample as a reference motion vector.
在一些实施例中,所述第一确定部分1002,还被配置为按照预设样点选取方式在所述参考亮度块中确定至少两个参考亮度样点,以及按照所述预设样点选取方式在所述参考色度块中确定与所述至少两个参考亮度样点各自对应的参考色度样点;根据所述至少两个参考亮度样点以及至少两个参考色度样点,确定所述跨分量预测模型;其中,所述至少两个参考亮度样点与所述至少两个参考色度样点相对应。In some embodiments, the first determination part 1002 is further configured to determine at least two reference luma samples in the reference luma block according to a preset sample selection method, and to determine reference chroma samples corresponding to the at least two reference luma samples in the reference chroma block according to the preset sample selection method; determine the cross-component prediction model according to the at least two reference luma samples and the at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
在一些实施例中,所述跨分量预测模型包括一个或多个跨分量预测子模型;所述第一确定部分1002,还被配置为按照所述至少两个参考亮度样点的亮度值,将所述至少两个参考亮度样点以及所述至少两个参考色度样点进行分组,得到至少一个参考样点组;其中,每一个参考样点组包括至少两个亮度样点以及至少两个色度样点;所述至少两个亮度样点与所述至少两个色度样点相对应;所述至少两个参考亮度样点包括所述至少两个亮度样点;所述至少两个参考色度样点包括所述至少两个色度样点;所述至少一个参考样点组对应不同的预设亮度范围;针对所述至少一个参考样点组中的每一参考样点组,根据所述每一参考样点组中的至少两个亮度样点以及所述至少两个色度样点,确定所述每一参考样点组对应的所述跨分量预测子模型。In some embodiments, the cross-component prediction model includes one or more cross-component prediction sub-models; the first determination part 1002 is also configured to group the at least two reference luma samples and the at least two reference chroma samples according to the luma values of the at least two reference luma samples to obtain at least one reference sample group; wherein each reference sample group includes at least two luma samples and at least two chroma samples; the at least two luma samples correspond to the at least two chroma samples; the at least two reference luma samples include the at least two luma samples; the at least two reference chroma samples include the at least two chroma samples; the at least one reference sample group corresponds to a different preset luma range; for each reference sample group in the at least one reference sample group, the cross-component prediction sub-model corresponding to each reference sample group is determined according to the at least two luma samples and the at least two chroma samples in each reference sample group.
在一些实施例中,所述第一确定部分1002,还被配置为按照所述至少两个亮度样点的亮度值,将所述每一参考样点组中的至少两个亮度样点以及所述至少两个色度样点进行分组,得到第一样点组和第二样点组;其中,所述第一样点组和第二样点组中各自包括至少一个亮度样点和至少一个色度样点;所述至少一个亮度样点与所述至少一个色度样点相对应;所述第一样点组中的至少一个亮度样点的重建亮度值大于或者等于第二样点组中的至少一个亮度样点的重建亮度值;根据所述第一样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最大参考亮度值和第一参考色度值;根据所述第二样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最小参考亮度值和第二参考色度值;基于所述最大参考亮度值、所述第一参考色度值、所述最小参考亮度值和所述第二参考色度值,确定缩放因子和偏移因子;根据所述缩放因子和偏移因子,确定所述每一参考样点组对应的所述跨分量预测子模型。In some embodiments, the first determining part 1002 is further configured to group the at least two luma samples and the at least two chroma samples in each reference sample group according to the luma values of the at least two luma samples to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one luma sample and at least one chroma sample; the at least one luma sample corresponds to the at least one chroma sample; the reconstructed luma value of at least one luma sample in the first sample group is greater than or equal to the reconstructed luma value of at least one luma sample in the second sample group; according to the The maximum reference luminance value and the first reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the first sample point group; the minimum reference luminance value and the second reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the second sample point group; a scaling factor and an offset factor are determined based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value and the second reference chrominance value; and the cross-component prediction sub-model corresponding to each reference sample point group is determined based on the scaling factor and the offset factor.
在一些实施例中,所述第一确定部分1002,还被配置为将所述第一参考色度值与所述第二参考色度值进行减法运算,得到第一中间参数;将所述最大参考亮度值与所述最小参考亮度值进行减法运算,得到第二中间参数;将所述第一中间参数和所述第二中间参数进行除法运算,得到所述缩放因子;将所述缩放因子和所述最小参考亮度值进行乘法运算,得到第三中间参数;将所述第二参考色度值和所述第三中间参数进行减法运算,得到所述偏移因子。In some embodiments, the first determination part 1002 is further configured to perform a subtraction operation on the first reference chromaticity value and the second reference chromaticity value to obtain a first intermediate parameter; perform a subtraction operation on the maximum reference luminance value and the minimum reference luminance value to obtain a second intermediate parameter; perform a division operation on the first intermediate parameter and the second intermediate parameter to obtain the scaling factor; perform a multiplication operation on the scaling factor and the minimum reference luminance value to obtain a third intermediate parameter; and perform a subtraction operation on the second reference chromaticity value and the third intermediate parameter to obtain the offset factor.
在一些实施例中,所述跨分量预测模型为非线性模型;所述第一确定部分1002,还被配置为在所述参考色度块中选取全部或部分参考色度样点;根据所述全部或部分参考色度样点、所述参考亮度块中的与所述全部或部分参考色度样点各自对应的参考亮度样点,以及所述参考亮度样点的邻域参考亮度样点,确定所述跨分量预测模型。 In some embodiments, the cross-component prediction model is a nonlinear model; the first determination part 1002 is also configured to select all or part of the reference chroma samples in the reference chroma block; and determine the cross-component prediction model based on the all or part of the reference chroma samples, the reference luminance samples in the reference luminance block corresponding to the all or part of the reference chroma samples, and the neighborhood reference luminance samples of the reference luminance samples.
在一些实施例中,所述邻域参考亮度样点包括以下一项或多项:位于所述参考亮度样点上方的参考亮度样点、位于所述参考亮度样点下方的参考亮度样点、位于所述参考亮度样点左方的参考亮度样点和位于所述参考亮度样点右方的参考亮度样点。In some embodiments, the neighborhood reference luma samples include one or more of the following: a reference luma sample located above the reference luma sample, a reference luma sample located below the reference luma sample, a reference luma sample located to the left of the reference luma sample, and a reference luma sample located to the right of the reference luma sample.
在一些实施例中,所述第一确定部分1002,还被配置为根据预设的M个位置信息,在所述当前同位亮度块中对所述预设的M个位置信息各自对应的候选参考样点进行遍历,得到满足所述预设的预测模式的候选参考样点;其中,M为大于等于1的正整数,i为小于M的正整数。In some embodiments, the first determination part 1002 is further configured to traverse the candidate reference sample points corresponding to each of the preset M position information in the current co-located luminance block according to the preset M position information, to obtain the candidate reference sample points that satisfy the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
在一些实施例中,所述第一确定部分1002,还被配置为针对预设的M个位置信息中的第i个位置信息,在所述当前同位亮度块中的与所述第i个位置信息对应的第i个候选参考样点不满足所述预设的预测模式的情况下,继续遍历所述当前同位亮度块中的与所述第i+1个位置信息对应的第i+1个候选参考样点,直至所述第i+1个候选参考样点满足预设的预测模式为止,将所述第i+1个候选参考样点确定为满足所述预设的预测模式的候选参考样点;或者,在所述第i个候选参考样点满足所述预设的预测模式的情况下,将所述第i个候选参考样点确定为满足所述预设的预测模式的候选参考样点。In some embodiments, the first determining part 1002 is further configured to, for the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or, if the i-th candidate reference sample satisfies the preset prediction mode, determine the i-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode.
在一些实施例中,所述M个位置信息包括以下一项或多项:所述当前同位亮度块的中间的位置;所述当前同位亮度块的左上方的位置;所述当前同位亮度块的右上方的位置;所述当前同位亮度块的左下方的位置;所述当前同位亮度块的右下方的位置。In some embodiments, the M positions information include one or more of the following: the middle position of the current co-located brightness block; the upper left position of the current co-located brightness block; the upper right position of the current co-located brightness block; the lower left position of the current co-located brightness block; and the lower right position of the current co-located brightness block.
在一些实施例中,所述预设的预测模式为:所述候选参考样点采用块复制帧内预测模式或者串复制帧内预测的普通串子模式。In some embodiments, the preset prediction mode is: the candidate reference samples adopt a block copy intra prediction mode or a common string sub-mode of a string copy intra prediction.
在一些实施例中,所述预设样点选取方式包括以下任意一种:居中选取方式、垂直选取方式、水平选取方式、对角线选取方式和顶点选取方式。In some embodiments, the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
在一些实施例中,所述预设样点选取方式为居中选取方式;所述参考色度块的宽度为W,所述参考色度块的高度为H;所述参考亮度块的宽度为2W,所述参考亮度块的高度为2H;所述至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与所述至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色度样点、第三参考色度样点和第四参考色度样点;其中,所述第一参考色度样点在所述参考色度块的位置坐标为(1,0);所述第一参考色度样点为所述参考色度块的左上角的色度样点;所述第二参考色度样点在所述参考色度块的位置坐标为(W-2,0);所述第三参考色度样点在所述参考色度块的位置坐标为(1,H-1);所述第四参考色度样点在所述参考色度块的位置坐标为(W-2,H-1);所述第一参考亮度样点在所述参考亮度块的位置坐标为(2,0);所述第一参考亮度样点为所述参考亮度块的左上角的亮度样点;所述第二参考亮度样点在所述参考亮度块的位置坐标为(2×(W-2),0);所述第三参考亮度样点在所述参考亮度块的位置坐标为(2,2×(H-1));所述第四参考亮度样点在所述参考亮度块的位置坐标为(2×(W-2),2×(H-1))。In some embodiments, the preset sample selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H; the at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; the reference chroma samples corresponding to the at least two reference luminance samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample; wherein the position coordinates of the first reference chroma sample in the reference chroma block are (1,0); the first reference chroma sample is the chroma sample at the upper left corner of the reference chroma block; the second reference chroma sample is The position coordinates of the chromaticity sample in the reference chromaticity block are (W-2, 0); the position coordinates of the third reference chromaticity sample in the reference chromaticity block are (1, H-1); the position coordinates of the fourth reference chromaticity sample in the reference chromaticity block are (W-2, H-1); the position coordinates of the first reference luminance sample in the reference luminance block are (2, 0); the first reference luminance sample is the luminance sample at the upper left corner of the reference luminance block; the position coordinates of the second reference luminance sample in the reference luminance block are (2×(W-2), 0); the position coordinates of the third reference luminance sample in the reference luminance block are (2, 2×(H-1)); the position coordinates of the fourth reference luminance sample in the reference luminance block are (2×(W-2), 2×(H-1)).
在一些实施例中,所述第一确定部分1002,还被配置为在所述参考运动矢量为无效的情况下,根据所述当前色度块的样本精度,确定所述预测色度块的预测色度值。In some embodiments, the first determining part 1002 is further configured to determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block when the reference motion vector is invalid.
在一些实施例中,所述第一确定部分1002,还被配置为将所述样本精度与第一预设值进行减法运算,得到第四中间参数;将所述第二预设值与所述第四中间参数进行指数运算,得到所述预测色度块中各个像素点的预测色度值。In some embodiments, the first determination part 1002 is further configured to perform a subtraction operation on the sample accuracy and a first preset value to obtain a fourth intermediate parameter; and perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
在一些实施例中,所述第一确定部分1002,还被配置为在所述参考运动矢量满足所述参考运动矢量对应的参考亮度块或参考色度块未重建完成、所述参考运动矢量对应的参考亮度块或参考色度块的预测模式不匹配,以及所述参考运动矢量越界中至少一项的情况下,确定所述参考运动矢量为无效;或者,在所述参考运动矢量满足所述参考运动矢量对应的参考亮度块或参考色度块已重建完成、所述参考运动矢量对应的参考亮度块或参考色度块的预测模式相匹配,以及所述参考运动矢量未越界的情况下,确定所述参考运动矢量为有效。In some embodiments, the first determination part 1002 is further configured to determine that the reference motion vector is invalid when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds; or, determine that the reference motion vector is valid when the reference motion vector satisfies the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector is not out of bounds.
在一些实施例中,所述第一确定部分1002,还被配置为通过所述跨分量预测模型,根据所述当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值;其中,所述候选色度预测块与所述当前色度块的大小不同;对所述候选色度预测块的候选预测色度值进行下采样,得到所述预测色度块的预测色度值。In some embodiments, the first determination part 1002 is further configured to determine the candidate predicted chrominance value of the candidate chrominance prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model; wherein the candidate chrominance prediction block is different in size from the current chrominance block; and downsample the candidate predicted chrominance value of the candidate chrominance prediction block to obtain the predicted chrominance value of the predicted chrominance block.
在一些实施例中,所述跨分量预测模型包括至少一个跨分量预测子模型;所述第一确定部分1002,还被配置为针对所述当前同位亮度块中的每一像素点的重建亮度值,将所述每一像素点的重建亮度值输入至相对应的跨分量预测子模型中,得到所述每一像素点对应的候选预测色度值;其中,所述每一像素点的重建亮度值对应的预设亮度范围与所述跨分量预测子模型相匹配;根据所述当前同位亮度块中的各个像素点对应的候选预测色度值,确定所述候选色度预测块的候选预测色度值。In some embodiments, the cross-component prediction model includes at least one cross-component prediction sub-model; the first determination part 1002 is also configured to input the reconstructed luminance value of each pixel in the current co-located luminance block into the corresponding cross-component prediction sub-model to obtain the candidate predicted chromaticity value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model; and determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the candidate predicted chromaticity value corresponding to each pixel in the current co-located luminance block.
在一些实施例中,所述解码部分1001,还被配置为解析码流,确定第二语法标识信息;在所述第二语法标识信息指示当前色度块不采用色度帧内块复制预测模式的情况下,执行所述解析码流,得到第一 语法标识信息的步骤。In some embodiments, the decoding part 1001 is further configured to parse the code stream to determine the second syntax identification information; when the second syntax identification information indicates that the current chroma block does not adopt the chroma intra block copy prediction mode, perform the parsing of the code stream to obtain the first The steps of the syntax identification information.
在一些实施例中,所述解码部分1001,还被配置为若所述第二语法标识信息的取值为第一值,则确定所述当前色度块采用色度帧内块复制预测模式;或者,若所述第二语法标识信息的取值为第二值,则确定所述当前色度块不采用色度帧内块复制预测模式。In some embodiments, the decoding part 1001 is further configured to determine that the current chroma block adopts the chroma intra-frame block copy prediction mode if the value of the second syntax identification information is a first value; or, if the value of the second syntax identification information is a second value, determine that the current chroma block does not adopt the chroma intra-frame block copy prediction mode.
在一些实施例中,所述解码部分1001,还被配置为若所述第一语法标识信息的取值为第三值,则确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式;或者,若所述第一语法标识信息的取值为第四值,则确定所述当前色度块不采用基于色度帧内块复制技术的跨分量预测模式。In some embodiments, the decoding part 1001 is further configured to determine that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the first syntax identification information is a third value; or, if the value of the first syntax identification information is a fourth value, determine that the current chroma block does not adopt a cross-component prediction mode based on the chroma intra-frame block copy technology.
在一些实施例中,所述解码部分1001,还被配置为解析码流,确定第三语法标识信息;在所述第三语法标识信息指示当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,执行所述解析码流,得到第一语法标识信息的步骤。In some embodiments, the decoding part 1001 is also configured to parse the code stream to determine the third syntax identification information; when the third syntax identification information indicates that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, perform the step of parsing the code stream to obtain the first syntax identification information.
在一些实施例中,所述解码部分1001,还被配置为若所述第三语法标识信息的取值为第五值,则确定所述当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式;或者,若所述第三语法标识信息的取值为第六值,则确定所述当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式。In some embodiments, the decoding part 1001 is further configured to determine that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the third syntax identification information is the fifth value; or, if the value of the third syntax identification information is the sixth value, determine that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology.
在一些实施例中,所述解码部分1001,还被配置为若所述第一语法标识信息的取值为第七值,则确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式;或者,若所述第一语法标识信息的取值为第八值,则确定所述当前色度块采用色度帧内块复制预测模式。In some embodiments, the decoding part 1001 is also configured to determine that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology if the value of the first syntax identification information is the seventh value; or, if the value of the first syntax identification information is the eighth value, determine that the current chroma block adopts the chroma intra-frame block copy prediction mode.
在一些实施例中,所述解码部分1001,还被配置为解析码流,得到所述当前色度块的色度残差值。In some embodiments, the decoding part 1001 is further configured to parse the bit stream to obtain the chroma residual value of the current chroma block.
在一些实施例中,所述第一确定部分1002,还被配置为对所述色度残差值进行反变换处理和反量化处理,得到所述当前色度块的反量化色度残差值;根据所述反量化色度残差值和所述预测色度值,确定所述当前色度块的所述重建色度值。In some embodiments, the first determination part 1002 is further configured to perform inverse transformation and inverse quantization on the chroma residual value to obtain an inverse quantized chroma residual value of the current chroma block; and determine the reconstructed chroma value of the current chroma block based on the inverse quantized chroma residual value and the predicted chroma value.
可以理解地,在本申请实施例中,“部分”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It is understandable that in the embodiments of the present application, "part" can be a part of a circuit, a part of a processor, a part of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the components in the present embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional module.
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
因此,本申请实施例提供了一种计算机可读存储介质,应用于解码器1000,该计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现前述实施例中任一项所述的方法。Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 1000. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, the method described in any one of the aforementioned embodiments is implemented.
基于上述解码器1000的组成以及计算机可读存储介质,参见图18,其示出了本申请实施例提供的解码器1000的具体硬件结构示意图。如图18所示,解码器1000可以包括:第一通信接口1101、第一存储器1102和第一处理器1103;各个组件通过第一总线系统1104耦合在一起。可理解,第一总线系统1104用于实现这些组件之间的连接通信。第一总线系统1104除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图18中将各种总线都标为第一总线系统1104。其中,Based on the composition of the above-mentioned decoder 1000 and the computer-readable storage medium, refer to Figure 18, which shows a specific hardware structure diagram of the decoder 1000 provided in an embodiment of the present application. As shown in Figure 18, the decoder 1000 may include: a first communication interface 1101, a first memory 1102 and a first processor 1103; each component is coupled together through a first bus system 1104. It can be understood that the first bus system 1104 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 1104 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as the first bus system 1104 in Figure 18. Among them,
第一通信接口1101,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;The first communication interface 1101 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
第一存储器1102,用于存储能够在第一处理器1103上运行的计算机程序;A first memory 1102, used to store a computer program that can be run on the first processor 1103;
第一处理器1103,用于在运行所述计算机程序时,执行:The first processor 1103 is configured to, when running the computer program, execute:
解析码流,确定第一语法标识信息;Parsing the code stream to determine first syntax identification information;
在所述第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据所述当前色度块对应的当前同位亮度块,确定参考运动矢量;When the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on a chroma intra block copying technique, determining a reference motion vector according to a current co-located luminance block corresponding to the current chroma block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;When the reference motion vector is valid, determining a cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值;Determining a predicted chroma value of a predicted chroma block based on the cross-component prediction model;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
可以理解,本申请实施例中的第一存储器1102可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、 可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的第一存储器1102旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the first memory 1102 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable Programmable ROM (EEPROM) or Flash memory. Volatile memory can be Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM) and Direct Rambus RAM (DRRAM). The first memory 1102 of the system and method described in the present application is intended to include but is not limited to these and any other suitable types of memory.
而第一处理器1103可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过第一处理器1103中的硬件的集成逻辑电路或者软件形式的指令完成。上述的第一处理器1103可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于第一存储器1102,第一处理器1103读取第一存储器1102中的信息,结合其硬件完成上述方法的步骤。The first processor 1103 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the first processor 1103. The above-mentioned first processor 1103 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the first memory 1102, and the first processor 1103 reads the information in the first memory 1102 and completes the steps of the above method in combination with its hardware.
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。It is understood that the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSP Device, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof. For software implementation, the technology described in this application can be implemented by a module (such as a process, function, etc.) that performs the functions described in this application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
可选地,作为另一个实施例,第一处理器1103还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。Optionally, as another embodiment, the first processor 1103 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
本实施例提供了一种解码器,在该解码器中,由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的解码场景,从而提高了对当前色度块的解码效率。The present embodiment provides a decoder, in which, since the cross-component prediction model is determined by a reference luminance block and a reference chrominance block corresponding to a reference motion vector, compared to a cross-component prediction model derived based on reconstructed pixels in an adjacent row and column of a current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex decoding scenarios, thereby improving the decoding efficiency of the current chrominance block.
在本申请的再一实施例中,基于前述实施例相同的发明构思,参见图19,其示出了本申请实施例提供的一种编码器的组成结构示意图。如图19所示,该编码器2000可以包括第二确定部分2001和编码部分2002;其中,In another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, see FIG19 , which shows a schematic diagram of the composition structure of an encoder provided by an embodiment of the present application. As shown in FIG19 , the encoder 2000 may include a second determination part 2001 and an encoding part 2002; wherein,
所述第二确定部分2001,被配置为根据当前色度块对应的当前同位亮度块,确定参考运动矢量;The second determining part 2001 is configured to determine a reference motion vector according to a current co-located luminance block corresponding to a current chrominance block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定所述跨分量预测模型;When the reference motion vector is valid, determining the cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值,并根据所述预测色度值,确定第一语法标识信息;其中,所述第一语法标识信息用于指示所述当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
在一些实施例中,所述跨分量预测模型表征所述当前色度块对应的当前同位亮度块的重建亮度值与所述预测色度块的预测色度值具有线性或者非线性关系。In some embodiments, the cross-component prediction model characterizes that a reconstructed luminance value of a current co-located luminance block corresponding to the current chrominance block has a linear or nonlinear relationship with a predicted chrominance value of the predicted chrominance block.
在一些实施例中,所述第二确定部分2001,还被配置为在所述当前同位亮度块中确定满足预设的预测模式的候选参考样点,并将所述候选参考样点对应的运动矢量作为参考运动矢量。In some embodiments, the second determining part 2001 is further configured to determine candidate reference samples that satisfy a preset prediction mode in the current co-located luminance block, and use the motion vector corresponding to the candidate reference sample as a reference motion vector.
在一些实施例中,所述第二确定部分2001,还被配置为按照预设样点选取方式在所述参考亮度块中确定至少两个参考亮度样点,以及按照所述预设样点选取方式在所述参考色度块中确定与所述至少两个参考亮度样点各自对应的参考色度样点;根据所述至少两个参考亮度样点以及至少两个参考色度样点,确定所述跨分量预测模型;其中,所述至少两个参考亮度样点与所述至少两个参考色度样点相对应。In some embodiments, the second determination part 2001 is further configured to determine at least two reference luma samples in the reference luma block according to a preset sample selection method, and to determine reference chroma samples corresponding to the at least two reference luma samples in the reference chroma block according to the preset sample selection method; determine the cross-component prediction model according to the at least two reference luma samples and the at least two reference chroma samples; wherein the at least two reference luma samples correspond to the at least two reference chroma samples.
在一些实施例中,所述跨分量预测模型包括一个或多个跨分量预测子模型;所述第二确定部分2001, 还被配置为按照所述至少两个参考亮度样点的亮度值,将所述至少两个参考亮度样点以及所述至少两个参考色度样点进行分组,得到至少一个参考样点组;其中,每一个参考样点组包括至少两个亮度样点以及至少两个色度样点;所述至少两个亮度样点与所述至少两个色度样点相对应;所述至少两个参考亮度样点包括所述至少两个亮度样点;所述至少两个参考色度样点包括所述至少两个色度样点;所述至少一个参考样点组对应不同的预设亮度范围;针对所述至少一个参考样点组中的每一参考样点组,根据所述每一参考样点组中的至少两个亮度样点以及所述至少两个色度样点,确定所述每一参考样点组对应的所述跨分量预测子模型。In some embodiments, the cross-component prediction model includes one or more cross-component prediction sub-models; the second determining part 2001, It is also configured to group the at least two reference luminance samples and the at least two reference chrominance samples according to the luminance values of the at least two reference luminance samples to obtain at least one reference sample group; wherein each reference sample group includes at least two luminance samples and at least two chrominance samples; the at least two luminance samples correspond to the at least two chrominance samples; the at least two reference luminance samples include the at least two luminance samples; the at least two reference chrominance samples include the at least two chrominance samples; the at least one reference sample group corresponds to a different preset luminance range; for each reference sample group in the at least one reference sample group, the cross-component prediction sub-model corresponding to each reference sample group is determined according to the at least two luminance samples and the at least two chrominance samples in the each reference sample group.
在一些实施例中,所述第二确定部分2001,还被配置为按照所述至少两个亮度样点的亮度值,将所述每一参考样点组中的至少两个亮度样点以及所述至少两个色度样点进行分组,得到第一样点组和第二样点组;其中,所述第一样点组和第二样点组中各自包括至少一个亮度样点和至少一个色度样点;所述至少一个亮度样点与所述至少一个色度样点相对应;所述第一样点组中的至少一个亮度样点的重建亮度值大于或者等于第二样点组中的至少一个亮度样点的重建亮度值;根据所述第一样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最大参考亮度值和第一参考色度值;根据所述第二样点组中的至少一个亮度样点的重建亮度值以及至少一个色度样点的重建色度值,分别确定最小参考亮度值和第二参考色度值;基于所述最大参考亮度值、所述第一参考色度值、所述最小参考亮度值和所述第二参考色度值,确定缩放因子和偏移因子;根据所述缩放因子和偏移因子,确定所述每一参考样点组对应的所述跨分量预测子模型。In some embodiments, the second determining part 2001 is further configured to group the at least two luma samples and the at least two chroma samples in each reference sample group according to the luma values of the at least two luma samples to obtain a first sample group and a second sample group; wherein the first sample group and the second sample group each include at least one luma sample and at least one chroma sample; the at least one luma sample corresponds to the at least one chroma sample; the reconstructed luma value of at least one luma sample in the first sample group is greater than or equal to the reconstructed luma value of at least one luma sample in the second sample group; and according to the The maximum reference luminance value and the first reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the first sample point group; the minimum reference luminance value and the second reference chrominance value are determined respectively based on the reconstructed luminance value of at least one luminance sample and the reconstructed chrominance value of at least one chrominance sample in the second sample point group; a scaling factor and an offset factor are determined based on the maximum reference luminance value, the first reference chrominance value, the minimum reference luminance value and the second reference chrominance value; and the cross-component prediction sub-model corresponding to each reference sample point group is determined based on the scaling factor and the offset factor.
在一些实施例中,所述第二确定部分2001,还被配置为将所述第一参考色度值与所述第二参考色度值进行减法运算,得到第一中间参数;将所述最大参考亮度值与所述最小参考亮度值进行减法运算,得到第二中间参数;将所述第一中间参数和所述第二中间参数进行除法运算,得到所述缩放因子;将所述缩放因子和所述最小参考亮度值进行乘法运算,得到第三中间参数;将所述第二参考色度值和所述第三中间参数进行减法运算,得到所述偏移因子。In some embodiments, the second determination part 2001 is further configured to subtract the first reference chromaticity value from the second reference chromaticity value to obtain a first intermediate parameter; subtract the maximum reference luminance value from the minimum reference luminance value to obtain a second intermediate parameter; divide the first intermediate parameter and the second intermediate parameter to obtain the scaling factor; multiply the scaling factor and the minimum reference luminance value to obtain a third intermediate parameter; and subtract the second reference chromaticity value from the third intermediate parameter to obtain the offset factor.
在一些实施例中,所述跨分量预测模型为非线性模型;所述第二确定部分2001,还被配置为在所述参考色度块中选取全部或部分参考色度样点;根据所述全部或部分参考色度样点、所述参考亮度块中的与所述全部或部分参考色度样点各自对应的参考亮度样点,以及所述参考亮度样点的邻域参考亮度样点,确定所述跨分量预测模型。In some embodiments, the cross-component prediction model is a nonlinear model; the second determination part 2001 is also configured to select all or part of the reference chroma samples in the reference chroma block; and determine the cross-component prediction model based on the all or part of the reference chroma samples, the reference luminance samples in the reference luminance block corresponding to the all or part of the reference chroma samples, and the neighborhood reference luminance samples of the reference luminance samples.
在一些实施例中,所述邻域参考亮度样点包括以下一项或多项:位于所述参考亮度样点上方的参考亮度样点、位于所述参考亮度样点下方的参考亮度样点、位于所述参考亮度样点左方的参考亮度样点和位于所述参考亮度样点右方的参考亮度样点。In some embodiments, the neighborhood reference luma samples include one or more of the following: a reference luma sample located above the reference luma sample, a reference luma sample located below the reference luma sample, a reference luma sample located to the left of the reference luma sample, and a reference luma sample located to the right of the reference luma sample.
在一些实施例中,所述第二确定部分2001,还被配置为据预设的M个位置信息,在所述当前同位亮度块中对所述预设的M个位置信息各自对应的候选参考样点进行遍历,得到满足所述预设的预测模式的候选参考样点;其中,M为大于等于1的正整数,i为小于M的正整数。In some embodiments, the second determination part 2001 is further configured to traverse the candidate reference sample points corresponding to each of the preset M position information in the current co-located luminance block according to the preset M position information, to obtain the candidate reference sample points that satisfy the preset prediction mode; wherein M is a positive integer greater than or equal to 1, and i is a positive integer less than M.
在一些实施例中,所述第二确定部分2001,还被配置为针对预设的M个位置信息中的第i个位置信息,在所述当前同位亮度块中的与所述第i个位置信息对应的第i个候选参考样点不满足所述预设的预测模式的情况下,继续遍历所述当前同位亮度块中的与所述第i+1个位置信息对应的第i+1个候选参考样点,直至所述第i+1个候选参考样点满足预设的预测模式为止,将所述第i+1个候选参考样点确定为满足所述预设的预测模式的候选参考样点;或者,在所述第i个候选参考样点满足所述预设的预测模式的情况下,将所述第i个候选参考样点确定为满足所述预设的预测模式的候选参考样点。In some embodiments, the second determination part 2001 is further configured to, for the i-th position information among the preset M position information, if the i-th candidate reference sample corresponding to the i-th position information in the current co-located luminance block does not satisfy the preset prediction mode, continue to traverse the i+1-th candidate reference sample corresponding to the i+1-th position information in the current co-located luminance block until the i+1-th candidate reference sample satisfies the preset prediction mode, and determine the i+1-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode; or, if the i-th candidate reference sample satisfies the preset prediction mode, determine the i-th candidate reference sample as a candidate reference sample that satisfies the preset prediction mode.
在一些实施例中,所述M个位置信息包括以下一项或多项:所述当前同位亮度块的中间的位置;所述当前同位亮度块的左上方的位置;所述当前同位亮度块的右上方的位置;所述当前同位亮度块的左下方的位置;所述当前同位亮度块的右下方的位置。In some embodiments, the M positions information include one or more of the following: the middle position of the current co-located brightness block; the upper left position of the current co-located brightness block; the upper right position of the current co-located brightness block; the lower left position of the current co-located brightness block; and the lower right position of the current co-located brightness block.
在一些实施例中,所述预设的预测模式为:所述候选参考样点采用块复制帧内预测模式或者串复制帧内预测的普通串子模式。In some embodiments, the preset prediction mode is: the candidate reference samples adopt a block copy intra prediction mode or a common string sub-mode of a string copy intra prediction.
在一些实施例中,所述预设样点选取方式包括以下任意一种:居中选取方式、垂直选取方式、水平选取方式、对角线选取方式和顶点选取方式。In some embodiments, the preset sample point selection method includes any one of the following: a center selection method, a vertical selection method, a horizontal selection method, a diagonal selection method, and a vertex selection method.
在一些实施例中,所述预设样点选取方式为居中选取方式;所述参考色度块的宽度为W,所述参考色度块的高度为H;所述参考亮度块的宽度为2W,所述参考亮度块的高度为2H;所述至少两个参考亮度样点包括:第一参考亮度样点、第二参考亮度样点、第三参考亮度样点和第四参考亮度样点;与所述至少两个参考亮度样点各自对应的参考色度样点包括:第一参考色度样点、第二参考色度样点、第三参考色度样点和第四参考色度样点;其中,所述第一参考色度样点在所述参考色度块的位置坐标为(1,0);所述第一参考色度样点为所述参考色度块的左上角的色度样点;所述第二参考色度样点在所述参考色度块的位置坐标为(W-2,0);所述第三参考色度样点在所述参考色度块的位置坐标为(1,H-1);所述 第四参考色度样点在所述参考色度块的位置坐标为(W-2,H-1);所述第一参考亮度样点在所述参考亮度块的位置坐标为(2,0);所述第一参考亮度样点为所述参考亮度块的左上角的亮度样点;所述第二参考亮度样点在所述参考亮度块的位置坐标为(2×(W-2),0);所述第三参考亮度样点在所述参考亮度块的位置坐标为(2,2×(H-1));所述第四参考亮度样点在所述参考亮度块的位置坐标为(2×(W-2),2×(H-1))。In some embodiments, the preset sample selection method is a center selection method; the width of the reference chroma block is W, and the height of the reference chroma block is H; the width of the reference luminance block is 2W, and the height of the reference luminance block is 2H; the at least two reference luminance samples include: a first reference luminance sample, a second reference luminance sample, a third reference luminance sample, and a fourth reference luminance sample; the reference chroma samples corresponding to the at least two reference luminance samples include: a first reference chroma sample, a second reference chroma sample, a third reference chroma sample, and a fourth reference chroma sample; wherein the position coordinates of the first reference chroma sample in the reference chroma block are (1,0); the first reference chroma sample is the chroma sample at the upper left corner of the reference chroma block; the position coordinates of the second reference chroma sample in the reference chroma block are (W-2,0); the position coordinates of the third reference chroma sample in the reference chroma block are (1,H-1); The position coordinates of the fourth reference chromaticity sample in the reference chromaticity block are (W-2, H-1); the position coordinates of the first reference luminance sample in the reference luminance block are (2, 0); the first reference luminance sample is the luminance sample at the upper left corner of the reference luminance block; the position coordinates of the second reference luminance sample in the reference luminance block are (2×(W-2), 0); the position coordinates of the third reference luminance sample in the reference luminance block are (2, 2×(H-1)); the position coordinates of the fourth reference luminance sample in the reference luminance block are (2×(W-2), 2×(H-1)).
在一些实施例中,所述第二确定部分2001,还被配置为在所述参考运动矢量为无效的情况下,根据所述当前色度块的样本精度,确定所述预测色度块的预测色度值。In some embodiments, the second determining part 2001 is further configured to determine the predicted chroma value of the predicted chroma block according to the sample accuracy of the current chroma block when the reference motion vector is invalid.
在一些实施例中,所述第二确定部分2001,还被配置为将所述样本精度与第一预设值进行减法运算,得到第四中间参数;将所述第二预设值与所述第四中间参数进行指数运算,得到所述预测色度块中各个像素点的预测色度值。In some embodiments, the second determination part 2001 is further configured to perform a subtraction operation on the sample accuracy and a first preset value to obtain a fourth intermediate parameter; and perform an exponential operation on the second preset value and the fourth intermediate parameter to obtain a predicted chromaticity value of each pixel in the predicted chromaticity block.
在一些实施例中,所述第二确定部分2001,还被配置为在所述参考运动矢量满足所述参考运动矢量对应的参考亮度块或参考色度块未重建完成、所述参考运动矢量对应的参考亮度块或参考色度块的预测模式不匹配,以及所述参考运动矢量越界中至少一项的情况下,确定所述参考运动矢量为无效;或者,在所述参考运动矢量满足所述参考运动矢量对应的参考亮度块或参考色度块已重建完成、所述参考运动矢量对应的参考亮度块或参考色度块的预测模式相匹配,以及所述参考运动矢量未越界的情况下,确定所述参考运动矢量为有效。In some embodiments, the second determination part 2001 is further configured to determine that the reference motion vector is invalid when the reference motion vector satisfies at least one of the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has not been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector does not match, and the reference motion vector is out of bounds; or, determine that the reference motion vector is valid when the reference motion vector satisfies the following conditions: the reference luminance block or the reference chrominance block corresponding to the reference motion vector has been reconstructed, the prediction mode of the reference luminance block or the reference chrominance block corresponding to the reference motion vector matches, and the reference motion vector is not out of bounds.
在一些实施例中,所述第二确定部分2001,还被配置为通过所述跨分量预测模型,根据所述当前同位亮度块中的各个像素点的重建亮度值,确定候选色度预测块的候选预测色度值;其中,所述候选色度预测块与所述当前色度块的大小不同;对所述候选色度预测块的候选预测色度值进行下采样,得到所述预测色度块的预测色度值。In some embodiments, the second determination part 2001 is further configured to determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the reconstructed luminance value of each pixel in the current co-located luminance block through the cross-component prediction model; wherein the candidate chromaticity prediction block is different in size from the current chromaticity block; and downsample the candidate predicted chromaticity value of the candidate chromaticity prediction block to obtain the predicted chromaticity value of the predicted chromaticity block.
在一些实施例中,所述跨分量预测模型包括至少一个跨分量预测子模型;所述第二确定部分2001,还被配置为针对所述当前同位亮度块中的每一像素点的重建亮度值,将所述每一像素点的重建亮度值输入至相对应的跨分量预测子模型中,得到所述每一像素点对应的候选预测色度值;其中,所述每一像素点的重建亮度值对应的预设亮度范围与所述跨分量预测子模型相匹配;根据所述当前同位亮度块中的各个像素点对应的候选预测色度值,确定所述候选色度预测块的候选预测色度值。In some embodiments, the cross-component prediction model includes at least one cross-component prediction sub-model; the second determination part 2001 is also configured to input the reconstructed luminance value of each pixel in the current co-located luminance block into the corresponding cross-component prediction sub-model to obtain the candidate predicted chromaticity value corresponding to each pixel; wherein the preset luminance range corresponding to the reconstructed luminance value of each pixel matches the cross-component prediction sub-model; and determine the candidate predicted chromaticity value of the candidate chromaticity prediction block according to the candidate predicted chromaticity value corresponding to each pixel in the current co-located luminance block.
在一些实施例中,所述第二确定部分2001,还被配置为根据所述当前色度块的原始色度值和所述预测色度值,确定所述当前色度块的色度残差值;对所述当前色度块的色度残差值进行率失真代价计算,得到所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式对应的第一率失真代价值;根据所述第一率失真代价值,确定所述当前色度块采用的预测模式;根据所述当前色度块采用的预测模式,确定所述第一语法标识信息。In some embodiments, the second determination part 2001 is further configured to determine the chroma residual value of the current chroma block based on the original chroma value and the predicted chroma value of the current chroma block; perform rate-distortion cost calculation on the chroma residual value of the current chroma block to obtain a first rate-distortion cost value corresponding to the cross-component prediction mode based on the chroma intra-frame block copy technology adopted by the current chroma block; determine the prediction mode adopted by the current chroma block based on the first rate-distortion cost value; and determine the first syntax identification information based on the prediction mode adopted by the current chroma block.
在一些实施例中,所述编码部分2002,被配置为将所述第一语法标识信息进行编码处理,将所得到的编码比特写入码流。In some embodiments, the encoding part 2002 is configured to encode the first syntax identification information and write the obtained encoded bits into a bit stream.
在一些实施例中,所述第二确定部分2001,还被配置为在所述第一率失真代价值小于或者等于预设的一个或多个候选预测模式各自对应的第二率失真代价值的情况下,确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式;或者,在所述第一率失真代价值大于所述预设的一个或多个候选预测模式各自对应的第二率失真代价值的情况下,确定所述当前色度块不采用基于色度帧内块复制技术的跨分量预测模式。In some embodiments, the second determination part 2001 is further configured to determine that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology when the first rate-distortion cost value is less than or equal to the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes; or determine that the current chroma block does not adopt the cross-component prediction mode based on the chroma intra-frame block copy technology when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to each of the one or more preset candidate prediction modes.
在一些实施例中,所述一个或多个候选预测模式包括:色度帧内块复制预测模式;所述第二确定部分2001,还被配置为在所述第一率失真代价值大于色度帧内块复制预测模式对应的第二率失真代价值的情况下,确定所述当前色度块采用色度帧内块复制预测模式。In some embodiments, the one or more candidate prediction modes include: a chroma intra block copy prediction mode; the second determination part 2001 is also configured to determine that the current chroma block adopts the chroma intra block copy prediction mode when the first rate-distortion cost value is greater than the second rate-distortion cost value corresponding to the chroma intra block copy prediction mode.
在一些实施例中,所述第二确定部分2001,还被配置为在确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,确定所述第一语法标识信息的取值为第三值;或者,在确定所述当前色度块不采用基于色度帧内块复制技术的跨分量预测模式的情况下,确定所述第一语法标识信息的取值为第四值。In some embodiments, the second determination part 2001 is further configured to determine that the value of the first syntax identification information is a third value when it is determined that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology; or to determine that the value of the first syntax identification information is a fourth value when it is determined that the current chroma block does not adopt a cross-component prediction mode based on the chroma intra-frame block copy technology.
在一些实施例中,所述第二确定部分2001,还被配置为确定第二语法标识信息。In some embodiments, the second determining part 2001 is further configured to determine second grammar identification information.
在一些实施例中,所述第二确定部分2001,还被配置为在确定所述当前色度块采用色度帧内块复制预测模式的情况下,则将所述第二语法标识信息的取值设置为第一值;或者,在确定所述当前色度块不采用色度帧内块复制预测模式的情况下,则将所述第二语法标识信息的取值设置为第二值。In some embodiments, the second determination part 2001 is further configured to set the value of the second syntax identification information to the first value when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode; or to set the value of the second syntax identification information to the second value when it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode.
在一些实施例中,所述编码部分2002,还被配置为将所述第二语法标识信息进行编码处理,将所得到的编码比特写入码流。In some embodiments, the encoding part 2002 is further configured to encode the second syntax identification information and write the obtained encoded bits into a bit stream.
在一些实施例中,所述第二确定部分2001,还被配置为在确定所述当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,则将所述第一语法标识信息的取值设置为第七值;或者,在确定所述当前色度块采用色度帧内块复制预测模式的情况下,则将所述第一语法标识信息的取值设置为 第八值。In some embodiments, the second determining part 2001 is further configured to, when it is determined that the current chroma block adopts the cross-component prediction mode based on the chroma intra-frame block copy technology, set the value of the first syntax identification information to the seventh value; or, when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode, set the value of the first syntax identification information to The eighth value.
在一些实施例中,所述第二确定部分2001,还被配置为确定第三语法标识信息。In some embodiments, the second determining part 2001 is further configured to determine third grammar identification information.
在一些实施例中,所述第二确定部分2001,还被配置为在确定所述当前色度块采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,则将所述第三语法标识信息的取值设置为第五值;或者,在确定所述当前色度块不采用色度帧内块复制预测模式或基于色度帧内块复制技术的跨分量预测模式的情况下,则将所述第三语法标识信息的取值设置为第六值。In some embodiments, the second determination part 2001 is further configured to set the value of the third syntax identification information to a fifth value when it is determined that the current chroma block adopts the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology; or, when it is determined that the current chroma block does not adopt the chroma intra-frame block copy prediction mode or the cross-component prediction mode based on the chroma intra-frame block copy technology, set the value of the third syntax identification information to a sixth value.
在一些实施例中,所述编码部分2002,还被配置为将所述第三语法标识信息进行编码处理,将所得到的编码比特写入码流。In some embodiments, the encoding part 2002 is further configured to encode the third syntax identification information and write the obtained encoded bits into a bit stream.
在一些实施例中,所述第二确定部分2001,还被配置为在确定当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,对所述色度残差值进行变换处理和量化处理,得到所述当前色度块的量化色度残差值。In some embodiments, the second determination part 2001 is further configured to, when it is determined that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, transform and quantize the chroma residual value to obtain a quantized chroma residual value of the current chroma block.
在一些实施例中,所述编码部分2002,还被配置为将所述当前色度块的是量化色度残差值进行编码处理,将所得到的编码比特写入码流。In some embodiments, the encoding part 2002 is further configured to encode the quantized chroma residual value of the current chroma block and write the obtained coded bits into the bitstream.
可以理解地,在本实施例中,“部分”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It can be understood that in this embodiment, "part" can be a part of the circuit, a part of the processor, a part of the program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional modules.
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例提供了一种计算机可读存储介质,应用于编码器2000,该计算机可读存储介质存储有计算机程序,所述计算机程序被第二处理器执行时实现前述实施例中任一项所述的方法。If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium, which is applied to the encoder 2000, and the computer-readable storage medium stores a computer program. When the computer program is executed by the second processor, the method described in any one of the above embodiments is implemented.
基于上述编码器2000的组成以及计算机可读存储介质,参见图20,其示出了本申请实施例提供的编码器2000的具体硬件结构示意图。如图20所示,编码器2000可以包括:第二通信接口2101、第二存储器2102和第二处理器2103;各个组件通过第二总线系统2104耦合在一起。可理解,第二总线系统2104用于实现这些组件之间的连接通信。第二总线系统2104除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图20中将各种总线都标为第二总线系统2104。其中,Based on the composition of the above-mentioned encoder 2000 and the computer-readable storage medium, refer to Figure 20, which shows a specific hardware structure diagram of the encoder 2000 provided in an embodiment of the present application. As shown in Figure 20, the encoder 2000 may include: a second communication interface 2101, a second memory 2102 and a second processor 2103; each component is coupled together through a second bus system 2104. It can be understood that the second bus system 2104 is used to realize the connection and communication between these components. In addition to the data bus, the second bus system 2104 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as the second bus system 2104 in Figure 20. Among them,
第二通信接口2101,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;The second communication interface 2101 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
第二存储器2102,用于存储能够在第二处理器2103上运行的计算机程序;The second memory 2102 is used to store a computer program that can be run on the second processor 2103;
第二处理器2103,用于在运行所述计算机程序时,执行:The second processor 2103 is configured to, when running the computer program, execute:
根据当前色度块对应的当前同位亮度块,确定参考运动矢量;Determine a reference motion vector according to a current co-located luminance block corresponding to the current chrominance block;
在所述参考运动矢量为有效的情况下,基于所述参考运动矢量对应的参考亮度块和参考色度块,确定所述跨分量预测模型;When the reference motion vector is valid, determining the cross-component prediction model based on a reference luminance block and a reference chrominance block corresponding to the reference motion vector;
基于所述跨分量预测模型,确定预测色度块的预测色度值,并根据所述预测色度值,确定第一语法标识信息;其中,所述第一语法标识信息用于指示所述当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;Based on the cross-component prediction model, determine a predicted chroma value of the predicted chroma block, and determine first syntax identification information according to the predicted chroma value; wherein the first syntax identification information is used to indicate whether the current chroma block adopts a cross-component prediction mode based on a chroma intra block copy technology;
根据所述预测色度块的预测色度值,确定所述当前色度块的重建色度值。Determine the reconstructed chrominance value of the current chrominance block according to the predicted chrominance value of the predicted chrominance block.
可选地,作为另一个实施例,第二处理器2103还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。Optionally, as another embodiment, the second processor 2103 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
可以理解,第二存储器2102与第一存储器1102的硬件功能类似,第二处理器2103与第一处理器1103的硬件功能类似;这里不再详述。It can be understood that the hardware functions of the second memory 2102 and the first memory 1102 are similar, and the hardware functions of the second processor 2103 and the first processor 1103 are similar; they will not be described in detail here.
本实施例提供了一种编码器,在该编码器中,由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编码场景,从而提高了对当前色度块的编码效率。The present embodiment provides an encoder, in which, since the cross-component prediction model is determined by a reference luminance block and a reference chrominance block corresponding to a reference motion vector, compared to a cross-component prediction model derived based on reconstructed pixels in an adjacent row and column of a current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex coding scenarios, thereby improving the coding efficiency of the current chrominance block.
在本申请的再一实施例中,参见图21,其示出了本申请实施例提供的一种编解码系统的组成结构示意图。如图21所示,编解码系统3000可以包括解码器3001和编码器3002。In yet another embodiment of the present application, referring to FIG21 , a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application is shown. As shown in FIG21 , the coding and decoding system 3000 may include a decoder 3001 and an encoder 3002 .
在本申请实施例中,解码器3001可以是前述实施例中任一项所述的解码器,编码器3002可以是前述实施例中任一项所述的编码器。In the embodiment of the present application, the decoder 3001 may be the decoder described in any one of the aforementioned embodiments, and the encoder 3002 may be the encoder described in any one of the aforementioned embodiments.
需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下, 由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this application, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. Without further restrictions, An element defined by the phrase "comprising a ..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述本申请实施例的保护范围为准。The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the embodiments of the present application.
本申请实施例中,在解码端,解析码流,确定第一语法标识信息;在第一语法标识信息指示当前色度块采用基于色度帧内块复制技术的跨分量预测模式的情况下,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值;根据预测色度块的预测色度值,确定当前色度块的重建色度值。在编码端,根据当前色度块对应的当前同位亮度块,确定参考运动矢量;在参考运动矢量为有效的情况下,基于参考运动矢量对应的参考亮度块和参考色度块,确定跨分量预测模型;基于跨分量预测模型,确定预测色度块的预测色度值,并根据预测色度值,确定第一语法标识信息;其中,第一语法标识信息用于指示当前色度块是否采用基于色度帧内块复制技术的跨分量预测模式;根据预测色度块的预测色度值,确定当前色度块的重建色度值。由于跨分量预测模型是通过参考运动矢量对应的参考亮度块和参考色度块确定的,这样,相比于根据当前色度块的相邻一行一列的重构像素推导的跨分量预测模型,可以提高确定跨分量预测模型的灵活性和多样性,从而使得跨分量预测模型可以灵活应对更多的复杂的编解码场景,从而提高了对当前色度块的编解码效率。 In an embodiment of the present application, at the decoding end, the bitstream is parsed to determine the first syntax identification information; when the first syntax identification information indicates that the current chroma block adopts a cross-component prediction mode based on the chroma intra-frame block copy technology, a reference motion vector is determined according to the current co-located luminance block corresponding to the current chroma block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chroma block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chroma value of the predicted chroma block is determined; and based on the predicted chroma value of the predicted chroma block, a reconstructed chroma value of the current chroma block is determined. At the encoding end, a reference motion vector is determined based on the current co-located luminance block corresponding to the current chrominance block; when the reference motion vector is valid, a cross-component prediction model is determined based on the reference luminance block and the reference chrominance block corresponding to the reference motion vector; based on the cross-component prediction model, a predicted chrominance value of the predicted chrominance block is determined, and first syntax identification information is determined based on the predicted chrominance value; wherein the first syntax identification information is used to indicate whether the current chrominance block adopts a cross-component prediction mode based on the chrominance intra-frame block copy technology; based on the predicted chrominance value of the predicted chrominance block, a reconstructed chrominance value of the current chrominance block is determined. Since the cross-component prediction model is determined by the reference luminance block and the reference chrominance block corresponding to the reference motion vector, compared with the cross-component prediction model derived from the reconstructed pixels of the adjacent row and column of the current chrominance block, the flexibility and diversity of determining the cross-component prediction model can be improved, so that the cross-component prediction model can flexibly cope with more complex encoding and decoding scenarios, thereby improving the encoding and decoding efficiency of the current chrominance block.
Claims (62)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2023/137583 WO2025118292A1 (en) | 2023-12-08 | 2023-12-08 | Encoding and decoding method, code stream, decoder, encoder, and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2023/137583 WO2025118292A1 (en) | 2023-12-08 | 2023-12-08 | Encoding and decoding method, code stream, decoder, encoder, and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025118292A1 true WO2025118292A1 (en) | 2025-06-12 |
Family
ID=95981576
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2023/137583 Pending WO2025118292A1 (en) | 2023-12-08 | 2023-12-08 | Encoding and decoding method, code stream, decoder, encoder, and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2025118292A1 (en) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110324627A (en) * | 2018-03-30 | 2019-10-11 | 杭州海康威视数字技术股份有限公司 | The intra-frame prediction method and device of coloration |
| US20190342933A1 (en) * | 2016-12-28 | 2019-11-07 | Huawei Technologies Co., Ltd. | Communication Establishment Method And Terminal |
| CN113676732A (en) * | 2019-03-18 | 2021-11-19 | Oppo广东移动通信有限公司 | Image component prediction method, encoder, decoder, and storage medium |
| US20220239897A1 (en) * | 2021-01-25 | 2022-07-28 | Lemon Inc. | Methods and apparatuses for cross-component prediction |
| KR20220126233A (en) * | 2021-03-08 | 2022-09-15 | 현대자동차주식회사 | Video Coding Method And Apparatus Using Matrix Based Cross-Component Prediction |
| CN115398912A (en) * | 2020-02-29 | 2022-11-25 | 抖音视界有限公司 | Constraint of syntax elements of adaptive parameter set |
-
2023
- 2023-12-08 WO PCT/CN2023/137583 patent/WO2025118292A1/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190342933A1 (en) * | 2016-12-28 | 2019-11-07 | Huawei Technologies Co., Ltd. | Communication Establishment Method And Terminal |
| CN110324627A (en) * | 2018-03-30 | 2019-10-11 | 杭州海康威视数字技术股份有限公司 | The intra-frame prediction method and device of coloration |
| CN113676732A (en) * | 2019-03-18 | 2021-11-19 | Oppo广东移动通信有限公司 | Image component prediction method, encoder, decoder, and storage medium |
| CN115398912A (en) * | 2020-02-29 | 2022-11-25 | 抖音视界有限公司 | Constraint of syntax elements of adaptive parameter set |
| US20220239897A1 (en) * | 2021-01-25 | 2022-07-28 | Lemon Inc. | Methods and apparatuses for cross-component prediction |
| KR20220126233A (en) * | 2021-03-08 | 2022-09-15 | 현대자동차주식회사 | Video Coding Method And Apparatus Using Matrix Based Cross-Component Prediction |
Non-Patent Citations (1)
| Title |
|---|
| G. LAROCHE (CANON), J. TAQUET (CANON), C. GISQUET (CANON), P. ONNO (CANON): "CE3: Cross-component linear model simplification (Test 5.1)", 124. MPEG MEETING; 20181008 - 20181012; MACAO; (MOTION PICTURE EXPERT GROUP OR ISO/IEC JTC1/SC29/WG11), 24 September 2018 (2018-09-24), XP030190874 * |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20200382800A1 (en) | Parameter derivation for intra prediction | |
| CN112929670B (en) | Adaptive chroma downsampling and color space conversion techniques | |
| CN113596475A (en) | Image/video encoding method, apparatus, system, and computer-readable storage medium | |
| CN119946259B (en) | Decoding prediction methods, devices, and computer storage media | |
| CN119835417A (en) | Video image component prediction method and device and computer storage medium | |
| US20240236372A1 (en) | Video encoding and decoding method, and device | |
| JP2007515115A (en) | Improvement of calculation method of interpolated pixel value | |
| WO2020192717A1 (en) | Parameter derivation for inter prediction | |
| CN117730339A (en) | Super-resolution positioning and network structure | |
| WO2025118292A1 (en) | Encoding and decoding method, code stream, decoder, encoder, and storage medium | |
| CN120548703A (en) | Coding and decoding method, code stream, encoder, decoder and storage medium | |
| CN118266217A (en) | Method, device and medium for video processing | |
| CN113395520B (en) | Decoding prediction method, device and computer storage medium | |
| CN112313950B (en) | Video image component prediction method, device and computer storage medium | |
| WO2020258053A1 (en) | Image component prediction method and apparatus, and computer storage medium | |
| WO2025065420A1 (en) | Coding method, decoding method, code stream, coder, decoder and storage medium | |
| WO2024207136A1 (en) | Encoding/decoding method, code stream, encoder, decoder and storage medium | |
| WO2025097423A1 (en) | Encoding and decoding methods, code stream, encoder, decoder, and storage medium | |
| WO2024153241A1 (en) | Coding method, decoding method, code stream, encoder, decoder and storage medium | |
| WO2025138242A1 (en) | Encoding and decoding methods, encoder, decoder, and storage medium | |
| WO2025147924A1 (en) | Coding method, decoding method, code stream, coder, decoder and storage medium | |
| WO2024148540A1 (en) | Coding method, decoding method, decoder, coder, bitstream and storage medium | |
| WO2025007276A1 (en) | Coding method, decoding method, bit stream, coder, decoder and storage medium | |
| WO2025065696A1 (en) | Coding method, decoding method, code stream, coder, decoder, and storage medium | |
| WO2024077569A1 (en) | Encoding method, decoding method, code stream, encoder, decoder, and storage medium |
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: 23960603 Country of ref document: EP Kind code of ref document: A1 |