Video coding method and related device

By performing chain-like encoding and quadtree raster encoding on the α image of the video frame, multiple bitstreams are generated and merged for output, which solves the problems of A-channel redundancy and glitches in YUV video encoding and decoding, and improves encoding efficiency and video quality.

CN114449285BActive Publication Date: 2026-11-27HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011226975.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-05
Publication Date
2026-11-27
Estimated Expiration
2040-11-05

AI Technical Summary

Technical Problem

Existing YUV video encoding and decoding technologies exhibit significant redundancy in the A channel and severe jagged edges at the mask edges, affecting video quality.

Method used

By performing chain-like coding and quadtree raster coding on the α image of the video frame, the first bitstream and the second bitstream are generated respectively, and then merged with the third bitstream of the YUV image for output, so as to prevent quantization distortion of the mask image and improve coding efficiency.

Benefits of technology

It effectively suppresses glitches, improves encoding efficiency and video quality, and ensures that the decoded image is natural and smooth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114449285B_ABST
    Figure CN114449285B_ABST
Patent Text Reader

Abstract

The application relates to the field of video coding, and particularly discloses a video coding method and related equipment. The video coding method comprises the following steps: obtaining a first grid image of a to-be-coded image, the first grid image being obtained according to an alpha image of the to-be-coded image, the to-be-coded image being any frame in a to-be-transmitted video; performing a quadtree grid coding operation on the first grid image to obtain a first code stream; performing a chain-like coding operation on a second grid image to obtain a second code stream, the second grid image being a mask image of the first grid image; and coding the first code stream and the second code stream into a third code stream, the third code stream being obtained by performing entropy coding on a YUV image of the to-be-coded image. By performing the chain-like coding operation on the mask image of the alpha image of the to-be-coded image, the quantization distortion of the mask image can be effectively prevented, so that the burr is suppressed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video encoding and decoding, and in particular to a video encoding and decoding method and related equipment. Background Technology

[0002] Currently, YUV video encoding and decoding technology is a relatively mature technology, widely used in video calls, video transmission, video recording and broadcasting, and live streaming. Mainstream video coding technologies include AVC, HEVC, VP8, and VP9. YUVA video joint coding technology refers to a joint coding technique that adds an alpha channel (A channel) to the original video encoding and decoding. By adding an A channel, the foreground and background images of video frames can be effectively separated. Therefore, this method will be widely used in augmented reality (AR) technology in the future. However, current mainstream video coding technologies suffer from significant redundancy in the A channel, resulting in severe jagged edges on the mask. Summary of the Invention

[0003] This application provides a video encoding and decoding method and related equipment. By performing chain-like encoding on the mask image of the α image of the video frame, quantization distortion of the mask image can be effectively prevented, thereby suppressing glitches.

[0004] In a first aspect, this application provides a video encoding method, including:

[0005] The process involves obtaining a first raster image of the image to be encoded, which is obtained from the α image of the image to be encoded, and the image to be encoded is any frame in the video to be transmitted; performing quadtree raster encoding on the first raster image to obtain a first bitstream; performing chain-like encoding on the second raster image to obtain a second bitstream, where the second raster image is a mask image of the first raster image; obtaining a third bitstream based on the YUV image of the image to be encoded; and merging and outputting the first, second, and third bitstreams.

[0006] Specifically, the first, second, and third bitstreams are merged and output, which includes outputting the first, second, and third bitstreams sequentially in a serial manner.

[0007] By performing chain-like encoding on the mask image of the α image of the image to be encoded, quantization distortion of the mask image can be effectively prevented, thereby suppressing glitches. By performing quadtree rasterization encoding on the α image of the image to be encoded, subsequent entropy encoding only requires encoding a portion of the raster in the α image of the image to be encoded, thereby improving encoding efficiency.

[0008] In one feasible embodiment, a quadtree raster encoding operation is performed on the first raster image to obtain a first bitstream, including:

[0009] Fine edge AR coding is performed on the first raster image to obtain the size of each sub-region and the first pixel value of the sub-region. The multiple sub-regions are obtained based on the first raster image. Entropy coding is performed on the quantization result of the common pixel value of each sub-region and the size of the sub-region to obtain the first bitstream.

[0010] In one feasible embodiment, fine-grained edge AR encoding is performed on the first raster image to obtain the size of each sub-region and the first pixel value of that sub-region, including:

[0011] The first raster image is encoded using a quadtree raster to obtain multiple sub-regions. The pixel values ​​of each grid cell within each sub-region are identical. Discrete cosine transform (DCT) is performed on each sub-region to obtain the common pixel values ​​and size of each sub-region. The common pixel values ​​of each sub-region are the pixel values ​​of any grid cell within that sub-region. Vector quantization is then performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. The quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

[0012] Since the pixel values ​​of the grid cells in the above sub-regions are all the same, in order to improve coding efficiency, DCT is performed on the sub-regions to obtain the common pixel values ​​and dimensions of the sub-regions. Then, vector quantization is performed on the common pixel values ​​to obtain the quantization results of the common pixel values. In subsequent encoding, only the dimensions and quantization results of the common pixel values ​​of the sub-regions need to be encoded, and the pixel values ​​of the entire first grid image do not need to be encoded, thereby improving coding efficiency.

[0013] In one feasible embodiment, a chain-like coding operation is performed on the second raster image to obtain a second bitstream, including:

[0014] The second raster image is columnarized to obtain a first vector of the second raster image. The elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image. Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, each first grid cell in the second vector is chain-like encoded to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. The second vector of the second raster image and the dimensions of the second raster image are entropy encoded to obtain a second bitstream.

[0015] The second raster image can be regarded as the mask image of the α image of the image to be encoded. By performing chain-like encoding on the mask image of the α image of the image to be encoded, the quantization distortion of the mask image can be effectively prevented, thereby achieving the effect of suppressing glitch.

[0016] In one feasible embodiment, when the image to be encoded is an I-frame, the first raster image is the α image of the image to be encoded, and the second raster image is the mask image of the α image of the image to be encoded;

[0017] Obtaining a third bitstream from the YUV image of the image to be encoded includes: performing entropy encoding on the YUV image of the image to be encoded to obtain a third bitstream;

[0018] When the image to be encoded is a P-frame, the first raster image is the residual image of the α-image of the image to be encoded relative to the α-image of the reference frame of the image to be encoded;

[0019] Obtaining a third bitstream from the YUV image of the image to be encoded includes: obtaining a residual image of the YUV image of the image to be encoded from the YUV image of the reference frame of the image to be encoded and the YUV image of the image to be encoded; and performing entropy coding on the residual image of the YUV image of the image to be encoded to obtain the third bitstream.

[0020] In one feasible embodiment, the audio signal corresponding to the image to be encoded is encoded to obtain an audio bitstream, and the audio bitstream is merged with the first bitstream, the second bitstream, and the third bitstream for output; specifically, the first bitstream, the second bitstream, the third bitstream, and the audio bitstream are output sequentially in a serial manner.

[0021] In a feasible embodiment, when encoding the first raster image, the YUV image of the image to be encoded, and the audio signal corresponding to the image to be encoded, the same timestamp is applied to the first raster image, the YUV image of the image to be encoded, and the audio signal corresponding to the image to be encoded. Then, the timestamp of the first raster image is encoded into the first bitstream, the timestamp of the YUV image of the image to be encoded is encoded into the third bitstream, and the timestamp of the audio signal corresponding to the image to be decoded is encoded into the audio bitstream, so that the decoding end can decode the reconstructed frame of the image to be encoded and the audio signal that are time-synchronized from the bitstream.

[0022] Secondly, embodiments of this application also provide a video decoding method, including:

[0023] The process involves: acquiring a video stream, comprising a first stream, a second stream, and a third stream; decoding the first stream to obtain a first reconstructed frame, which is associated with a reconstructed frame of the α image of the image to be decoded; the image to be decoded being any frame in the video; decoding the second stream to obtain a second reconstructed frame, which is associated with a reconstructed frame of the mask image of the α image of the image to be decoded; obtaining a third reconstructed frame based on the third stream, which is a reconstructed frame of the YUV image of the image to be decoded; obtaining a reconstructed frame of the target α image based on the first and second reconstructed frames; and performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain a reconstructed frame of the image to be decoded, which is a third reconstructed frame with a transparent background.

[0024] Wherein, when the image to be decoded is an I-frame, the first reconstructed frame is the reconstructed frame of the α-image of the image to be decoded, and the second reconstructed frame is the reconstructed frame of the mask image of the α-image of the image to be decoded; obtaining the third reconstructed frame according to the third bitstream includes: decoding the third bitstream to obtain the third reconstructed frame; when the image to be decoded is a P-frame, the first reconstructed frame is the reconstructed frame of the residual image of the α-image of the image to be decoded, and the second reconstructed frame is the reconstructed frame of the mask image of the residual image of the α-image of the image to be decoded; obtaining the third reconstructed frame according to the third bitstream includes: decoding the third bitstream to obtain the reconstructed frame of the residual image of the YUV image of the image to be decoded; obtaining the third reconstructed frame according to the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

[0025] In one feasible embodiment, decoding the first bitstream to obtain a first reconstructed frame includes:

[0026] Entropy decoding is performed on the first bitstream to obtain the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame; fine edge AR decoding is performed on the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame to obtain the first reconstructed frame.

[0027] In one feasible embodiment, fine-grained edge AR decoding is performed on the first pixel value of each sub-region and the size of each sub-region of the first reconstructed frame to obtain the first reconstructed frame, including:

[0028] Inverse vector quantization is performed on the first pixel values ​​of multiple sub-regions to obtain common pixel values ​​for each sub-region; inverse DCT is performed based on the common pixel values ​​and size of each sub-region to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value; quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

[0029] In one feasible embodiment, decoding the second bitstream to obtain a second reconstructed frame includes:

[0030] Entropy decoding is performed on the second bitstream to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the second reconstructed frame; chain-like decoding is performed on the second vector to obtain the first vector of the second reconstructed frame, the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; row and column transformations are performed on the first vector according to the size of the second reconstructed frame to obtain the second reconstructed frame.

[0031] In one feasible embodiment, obtaining the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame includes:

[0032] Perform an AND operation on the first and second reconstructed frames to obtain the reconstructed frames of the target α image.

[0033] or;

[0034] A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the first α image. The reconstructed frame of the first α image is then input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image. The compensation model is implemented based on a neural network.

[0035] In one feasible embodiment, obtaining the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame includes:

[0036] Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; obtain the reconstructed frame of the target α image based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image;

[0037] or;

[0038] A bitwise AND operation is performed on the first and second reconstructed frames to obtain the reconstructed frame of the second α image; the reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

[0039] Optionally, the neural network described above can be a convolutional neural network, a recurrent neural network, a fully connected neural functional network, or other neural networks.

[0040] Because the first and second reconstructed frames have pixel value differences in some edge lines during the fusion filtering, resulting in obvious harshness and sharpening of the edge lines, the pixel value difference is weakened by using a compensation model to perform edge filtering on the reconstructed frames of the α image obtained after fusing the first and second reconstructed frames, making the decoded α image more natural.

[0041] In one feasible embodiment, the bitstream further includes an audio bitstream, and the method of this application further includes:

[0042] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded.

[0043] In a feasible embodiment, before performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the method of this application further includes:

[0044] The timestamps of the reconstructed frames, the third reconstructed frame, and the audio signal corresponding to the image to be decoded are decoded from the bitstream;

[0045] Based on the reconstructed frames of the target α image, the third reconstructed frame is segmented and superimposed to obtain the reconstructed frame of the image to be decoded, including:

[0046] When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed according to the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

[0047] If any one of the timestamps of the reconstructed frame of the target α image, the third reconstructed frame, and the audio signal corresponding to the image to be decoded is different from the other two, all of the above-mentioned reconstructed frame of the target α image, the third reconstructed frame, and the audio signal corresponding to the image to be decoded are discarded, and the decoding of the next frame image continues.

[0048] By adopting the above synchronization method, the reconstructed frames of the α image and the YUV image are kept synchronized, which can obtain accurate reconstructed frames of the image to be decoded. Finally, the reconstructed frames of the image to be decoded and the audio signal with time synchronization are output, which improves the user experience.

[0049] Thirdly, embodiments of this application provide a video encoding device, including:

[0050] The acquisition unit is used to acquire the first raster image of the image to be encoded, which is obtained based on the α image of the image to be encoded, which is any frame in the video to be transmitted.

[0051] The encoding unit is used to perform quadtree raster encoding on the first raster image to obtain a first bitstream; to perform chain-like encoding on the second raster image to obtain a second bitstream, wherein the second raster image is a mask image of the first raster image; and to obtain a third bitstream based on the YUV image of the image to be encoded.

[0052] The output unit is used to merge and output the first bitstream, the second bitstream, and the third bitstream.

[0053] In one feasible embodiment, in performing quadtree raster encoding on the first raster image to obtain the first bitstream, the encoding unit is specifically used for:

[0054] Fine edge AR coding is performed on the first raster image to obtain the size of each sub-region and the first pixel value of the sub-region. The multiple sub-regions are obtained based on the first raster image. Entropy coding is performed on the quantization result of the common pixel value of each sub-region and the size of the sub-region to obtain the first bitstream.

[0055] In one feasible embodiment, in performing fine edge AR encoding on a first raster image to obtain the size of each sub-region and the first pixel value of that sub-region in a plurality of sub-regions, the encoding unit is specifically configured to:

[0056] The first raster image is encoded using a quadtree raster to obtain multiple sub-regions. The pixel values ​​of each grid cell within each sub-region are identical. Discrete cosine transform (DCT) is performed on each sub-region to obtain the common pixel values ​​and size of each sub-region. The common pixel values ​​of each sub-region are the pixel values ​​of any grid cell within that sub-region. Vector quantization is then performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. The quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

[0057] In one feasible embodiment, in performing chain-like coding on the second raster image to obtain the second bitstream, the coding unit is specifically used for:

[0058] The second raster image is columnarized to obtain a first vector of the second raster image. The elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image. Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, a chain-like encoding is performed on each first grid cell in the second vector to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. Entropy encoding is performed on the second vector of the second raster image and the dimensions of the second raster image to obtain a second bitstream.

[0059] In one feasible embodiment, when the image to be encoded is an I-frame, the first raster image is the α image of the image to be encoded, and the second raster image is the mask image of the α image of the image to be encoded.

[0060] In a feasible embodiment, when the image to be encoded is an I-frame, the encoding unit is specifically used for obtaining a third bitstream based on the YUV image of the image to be encoded as follows:

[0061] Entropy encoding is performed on the YUV image of the image to be encoded to obtain a third bitstream.

[0062] In one feasible embodiment, when the image to be encoded is a P-frame, the first raster image is a residual image of the α-image of the image to be encoded relative to the α-image of the reference frame of the image to be encoded.

[0063] In a feasible embodiment, when the image to be encoded is a P-frame, in terms of obtaining a third bitstream based on the YUV image of the image to be encoded, the encoding unit is specifically used for:

[0064] The residual image of the YUV image of the image to be encoded is obtained from the YUV image of the reference frame of the image to be encoded and the YUV image of the image to be encoded; the residual image of the YUV image of the image to be encoded is entropy encoded to obtain the third bitstream.

[0065] In one feasible embodiment, the output unit is specifically used for:

[0066] The first, second, and third bitstreams are output sequentially in a serial manner.

[0067] In one feasible embodiment, the encoding unit is further configured to:

[0068] The audio signal corresponding to the image to be encoded is encoded to obtain the first bitstream, the second bitstream, the third bitstream, and the audio bitstream;

[0069] The output unit is also used to output audio bitstreams sequentially in a serial manner.

[0070] Fourthly, embodiments of this application provide a video decoding device, including:

[0071] The acquisition unit is used to acquire the video bitstream, which includes a first bitstream, a second bitstream, and a third bitstream.

[0072] The decoding unit is used to perform decoding operations on the first bitstream to obtain a first reconstructed frame, which is related to the reconstructed frame of the α image of the image to be decoded; the image to be decoded is any frame in the video; to perform decoding operations on the second bitstream to obtain a second reconstructed frame; the second reconstructed frame is related to the reconstructed frame of the mask image of the α image of the image to be decoded; and to obtain a third reconstructed frame based on the third bitstream, which is the reconstructed frame of the YUV image of the image to be decoded.

[0073] The reconstruction unit is used to obtain the reconstruction frame of the target α image based on the first reconstruction frame and the second reconstruction frame, and to perform image segmentation and superposition on the third reconstruction frame based on the reconstruction frame of the target α image to obtain the reconstruction frame of the image to be decoded. The reconstruction frame of the image to be decoded is the third reconstruction frame with a transparent background.

[0074] In a feasible embodiment, in terms of decoding the first bitstream to obtain the first reconstructed frame, the decoding unit is specifically configured to:

[0075] Entropy decoding is performed on the first bitstream to obtain the quantization result of the common pixel value of each sub-region of the multiple sub-regions of the first reconstructed frame and the size of each sub-region; fine edge AR decoding is performed on the first pixel value of each sub-region of the multiple sub-regions of the first reconstructed frame and the size of each sub-region to obtain the first reconstructed frame.

[0076] In one feasible embodiment, in obtaining the first reconstructed frame by performing fine-grained edge AR decoding on the first pixel value of each sub-region and the size of each sub-region of the plurality of sub-regions, the decoding unit is specifically configured to:

[0077] Inverse vector quantization is performed on the first pixel values ​​of multiple sub-regions to obtain common pixel values ​​for each sub-region; inverse DCT is performed based on the common pixel values ​​and size of each sub-region to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value; quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

[0078] In a feasible embodiment, in terms of decoding the second bitstream to obtain the second reconstructed frame, the decoding unit is specifically configured to:

[0079] Entropy decoding is performed on the second bitstream to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the second reconstructed frame; chain-like decoding is performed on the second vector to obtain the first vector of the second reconstructed frame, the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; row and column transformations are performed on the first vector according to the size of the second reconstructed frame to obtain the second reconstructed frame.

[0080] In one feasible embodiment, when the image to be decoded is an I-frame, the first reconstructed frame is a reconstructed frame of the α-image of the image to be decoded; the second reconstructed frame is a reconstructed frame of the mask image of the α-image of the image to be decoded.

[0081] In obtaining the third reconstructed frame based on the third bitstream, the decoding unit is specifically used to: decode the third bitstream to obtain the third reconstructed frame.

[0082] In one feasible embodiment, when the image to be decoded is a P-frame, the first reconstructed frame is a reconstructed frame of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded, and the second reconstructed frame is a reconstructed frame of the mask image of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded.

[0083] In obtaining the third reconstructed frame based on the third bitstream, the decoding unit is specifically used for:

[0084] The third bitstream is decoded to obtain a reconstructed frame of the residual image of the YUV image of the image to be decoded; the third reconstructed frame is obtained based on the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

[0085] In a feasible embodiment, in terms of obtaining the reconstructed frame of the target α image based on the first and second reconstructed frames, the reconstruction unit is specifically configured to:

[0086] Perform an AND operation on the first and second reconstructed frames to obtain the reconstructed frames of the target α image.

[0087] or;

[0088] A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the first α image. The reconstructed frame of the first α image is then input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image. The compensation model is implemented based on a neural network.

[0089] In a feasible embodiment, in terms of obtaining the reconstructed frame of the target α image based on the first and second reconstructed frames, the reconstruction unit is specifically configured to:

[0090] Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; obtain the reconstructed frame of the target α image based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image;

[0091] or;

[0092] A bitwise AND operation is performed on the first and second reconstructed frames to obtain the reconstructed frame of the second α image; the reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

[0093] Optionally, the neural network described above can be a convolutional neural network, a recurrent neural network, a fully connected neural functional network, or other neural networks.

[0094] In one feasible embodiment, the bitstream further includes an audio bitstream, and the decoding unit is further configured to:

[0095] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded.

[0096] In a feasible embodiment, before the reconstruction unit performs image segmentation and overlay on the third reconstruction frame based on the reconstruction frame of the target α image to obtain the reconstruction frame of the image to be decoded, the decoding unit is further configured to:

[0097] The timestamps of the reconstructed frames, the third reconstructed frame, and the audio signal corresponding to the image to be decoded are decoded from the bitstream;

[0098] In terms of performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the reconstruction unit is specifically used for:

[0099] When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

[0100] Fifthly, embodiments of this application also provide a video encoding device, including:

[0101] A memory and a processor coupled to the memory, wherein the memory stores instructions that, when executed by the processor, perform some or all of the instructions as described in the first aspect.

[0102] Sixthly, embodiments of this application also provide a video decoding device, including:

[0103] A memory and a processor coupled to the memory, wherein the memory stores instructions that, when executed by the processor, perform part or all of the method as described in the second aspect.

[0104] In a seventh aspect, embodiments of this application also provide a video device, including:

[0105] A memory and a processor coupled to the memory, wherein the memory stores instructions that, when executed by the processor, perform part or all of the method as described in the first or second aspect.

[0106] The video device provided in this application embodiment can be a device with video processing capabilities.

[0107] Eighthly, embodiments of this application provide a chip system applied to an electronic device; the chip system includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected via lines; the interface circuits are used to receive signals from the memory of the electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device performs part or all of the method as described in the first or second aspect.

[0108] In a ninth aspect, embodiments of this application provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform part or all of the methods described in the first or second aspect.

[0109] In a tenth aspect, embodiments of this application provide a computer program product including computer instructions that, when executed on an electronic device, cause the electronic device to perform part or all of the method described in the first or second aspect.

[0110] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description

[0111] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0112] Figure 1a This is a schematic diagram of the chain coding principle;

[0113] Figure 1b This is a schematic diagram illustrating the principle of quadtree raster encoding.

[0114] Figure 1c This is a schematic diagram illustrating the principle of vector quantization.

[0115] Figure 2a This is a schematic diagram of an application scenario provided by an embodiment of this application;

[0116] Figure 2b This is a schematic diagram illustrating another application scenario provided by an embodiment of this application;

[0117] Figure 2c This is a schematic diagram illustrating another application scenario provided by an embodiment of this application;

[0118] Figure 3 A flowchart illustrating a video encoding method provided in an embodiment of this application;

[0119] Figure 4a A schematic diagram illustrating a specific example of a quadtree raster encoding provided in this application;

[0120] Figure 4b A schematic diagram illustrating a specific example of vector quantization provided in this application;

[0121] Figure 5 A schematic diagram illustrating a specific example of chained encoding provided in this application;

[0122] Figure 6 A flowchart illustrating a video decoding method provided in an embodiment of this application;

[0123] Figure 7 A schematic diagram of a video encoding and decoding process provided in an embodiment of this application;

[0124] Figure 8 A schematic diagram illustrating another video encoding / decoding process provided in an embodiment of this application;

[0125] Figure 9 This is a schematic diagram of the structure of a video encoding device provided in an embodiment of this application;

[0126] Figure 10 This is a schematic diagram of the structure of a video decoding device provided in an embodiment of this application;

[0127] Figure 11 This is a schematic diagram of the structure of another video encoding device provided in an embodiment of this application;

[0128] Figure 12 This is a schematic diagram of another video decoding device provided in an embodiment of this application. Detailed Implementation

[0129] The embodiments of this application will now be described with reference to the accompanying drawings.

[0130] First, the key terms in this application will be explained.

[0131] A YUV image is an image in which each pixel is stored in YUV format. Here, Y represents luminance, and U and V represent chrominance. YUV can be obtained by converting the three primary colors of color, RGB. Since computers are not sensitive to RGB, computer pixels are represented in YUV format.

[0132] In this application, the α image refers to an A-channel image, where the A-channel of the image refers to the transparency or semi-transparency of the image.

[0133] Raster coding refers to a data format that divides space into a regular grid, with each grid cell called a unit, and assigns corresponding attribute values ​​to each unit to represent entities. The position of each unit (pixel) is defined by its row and column numbers, and the location of the entity it represents is implicit in the raster row and column positions. Raster structures approximate a graphic using a finite grid; therefore, the surface represented by raster data is discontinuous and approximately discrete. Raster data is mostly used in Geographic Information Systems (GIS), and GIS maps primarily include national borders, provincial highways, railways, and rivers.

[0134] Chained encoding, also known as Freeman chained code or world chained code, consists of an initial point and a chain of unit vectors defined by numbers in fundamental directions. There are eight fundamental directions: east, southeast, south, southwest, west, northwest, north, and northeast. Each successor point is located in one of the eight possible fundamental directions of its predecessor point, such as... Figure 1a As shown. The codes for the eight basic directions can be represented by East = 0, South = 3, West = 2, North = 1, Southeast = 4, Northeast = 5, Southwest = 6, and Northwest = 7, respectively, and can be represented either clockwise or counterclockwise. The grid structure is coded clockwise, as shown below. Figure 1a As shown, starting from the gray point, the positional relationship between each successor point and its predecessor is: Southeast, East, East, South, Southwest, ...; the corresponding codes are 4, 0, 0, 3, 6, ... . Chained encoding effectively compresses raster data, especially for polygon representation, and is well-suited for storing graphic data.

[0135] Quadtree coding: The basic idea is to divide a raster map or image into four equal parts. Each block is checked for its grid attribute values ​​(or grayscale). If all pixel values ​​in a sub-region have the same value, then that sub-region is not further divided; otherwise, it is further divided into four sub-regions, such as... Figure 1bAs shown. This process of segmentation continues until each sub-block contains only the same attribute value or grayscale value. In other words, based on the characteristics of the two-dimensional spatial distribution of raster data, the spatial region is recursively segmented into four quadrants (2n×2n, where n>1) until the values ​​of the sub-quadrants are monotonic, finally resulting in a four-branched inverted tree.

[0136] Vector quantization involves first grouping data into K data points to form a K-dimensional vector, and then quantizing the data using these vectors as the processing unit. Its concept is similar to rounding, both using the nearest integer to approximate a number. For example... Figure 1c As shown, vector quantization is performed on a one-dimensional array. Numbers less than -2 are approximated as -3, numbers between -2 and 0 are approximated as -1, numbers between 0 and 2 are approximated as 1, and numbers greater than 2 are approximated as 3. In this way, any number will be approximated as one of the four numbers: -3, -1, 1, or 3.

[0137] Encoding and decoding of I-frames and P-frames:

[0138] I-frames represent keyframes; decoding only requires the data from that frame. When compressing I-frames, they do not depend on other frames. P-frames, also known as forward prediction frames, represent the differences between this frame and a previous keyframe (or P-frame). Decoding requires overlaying the previously buffered images with the differences defined in this frame to generate the final image. P-frames use I-frames as reference frames. The predicted value and motion vector of a "point" in the P-frame are found within the I-frame, and the prediction difference and motion vector are transmitted together. At the receiving end, the predicted value of the "point" in the P-frame is found from the I-frame based on the motion vector, and added to the difference to obtain the sample value of the "point" in the P-frame, thus obtaining the complete P-frame.

[0139] The application scenarios of this application are described below.

[0140] In one example, such as Figure 2a As shown, this application scenario includes an encoding device 101 and one or more decoding devices 102. The encoding device 101 includes, but is not limited to, a content provider's server for providing audio and video content. The decoding device 102 includes, but is not limited to, user devices, such as smartphones, smart glasses, or smartwatches.

[0141] Encoding device 101 encodes the image to be transmitted according to the encoding method of this application to obtain the bitstream of the image to be transmitted, and transmits the bitstream of the image to one or more decoding devices 102. Then, each of the one or more decoding devices 102 decodes the received bitstream according to the decoding method of this application to obtain the image. Optionally, the image is displayed on the display interface of the decoding device 102.

[0142] In another example, such as Figure 2b As shown, this application scenario includes an encoding device 101, a decoding device 103, and one or more display devices 104. The encoding device 101 includes, but is not limited to, a content provider's server, used to provide audio and video content; the decoding device 103 is used to decode the received bitstream; and the display device 104 can be a smartphone, smart glasses, or smartwatch, etc., which can be used to display images or videos.

[0143] Encoding device 101 encodes the image to be transmitted according to the encoding method of this application to obtain the bitstream of the image to be transmitted, and transmits the bitstream of the image to be transmitted to decoding device 103. Then, decoding device 103 decodes the received bitstream according to the decoding method of this application to obtain the image. Decoding device 103 transmits the decoded image to one or more display devices 104 for display on display device 104.

[0144] In another example, such as Figure 2c As shown, this application scenario includes an encoding device 101, multiple decoding devices 103, and multiple display devices 104. The multiple decoding devices 103 and multiple display devices 104 are in one-to-one correspondence; that is, each decoding device has a unique display device 104 for displaying the decoded image or video. The encoding device 101 includes, but is not limited to, a content provider's server for providing audio and video content. The decoding devices 103 are used to decode the received bitstream. The display devices 104 can be smartphones, smart glasses, or smartwatches, or other devices that can display images or videos.

[0145] Encoding device 101 encodes the image to be transmitted according to the encoding method of this application to obtain the bitstream of the image to be transmitted, and transmits the bitstream of the image to be transmitted to decoding device 103. Then, decoding device 103 decodes the received bitstream according to the decoding method of this application to obtain the image. Decoding device 103 transmits the decoded image to the corresponding display device 104 for display.

[0146] See Figure 3 , Figure 3 This application provides a schematic flowchart of a video encoding method as an embodiment. Figure 3 As shown, the method includes:

[0147] S301. Obtain the first raster image and the second raster image of the image to be encoded.

[0148] The first raster image is obtained from the α image of the image to be encoded, and the second raster image is a mask image of the first raster image; the graphic to be encoded is any frame in the video to be transmitted.

[0149] When the image to be encoded is an I-frame, the first raster image is the α image of the image to be encoded; when the image to be encoded is a P-frame, the first raster image is the residual image of the α image of the image to be encoded relative to the α image of the reference frame of the image to be encoded. The first raster image is a grayscale image.

[0150] S302. Perform quadtree raster encoding on the first raster image to obtain the first bitstream; perform chain-like encoding on the second raster image to obtain the second bitstream; obtain the third bitstream based on the YUV image of the image to be encoded.

[0151] In one feasible embodiment, a quadtree raster encoding operation is performed on the first raster image to obtain a first bitstream, including:

[0152] Fine-grained edge augmented reality (AR) encoding is performed on the first raster map to obtain the size of each sub-region and the first pixel value of the sub-region in multiple sub-regions, which are obtained based on the first raster image; entropy encoding is performed on the quantization result of the common pixel value of each sub-region in multiple sub-regions and the size of the sub-region to obtain the first bitstream.

[0153] Furthermore, fine-grained edge augmented reality (AR) encoding is performed on the first raster map to obtain the size of each sub-region and the first pixel value of that sub-region, including:

[0154] The first raster image is subjected to quadtree raster encoding to obtain multiple sub-regions, wherein the pixel value of each grid cell in each sub-region is the same; DCT is performed on each sub-region to obtain the common pixel value and the size of the sub-region, wherein the common pixel value of each sub-region is the pixel value of any grid cell in the sub-region; vector quantization is performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region; the quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

[0155] Specifically, such as Figure 4a As shown, quadtree raster encoding is performed on the first raster image to obtain the following result: Figure 4aThe diagram shows 14 sub-regions. Within each of these sub-regions, all raster cells share the same pixel value. DCT is then performed on each of these sub-regions to obtain the common pixel values ​​and size of each sub-region. The common pixel values ​​of these 14 sub-regions, arranged from left to right and top to bottom, are 95, 97, 88, 94, 84, 87, 106, 101, 89, 91, 87, 72, 86, and 88. It should be noted that these common pixel values ​​represent the pixel value of any raster cell within that sub-region. Vector quantization is then performed on these common pixel values ​​to obtain the quantized result of the common pixel values ​​for each sub-region. Figure 4b The quantization rules shown indicate that the quantization results of the common pixel values ​​in the 14 sub-regions are 95, 95, 85, 95, 85, 85, 105, 105, 85, 95, 85, 75, 85, and 85. Finally, entropy encoding is performed on the quantization results and dimensions of the common pixel values ​​in each of the 14 sub-regions to obtain the first bitstream mentioned above.

[0156] In one feasible embodiment, a chain-like coding operation is performed on the second raster image to obtain a second bitstream, including:

[0157] The second raster image is columnarized to obtain a first vector of the second raster image. The elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image. Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, each first grid cell in the first vector is chain-like encoded to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. The second vector of the second raster image and the dimensions of the second raster image are entropy encoded to obtain a second bitstream.

[0158] It should be noted that the first raster image can be a grayscale image, and the second raster image is a binary image. The second raster image can be seen as a dimensionality reduction of the first raster image, specifically converting the first raster image into a binary image with pixel values ​​of 0 and 1. That is, the second raster image is a binary image with pixel values ​​of 0 and 1.

[0159] For example, the second raster image is as follows: Figure 5 As shown, where 1 represents white and 0 represents black, the second raster image has a size of 5*5. Then, the second raster image is columnarized to obtain a first vector of length 1*25, as shown below. Figure 5 As shown; then with Figure 5 Starting with the gray grid cells in the matrix shown, and following a clockwise order, based on the positional relationship between each grid cell with a pixel value of 0 in the first vector and its adjacent grid cells in the second raster image, a chain-like encoding is performed on each grid cell with a pixel value of 0 in the first vector to obtain the second vector of the second raster image, as shown below. Figure 5 As shown, starting from the gray grid cell, the directions in clockwise order are: East, Southeast, South, Southwest, South, West, West, Northwest, North, North, East, East. Therefore, the second vector is represented as [0,4,3,6,3,2,2,7,1,1,0,0]. Finally, entropy encoding is performed on the second vector to obtain the second bitstream. In order for the decoding end to be able to decode the second raster image normally, the size of the second raster image is simultaneously encoded into the second bitstream when encoding the second vector.

[0160] It should be noted that when grid cell A's adjacent grid cells include grid cells adjacent to it in both the first and second directions, in chain-like encoding, only the grid cells adjacent to it in the first direction are considered as adjacent to grid cell A. Here, the first direction is east, south, west, or north, and the second direction is southeast, northeast, southwest, or northwest. Figure 5 As shown, in the clockwise direction, the grid cells adjacent to grid cell B include two grid cells located to the west and southwest of grid cell B. When performing chain-like encoding, only the grid cell located to the west of grid cell B is considered as the grid cell adjacent to grid cell B.

[0161] In one feasible embodiment, obtaining a third bitstream based on the YUV image of the image to be encoded includes:

[0162] When the image to be encoded is an I-frame, entropy coding is performed on the YUV image of the image to be encoded to obtain a third bitstream; when the image to be encoded is a P-frame, a residual image of the YUV image of the image to be encoded is obtained based on the YUV image of the reference frame of the image to be encoded and the YUV image of the image to be encoded; entropy coding is performed on the residual image of the YUV image of the image to be encoded to obtain the third bitstream.

[0163] It should be noted that when the image to be encoded is a P-frame, when obtaining the residual images of the YUV and α images of the image to be encoded, the YUV image of the reference frame of the image to be encoded is used as the reference frame of the YUV image of the image to be encoded, and the α image of the reference frame of the image to be encoded is used as the reference frame of the α image of the image to be encoded. Furthermore, the motion estimation performed on the residual image of the YUV image of the image to be encoded based on the YUV image of the reference frame of the image to be encoded is the same as the motion estimation performed on the residual image of the α image of the image to be encoded based on the α image of the reference frame of the image to be encoded. The motion estimation includes, but is not limited to, translation, affine and / or bilinear operations.

[0164] S303: Combine and output the first, second, and third bitstreams.

[0165] Specifically, the first bitstream, the second bitstream, and the third bitstream are merged and output, including: outputting the first bitstream, the second bitstream, and the third bitstream in a serial manner.

[0166] In one feasible embodiment, the method of this application further includes:

[0167] The audio signal corresponding to the video is encoded to obtain an audio bitstream, and the audio bitstream is merged with the first bitstream, the second bitstream, and the third bitstream for output. Specifically, the first bitstream, the second bitstream, the third bitstream, and the audio bitstream are output sequentially in a serial manner, so that the decoding end can decode the audio signal at the same time as decoding the image, in order to provide the user with an audio-visual experience.

[0168] In one feasible embodiment, the image to be encoded and its corresponding audio signal are stamped with the same timestamp, and the timestamp of the image to be encoded is encoded into the first bitstream or the second bitstream, and the timestamp of the audio signal is encoded into the audio bitstream.

[0169] In one feasible embodiment, the α image of the image to be encoded and the YUV image of the image to be encoded, as well as their corresponding audio signals, are stamped with the same timestamp. Then, the α image of the image to be encoded is encoded into the first bitstream, the timestamp of the YUV image of the image to be encoded is encoded into the third bitstream, and the timestamp of the audio signal is encoded into the audio bitstream, so that the decoding end can decode the reconstructed frame of the image to be encoded and the audio signal that are time-synchronized from the bitstream.

[0170] As can be seen, in the embodiments of this application, by performing chain-like encoding on the mask image of the α image of the image to be encoded, the raster data is effectively compressed, especially for the representation of polygons. Chain-like encoding also has certain computational capabilities, making it more convenient to calculate the length, area, or convexity / concavity of the turning direction. Applying chain-like encoding to the block division of the mask image can effectively prevent the quantization distortion of the lines in the mask image, thereby suppressing severe edge burrs. Using quadtree raster encoding to encode the α image of the image to be encoded ensures that subsequent encoding is concentrated within the mask of the α image of the image to be encoded, thereby improving encoding efficiency.

[0171] See Figure 6 , Figure 6 This is a flowchart illustrating a video decoding method provided in an embodiment of this application. Figure 6 As shown, the method includes:

[0172] S601. Obtain the bitstream, which includes a first bitstream, a second bitstream, and a third bitstream.

[0173] The first bitstream is obtained by encoding the α image of the image to be decoded, or by encoding the residual image of the α image of the image to be decoded; the second bitstream is obtained by encoding the mask image of the α image of the image to be decoded, or by encoding the mask image of the residual image of the α image of the image to be decoded; the third bitstream is obtained by encoding the YUV image of the image to be decoded, or by encoding the residual image of the YUV image of the image to be encoded.

[0174] When the image to be decoded is an I-frame, the first bitstream is obtained by encoding the α image of the image to be decoded, the second bitstream is obtained by encoding the mask image of the α image of the image to be decoded, and the third bitstream is obtained by encoding the YUV image of the image to be decoded; when the image to be decoded is a P-frame, the first bitstream is obtained by encoding the residual image of the α image of the image to be decoded, the second bitstream is obtained by encoding the mask image of the residual image of the α image of the image to be decoded, and the third bitstream is obtained by encoding the residual image of the YUV image of the image to be encoded.

[0175] S602. Decode the first bitstream to obtain the first reconstructed frame; decode the second bitstream to obtain the second reconstructed frame; obtain the third reconstructed frame based on the third bitstream.

[0176] In one feasible embodiment, decoding the first bitstream to obtain a first reconstructed frame includes:

[0177] Entropy decoding is performed on the first bitstream to obtain the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame; fine edge AR decoding is performed on the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame to obtain the first reconstructed frame.

[0178] In one feasible embodiment, fine-grained edge AR decoding is performed on the first pixel value of each sub-region and the size of each sub-region of the first reconstructed frame to obtain the first reconstructed frame, including:

[0179] Inverse vector quantization is performed on the first pixel values ​​of multiple sub-regions to obtain common pixel values ​​for each sub-region; inverse DCT is performed based on the common pixel values ​​and size of each sub-region to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value; quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

[0180] It should be noted that the specific implementation process of decoding the first bitstream can be regarded as the inverse process of performing quadtree raster encoding on the first raster image. The specific implementation process can be found in the relevant description of S302, and will not be described here.

[0181] In one feasible embodiment, decoding the second bitstream to obtain a second reconstructed frame includes:

[0182] Entropy decoding is performed on the second bitstream to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the second reconstructed frame; chain-like decoding is performed on the second vector to obtain the first vector of the second reconstructed frame, the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; row and column transformations are performed on the first vector according to the size of the second reconstructed frame to obtain the second reconstructed frame.

[0183] It should be noted that the specific implementation process of decoding the second bitstream can be regarded as the inverse process of performing chain-like encoding on the first raster image. The specific implementation process can be found in the relevant description of S302, and will not be described here.

[0184] Optionally, when the image to be decoded is an I-frame, the first reconstructed frame is the reconstructed frame of the α-image of the image to be decoded; when the image to be decoded is a P-frame, the first reconstructed frame is the reconstructed frame of the residual image of the α-image of the image to be decoded.

[0185] When the image to be decoded is an I-frame, the first reconstructed frame is the reconstructed frame of the mask image of the α-image of the image to be decoded; when the image to be decoded is a P-frame, the first reconstructed frame is the reconstructed frame of the residual image of the mask image of the α-image of the image to be decoded.

[0186] The third reconstructed frame is the reconstructed frame of the YUV image of the image to be decoded. It is obtained from the third bitstream and includes:

[0187] When the image to be decoded is an I-frame, entropy decoding is performed on the third bitstream to obtain the third reconstructed frame; when the image to be decoded is a P-frame, entropy decoding is performed on the third bitstream to obtain the reconstructed frame of the residual image of the YUV image of the image to be decoded, and the third reconstructed frame is obtained based on the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

[0188] S603. Obtain the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame.

[0189] In one feasible embodiment, obtaining the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame includes:

[0190] When the image to be decoded is an I-frame, an AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the target α image; or, an AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the first α image of the image to be decoded, and the reconstructed frame of the first α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image.

[0191] When the image to be decoded is a P-frame, perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α-image; obtain the reconstructed frame of the target α-image based on the reconstructed frame of the α-image of the reference frame of the image to be decoded and the reconstructed frame of the second α-image.

[0192] or;

[0193] A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; the reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

[0194] Specifically, the first reconstructed frame is a grayscale image, and the second reconstructed frame is a binary image. The sizes of the first and second reconstructed frames are the same. An AND operation is performed on the first and second reconstructed frames, specifically on the pixel values ​​of the raster units at the same positions in both frames, to obtain the processed first reconstructed frame. When the image to be decoded is an I-frame, the processed first reconstructed frame is the reconstructed frame of the aforementioned target α image. Because the first and second reconstructed frames exhibit pixel value differences in some edge lines during fusion filtering, resulting in noticeably harsh and sharpened edge lines, which significantly impacts subsequent image segmentation and overlay, the processed first reconstructed frame is input into a compensation model for edge filtering to obtain the reconstructed frame of the target α image. At this point, the processed first reconstructed frame is the reconstructed frame of the aforementioned first α image.

[0195] When the image to be decoded is a P-frame, the first reconstructed frame is the reconstructed frame of the residual image of the α-image of the image to be decoded, and the processed first reconstructed frame is the reconstructed frame of the aforementioned second α-image. After obtaining the processed first reconstructed frame, the image obtained based on the reconstructed frame of the α-image of the reference frame of the image to be decoded and the processed first reconstructed frame is the reconstructed frame of the target α-image. In this process, the motion estimation used is the same as that used at the encoding end to obtain the residual image of the α-image of the image to be decoded based on the α-image of the reference frame of the image to be decoded. That is to say, at the encoding end and the decoding end, for the same... The P-frame uses the same reference frame and motion estimation. However, during the fusion filtering of the first and second reconstructed frames, some edge lines exhibit pixel value differences, resulting in noticeably harsh and sharpened edge lines. This significantly impacts subsequent image segmentation and overlay. Therefore, after reconstructing the image from the α-image of the reference frame of the image to be decoded and the processed first reconstructed frame (i.e., the reconstructed frame of the aforementioned third α-image), the reconstructed frame of the third α-image is input into the compensation model for edge filtering. The resulting image is the reconstructed frame of the target α-image. By using the compensation model to compensate for the pixel value differences in edge lines, the pixel value differences are weakened, resulting in a more natural presentation of the reconstructed frame of the image to be decoded.

[0196] S604. Based on the reconstructed frames of the target α image, the third reconstructed frame is segmented and superimposed to obtain the reconstructed frame of the image to be decoded.

[0197] Among them, the reconstructed frame of the image to be decoded is the third reconstructed frame with a transparent background.

[0198] After obtaining the third reconstructed frame, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded; that is, the reconstructed frame of the target α image can be regarded as a mask image of the third reconstructed frame. First, the third reconstructed frame is segmented based on the reconstructed frame of the target α image to obtain the segmentation result, which includes the main object in the image to be decoded; then the reconstructed frame of the target α image is superimposed with the above segmentation result to obtain the reconstructed frame of the image to be decoded.

[0199] The bitstream of each image to be decoded in the video is decoded using the method described above, thereby obtaining the video.

[0200] In one feasible embodiment, the above-mentioned bitstream also includes an audio bitstream, and the method of this application further includes:

[0201] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded. The audio signal corresponding to the image to be decoded can be output when outputting the reconstructed frame of the image to be decoded, thereby improving the user's audiovisual experience.

[0202] In a feasible embodiment, before performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the method of this application further includes:

[0203] The timestamps of the reconstructed frames of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are decoded from the bitstream; specifically, the timestamps of the reconstructed frames of the target α image are decoded from the first bitstream, the timestamps of the third reconstructed frame are decoded from the third bitstream, and the audio signal corresponding to the image to be decoded is decoded from the audio bitstream.

[0204] Based on the reconstructed frames of the target α image, the third reconstructed frame is segmented and superimposed to obtain the reconstructed frame of the image to be decoded, including:

[0205] When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

[0206] In a feasible embodiment, in order to ensure the synchronization of audio signal and video, during encoding, the same timestamp is applied to the image to be decoded and its corresponding audio signal. When the reconstructed frame of the image to be decoded and the audio signal are obtained, the timestamp of the reconstructed frame of the image to be decoded and the timestamp of the audio signal are simultaneously decoded from the corresponding bitstream, and the reconstructed frame of the image to be decoded and the audio signal are cached in the first cache and the second cache, respectively.

[0207] If either the reconstructed frame of the image to be decoded or the audio signal with the same timestamp is lost, the other one of the reconstructed frame of the image to be decoded and the corresponding audio signal is discarded; if neither the reconstructed frame of the image to be decoded nor the audio signal with the same timestamp is lost, the reconstructed frame of the image to be decoded and the audio signal with the same timestamp are output, or...

[0208] When either the reconstructed frame of the image to be decoded or the audio signal with the same timestamp is decoded first, the decoding of the bitstream of the next frame of the image to be decoded and the corresponding audio bitstream is stopped, and the decoding is stopped after a preset time, or after the other one of the reconstructed frame of the image to be decoded and the audio signal with the same timestamp is decoded, the decoding of the bitstream of the next frame of the image and the corresponding audio bitstream is started. When the reconstructed frame of the image to be decoded and the audio signal with the same timestamp are decoded, the reconstructed frame of the image to be decoded and the audio signal with the same timestamp are output, or...

[0209] When there are multiple reconstructed frames of images to be decoded in the first buffer, or multiple audio signals in the second buffer, if the order of the times when the multiple reconstructed frames of images to be decoded in the first buffer are decoded is inconsistent with the order of the timestamps marked during the encoding of the multiple images to be decoded, then the times when the multiple reconstructed frames of images to be decoded in the first buffer are decoded are adjusted so that the order of the times when the multiple reconstructed frames of images to be decoded in the first buffer is consistent with the order of the timestamps marked during the encoding of the multiple images to be decoded, and then the multiple reconstructed frames of images to be decoded are output according to the adjusted times when the multiple reconstructed frames of images to be decoded are decoded.

[0210] If the order in which multiple audio signals in the second buffer are decoded is inconsistent with the order in which the timestamps of the multiple audio signals are added during encoding, then the decoding times of the reconstructed frames of the multiple images to be decoded in the first buffer are adjusted so that the order in which multiple audio signals in the first buffer are decoded is consistent with the order in which the timestamps of the multiple audio signals are added during encoding. Then, multiple audio signals are output according to the adjusted decoding times of the multiple audio signals.

[0211] In an optional embodiment, before encoding, the YUV image, α image, and audio signal of the image to be decoded are stamped with the same timestamp. When the reconstructed frame of the YUV image of the image to be decoded, the reconstructed frame of the target α image, and the audio signal are decoded, the timestamp of the reconstructed frame of the YUV image of the image to be decoded, the timestamp of the reconstructed frame of the target α image, and the time of the audio signal are simultaneously decoded, and the reconstructed frame of the YUV image of the image to be decoded, the reconstructed frame of the target α image, and the audio signal are saved to the third buffer, the fourth buffer, and the second buffer, respectively.

[0212] If any one of the reconstructed frames of the YUV image of the image to be decoded, the reconstructed frames of the target α image, and the audio signal is lost based on the timestamp, the other two of the reconstructed frames of the YUV image of the image to be decoded, the reconstructed frames of the target α image, and the audio signal will also be discarded.

[0213] When any one of the reconstructed frames of the YUV images of the image to be decoded, the reconstructed frames of the target α images, and the audio signals with the same timestamp is decoded first, the decoding of the bitstream of the next frame of the image to be decoded and the corresponding audio bitstream is stopped, and the decoding is stopped after a preset time, or after the other two of the reconstructed frames of the YUV images of the image to be decoded, the reconstructed frames of the target α images, and the audio signals with the same timestamp are decoded, the decoding of the bitstream of the next frame of the image and the corresponding audio bitstream is started.

[0214] After decoding the reconstructed frames of the YUV images of the image to be decoded and the reconstructed frames of the target α image with the same timestamp, the reconstructed frames of the YUV images of the image to be decoded are segmented and superimposed according to the reconstructed frames of the α image of the image to be decoded to obtain the reconstructed frames of the image to be decoded.

[0215] The above method can ensure the synchronization between the image and the audio signal; or ensure the synchronization of the reconstructed frames of the YUV image of the image to be decoded, the reconstructed frames of the target α image, and the audio signal, thereby ensuring the accuracy of the subsequently obtained reconstructed frames to be decoded and improving the user's audiovisual experience.

[0216] The following is a systematic introduction to the video encoding and decoding process.

[0217] See Figure 7 , Figure 7 This is a schematic diagram illustrating a video encoding / decoding process provided in an embodiment of this application. Figure 7 As shown, at the encoding end, the YUV image and α image of the image to be encoded are obtained based on the image to be encoded. When the image to be encoded is an I-frame, the encoding process for the YUV image specifically includes: performing block division, prediction, transformation, quantization, and entropy coding on the YUV image in sequence to obtain the bitstream of the YUV image. This process is lossy coding. The decoding process for the bitstream of the YUV image specifically includes performing entropy decoding, inverse quantization, inverse transformation, and prediction on the bitstream of the YUV image in sequence to obtain the reconstructed frame of the YUV image. In this application, the bitstream of the YUV image can also be referred to as the third bitstream.

[0218] For the α image, two-way processing is performed: First, quadtree encoding is applied to the image to obtain sub-regions, where the pixel values ​​of grid cells in each sub-region are identical. Then, DCT is performed on each sub-region to obtain the common pixel values ​​and size of each sub-region, where the common pixel values ​​are the pixel values ​​of any grid cell within that sub-region. Next, vector quantization is performed on the common pixel values ​​of multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. Finally, entropy encoding is performed on the quantization result of the common pixel values ​​of each sub-region and the size of that sub-region to obtain the first bitstream.

[0219] The other processing method involves: obtaining the mask image of the α image; generally, the α image is a grayscale image, and the mask image is a binary image. Therefore, obtaining the mask image of the α image can be seen as performing dimensionality reduction on the α image to obtain the mask image; columnarizing the mask image to obtain the first vector of the mask image, the elements of which include the pixel values ​​of the grid cells in the mask image; based on the positional relationship between the first grid cell in the first vector and its adjacent grid cells in the mask image, performing chain-like encoding on each first grid cell in the first vector to obtain the second vector of the mask image; each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the mask; the first grid cell in the first vector is a grid cell with a preset pixel value; entropy encoding is performed on the second vector of the mask image and the size of the mask to obtain the second bitstream.

[0220] At this point, the image to be encoded is complete; simultaneously, the corresponding audio signal is encoded to obtain the audio bitstream.

[0221] The YUV image, α image, and corresponding audio signal of the image to be encoded are given the same timestamp, and then during encoding, the timestamp is encoded into the third bitstream, the first bitstream, and the audio bitstream, respectively.

[0222] The decoding process for the α image specifically includes: decoding the first bitstream to obtain the reconstructed frame of the α image. This decoding process is the inverse of the encoding process. Specifically, it includes entropy decoding of the first bitstream to obtain the quantization result of the common pixel values ​​of each sub-region of the reconstructed frame of the α image and the size of each sub-region; performing inverse vector quantization on the quantization result of the common pixel values ​​of the multiple sub-regions to obtain the common pixel values ​​of each sub-region of the multiple sub-regions; and performing inverse DCT based on the common pixel values ​​and sizes of each sub-region of the multiple sub-regions to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value. The process involves: determining pixel values; performing quadtree raster decoding on multiple sub-regions to obtain the reconstructed frame of the α image; decoding the second bitstream to obtain the second vector of the mask image and the size of the mask image; each element in the second vector representing the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the mask image; performing chain-like decoding on the second vector to obtain the first vector of the mask image, where the elements include the pixel values ​​of all grid cells in the mask image; and performing row and column transformations on the first vector according to the size of the mask image to obtain the mask image.

[0223] After obtaining the mask image of the image to be decoded and the reconstructed frame of the α image of the image to be decoded, an AND operation is performed on the mask image and the reconstructed frame of the α image to obtain the processed α image, which is the reconstructed frame of the target α image. Optionally, in order to improve the accuracy of the reconstructed frame of the α image, the processed α image is input into the compensation model for edge filtering to obtain the reconstructed frame of the target α image.

[0224] The timestamps of the YUV image and the α image are also decoded from the YUV image bitstream and the first bitstream, respectively.

[0225] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded and the timestamp of the audio signal.

[0226] To ensure synchronous decoding, the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal need to be synchronized. This can be achieved using the following methods:

[0227] Method 1: For the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal of the same image to be decoded, if only a portion of the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal are currently decoded, it is necessary to wait until a preset time or until another portion of the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal are decoded before the next frame of the image to be decoded can be decoded.

[0228] Method 2: Buffer the reconstructed frames of the decoded YUV image, the reconstructed frames of the target α image, and the audio signal respectively; then, for the same timestamp, if the buffer only contains a portion of the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal, discard that portion entirely.

[0229] Method 3: For multiple data of the same category in the cache, including reconstructed frames of YUV images, reconstructed frames of target α images, and audio signals; if the order of the decoded moments is inconsistent with the order of the timestamps, the multiple data are reordered so that the order of the decoded moments after reordering is consistent with the order of the timestamps.

[0230] After the above synchronization process is performed, the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal used in subsequent processing have the same timestamp. The subsequent processing includes: segmenting and superimposing the reconstructed frames of the YUV image of the image to be decoded based on the reconstructed frames of the α image of the image to be decoded to obtain the reconstructed frames of the image to be decoded; and playing the audio signal while displaying the reconstructed frames of the image to be decoded.

[0231] like Figure 8 As shown, when the image to be decoded is a P-frame, at the encoding end, after obtaining the YUV image and α image of the image to be encoded based on the image to be encoded, the residual image of the YUV image and the residual image of the α image of the image to be encoded are obtained respectively based on the YUV image and α image of the reference frame of the image to be encoded. The encoding process of the residual image of the YUV image specifically includes: performing block division, prediction, transformation, quantization and entropy coding on the YUV image in sequence to obtain the bitstream of the residual image of the YUV image. This process is lossy coding. The decoding process of the bitstream of the residual image of the YUV image specifically includes performing entropy decoding, inverse quantization, inverse transformation and prediction on the bitstream of the residual image of the YUV image in sequence to obtain the reconstructed frame of the residual image of the YUV image.

[0232] For the residual image of the α image, the encoding process can be found above. Figure 7 The description of encoding the α image shown will not be repeated here.

[0233] At the decoding end, for the bitstream obtained by encoding the residual image of the α image, the decoding process can be referred to the above. Figure 7 The description shown above describes the decoding of the first and second bitstreams, resulting in the reconstructed frame of the residual image of the α image of the image to be decoded and the corresponding mask image. These details will not be elaborated here.

[0234] according to Figure 7The method shown obtains the reconstructed frame of the residual image of the α image of the image to be decoded and the corresponding mask image. Then, it performs an AND operation on the reconstructed frame of the residual image of the α image of the image to be decoded and the corresponding mask image to obtain the reconstructed frame of the residual image of the processed α image. Then, it obtains the reconstructed frame of the α image of the image to be decoded based on the reconstructed frame of the α image of the reference frame and the reconstructed frame of the residual image of the α image. Optionally, the image obtained based on the reconstructed frame of the α image of the reference frame and the reconstructed frame of the residual image of the α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the α image of the image to be decoded.

[0235] The timestamps of the YUV image and the α image are also decoded from the third bitstream and the first bitstream, respectively. The timestamp of the YUV image is the timestamp of the reconstructed frame of the YUV image, and the timestamp of the α image is the timestamp of the reconstructed frame of the target α image. The audio bitstream is decoded to obtain the audio signal corresponding to the image to be decoded and the timestamp of the audio signal.

[0236] To ensure synchronization during decoding, the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal need to be synchronized. The synchronization method can be found in [reference needed]. Figure 7 The relevant descriptions in the illustrated embodiments will not be repeated here.

[0237] After the above synchronization process is performed, the reconstructed frames of the YUV image, the reconstructed frames of the target α image, and the audio signal used in subsequent processing have the same timestamp. The subsequent processing includes: segmenting and superimposing the reconstructed frames of the YUV image of the image to be decoded based on the reconstructed frames of the target α image to obtain the reconstructed frames of the image to be decoded; and playing the audio signal while displaying the reconstructed frames of the image to be decoded.

[0238] As can be seen, in the embodiments of this application, by performing chain-like coding on the mask image of the α image of the image to be encoded, the raster data is effectively compressed; applying chain-like coding to the block division of the mask image can effectively prevent quantization distortion of the mask image lines, thereby suppressing severe edge spikes; using quadtree raster coding to encode the α image of the image to be encoded ensures that subsequent encoding is concentrated within the mask of the α image of the image to be encoded, thereby improving encoding efficiency. At the decoding end, by introducing a compensation model to perform edge filtering on the reconstructed frame of the input α image, the phenomenon of obviously harsh and sharpened edge lines is avoided, while improving the accuracy of the reconstructed frame of the image to be decoded.

[0239] See Figure 9 , Figure 9 This is a schematic diagram of the structure of an encoding device provided in an embodiment of this application. Figure 9As shown, the video encoding device 900 includes:

[0240] The acquisition unit 901 is used to acquire a first raster image of the image to be encoded, which is obtained based on the α image of the image to be encoded, and the image to be encoded is any frame in the video to be transmitted.

[0241] The encoding unit 902 is used to perform quadtree raster encoding on the first raster image to obtain a first bitstream; to perform chain-like encoding on the second raster image to obtain a second bitstream, wherein the second raster image is a mask image of the first raster image; and to obtain a third bitstream based on the YUV image of the image to be encoded.

[0242] Output unit 903 is used to merge and output the first bitstream, the second bitstream, and the third bitstream.

[0243] In a feasible embodiment, in performing quadtree raster encoding on the first raster image to obtain the first bitstream, the encoding unit 902 is specifically used for:

[0244] Fine edge AR coding is performed on the first raster image to obtain the size of each sub-region and the first pixel value of the sub-region. The multiple sub-regions are obtained based on the first raster image. Entropy coding is performed on the quantization result of the common pixel value of each sub-region and the size of the sub-region to obtain the first bitstream.

[0245] In a feasible embodiment, in performing fine edge AR encoding on the first raster image to obtain the size of each sub-region and the first pixel value of that sub-region in a plurality of sub-regions, the encoding unit 902 is specifically configured to:

[0246] The first raster image is encoded using quadtree raster coding to obtain multiple sub-regions. The pixel values ​​of each grid cell within each sub-region are identical. Discrete cosine transform (DCT) is performed on each sub-region to obtain the common pixel values ​​and size of each sub-region. The common pixel values ​​of each sub-region are the pixel values ​​of any grid cell within that sub-region. Vector quantization is then performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. The quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

[0247] In a feasible embodiment, in performing chain-like encoding on the second raster image to obtain the second bitstream, the encoding unit 902 is specifically used for:

[0248] The second raster image is columnarized to obtain a first vector of the second raster image. The elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image. Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, each first grid cell in the second vector is chain-like encoded to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. The second vector of the second raster image and the dimensions of the second raster image are entropy encoded to obtain a second bitstream.

[0249] In one feasible embodiment, when the image to be encoded is an I-frame, the first raster image is the α image of the image to be encoded, and the second raster image is the mask image of the α image of the image to be encoded.

[0250] In a feasible embodiment, when the image to be encoded is an I-frame, the encoding unit is specifically used for obtaining a third bitstream based on the YUV image of the image to be encoded as follows:

[0251] Entropy encoding is performed on the YUV image of the image to be encoded to obtain a third bitstream.

[0252] In one feasible embodiment, when the image to be encoded is a P-frame, the first raster image is a residual image of the α-image of the image to be encoded relative to the α-image of the reference frame of the image to be encoded.

[0253] In a feasible embodiment, when the image to be encoded is a P-frame, in terms of obtaining a third bitstream based on the YUV image of the image to be encoded, the encoding unit is specifically used for:

[0254] The residual image of the YUV image of the image to be encoded is obtained from the YUV image of the reference frame and the YUV image of the image to be encoded; entropy coding is then performed on the residual image of the YUV image of the image to be encoded to obtain the third bitstream.

[0255] In one feasible embodiment, the output unit 903 is specifically used for:

[0256] The first, second, and third bitstreams are output sequentially in a serial manner.

[0257] In one feasible embodiment, the encoding unit 902 is further configured to:

[0258] The audio signal corresponding to the image to be encoded is encoded to obtain the first bitstream, the second bitstream, the third bitstream, and the audio bitstream;

[0259] The output unit 903 is also used to output audio bitstreams sequentially in a serial manner.

[0260] It should be noted that the above-mentioned units (acquisition unit 901, encoding unit 902, and output unit 903) are used to execute the relevant contents of steps S301-S303 of the above method. Among them, acquisition unit 901 is used to execute the relevant contents of S301, and encoding unit 902 and output unit 903 are used to execute the relevant contents of S302 and S303.

[0261] In this embodiment, the video encoding device 900 is presented in the form of a unit. Here, "unit" can refer to an application-specific integrated circuit (ASIC), a processor and memory executing one or more software or firmware programs, integrated logic circuits, and / or other devices that can provide the above-mentioned functions. Furthermore, the acquisition unit 901, encoding unit 902, and output unit 903 can be... Figure 11 The processor 1101 of the encoding device shown is used to implement this.

[0262] See Figure 10 , Figure 10 This is a schematic diagram of the structure of a decoding device provided in an embodiment of this application. Figure 10 As shown, the video decoding device 1000 includes:

[0263] The acquisition unit 1001 is used to acquire the video bitstream, which includes a first bitstream, a second bitstream, and a third bitstream.

[0264] Decoding unit 1002 is used to perform decoding operations on a first bitstream to obtain a first reconstructed frame, the first reconstructed frame being related to the reconstructed frame of the α image of the image to be decoded; the image to be decoded is any frame in the video; to perform decoding operations on a second bitstream to obtain a second reconstructed frame; the second reconstructed frame being related to the reconstructed frame of the mask image of the α image of the image to be decoded; and to obtain a third reconstructed frame based on a third bitstream, the third reconstructed frame being the reconstructed frame of the YUV image of the image to be decoded.

[0265] The reconstruction unit 1003 is used to obtain the reconstruction frame of the target α image based on the first reconstruction frame and the second reconstruction frame, and to perform image segmentation and superposition on the third reconstruction frame based on the reconstruction frame of the target α image to obtain the reconstruction frame of the image to be decoded. The reconstruction frame of the image to be decoded is the third reconstruction frame with a transparent background.

[0266] In a feasible embodiment, in terms of decoding the first bitstream to obtain the first reconstructed frame, the decoding unit 1002 is specifically configured to:

[0267] Entropy decoding is performed on the first bitstream to obtain the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame; fine edge AR decoding is performed on the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame to obtain the first reconstructed frame.

[0268] In one feasible embodiment, in obtaining the first reconstructed frame by performing fine-grained edge AR decoding on the first pixel value of each sub-region and the size of each sub-region of the plurality of sub-regions of the first reconstructed frame, the decoding unit 1002 is specifically used for:

[0269] Inverse vector quantization is performed on the first pixel values ​​of multiple sub-regions to obtain common pixel values ​​for each sub-region; inverse DCT is performed based on the common pixel values ​​and size of each sub-region to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value; quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

[0270] In a feasible embodiment, in terms of decoding the second bitstream to obtain the second reconstructed frame, the decoding unit 1002 is specifically configured to:

[0271] Entropy decoding is performed on the second bitstream to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the second reconstructed frame; chain-like decoding is performed on the second vector to obtain the first vector of the second reconstructed frame, the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; row and column transformations are performed on the first vector according to the size of the second reconstructed frame to obtain the second reconstructed frame.

[0272] In one feasible embodiment, when the image to be decoded is an I-frame, the first reconstructed frame is a reconstructed frame of the α-image of the image to be decoded; the second reconstructed frame is a reconstructed frame of the mask image of the α-image of the image to be decoded.

[0273] In obtaining the third reconstructed frame based on the third bitstream, the decoding unit 1002 is specifically used to: decode the third bitstream to obtain the third reconstructed frame.

[0274] In one feasible embodiment, when the image to be decoded is a P-frame, the first reconstructed frame is a reconstructed frame of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded, and the second reconstructed frame is a reconstructed frame of the mask image of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded.

[0275] In obtaining the third reconstructed frame based on the third bitstream, the decoding unit 1002 is specifically used for:

[0276] The third bitstream is decoded to obtain a reconstructed frame of the residual image of the YUV image of the image to be decoded; the third reconstructed frame is obtained based on the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

[0277] In a feasible embodiment, in terms of obtaining the reconstruction frame of the target α image based on the first reconstruction frame and the second reconstruction frame, the reconstruction unit 1003 is specifically configured to:

[0278] Perform an AND operation on the first and second reconstructed frames to obtain the reconstructed frames of the target α image.

[0279] or;

[0280] A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the first α image. The reconstructed frame of the first α image is then input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image. The compensation model is implemented based on a neural network.

[0281] In a feasible embodiment, in terms of obtaining the reconstruction frame of the target α image based on the first reconstruction frame and the second reconstruction frame, the reconstruction unit 1003 is specifically configured to:

[0282] Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; obtain the reconstructed frame of the target α image based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image;

[0283] or;

[0284] A bitwise AND operation is performed on the first and second reconstructed frames to obtain the reconstructed frame of the second α image; the reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

[0285] Optionally, the neural network described above can be a convolutional neural network, a recurrent neural network, a fully connected neural functional network, or other neural networks.

[0286] In one feasible embodiment, the bitstream further includes an audio bitstream, and the decoding unit 1002 is further configured to:

[0287] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded.

[0288] In a feasible embodiment, before the reconstruction unit 1003 performs image segmentation and overlay on the third reconstruction frame based on the reconstruction frame of the target α image to obtain the reconstruction frame of the image to be decoded, the decoding unit 1002 is further configured to:

[0289] The timestamps of the reconstructed frames, the third reconstructed frame, and the audio signal corresponding to the image to be decoded are decoded from the bitstream;

[0290] In terms of performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the reconstruction unit 1003 is specifically used for:

[0291] When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

[0292] It should be noted that the above-mentioned units (acquisition unit 1001, decoding unit 1002, and reconstruction unit 1003) are used to execute the relevant content of steps S601-S604 of the above method. Specifically, acquisition unit 1001 is used to execute the relevant content of S601, decoding unit 1002 is used to execute the relevant content of S602, and reconstruction unit 1003 is used to execute the relevant content of S604.

[0293] In this embodiment, the video decoding device 1000 is presented in the form of a unit. Here, "unit" can refer to an application-specific integrated circuit (ASIC), a processor and memory executing one or more software or firmware programs, integrated logic circuits, and / or other devices that can provide the above-mentioned functions. Furthermore, the acquisition unit 1001, decoding unit 1002, and reconstruction unit 1003 can be... Figure 12 The processor 1201 of the decoding device shown is used to implement this.

[0294] like Figure 11 The video encoding device 1100 shown can be used to Figure 11 The video encoding device 1100 is implemented using the structure described above. It includes at least one processor 1101, at least one memory 1102, and at least one communication interface 1103. The processor 1101, the memory 1102, and the communication interface 1103 are connected through the communication bus and communicate with each other.

[0295] Processor 1101 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of programs in the above scheme.

[0296] Communication interface 1103 is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.

[0297] The memory 1102 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.

[0298] The memory 1102 stores the application code for executing the above scheme, and its execution is controlled by the processor 1101. The processor 1101 executes the application code stored in the memory 1102.

[0299] The code stored in memory 1102 can execute any of the video encoding methods provided above, such as performing the following steps:

[0300] The process involves obtaining a first raster image of the image to be encoded, which is obtained from the α image of the image to be encoded, and the image to be encoded is any frame in the video to be transmitted; performing quadtree raster encoding on the first raster image to obtain a first bitstream; performing chain-like encoding on the second raster image to obtain a second bitstream, where the second raster image is a mask image of the first raster image; obtaining a third bitstream based on the YUV image of the image to be encoded; and merging and outputting the first, second, and third bitstreams.

[0301] In a feasible embodiment, when performing quadtree raster encoding on the first raster image to obtain the first bitstream, the processor 1101 specifically performs the following steps:

[0302] Fine-grained edge AR encoding is performed on the first raster map to obtain the size of each sub-region and the first pixel value of the sub-region in multiple sub-regions, which are obtained based on the first raster image; entropy encoding is performed on the size of each sub-region and the first pixel value of the sub-region in multiple sub-regions to obtain the first bitstream.

[0303] In a feasible embodiment, when performing fine-grained edge augmented reality (AR) encoding on the first grid map to obtain the size of each sub-region and the first pixel value of that sub-region, the processor 1101 specifically performs the following steps:

[0304] The first raster image is encoded using quadtree raster coding to obtain multiple sub-regions. The pixel values ​​of each grid cell within each sub-region are identical. DCT is performed on each sub-region to obtain the common pixel values ​​and size of each sub-region. The common pixel values ​​of each sub-region are the pixel values ​​of any grid cell within that sub-region. Vector quantization is then performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. The quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

[0305] In a feasible embodiment, when performing a chain-like encoding operation on the first raster image to obtain the second bitstream, the processor 1101 specifically executes the following steps:

[0306] The first raster image is dimensionality reduced to obtain a second raster image, which is a binary image. The second raster image is then columnarized to obtain a first vector. The elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image. Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, each first grid cell in the second vector is subjected to chain-like encoding to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. The second vector of the second raster image and the dimensions of the second raster image are entropy encoded to obtain a second bitstream.

[0307] In one feasible embodiment, when the image to be encoded is an I-frame, the first raster image is the α image of the image to be encoded.

[0308] In a feasible embodiment, when the image to be encoded is an I-frame, when performing the step of obtaining a third bitstream based on the YUV image of the image to be encoded, the processor 1101 is specifically used to perform the following steps:

[0309] Entropy encoding is performed on the YUV image of the image to be encoded to obtain a third bitstream.

[0310] In one feasible embodiment, when the image to be encoded is a P-frame, the first raster image is obtained based on the α-image of the image to be encoded, and includes:

[0311] The first raster image is the residual image of the α image of the image to be encoded relative to the α image of the reference frame of the image to be encoded;

[0312] When performing the step of obtaining a third bitstream from the YUV image of the image to be encoded, the processor 1101 specifically performs the following steps:

[0313] The residual image of the YUV image of the image to be encoded is obtained from the YUV image of the reference frame of the image to be encoded and the YUV image of the image to be encoded; the residual image of the YUV image of the image to be encoded is entropy encoded to obtain the third bitstream.

[0314] In a feasible embodiment, when performing the step of merging and outputting the first bitstream, the second bitstream, and the third bitstream, the processor 1101 is specifically used to perform the following steps: outputting the first bitstream, the second bitstream, and the third bitstream in a concatenated manner.

[0315] In one feasible embodiment, the processor 1101 is further configured to perform the following steps:

[0316] The audio signal corresponding to the image to be encoded is encoded to obtain the audio bitstream.

[0317] like Figure 12 The video decoding device 1200 shown can be used to... Figure 12 The video decoding device 1200 is implemented using the structure described above. It includes at least one processor 1201, at least one memory 1202, and at least one communication interface 1203. The processor 1201, the memory 1202, and the communication interface 1203 are connected through the communication bus and communicate with each other.

[0318] Processor 1201 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of programs in the above scheme.

[0319] The communication interface 1203 is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.

[0320] The memory 1202 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, laser discs, optical discs, digital universal discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.

[0321] The memory 1202 stores the application code for executing the above scheme, and its execution is controlled by the processor 1201. The processor 1201 executes the application code stored in the memory 1202.

[0322] The code stored in memory 1202 can execute any of the video decoding methods provided above, such as performing the following steps:

[0323] The process involves: acquiring a video stream, comprising a first stream, a second stream, and a third stream; decoding the first stream to obtain a first reconstructed frame, which is associated with a reconstructed frame of the α image of the image to be decoded; the image to be decoded being any frame in the video; decoding the second stream to obtain a second reconstructed frame, which is associated with a reconstructed frame of the mask image of the α image of the image to be decoded; obtaining a third reconstructed frame based on the third stream, which is a reconstructed frame of the YUV image of the image to be decoded; obtaining a reconstructed frame of the target α image based on the first and second reconstructed frames; and performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain a reconstructed frame of the image to be decoded, which is a third reconstructed frame with a transparent background.

[0324] In a feasible embodiment, when performing the step of decoding the first bitstream to obtain the first reconstructed frame, the processor 1201 is specifically configured to perform the following steps:

[0325] Entropy decoding is performed on the first bitstream to obtain the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame; fine edge AR decoding is performed on the first pixel value and size of each sub-region of the multiple sub-regions of the first reconstructed frame to obtain the first reconstructed frame.

[0326] In a feasible embodiment, when performing fine-grained edge AR decoding on the first pixel value and size of each of the plurality of sub-regions of the first reconstructed frame to obtain the first reconstructed frame, the processor 1201 is specifically configured to perform the following steps:

[0327] Inverse vector quantization is performed on the first pixel values ​​of multiple sub-regions to obtain common pixel values ​​for each sub-region; inverse DCT is performed based on the common pixel values ​​and size of each sub-region to obtain multiple sub-regions, where each pixel value within each sub-region is a common pixel value; quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

[0328] In a feasible embodiment, when performing the step of decoding the second bitstream to obtain the second reconstructed frame, the processor 1201 is specifically configured to perform the following steps:

[0329] Entropy decoding is performed on the second bitstream to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to that element and the grid cell corresponding to the previous element in the second reconstructed frame; chain-like decoding is performed on the second vector to obtain the first vector of the second reconstructed frame, the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; row and column transformations are performed on the first vector according to the size of the second reconstructed frame to obtain the second reconstructed frame.

[0330] In one feasible embodiment, when the image to be decoded is an I-frame, the first reconstructed frame is a reconstructed frame of the α-image of the image to be decoded; the second reconstructed frame is a reconstructed frame of the mask image of the α-image of the image to be decoded.

[0331] When performing the step of obtaining the third reconstructed frame based on the third bitstream, the processor 1201 specifically performs the following steps:

[0332] The third reconstructed frame is obtained by entropy decoding of the third bitstream.

[0333] In one feasible embodiment, when the image to be decoded is a P-frame, the first reconstructed frame is a reconstructed frame of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded, and the second reconstructed frame is a reconstructed frame of the mask image of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded.

[0334] When performing the step of obtaining the third reconstructed frame based on the third bitstream, the processor 1201 specifically performs the following steps:

[0335] The third bitstream is decoded to obtain a reconstructed frame of the residual image of the YUV image of the image to be decoded; the third reconstructed frame is obtained based on the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

[0336] In a feasible embodiment, when performing the step of obtaining the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame, the processor 1201 is specifically configured to perform the following steps:

[0337] Perform an AND operation on the first and second reconstructed frames to obtain the reconstructed frames of the target α image.

[0338] or;

[0339] A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the first α image. The reconstructed frame of the first α image is then input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image. The compensation model is implemented based on a neural network.

[0340] In a feasible embodiment, when performing the step of obtaining the reconstructed frame of the target α image based on the first reconstructed frame and the second reconstructed frame, the processor 1201 is specifically configured to perform the following steps:

[0341] Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; obtain the reconstructed frame of the target α image based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image;

[0342] or;

[0343] A bitwise AND operation is performed on the first and second reconstructed frames to obtain the reconstructed frame of the second α image; the reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

[0344] In one feasible embodiment, the bitstream further includes an audio bitstream, and the processor 1201 is specifically configured to perform the following steps:

[0345] The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded.

[0346] In a feasible embodiment, before performing the step of image segmentation and overlay of the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the processor 1201 is further specifically configured to perform the following steps:

[0347] The timestamps of the reconstructed frames, the third reconstructed frame, and the audio signal corresponding to the image to be decoded are decoded from the bitstream;

[0348] When performing the step of image segmentation and overlay of the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the processor 1201 is also specifically used to perform the following steps:

[0349] When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

[0350] This application also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, includes some or all of the steps of any of the video encoding / decoding methods described in the above method embodiments.

[0351] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0352] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0353] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0354] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0355] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0356] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0357] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0358] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A video encoding method, characterized in that, include: A first raster image of the image to be encoded is obtained, which is obtained based on the α image of the image to be encoded, wherein the image to be encoded is any frame in the video to be transmitted; Perform quadtree raster encoding on the first raster image to obtain the first bitstream; A chain-like encoding operation is performed on the second raster image to obtain a second bitstream, wherein the second raster image is a mask image of the first raster image; The third bitstream is obtained based on the YUV image of the image to be encoded; The first, second, and third bitstreams are merged and output.

2. The method according to claim 1, characterized in that, The step of performing quadtree raster encoding on the first raster image to obtain the first bitstream includes: The first raster image is subjected to fine edge augmented reality (AR) encoding to obtain the size of each sub-region and the first pixel value of the sub-region, wherein the multiple sub-regions are obtained based on the first raster image; The size of each sub-region and the first pixel value of that sub-region are entropy encoded to obtain the first bitstream.

3. The method according to claim 2, characterized in that, The step of performing fine-grained edge augmented reality (AR) encoding on the first raster image to obtain the size of each sub-region and the first pixel value of that sub-region includes: The first raster image is subjected to quadtree raster encoding to obtain the plurality of sub-regions, wherein the pixel value of each grid cell in each sub-region is the same; Perform Discrete Cosine Transform (DCT) on each of the plurality of sub-regions to obtain the common pixel values ​​of each sub-region and the size of the sub-region. The common pixel values ​​of each sub-region are the pixel values ​​of any grid cell within the sub-region. Vector quantization is performed on the common pixel values ​​of the multiple sub-regions to obtain the quantization result of the common pixel values ​​of each sub-region. The quantization result of the common pixel values ​​of each sub-region is the first pixel value of each sub-region.

4. The method according to any one of claims 1-3, characterized in that, The step of performing chain-like encoding on the second raster image to obtain the second bitstream includes: The second raster image is subjected to columnarization to obtain a first vector of the second raster image; the elements in the first vector of the second raster image include the pixel values ​​of the grid cells in the second raster image; Based on the positional relationship between each first grid cell in the first vector and its adjacent first grid cells in the second raster image, a chain-like encoding is performed on each first grid cell in the first vector to obtain a second vector of the second raster image. Each element in the second vector is used to indicate the positional relationship between the first grid cell corresponding to that element and the first grid cell corresponding to the previous element in the second raster image. The first grid cell in the first vector is a grid cell with a preset pixel value. The second vector of the second raster image and the size of the second raster image are entropy encoded to obtain the second bitstream.

5. The method according to claim 1, characterized in that, When the image to be encoded is an I-frame, the first raster image is the α-image of the image to be encoded.

6. The method according to claim 1, characterized in that, When the image to be encoded is an I-frame, obtaining the third bitstream based on the YUV image of the image to be encoded includes: Entropy encoding is performed on the YUV image of the image to be encoded to obtain the third bitstream.

7. The method according to claim 1, characterized in that, When the image to be encoded is a P-frame, the first raster image is obtained based on the α-image of the image to be encoded, and includes: The first raster image is a residual image of the α image of the image to be encoded relative to the α image of the reference frame of the image to be encoded; The step of obtaining the third bitstream based on the YUV image of the image to be encoded includes: The residual image of the YUV image of the image to be encoded is obtained based on the YUV image of the reference frame of the image to be encoded and the YUV image of the image to be encoded. Entropy coding is performed on the residual image of the YUV image of the image to be encoded to obtain the third bitstream.

8. The method according to claim 1, characterized in that, The step of merging and outputting the first bitstream, the second bitstream, and the third bitstream includes: The first bitstream, the second bitstream, and the third bitstream are output sequentially in a concatenated manner.

9. The method according to claim 1, characterized in that, The method further includes: The audio signal corresponding to the image to be encoded is encoded to obtain an audio bitstream.

10. A video decoding method, characterized in that, include: The video bitstream is obtained, and the video bitstream includes a first bitstream, a second bitstream, and a third bitstream; The first bitstream is decoded to obtain a first reconstructed frame, which is related to the reconstructed frame of the α image of the image to be decoded; the image to be decoded is any frame in the video. The second bitstream is decoded to obtain a second reconstructed frame; the second reconstructed frame is related to the reconstructed frame of the mask image of the α image of the image to be decoded; The third reconstructed frame is obtained based on the third bitstream, and the third reconstructed frame is the reconstructed frame of the YUV image of the image to be decoded; The reconstructed frames of the target α image are obtained based on the first and second reconstructed frames. Based on the reconstructed frame of the target α image, the third reconstructed frame is segmented and superimposed to obtain the reconstructed frame of the image to be decoded, wherein the reconstructed frame of the image to be decoded is the third reconstructed frame with a transparent background.

11. The method according to claim 10, characterized in that, The decoding operation on the first bitstream to obtain the first reconstructed frame includes: Entropy decoding is performed on the first bitstream to obtain the first pixel value of each sub-region of the multiple sub-regions of the first reconstructed frame and the size of each sub-region; The first reconstructed frame is obtained by performing fine-grained edge augmented reality (AR) decoding on the first pixel value of each of the multiple sub-regions of the first reconstructed frame and the size of each sub-region.

12. The method according to claim 11, characterized in that, The process of performing fine-grained edge augmented reality (AR) decoding on the first pixel value of each sub-region of the plurality of sub-regions of the first reconstructed frame and the size of each sub-region to obtain the first reconstructed frame includes: Inverse vector quantization is performed on the first pixel values ​​of the plurality of sub-regions to obtain the common pixel values ​​of each sub-region in the plurality of sub-regions; Inverse Discrete Cosine Transform (DCT) is performed on the common pixel values ​​and dimensions of each of the multiple sub-regions to obtain multiple sub-regions, where each pixel value in each sub-region is the common pixel value. Quadtree raster decoding is performed on the multiple sub-regions to obtain the first reconstructed frame.

13. The method according to any one of claims 10-12, characterized in that, The decoding operation on the second bitstream to obtain the second reconstructed frame includes: The second bitstream is entropy decoded to obtain the second vector of the second reconstructed frame and the size of the second reconstructed frame; each element in the second vector is used to characterize the positional relationship between the grid cell corresponding to the element and the grid cell corresponding to the previous element in the second reconstructed frame; The second vector is subjected to chain-like decoding to obtain the first vector of the second reconstructed frame, wherein the elements of the first vector include the pixel values ​​of all grid cells in the second reconstructed frame; The first vector is transformed into rows and columns according to the size of the second reconstructed frame to obtain the second reconstructed frame.

14. The method according to claim 10, characterized in that, When the image to be decoded is an I-frame The first reconstructed frame is a reconstructed frame of the α image of the image to be decoded; the second reconstructed frame is a reconstructed frame of the mask image of the α image of the image to be decoded. The step of obtaining the third reconstructed frame based on the third bitstream includes: The third reconstructed frame is obtained by entropy decoding of the third bitstream.

15. The method according to claim 10, characterized in that, When the image to be decoded is a P-frame, the first reconstructed frame is a reconstructed frame of the residual image of the α-image of the image to be decoded relative to the α-image of the reference frame of the image to be decoded. The second reconstructed frame is related to the reconstructed frame of the mask image of the α image of the image to be decoded, and includes: The second reconstructed frame is a reconstructed frame of a mask image of the residual image of the α image of the image to be decoded relative to the α image of the reference frame of the image to be decoded; The step of obtaining the third reconstructed frame based on the third bitstream includes: The third bitstream is decoded to obtain the reconstructed frame of the residual image of the YUV image of the image to be decoded; The third reconstructed frame is obtained based on the reconstructed frame of the residual image of the YUV image of the image to be decoded and the reconstructed frame of the YUV image of the reference frame of the image to be decoded.

16. The method according to claim 14, characterized in that, The step of obtaining the reconstructed frame of the target α image based on the first and second reconstructed frames includes: Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the target α image. or; An AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain a reconstructed frame of the first α image. The reconstructed frame of the first α image is then input into a compensation model for edge filtering to obtain a reconstructed frame of the target α image. The compensation model is implemented based on a neural network.

17. The method according to claim 15, characterized in that, The step of obtaining the reconstructed frame of the target α image based on the first and second reconstructed frames includes: Perform an AND operation on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; obtain the reconstructed frame of the target α image based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image; or; A bitwise AND operation is performed on the first reconstructed frame and the second reconstructed frame to obtain the reconstructed frame of the second α image; a reconstructed frame of the third α image is obtained based on the reconstructed frame of the α image of the reference frame of the image to be decoded and the reconstructed frame of the second α image, and the reconstructed frame of the third α image is input into the compensation model for edge filtering processing to obtain the reconstructed frame of the target α image; wherein, the compensation model is implemented based on a neural network.

18. The method according to claim 10, characterized in that, The bitstream also includes an audio bitstream, and the method further includes: The audio stream is decoded to obtain the audio signal corresponding to the image to be decoded.

19. The method according to claim 18, characterized in that, Before performing image segmentation and overlay on the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded, the method further includes: The timestamps of the reconstructed frames of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are decoded from the bitstream. The step of segmenting and overlaying the third reconstructed frame based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded includes: When the timestamp of the reconstructed frame of the target α image, the timestamp of the third reconstructed frame, and the timestamp of the audio signal corresponding to the image to be decoded are consistent, the third reconstructed frame is segmented and superimposed based on the reconstructed frame of the target α image to obtain the reconstructed frame of the image to be decoded.

20. A video encoding device, characterized in that, include: Memory, used to store instructions; as well as The processor is coupled to the memory; Wherein, when the processor executes the instruction, the video encoding device performs the method as described in any one of claims 1-9.

21. A video decoding device, characterized in that, include: Memory, used to store instructions; as well as The processor is coupled to the memory; When the processor executes the instruction, the video decoding device performs the method as described in any one of claims 10-19.

22. A video device, characterized in that, include: Memory, used to store instructions; as well as The processor is coupled to the memory; Wherein, when the processor executes the instruction, it performs the method as described in any one of claims 1-19.

23. A chip system, characterized in that, The chip system is applied to an electronic device; the chip system includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected via lines; the interface circuits are used to receive signals from the memory of the electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device performs the method as described in any one of claims 1-19.

24. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1-19.

25. A computer program product, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-19.

Citation Information

Patent Citations

  • Object-based fractal video compression and decompression method

    CN101827268A

  • Picture file processing method and intelligent terminal

    CN107071514A