WO2021237569A1 - Encoding method, decoding method, apparatus and system - Google Patents

Encoding method, decoding method, apparatus and system Download PDF

Info

Publication number
WO2021237569A1
WO2021237569A1 PCT/CN2020/092920 CN2020092920W WO2021237569A1 WO 2021237569 A1 WO2021237569 A1 WO 2021237569A1 CN 2020092920 W CN2020092920 W CN 2020092920W WO 2021237569 A1 WO2021237569 A1 WO 2021237569A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
channel
yuv
alpha
specified
Prior art date
Application number
PCT/CN2020/092920
Other languages
French (fr)
Chinese (zh)
Inventor
刘细华
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN202080039078.8A priority Critical patent/CN113994708A/en
Priority to PCT/CN2020/092920 priority patent/WO2021237569A1/en
Publication of WO2021237569A1 publication Critical patent/WO2021237569A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements

Definitions

  • This application relates to the field of coding technology, and specifically to an encoding method, decoding method, device and system.
  • More and more smart terminals provide various video taking and video editing functions. For example, users can use their mobile phones to take pictures or videos, and then process the pictures or videos and share them with friends. In order to make pictures or videos more lively and interesting, users can superimpose some animation materials on the pictures or videos. In order to better integrate the animation materials with the shooting materials, the animation materials often use transparent or semi-transparent materials, which are superimposed with the shooting materials. Fusion later.
  • pictures or videos containing transparent or semi-transparent materials include not only red (Red, R for short), Green (G), and Blue (B for short) three-channel images, they also include Alpha channel images, so When encoding, transmitting and decoding such pictures or videos, the Alpha channel image needs to be separately encoded into one file, so two files need to be transmitted and decoded.
  • the overall file takes up a lot of memory and the transmission process takes up more bandwidth resources.
  • the performance requirements for terminal equipment are also high, and it is not suitable for some terminal equipment with relatively poor performance, and it is easy to cause a stuck phenomenon.
  • the present application provides an encoding method, decoding method, device, and system.
  • an encoding method including:
  • a decoding method including:
  • YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
  • the original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
  • an encoding device includes a processor, a memory, and a computer program stored in the storage, and the processor implements the following steps in the claims when the processor executes the computer program:
  • a decoding device includes a processor, a memory, and a computer program stored in the storage, and when the processor executes the computer program, the following steps are implemented:
  • YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
  • the original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
  • a video transmission system including an encoding device and a decoding device;
  • the encoding device is used to obtain a target image to be encoded, convert the RGB channel image corresponding to the target image into a YUV image, and fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image , Encoding the new YUV image to send the encoded image;
  • the decoding device is configured to, after receiving the encoded image, process the encoded image to obtain the new YUV image, and restore the YUV image and the Alpha channel based on the new YUV image Image, converting the YUV image into an RGB image, and obtaining the target image based on the RGB image and the Alpha channel image.
  • the RGB image corresponding to the target image can be converted to a YUV image, and then the Alpha channel image corresponding to the target image can be fused with the YUV image to obtain a new The YUV image, and the new YUV image is encoded.
  • the Alpha channel image corresponding to the target image can be fused with the YUV image to obtain a new The YUV image, and the new YUV image is encoded.
  • Fig. 1 is a schematic diagram of encoding an image with a transparent effect in the related art.
  • Fig. 2 is a flowchart of an encoding method according to an embodiment of the present application.
  • Fig. 3(a) is a schematic diagram of the fusion of the Y channel image and the Alpha channel image in the YUV image according to an embodiment of the present application.
  • Fig. 3(b) is a schematic diagram of the fusion of the Y channel image and the Alpha channel image in the YUV image according to an embodiment of the present application.
  • Fig. 4 is a schematic diagram of the fusion of Y channel images and Alpha channel images in a YUV image according to an embodiment of the present application.
  • Fig. 5 is a schematic diagram of a decoding method according to an embodiment of the present application.
  • Fig. 6(a) is a schematic diagram of an encoding process of an embodiment of the present application.
  • Figure 6(b) is a schematic diagram of the decoding process of an embodiment of the present application.
  • Fig. 7 is a schematic diagram of the logical structure of an encoding device according to an embodiment of the present application.
  • Fig. 8 is a schematic diagram of a logical structure of a decoding device according to an embodiment of the present application.
  • the image A to be transmitted needs to be encoded into two files, that is, the RGB channel image is encoded into One file (file 1), the Alpha channel image needs to be separately encoded into a file (file 2), and then the two files are transmitted to the decoding end.
  • file 1 the RGB channel image
  • file 2 the Alpha channel image needs to be separately encoded into a file
  • file 2 the two files need to be decoded.
  • File 2 is decoded to obtain an RGB channel image and an Alpha channel image, thereby obtaining image A. Due to the large size of the overall file, the transmission process requires more bandwidth resources.
  • the performance requirements of the terminal device are relatively high.
  • this application provides an encoding method that can merge the YUV image obtained by converting the Alpha channel image corresponding to the image to be encoded and the RGB channel image corresponding to the image to be encoded into a new YUV image, and then encoding
  • the processing not only conforms to the general coding and decoding standards, but also only needs to code and decode one file, which can save transmission resources and has lower requirements on terminal performance.
  • the method includes the following steps:
  • the encoding method of the present application can be used for an encoding device that performs encoding processing on images or videos.
  • the encoding device can be integrated on terminal devices such as mobile phones, tablets, and computers, or it can be an independent device.
  • the target image to be encoded can be an image with a transparency effect, that is, an image containing four channels of R, G, B, and Alpha.
  • the target image can be a single image, or it can be a frame or multiple frames of images contained in the video to be encoded.
  • coding standards such as H264/H265
  • the Alpha channel image corresponding to the target image can be fused with the converted YUV image to generate a new YUV image.
  • the two images can be fused using the preset fusion rules.
  • the fusion rules can be set by themselves, as long as the decoding can be restored according to the fusion rules.
  • the original YUV image and Alpha channel image can be used.
  • general coding technology can be used to encode the new YUV image, for example, the H264/H265 standard is used to encode the generated new YUV image.
  • the image can not only meet the general encoding and decoding standards, and for one frame of target image, only one file needs to be encoded, which can reduce the data volume of the file and save the bandwidth resources of the transmission process. It is necessary to decode a file, which requires relatively low performance on the decoding side, and it is also applicable to the decoding side with poor performance.
  • the target image when the Alpha channel image corresponding to the target image is fused with the converted YUV image, the target image can be combined
  • the corresponding Alpha channel image is fused with the image of the designated channel corresponding to the YUV image, where the image of the designated channel may be at least one of a Y channel image, a U channel image, or a V channel image.
  • the Alpha channel image and the Y channel image can be fused to obtain the Y channel image of a new YUV image, or the Alpha channel image can be fused with the U channel image or V channel image to obtain the U channel image or V channel image of the new YUV image.
  • the Alpha channel image corresponding to the target image when the Alpha channel image corresponding to the target image is fused with the image of the specified channel corresponding to the YUV image, the Alpha channel image and the image of the specified channel corresponding to the YUV image may be compressed first, and then The compressed Alpha channel image and the compressed image of the specified channel are stitched together to obtain the image of the specified channel corresponding to the new YUV image.
  • the width of the image can be compressed, and the height of the image can also be compressed. Therefore, in some embodiments, the width of the Alpha channel image and the width of the image of the specified channel corresponding to the YUV image can be respectively compressed, and then the compressed images are stitched horizontally to obtain the image of the specified channel of the new YUV image. ; Of course, it is also possible to separately compress the height of the Alpha channel image and the height of the image of the specified channel corresponding to the YUV image, and then stitch the compressed images vertically to obtain the image of the specified channel of the new YUV image.
  • FIG. 3(a) it is a schematic diagram of horizontally compressing the Y channel image and the Alpha channel image, and then stitching the Y channel image of a new YUV image.
  • Figure 3(b) it is a schematic diagram of longitudinally compressing the Y channel image and the Alpha channel image, and then stitching to obtain the Y channel image of the new YUV image.
  • the compression ratio when the image of the specified channel and the image of the Alpha channel are compressed, the compression ratio may be the same or different.
  • the Alpha channel image can be compressed according to the first ratio
  • the image of the specified channel can be compressed according to the second ratio.
  • the first ratio The sum to the second ratio is 1.
  • the first ratio and the second ratio can be set according to actual needs. Generally, the larger the compression ratio, the more obvious the distortion of the image. Therefore, in the actual processing process, you can according to the requirements for the effect of the specified channel image or the alpha channel image Set the first ratio and the second ratio flexibly.
  • the compression ratio of the Alpha channel image can be appropriately smaller, and the compression of the image of the specified channel The ratio can be larger.
  • the compression ratio of the image of the specified channel can be appropriately smaller.
  • the two images in order not to affect the compression effect of the Alpha channel image and the specified channel image as much as possible, the two images can be compressed by half. Therefore, the first ratio and the second ratio can both be set to 1/2.
  • the pixel value of the specified pixel in the Alpha channel image can be used to replace the image of the specified channel.
  • the pixel values of the pixels at the corresponding positions of these designated pixels are obtained to obtain the image of the designated channel corresponding to the new YUV image.
  • the designated pixels may be some predefined pixels, for example, some rows of pixels, some columns of pixels, some designated number of pixels, and so on.
  • the designated pixel may be a pixel of a designated row in the Alpha channel image or a pixel of a designated column in the Alpha channel image.
  • you can also use The pixel value of the odd-numbered column of the pixel in the alpha channel image replaces the pixel value of the odd-numbered column of the image of the specified channel to obtain the image of the specified channel of the new YUV image.
  • the Alpha channel image and the specified channel image are fused to minimize the sharpness of the two images during the fusion process.
  • the specified channel can select the channel with the same number of pixels as the Alpha channel, so that the image of the specified channel can be compared with the Alpha channel.
  • the number of pixels in the channel image is the same, that is, the image size is the same.
  • YUV images there are multiple formats, such as YUV444, YUV422, and YUV420.
  • a Y component corresponds to a U component and a V component, that is, a Y channel image, a U channel image, and a V channel.
  • the number of pixels in the image is the same, which is the same as the number of pixels in the Alpha channel image. Therefore, when the image of the specified channel is selected for fusion with the Alpha channel image, either the Y channel image, the U channel or the V channel can be selected. Image.
  • every four Y components share a pair of U and V components.
  • the number of pixels in the U and V channel images is much less than the number of pixels in the Y channel image.
  • the number of pixels in the Y channel image is the same as Alpha.
  • the number of pixels in the channel image is the same.
  • the size of the fused image and the U channel or V channel image must be the same, or the Alpha channel image and the U channel and V channel image should be fused ,
  • the fused image and the image size jointly formed by the U channel and the V channel image must be the same, and the size of the Alpha channel image (or the number of pixels) and the size of the Y channel image (or the number of pixels) are the same, that is The size of the Alpha channel image (or the number of pixels) is larger than any one or a combination of the U channel image and the V channel image. At this time, the resolution of the Alpha channel image will be greatly reduced, which will affect the display effect of the transparent image after encoding.
  • the image of the specified channel can be a Y-channel image.
  • the Y-channel image of the new YUV image is obtained by fusing the Y-channel image with the Alpha channel image.
  • a general coding standard can be used to encode the new YUV image to obtain an encoded image.
  • the RGB image corresponding to the target image can be converted into a YUV image, and then the Alpha channel image corresponding to the target image is fused with the YUV image to obtain a new YUV image , And the new YUV image is encoded.
  • the Alpha channel image corresponding to the target image is fused with the YUV image to obtain a new YUV image , And the new YUV image is encoded.
  • the decoding method includes the following steps:
  • S502 Obtain a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by the conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
  • S506 Convert the original YUV image to obtain the RGB channel image, and obtain the target image based on the RGB channel image and the Alpha channel image.
  • the decoding method of the present application can be applied to a decoding device that decodes images or videos.
  • the decoding device can be integrated on terminal devices such as mobile phones, tablets, and computers, or can be an independent device.
  • the image to be decoded can be obtained first.
  • the image to be decoded is a YUV image.
  • the YUV image is obtained by fusing the original YUV image converted from the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image , Where the original YUV image and the Alpha channel image are fused to obtain the YUV image, which can be fused by using predefined fusion methods and rules.
  • predefined fusion process please refer to the implementations in the above coding methods. The description of the example will not be repeated here.
  • the original YUV image and Alpha channel image corresponding to the target image can be restored according to the YUV image, and then the original YUV image is converted to obtain the corresponding RGB channel image of the target image.
  • the channel image and the Alpha channel image, that is, the decoded target image can be obtained.
  • the original YUV image obtained by converting the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image are fused into a new YUV image, and then the encoding process is performed. Therefore, when decoding, it is also Only one file needs to be decoded, and during the decoding process, the fused YUV image can be restored to obtain the original YUV image Alpha channel image of the target image, and the original YUV image is converted into RGB channel image, according to the Alpha channel image and RGB channel image
  • the channel image can decode the target image. For images or videos with transparent effects, since only one file needs to be decoded, the performance requirements of the decoding end device are relatively low.
  • the image after receiving the image encoded by the encoding device, the image may be first subjected to a conventional decoding operation, for example, the image is decoded according to a general encoding and decoding standard. Therefore, the YUV image to be decoded in this application may be an image obtained after a specified decoding operation is processed.
  • the specified decoding operation may be a decoding operation based on the H264/H265 standard, of course, it may also be based on other similar decoding standards. Operation.
  • the Alpha channel image corresponding to the target image when the Alpha channel image corresponding to the target image is fused with the original YUV image, the Alpha channel image corresponding to the target image can be fused with the specified channel image corresponding to the YUV image.
  • the image of the designated channel may be at least one of a Y channel image, a U channel image, or a V channel image. Therefore, when the original YUV image and the Alpha channel image are restored from the fused YUV image, the image of the specified channel corresponding to the original YUV image and the image of the specified channel can be restored according to the image of the specified channel corresponding to the fused YUV image.
  • Alpha channel image where the image of the designated channel may also be at least one of Y channel image, U channel image, or V channel image, which can be specifically determined according to the encoding mode. For example, if the specified channel image is a Y channel image during encoding, the Y channel image of the merged YUV is restored to obtain the Y channel image and the Alpha channel image of the original YUV image.
  • the size of the fused image needs to be consistent with the size of the designated channel image, and the fusion process will inevitably sacrifice the sharpness of the image.
  • the Alpha channel image and the designated channel image are fused to minimize the decrease in the sharpness of the two images during the fusion process.
  • the designated channel image can be selected to have the same number of pixels as the Alpha channel image.
  • the image of the designated channel may be a Y channel image
  • the Y channel image of the new YUV image is obtained by fusing the Y channel image and the Alpha channel image.
  • the YUV image may be corresponding to the original YUV image according to the preset split rule
  • the pixels of the image of the specified channel are split to obtain some pixels of the image of the specified channel corresponding to the original YUV image and some pixels of the image of the Alpha channel, and then according to the resolution of the YUV image and the image of the specified channel.
  • the split rule can be determined according to the fusion method of the original YUV image and the Alpha channel image. For example, when the original YUV image and the Alpha channel image are fused into a YUV image, the odd rows of pixels of the Alpha channel image are used to replace the odd rows of pixels of the Y channel image of the original YUV image.
  • splitting you can Split the odd and even rows of pixels of the fused YUV image. The odd rows of pixels are part of the Alpha channel image, and the even rows of pixels are part of the Y channel image of the original YUV image. point.
  • the Y channel image and the Alpha channel image of the original YUV image are compressed by half in height respectively, and then stitched vertically to obtain the YUV image, then when decoding .
  • the pixels of the YUV image can be divided into 2 parts in the longitudinal direction, one part is part of the pixels of the Y channel image of the original YUV image, and the other part is part of the pixels of the Alpha channel image.
  • the splitting rules can be adjusted according to the fusion method, and this application does not limit it.
  • interpolation algorithm when restoring the image of the specified channel of the original YUV image and the Alpha channel image based on the partial pixels obtained by the YUV splitting, interpolation algorithm can be used to restore, or the pixels of adjacent pixels can be directly copied.
  • the value is used as the pixel of the new pixel to restore the image.
  • the size of the specified channel image and the alpha channel image of the original YUV image can be determined according to the resolution of the fused YUV image, that is, the number of pixels, and then some pixels of the image of the specified channel of the original YUV image can be interpolated Processing, restore the image of the designated channel of the original YUV image, and perform interpolation processing on some pixels of the Alpha channel image to restore the Alpha channel image.
  • the original YUV image After restoring the specified channel image and Alpha channel image of the original YUV image, the original YUV image can be obtained, and then the original YUV image is converted into an RGB channel image. According to the RGB channel image and the Alpha channel image, the target image can be decoded.
  • the decoding end when decoding a target image with a transparent effect, the decoding end only needs to decode one file, which has lower performance requirements on the decoding end, and can avoid image and video jams.
  • users can edit the video after shooting some small videos with mobile phones, tablets and other devices, such as adding some transparent animation materials to increase the interest of the video, and then send the processed video to their friends.
  • the Alpha channel image needs to be separately encoded into one file. Therefore, when transmitting and decoding, two files need to be transmitted and decoded.
  • the overall file size is large and the transmission process It occupies a lot of bandwidth resources and has high requirements for terminal equipment performance. It is not suitable for some terminal equipment with relatively poor performance, and it is easy to cause a stuck phenomenon.
  • this embodiment provides a method for encoding images and videos with transparency effects. Since most hardware platforms support decoding of images or video files in H264YUV420 format, the following uses this format as an example to illustrate , The specific encoding and decoding process is as follows:
  • Each frame image in the video is an RGBA image.
  • the RGBA image contains both RGB channel images and Alpha channel images. Since H264 encoding needs to convert the image to the YUV format image, you can first convert the RGB channel image to the YUV420 format image. Hereinafter, it is called the original YUV420 image.
  • the YUV420 format image means that every 4 Y components share a pair of U components.
  • V component, YUV420 image contains Y channel image, U channel image and V channel image, the size of Y channel image is the same as the original image size.
  • the height or width of the Y channel image can be compressed at a ratio of 2:1 (in the figure, height compression is taken as an example).
  • an image with a width and height of 400x400 can be scaled 2:1 in height to become a 400x200 image.
  • the height or width of the Alpha channel image is compressed at a ratio of 2:1 (in the figure, the height compression is taken as an example).
  • it can also be compressed at other ratios. For example, if the brightness of the encoded image is higher, then the Y channel The compression ratio of the image can be smaller, and the transparency of the image is required to be higher, then the compression ratio of the Alpha channel image can be set smaller. Then the compressed Y channel image and Alpha channel image are spliced together to form a spliced Y channel image.
  • the spliced Y channel image and the original UV channel image form a new YUV420 image, which is called fusion hereinafter YUV420 image, and then the fused YUV420 image can be sent to the encoder for H264 encoding processing.
  • the decoder After the decoder receives the image to be decoded encoded according to the above encoding process, it can first perform conventional decoding processing on the image to be decoded according to the H264 decoding standard to obtain the fused YUV420 image. . Then, the pixels of the Y-channel image of the fused YUV420 image are split according to the preset splitting rules, where the specific splitting rules can be determined according to the fusion method of the Y-channel image and the Alpha channel image in the encoding process. In the encoding process, the Y channel image and the Alpha channel image are highly compressed and vertically stitched.
  • the pixels of the Y channel image of the fused YUV420 image can be split into two parts, one part is the pixel of the Y channel image of the original YUV image Point, part of which is the pixel point of the Alpha channel image. Then the size of the original YUV image and the Alpha channel image can be determined according to the resolution of the fused YUV420 image, and the original YUV image and the Alpha channel image can be restored according to the split pixels, for example, it can be enlarged by a ratio of 1:2
  • interpolation algorithm can be used to fill in the pixels of the image, or the neighboring pixels can be copied directly as new pixels to fill in the pixels of the image, and then the restored original YUV420 Y channel image and Alpha can be obtained.
  • Channel image After the original YUV420 image is obtained, the original YUV420 image can be converted into an RGB image, and then the RGB image and the restored Alpha channel image can be combined to obtain an RGBA image, thereby completing the image decoding process.
  • the present application also provides an encoding device.
  • the encoding device includes a processor 71, a memory 72, a computer program stored in the memory 72, and the processor 71
  • the processor 71 The following steps of the claims are realized when the computer program is executed:
  • the processor when the processor is configured to fuse the Alpha channel image corresponding to the target image with the YUV image, it is specifically configured to:
  • the Alpha channel image corresponding to the target image is fused with the image of the designated channel corresponding to the YUV image, and the image of the designated channel includes at least one of a Y channel image, a U channel image, or a V channel image.
  • the processor when the processor is configured to fuse the Alpha channel image corresponding to the target image with the specified channel image corresponding to the YUV image, it is specifically configured to:
  • the compressed Alpha channel image is spliced with the compressed designated channel image to obtain the designated channel image corresponding to the new YUV image.
  • the processor when configured to respectively compress the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image, it is specifically configured to:
  • the heights of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image are compressed respectively.
  • the processor when configured to respectively compress the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image, it is specifically configured to:
  • the Alpha channel image is compressed at a first ratio, and the designated channel image is compressed at a second ratio, and the sum of the first ratio and the second ratio is 1.
  • the first ratio and the second ratio are both 1/2.
  • the processor when the processor is configured to fuse the Alpha channel image corresponding to the target image with the specified channel image corresponding to the YUV image, it is specifically configured to:
  • the designated pixels include:
  • the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
  • the YUV image is an image in YUV420 format, and the image of the designated channel is a Y-channel image.
  • the encoding device provided by the embodiments of the present application can convert the RGB image corresponding to the target image into a YUV image when encoding a target image with a transparent effect, and then merge the Alpha channel image corresponding to the target image with the YUV image, A new YUV image is obtained, and the new YUV image is encoded.
  • By fusing the Alpha channel image with the YUV image only one file needs to be encoded and the transmission bandwidth can be saved during the transmission process.
  • the present application also provides a decoding device.
  • the decoding device includes a processor 81, a memory 82, a computer program stored in the memory 82, and the processor 81 The following steps are implemented when the computer program is executed:
  • YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
  • the original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
  • the processor when the processor is configured to obtain the original YUV image and the Alpha channel image based on the YUV image restoration, it is specifically configured to:
  • the image of the specified channel corresponding to the original YUV image and the Alpha channel image are obtained, and the image of the specified channel includes the Y channel image, the U channel image, or the V channel image. At least one of.
  • the processor when the processor is configured to obtain the image of the specified channel corresponding to the original YUV image and the image of the Alpha channel based on the image restoration of the specified channel corresponding to the YUV image, it is specifically used for:
  • the split rule is determined based on the fusion mode of the original YUV image and the Alpha channel image;
  • the processor is configured to restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and based on the resolution of the YUV image and all pixels.
  • some pixels of the Alpha channel image are restored to the Alpha channel image, they are specifically used for:
  • the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
  • the YUV image is an image in YUV420 format, and the image of the designated channel is a Y-channel image.
  • the YUV image to be decoded is an image obtained after processing by a designated decoding operation, and the designated decoding operation includes a decoding operation based on the H264/H265 standard.
  • the decoding device provided by the embodiment of the present application only needs to decode one file, which has low requirements on the performance of the decoding end, and can avoid the freezing phenomenon of images and videos at the same time.
  • this application also provides a video transmission system, characterized in that the video transmission system includes an encoding device and a decoding device;
  • the encoding device is used to obtain a target image to be encoded, convert the RGB channel image corresponding to the target image into a YUV image, and fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image , Encoding the new YUV image to send the encoded image;
  • the decoding device is configured to, after receiving the encoded image, process the encoded image to obtain the new YUV image, and restore the YUV image and the Alpha channel based on the new YUV image Image, converting the YUV image into an RGB image, and obtaining the target image based on the RGB image and the Alpha channel image.
  • the video transmission system can convert the RGB image corresponding to the target image into a YUV image when encoding a target image with a transparent effect, and then fuse the Alpha channel image corresponding to the target image with the YUV image , A new YUV image is obtained, and the new YUV image is encoded.
  • the transmission bandwidth can be saved during transmission, and the decoding end only needs to decode one file, which requires lower performance on the decoding end, while avoiding images and videos The stuttering phenomenon.
  • an embodiment of this specification also provides a computer storage medium in which a program is stored, and when the program is executed by a processor, the encoding method or the decoding method in any of the foregoing embodiments is implemented.
  • the embodiments of this specification may adopt the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program codes.
  • Computer usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • CD-ROM compact disc
  • DVD digital versatile disc
  • Magnetic cassettes magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
  • the relevant part can refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, where the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments. Those of ordinary skill in the art can understand and implement without creative work.

Abstract

An encoding method, decoding method, apparatus and system. The encoding method comprises: acquiring a target image to be encoded, converting an RGB channel image corresponding to the target image into a YUV image, and fusing an alpha channel image corresponding to the target image with the YUV image so as to generate a new YUV image; and encoding the new YUV image. By fusing an alpha channel image with a YUV image, only one file thus requires being encoded and obtained; in addition, in a transmission process, transmission bandwidth can be reduced, only one file needs to be decoded at a decoding end, and decoding end performance requirements are relatively low, and at the same time, image and video lag can be avoided.

Description

编码方法、解码方法、装置及系统Coding method, decoding method, device and system 技术领域Technical field
本申请涉及编码技术领域,具体而言,涉及一种编码方法、解码方法、装置及系统。This application relates to the field of coding technology, and specifically to an encoding method, decoding method, device and system.
背景技术Background technique
越来越多的智能终端提供各种视频拍照和视频编辑功能。比如,用户可以使用自己的手机拍摄图片或视频,然后对图片或视频进行处理后分享给好友。为了使图片或视频更加生动有趣,用户可以在图片或视频中叠加一些动画素材,为了使动画素材与拍摄素材更好的融合,动画素材往往会使用透明或半透明的素材,与拍摄素材做叠加后再融合。由于包含透明或半透明素材的图片或视频除了包括红(Red,简称R)、绿(Green,简称G)、蓝(Blue,简称B)三个通道的图像外,还包括Alpha通道图像,因而,在进行这类图片或视频的编码、传输和解码时,Alpha通道图像需另外独立编码成一个文件,从而需传输和解码两个文件,整体文件占用内存较大,传输过程占用带宽资源较多,对终端设备性能要求也较高,对于一些性能比较差的终端设备不太适用,易造成卡顿现象。More and more smart terminals provide various video taking and video editing functions. For example, users can use their mobile phones to take pictures or videos, and then process the pictures or videos and share them with friends. In order to make pictures or videos more lively and interesting, users can superimpose some animation materials on the pictures or videos. In order to better integrate the animation materials with the shooting materials, the animation materials often use transparent or semi-transparent materials, which are superimposed with the shooting materials. Fusion later. Since pictures or videos containing transparent or semi-transparent materials include not only red (Red, R for short), Green (G), and Blue (B for short) three-channel images, they also include Alpha channel images, so When encoding, transmitting and decoding such pictures or videos, the Alpha channel image needs to be separately encoded into one file, so two files need to be transmitted and decoded. The overall file takes up a lot of memory and the transmission process takes up more bandwidth resources. , The performance requirements for terminal equipment are also high, and it is not suitable for some terminal equipment with relatively poor performance, and it is easy to cause a stuck phenomenon.
发明内容Summary of the invention
有鉴于此,本申请提供一种编码方法、解码方法、装置及系统。In view of this, the present application provides an encoding method, decoding method, device, and system.
根据本申请的第一方面,提供一种编码方法,所述方法包括:According to the first aspect of the present application, an encoding method is provided, the method including:
获取待编码的目标图像;Obtain the target image to be encoded;
将所述目标图像对应的RGB通道图像转化为YUV图像;Converting the RGB channel image corresponding to the target image into a YUV image;
将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;Fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
对所述新的YUV图像进行编码。Encoding the new YUV image.
根据本申请的第二方面,提供一种解码方法,所述方法包括:According to a second aspect of the present application, there is provided a decoding method, the method including:
获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;Acquiring a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;Obtaining the original YUV image and the Alpha channel image based on the YUV image restoration;
对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。The original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
根据本申请的第三方面,提供一种编码装置,所述编码装置包括处理器、存储器、存储在所述存储的计算机程序,所述处理器执行所述计算机程序时实现权利要求以下步骤:According to a third aspect of the present application, an encoding device is provided. The encoding device includes a processor, a memory, and a computer program stored in the storage, and the processor implements the following steps in the claims when the processor executes the computer program:
获取待编码的目标图像;Obtain the target image to be encoded;
将所述目标图像对应的RGB通道图像转化为YUV图像;Converting the RGB channel image corresponding to the target image into a YUV image;
将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;Fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
对所述新的YUV图像进行编码。Encoding the new YUV image.
根据本申请的第四方面,提供一种解码装置,所述解码装置包括处理器、存储器、存储在所述存储的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:According to a fourth aspect of the present application, a decoding device is provided, the decoding device includes a processor, a memory, and a computer program stored in the storage, and when the processor executes the computer program, the following steps are implemented:
获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;Acquiring a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;Obtaining the original YUV image and the Alpha channel image based on the YUV image restoration;
对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。The original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
根据本申请的第五方面,提供一种视频传输系统,所述视频传输系统系统包括编码装置和解码装置;According to a fifth aspect of the present application, there is provided a video transmission system, the video transmission system including an encoding device and a decoding device;
所述编码装置用于获取待编码的目标图像,将所述目标图像对应的RGB通道图像转化为YUV图像,将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像,对所述新的YUV图像进行编码,以发送编码后的图像;The encoding device is used to obtain a target image to be encoded, convert the RGB channel image corresponding to the target image into a YUV image, and fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image , Encoding the new YUV image to send the encoded image;
所述解码装置用于在接收到编码后的图像后,对所述编码后的图像进行处理得到所述新的YUV图像,基于所述新的YUV图像还原得到所述YUV图像和所述Alpha通道图像,将所述YUV图像转化为RGB图像,基于所述RGB图像和所述Alpha通道图像得到所述目标图像。The decoding device is configured to, after receiving the encoded image, process the encoded image to obtain the new YUV image, and restore the YUV image and the Alpha channel based on the new YUV image Image, converting the YUV image into an RGB image, and obtaining the target image based on the RGB image and the Alpha channel image.
应用本申请提供的方案,在对具有透明效果的目标图像进行编码时,可以将目标图像对应的RGB图像转为YUV图像,然后将目标图像对应的Alpha通道图像与该YUV图像进行融合,得到新的YUV图像,并且该新的YUV图像进行编码处理。通过将Alpha通道图像与YUV图像融合,从而只需编码得到一个文件,传输过程中可以节省传输带宽,并且解码端也只需解码一个文件,对解码端性能要求较低,同时可以避免图像和视频的卡顿现象。Using the solution provided by this application, when encoding a target image with a transparent effect, the RGB image corresponding to the target image can be converted to a YUV image, and then the Alpha channel image corresponding to the target image can be fused with the YUV image to obtain a new The YUV image, and the new YUV image is encoded. By fusing the Alpha channel image with the YUV image, only one file needs to be encoded, the transmission bandwidth can be saved during transmission, and the decoding end only needs to decode one file, which requires lower performance on the decoding end, while avoiding images and videos The stuttering phenomenon.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性 劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present application more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
图1是相关技术中对具有透明效果的图像进行编码的示意图。Fig. 1 is a schematic diagram of encoding an image with a transparent effect in the related art.
图2是本申请一个实施例的编码方法流程图。Fig. 2 is a flowchart of an encoding method according to an embodiment of the present application.
图3(a)是本申请一个实施例的YUV图像中Y通道图像与Alpha通道图像进行融合的示意图。Fig. 3(a) is a schematic diagram of the fusion of the Y channel image and the Alpha channel image in the YUV image according to an embodiment of the present application.
图3(b)是本申请一个实施例的YUV图像中Y通道图像与Alpha通道图像进行融合的示意图。Fig. 3(b) is a schematic diagram of the fusion of the Y channel image and the Alpha channel image in the YUV image according to an embodiment of the present application.
图4是本申请一个实施例的YUV图像中Y通道图像与Alpha通道图像进行融合的示意图。Fig. 4 is a schematic diagram of the fusion of Y channel images and Alpha channel images in a YUV image according to an embodiment of the present application.
图5是本申请一个实施例的解码方法示意图。Fig. 5 is a schematic diagram of a decoding method according to an embodiment of the present application.
图6(a)是本申请一个实施例的编码过程示意图。Fig. 6(a) is a schematic diagram of an encoding process of an embodiment of the present application.
图6(b)是本申请一个实施例的解码过程示意图。Figure 6(b) is a schematic diagram of the decoding process of an embodiment of the present application.
图7是本申请一个实施例的编码装置的逻辑结构示意图。Fig. 7 is a schematic diagram of the logical structure of an encoding device according to an embodiment of the present application.
图8是本申请一个实施例的解码装置的逻辑结构示意图。Fig. 8 is a schematic diagram of a logical structure of a decoding device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by a person of ordinary skill in the art without creative work shall fall within the protection scope of this application.
图片、视频的拍摄和剪辑越来越来普遍,用户拍摄图片或视频后,可以在图片或视频中叠加一些透明或半透明的素材,与拍摄素材做叠加后再融合,比如,可以在图像中加一些半透明的水印、logo等。由于包含透明或半透明素材的图片或视频除了包括红、绿、蓝(简称R、G、B)三个通道的图像外,还包括Alpha通道图像,因而,在进行这类图片或视频的编码、传输和解码时,为了符合相关的编解码标准,需编码成两个文件,如 图1所示,在编码端,需将待传输的图像A编码成两个文件,即RGB通道图像编码成一个文件(文件1),Alpha通道图像需另外独立编码成一个文件(文件2),然后将两文件传输给解码端,同样的,在解码端,也需解码两个文件,分别对文件1和文件2进行解码得到RGB通道图像和Alpha通道图像,从而得到图像A。由于整体文件较大,传输过程需占用较多的带宽资源,同时,对于视频或图片的解码端来说,由于需同时解码两个文件,对终端设备性能要求较高,因而,对于一些性能比较差的终端设备不太适用,易造成卡顿现象。然而,目前的图片、视频的拍摄、编辑、编解码等大多在手机端进行,相比于以往采用电脑端处理的方式,手机端的性能往往较差,因而,有必要提供一种对包含透明图像的图片或视频的编解码方案,以便对于性能较差的终端设备也同样适用。The shooting and editing of pictures and videos is becoming more and more common. After users take pictures or videos, they can superimpose some transparent or semi-transparent materials in the pictures or videos, and then merge them with the shooting materials, for example, in the image Add some translucent watermarks, logos, etc. Since pictures or videos containing transparent or semi-transparent materials include not only red, green, and blue (referred to as R, G, B) three-channel images, they also include Alpha channel images. Therefore, the encoding of such pictures or videos , During transmission and decoding, in order to comply with the relevant coding and decoding standards, it needs to be encoded into two files, as shown in Figure 1. At the encoding end, the image A to be transmitted needs to be encoded into two files, that is, the RGB channel image is encoded into One file (file 1), the Alpha channel image needs to be separately encoded into a file (file 2), and then the two files are transmitted to the decoding end. Similarly, on the decoding end, two files need to be decoded. File 2 is decoded to obtain an RGB channel image and an Alpha channel image, thereby obtaining image A. Due to the large size of the overall file, the transmission process requires more bandwidth resources. At the same time, for the video or picture decoding end, since two files need to be decoded at the same time, the performance requirements of the terminal device are relatively high. Therefore, for some performance comparisons Poor terminal equipment is not suitable, and it is easy to cause jams. However, the current shooting, editing, coding and decoding of pictures and videos are mostly performed on the mobile phone. Compared with the previous computer-side processing methods, the performance of the mobile phone is often inferior. Therefore, it is necessary to provide a way to contain transparent images. The encoding and decoding scheme of the picture or video in order to be equally applicable to terminal equipment with poor performance.
基于此,本申请提供一种编码方法,该编码方法可以将待编码图像对应的Alpha通道图像与待编码图像对应的RGB通道图像转化得到的YUV图像融合成一张新的YUV图像,然后再进行编码处理,既符合通用的编解码标准,而且只需编解码一个文件,可以节省传输资源,并且对终端性能要求较低。具体的,如图2所示,所述方法包括以下步骤:Based on this, this application provides an encoding method that can merge the YUV image obtained by converting the Alpha channel image corresponding to the image to be encoded and the RGB channel image corresponding to the image to be encoded into a new YUV image, and then encoding The processing not only conforms to the general coding and decoding standards, but also only needs to code and decode one file, which can save transmission resources and has lower requirements on terminal performance. Specifically, as shown in Figure 2, the method includes the following steps:
S202、获取待编码的目标图像;S202: Obtain a target image to be encoded;
S204、将所述目标图像对应的RGB通道图像转化为YUV图像;S204: Convert the RGB channel image corresponding to the target image into a YUV image;
S206、将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;S206. Fusion the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
S208、对所述新的YUV图像进行编码。S208: Encode the new YUV image.
本申请的编码方法可以用于对图像或视频进行编码处理的编码装置,该编码装置可以集成在手机、平板、电脑等终端设备上,也可以是一个独立的设备。The encoding method of the present application can be used for an encoding device that performs encoding processing on images or videos. The encoding device can be integrated on terminal devices such as mobile phones, tablets, and computers, or it can be an independent device.
待编码的目标图像可以是具有透明效果的图像,即包含R、G、B、Alpha四个通道的图像。目标图像可以是单独的图像,也可以是待编码视频中包含的一帧或者多帧图像。一般而言,采用H264/H265等编码标准对图像进 行编码时,需将图像转化为YUV格式的图像,然后再进行编码处理。因此,在获取目标图像后,可以将目标图像对应的RGB通道图像转化为YUV图像,其中,YUV图像可以是YUV444、YUV422或者YUV420格式中的任一种,具体可以根据实际编解码标准设置。然后可以将目标图像对应的Alpha通道图像与转化得到的YUV图像融合,生成新的YUV图像。其中,在将YUV图像和Alpha通道图像进行融合,生成新的YUV图像时,可以采用预先设置的融合规则对两种图像进行融合,其中融合规则可以自行设置,只要解码时可以根据融合规则还原得到原来的YUV图像和Alpha通道图像即可。The target image to be encoded can be an image with a transparency effect, that is, an image containing four channels of R, G, B, and Alpha. The target image can be a single image, or it can be a frame or multiple frames of images contained in the video to be encoded. Generally speaking, when encoding an image using coding standards such as H264/H265, it is necessary to convert the image into a YUV format image, and then perform the encoding process. Therefore, after acquiring the target image, the RGB channel image corresponding to the target image can be converted into a YUV image, where the YUV image can be any of the formats of YUV444, YUV422 or YUV420, which can be specifically set according to the actual codec standard. Then the Alpha channel image corresponding to the target image can be fused with the converted YUV image to generate a new YUV image. Among them, when the YUV image and the Alpha channel image are fused to generate a new YUV image, the two images can be fused using the preset fusion rules. The fusion rules can be set by themselves, as long as the decoding can be restored according to the fusion rules. The original YUV image and Alpha channel image can be used.
融合得到新的YUV图像后,可以采用通用的编码技术对新的YUV图像进行编码处理,比如采用H264/H265标准对生成的新的YUV图像进行编码。After the new YUV image is obtained by fusion, general coding technology can be used to encode the new YUV image, for example, the H264/H265 standard is used to encode the generated new YUV image.
通过这种编码方式,既可以使图像符合通用编解码标准,并且针对一帧目标图像,只需编码得到一个文件,可以减小文件的数据量,节省传输过程的带宽资源,并且解码端也只需解码一个文件,对解码端性能要求比较低,对于性能较差的解码端也同样适用。Through this encoding method, the image can not only meet the general encoding and decoding standards, and for one frame of target image, only one file needs to be encoded, which can reduce the data volume of the file and save the bandwidth resources of the transmission process. It is necessary to decode a file, which requires relatively low performance on the decoding side, and it is also applicable to the decoding side with poor performance.
由于YUV格式的图像包含Y通道图像、U通道图像和V通道图像,因而,在某些实施例中,在将目标图像对应的Alpha通道图像与转化得到的YUV图像进行融合时,可以将目标图像对应的Alpha通道图像与该YUV图像对应的指定通道的图像融合,其中,指定通道的图像可以是Y通道图像、U通道图像或V通道图像中的至少一种。比如,可以将Alpha通道图像与Y通道图像融合得到新的YUV图像的Y通道图像,也可以将Alpha通道图像与U通道图像或V通道图像融合得到新的YUV图像的U通道图像或V通道图像,亦可以将可以将Alpha通道图像与U通道图像和V通道图像融合得到新的YUV图像的U通道图像和V通道图像。Since the image in the YUV format includes a Y channel image, a U channel image, and a V channel image, in some embodiments, when the Alpha channel image corresponding to the target image is fused with the converted YUV image, the target image can be combined The corresponding Alpha channel image is fused with the image of the designated channel corresponding to the YUV image, where the image of the designated channel may be at least one of a Y channel image, a U channel image, or a V channel image. For example, the Alpha channel image and the Y channel image can be fused to obtain the Y channel image of a new YUV image, or the Alpha channel image can be fused with the U channel image or V channel image to obtain the U channel image or V channel image of the new YUV image. , You can also merge the Alpha channel image with the U channel image and the V channel image to obtain the U channel image and V channel image of the new YUV image.
在某些实施例中,在将目标图像对应的Alpha通道图像与YUV图像对应的指定通道的图像融合时,可以先分别将该Alpha通道图像和该YUV 图像对应的指定通道的图像进行压缩,然后将压缩后的Alpha通道图像与压缩后的指定通道的图像拼接,得到新的YUV图像对应的该指定通道的图像。In some embodiments, when the Alpha channel image corresponding to the target image is fused with the image of the specified channel corresponding to the YUV image, the Alpha channel image and the image of the specified channel corresponding to the YUV image may be compressed first, and then The compressed Alpha channel image and the compressed image of the specified channel are stitched together to obtain the image of the specified channel corresponding to the new YUV image.
其中,对Alpha通道图像和指定通道的图像进行压缩时,可以压缩图像的宽度,也可以压缩图像的高度。所以,在某些实施例中,可以分别压缩该Alpha通道图像的宽度以及该YUV图像对应的指定通道的图像的宽度,然后将压缩后的图像横向拼接,得到新的YUV图像的指定通道的图像;当然,也可以分别压缩该Alpha通道图像的高度以及该YUV图像对应的指定通道的图像的高度,然后将压缩后的图像纵向拼接,得到新的YUV图像的指定通道的图像。以该指定通道的图像为Y通道图像为例,如图3(a)所示,为对Y通道图像和Alpha通道图像进行横向压缩,然后拼接得到新的YUV图像的Y通道图像的示意图。如图3(b)所示,为对Y通道图像和Alpha通道图像进行纵向压缩,然后拼接得到新的YUV图像的Y通道图像的示意图。Among them, when the Alpha channel image and the image of the specified channel are compressed, the width of the image can be compressed, and the height of the image can also be compressed. Therefore, in some embodiments, the width of the Alpha channel image and the width of the image of the specified channel corresponding to the YUV image can be respectively compressed, and then the compressed images are stitched horizontally to obtain the image of the specified channel of the new YUV image. ; Of course, it is also possible to separately compress the height of the Alpha channel image and the height of the image of the specified channel corresponding to the YUV image, and then stitch the compressed images vertically to obtain the image of the specified channel of the new YUV image. Taking the image of the designated channel as the Y channel image as an example, as shown in Figure 3(a), it is a schematic diagram of horizontally compressing the Y channel image and the Alpha channel image, and then stitching the Y channel image of a new YUV image. As shown in Figure 3(b), it is a schematic diagram of longitudinally compressing the Y channel image and the Alpha channel image, and then stitching to obtain the Y channel image of the new YUV image.
其中,指定通道的图像与Alpha通道图像在进行压缩时,压缩比例可以相同,也可以不同。在某些实施例中,可以将Alpha通道图像按第一比例压缩,将指定通道的图像按第二比例压缩,为了最后拼接得到的图像的尺寸与原来指定通道的图像的尺寸一致,第一比例与第二比例的和为1。其中,第一比例和第二比例可以根据实际需求设置,通常,压缩比例越大,图像的失真会越明显,所以实际处理过程中,可以根据对该指定通道图像或Alpha通道图像的效果的需求灵活设置第一比例和第二比例,举个例子,对于某些场景,对Alpha通道图像的效果或清晰度要求较高,则Alpha通道图像的压缩比例可以适当小一些,指定通道的图像的压缩比例可以大一些,对于某些场景,对该指定通道的图像的效果或清晰度要求较高,则该指定通道的图像的压缩比例可以适当小一些。Among them, when the image of the specified channel and the image of the Alpha channel are compressed, the compression ratio may be the same or different. In some embodiments, the Alpha channel image can be compressed according to the first ratio, and the image of the specified channel can be compressed according to the second ratio. In order that the size of the finally stitched image is consistent with the size of the original image of the specified channel, the first ratio The sum to the second ratio is 1. Among them, the first ratio and the second ratio can be set according to actual needs. Generally, the larger the compression ratio, the more obvious the distortion of the image. Therefore, in the actual processing process, you can according to the requirements for the effect of the specified channel image or the alpha channel image Set the first ratio and the second ratio flexibly. For example, for some scenes, where the effect or definition of the Alpha channel image is higher, the compression ratio of the Alpha channel image can be appropriately smaller, and the compression of the image of the specified channel The ratio can be larger. For some scenes, where the effect or definition of the image of the specified channel is higher, the compression ratio of the image of the specified channel can be appropriately smaller.
在某实施例中,为了尽可能不影响Alpha通道图像和指定通道的图像压缩后的效果,可以将两种图像各压缩一半,所以,第一比例与第二比例 可以均设置成1/2。In an embodiment, in order not to affect the compression effect of the Alpha channel image and the specified channel image as much as possible, the two images can be compressed by half. Therefore, the first ratio and the second ratio can both be set to 1/2.
在某些实施例中,在将目标图像对应的Alpha通道图像与转化得到的YUV图像对应的指定通道的图像融合时,可以用Alpha通道图像中指定像素点的像素值替换该指定通道的图像中这些指定像素点对应位置的像素点的像素值,得到新的YUV图像对应的指定通道的图像。其中,指定像素点可以是预先定义的某些像素点,比如、某些行的像素点、某些列的像素点、某些指定编号的像素点等等。在某些实施例中,指定像素点可以是Alpha通道图像中指定行的像素点或者是Alpha通道图像中指定列的像素点。举个例子,可以用Alpha通道图像中奇数行的像素点的像素值替换该指定通道的图像中奇数行的像素点的像素值,得到新的YUV图像的指定通道的图像,当然,也可以用Alpha通道图像中奇数列的像素点的像素值替换该指定通道的图像中奇数列的像素点的像素值,得到新的YUV图像的指定通道的图像。当然,也可以用Alpha通道图像中奇数行中序号为偶数的像素点的像素值替换该指定通道的图像中奇数行序号为偶数的像素点的像素值,得到新的YUV图像的指定通道的图像,或者也可以采用其他的替换方式,本申请不作限制。以指定通道图像为Y通道图像为例,如图4所示,为采用Alpha通道图像奇数行像素点的像素值替换Y通道图像的奇数行的像素点的像素值,得到新的YUV图像的Y通道图像示意图。In some embodiments, when the Alpha channel image corresponding to the target image is fused with the image of the specified channel corresponding to the converted YUV image, the pixel value of the specified pixel in the Alpha channel image can be used to replace the image of the specified channel. The pixel values of the pixels at the corresponding positions of these designated pixels are obtained to obtain the image of the designated channel corresponding to the new YUV image. Among them, the designated pixels may be some predefined pixels, for example, some rows of pixels, some columns of pixels, some designated number of pixels, and so on. In some embodiments, the designated pixel may be a pixel of a designated row in the Alpha channel image or a pixel of a designated column in the Alpha channel image. For example, you can replace the pixel values of the odd-numbered rows of pixels in the image of the specified channel with the pixel values of the odd-numbered rows of the Alpha channel image to obtain the image of the specified channel of the new YUV image. Of course, you can also use The pixel value of the odd-numbered column of the pixel in the alpha channel image replaces the pixel value of the odd-numbered column of the image of the specified channel to obtain the image of the specified channel of the new YUV image. Of course, it is also possible to replace the pixel value of the even-numbered pixel in the odd-numbered row of the image of the specified channel with the pixel value of the even-numbered pixel in the odd-numbered row of the Alpha channel image to obtain the image of the specified channel of the new YUV image , Or other alternative methods can also be used, and this application is not limited. Taking the specified channel image as the Y channel image as an example, as shown in Figure 4, the pixel values of the odd rows of the Y channel image are replaced with the pixel values of the odd rows of the Alpha channel image to obtain the Y of the new YUV image. Schematic diagram of channel image.
由于在将Alpha通道图像和指定通道图像进行融合时,融合后的图像的尺寸需与该指定通道图像的尺寸一致,并且融合过程势必会牺牲图像的清晰度,在某些实施例中,为了方便Alpha通道图像和指定通道图像进行融合,尽量减小两种图像在融合过程中的清晰度的下降,指定通道可以选择与Alpha通道的像素点数量一致的通道,从而使指定通道的图像可以与Alpha通道图像的像素点数量一致,也就是图像大小一致。举个例子,对于YUV图像,其存在多种格式,比如YUV444、YUV422、YUV420,对于YUV444,一个Y分量分别对应一个U分量和一个V分量,也就是说Y通道图像、U通道图像和V通道图像的像素点数量相同,都与Alpha通道 图像的像素点数量一致,因而,在选择指定通道的图像与Alpha通道图像进行融合时,既可以选用Y通道的图像,也可以选用U通道或V通道的图像。而对于YUV420图像,每四个Y分量共用一对U分量和V分量,U通道和V通道图像的像素点数量要远少于Y通道图像的像素点数量,而Y通道图像像素点数量与Alpha通道图像的像素点数量一致,如果将Alpha通道图像与U通道或V通道图像融合,融合后的图像与U通道或V通道图像尺寸需一致,或者将Alpha通道图像与U通道和V通道图像融合,则融合后的图像与U通道和V通道图像共同构成的图像尺寸需一致,而Alpha通道图像的尺寸(或像素点的数量)与Y通道图像的尺寸(或像素点的数量)一致,即Alpha通道图像的尺寸(或像素点的数量)大于U通道图像和V通道图像中的任意一个或其组合这时,Alpha通道图像的分辨率会大大降低,影响编码后透明图像的显示效果,同样的,由于对U通道和/或V通道图像的色彩进行了比较的大的压缩,再与Alpha通道图像融合时,会进一步降低U通道和/或V通道图像的分辨率,也会影响编码后U通道和/或V通道图像的显示效果。When the Alpha channel image and the designated channel image are fused, the size of the fused image needs to be consistent with the size of the designated channel image, and the fusion process will inevitably sacrifice the sharpness of the image. In some embodiments, for convenience The Alpha channel image and the specified channel image are fused to minimize the sharpness of the two images during the fusion process. The specified channel can select the channel with the same number of pixels as the Alpha channel, so that the image of the specified channel can be compared with the Alpha channel. The number of pixels in the channel image is the same, that is, the image size is the same. For example, for YUV images, there are multiple formats, such as YUV444, YUV422, and YUV420. For YUV444, a Y component corresponds to a U component and a V component, that is, a Y channel image, a U channel image, and a V channel. The number of pixels in the image is the same, which is the same as the number of pixels in the Alpha channel image. Therefore, when the image of the specified channel is selected for fusion with the Alpha channel image, either the Y channel image, the U channel or the V channel can be selected. Image. For the YUV420 image, every four Y components share a pair of U and V components. The number of pixels in the U and V channel images is much less than the number of pixels in the Y channel image. The number of pixels in the Y channel image is the same as Alpha. The number of pixels in the channel image is the same. If the Alpha channel image is fused with the U channel or V channel image, the size of the fused image and the U channel or V channel image must be the same, or the Alpha channel image and the U channel and V channel image should be fused , The fused image and the image size jointly formed by the U channel and the V channel image must be the same, and the size of the Alpha channel image (or the number of pixels) and the size of the Y channel image (or the number of pixels) are the same, that is The size of the Alpha channel image (or the number of pixels) is larger than any one or a combination of the U channel image and the V channel image. At this time, the resolution of the Alpha channel image will be greatly reduced, which will affect the display effect of the transparent image after encoding. Yes, because the color of the U channel and/or V channel image is relatively large compressed, when it is merged with the Alpha channel image, the resolution of the U channel and/or V channel image will be further reduced, and it will also affect the encoding U channel and/or V channel image display effect.
所以,在某些实施例中,如果YUV图像为YUV420格式的图像,则指定通道的图像可以是Y通道图像,通过将Y通道图像与Alpha通道图像进行融合,得到新的YUV图像的Y通道图像,以上举例仅是示例性的,目的在于说明本申请的方案,并不对本申请构成限制。Therefore, in some embodiments, if the YUV image is an image in the YUV420 format, the image of the specified channel can be a Y-channel image. The Y-channel image of the new YUV image is obtained by fusing the Y-channel image with the Alpha channel image. The above examples are only exemplary, and the purpose is to illustrate the solution of the application, and does not limit the application.
在融合得到新的YUV图像后,可以采用通用的编码标准对该新的YUV图像进行编码处理,以得到编码处理后的图像。After the new YUV image is obtained by fusion, a general coding standard can be used to encode the new YUV image to obtain an encoded image.
本申请实施例在对具有透明效果的目标图像进行编码时,可以将目标图像对应的RGB图像转为YUV图像,然后将目标图像对应的Alpha通道图像与该YUV图像进行融合,得到新的YUV图像,并且该新的YUV图像进行编码处理。通过将Alpha通道图像与YUV图像融合,从而只需编码得到一个文件,传输过程中可以节省传输带宽,并且解码端也只需解码一个文件,对解码端性能要求较低,同时可以避免图像和视频的卡顿现象。In the embodiment of the application, when encoding a target image with a transparent effect, the RGB image corresponding to the target image can be converted into a YUV image, and then the Alpha channel image corresponding to the target image is fused with the YUV image to obtain a new YUV image , And the new YUV image is encoded. By fusing the Alpha channel image with the YUV image, only one file needs to be encoded, the transmission bandwidth can be saved during transmission, and the decoding end only needs to decode one file, which requires lower performance on the decoding end, while avoiding images and videos The stuttering phenomenon.
与上述编码方法相对应,本申请还提供了一种解码方法,如图5所示,所述解码方法包括以下步骤:Corresponding to the foregoing encoding method, this application also provides a decoding method. As shown in FIG. 5, the decoding method includes the following steps:
S502、获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;S502: Obtain a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by the conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
S504、基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;S504: Obtain the original YUV image and the Alpha channel image based on the YUV image restoration;
S506、对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。S506: Convert the original YUV image to obtain the RGB channel image, and obtain the target image based on the RGB channel image and the Alpha channel image.
同样的,本申请的解码方法可以适用于对图像或者视频进行解码处理的解码装置,该解码装置可以集成在手机、平板、电脑等终端设备上,也可以是独立的设备。Similarly, the decoding method of the present application can be applied to a decoding device that decodes images or videos. The decoding device can be integrated on terminal devices such as mobile phones, tablets, and computers, or can be an independent device.
解码过程中,可以先获取待解码的图像,该待解码图像为YUV图像,该YUV图像是通过目标图像对应的RGB通道图像转化得到的原始YUV图像和该目标图像对应的Alpha通道图像融合得到的,其中,将该原始YUV图像和该的Alpha通道图像进行融合,以得到的该YUV图像时,可以采用预先定义的融合方式和规则进行融合,其具体的融合过程可以参考上述编码方法中各实施例的描述,在此不再赘述。In the decoding process, the image to be decoded can be obtained first. The image to be decoded is a YUV image. The YUV image is obtained by fusing the original YUV image converted from the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image , Where the original YUV image and the Alpha channel image are fused to obtain the YUV image, which can be fused by using predefined fusion methods and rules. For the specific fusion process, please refer to the implementations in the above coding methods. The description of the example will not be repeated here.
获取得到待解码的YUV图像后,可以根据该YUV图像还原得到该目标图像对应的原始YUV图像以及Alpha通道图像,然后将原始YUV图像进行转化,得到目标图像的对应的RGB通道图像,根据该RGB通道图像和该Alpha通道图像,即可以得到解码后的目标图像。After obtaining the YUV image to be decoded, the original YUV image and Alpha channel image corresponding to the target image can be restored according to the YUV image, and then the original YUV image is converted to obtain the corresponding RGB channel image of the target image. The channel image and the Alpha channel image, that is, the decoded target image can be obtained.
由于在对目标图像进行编码时,将目标图像对应的RGB通道图像转化得到的原始YUV图像和目标图像对应的Alpha通道图像融合成新的YUV图像后,再进行编码处理,所以,解码时,也只需解码一个文件,并且解码过程中,可以通过对融合后的YUV图像进行还原,得到目标图像的原始YUV图像Alpha通道图像,并将原始YUV图像转化为RGB通道图像, 根据Alpha通道图像和RGB通道图像即可以解码出目标图像。对于具有透明效果的图像或视频,由于只需解码一个文件,对解码端设备性能要求比较低。Since when encoding the target image, the original YUV image obtained by converting the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image are fused into a new YUV image, and then the encoding process is performed. Therefore, when decoding, it is also Only one file needs to be decoded, and during the decoding process, the fused YUV image can be restored to obtain the original YUV image Alpha channel image of the target image, and the original YUV image is converted into RGB channel image, according to the Alpha channel image and RGB channel image The channel image can decode the target image. For images or videos with transparent effects, since only one file needs to be decoded, the performance requirements of the decoding end device are relatively low.
在某些实施例,接收编码装置编码的图像后,可以先对图像进行常规的解码操作,比如,根据通用的编解码标准对图像进行解码处理。因此,本申请中的待解码的YUV图像可以是经过指定解码操作处理后得到的图像,所述指定解码操作可以是基于H264/H265标准的解码操作,当然,也可以是基于其他类似的解码标准的操作。In some embodiments, after receiving the image encoded by the encoding device, the image may be first subjected to a conventional decoding operation, for example, the image is decoded according to a general encoding and decoding standard. Therefore, the YUV image to be decoded in this application may be an image obtained after a specified decoding operation is processed. The specified decoding operation may be a decoding operation based on the H264/H265 standard, of course, it may also be based on other similar decoding standards. Operation.
在某些实施例中,由于编码过程中,在将目标图像对应的Alpha通道图像与原始YUV图像进行融合时,可以将目标图像对应的Alpha通道图像与该YUV图像对应的指定通道的图像融合,其中,指定通道的图像可以是Y通道图像、U通道图像或V通道图像中的至少一种。因而,在根据融合得到的YUV图像还原得到该原始YUV图像和Alpha通道图像时,可以根据该融合后的YUV图像对应的指定通道的图像还原得到原始YUV图像对应的该指定通道的图像和所述Alpha通道图像,其中,指定通道的图像也可以是Y通道图像、U通道图像或V通道图像中的至少一种,具体可以根据编码方式确定。比如,如果编码时,指定通道图像为Y通道图像,则采用融合后的YUV的Y通道图像还原得到原始YUV图像的Y通道图像和Alpha通道图像。In some embodiments, because during the encoding process, when the Alpha channel image corresponding to the target image is fused with the original YUV image, the Alpha channel image corresponding to the target image can be fused with the specified channel image corresponding to the YUV image. The image of the designated channel may be at least one of a Y channel image, a U channel image, or a V channel image. Therefore, when the original YUV image and the Alpha channel image are restored from the fused YUV image, the image of the specified channel corresponding to the original YUV image and the image of the specified channel can be restored according to the image of the specified channel corresponding to the fused YUV image. Alpha channel image, where the image of the designated channel may also be at least one of Y channel image, U channel image, or V channel image, which can be specifically determined according to the encoding mode. For example, if the specified channel image is a Y channel image during encoding, the Y channel image of the merged YUV is restored to obtain the Y channel image and the Alpha channel image of the original YUV image.
由于在将Alpha通道图像和指定通道图像进行融合时,融合后的图像的尺寸需与该指定通道图像的尺寸一致,并且融合过程势必会牺牲图像的清晰度,在某些实施例中,为了方便Alpha通道图像和指定通道图像进行融合,尽量减小两种图像在融合过程中的清晰度的下降,指定通道的图像可以选择与Alpha通道图像的像素点数量一致的图像。When the Alpha channel image and the designated channel image are fused, the size of the fused image needs to be consistent with the size of the designated channel image, and the fusion process will inevitably sacrifice the sharpness of the image. In some embodiments, for convenience The Alpha channel image and the designated channel image are fused to minimize the decrease in the sharpness of the two images during the fusion process. The designated channel image can be selected to have the same number of pixels as the Alpha channel image.
在某些实施例中,如果YUV图像为YUV420格式的图像,则指定通道的图像可以是Y通道图像,通过将Y通道图像与Alpha通道图像进行融合,得到新的YUV图像的Y通道图像。In some embodiments, if the YUV image is an image in the YUV420 format, the image of the designated channel may be a Y channel image, and the Y channel image of the new YUV image is obtained by fusing the Y channel image and the Alpha channel image.
在某些实施例中,在根据融合后的YUV图像对应的指定通道的图像还原得到原始YUV图像对应的指定通道的图像和Alpha通道图像时,可以根据预设的拆分规则对该YUV图像对应的指定通道的图像的像素点进行拆分,得到原始YUV图像对应的指定通道的图像的部分像素点以及Alpha通道图像的部分像素点,然后根据该YUV图像的分辨率以及该指定通道的图像的部分像素点还原该原始YUV图像对应的指定通道的图像,根据该YUV图像的分辨率以及该Alpha通道图像的部分像素点还原该Alpha通道图像。其中,拆分规则可以根据原始YUV图像和Alpha通道图像的融合方式确定。举个例子,在将原始YUV图像和Alpha通道图像融合成YUV图像时,是采用Alpha通道图像的奇数行像素点替换原始YUV图像的Y通道图像的奇数行像素点,则在拆分时,可以将融合后的YUV图像的奇数行像素点和偶数行像素点拆分,奇数行像素点即为Alpha通道图像的一部分像素点,偶数行的像素点即为原始YUV图像的Y通道图像的部分像素点。当然,如果在将原始YUV图像和Alpha通道图像融合成YUV图像时,是将原始YUV图像的Y通道图像与Alpha通道图像分别在高度上压缩一半,然后再纵向拼接,得到YUV图像,则解码时,可以将YUV图像的像素点在纵向分成2部分,一部分为原始YUV图像的Y通道图像的部分像素点,一部分为Alpha通道图像的部分像素点。当然,如果编码过程是采用其他的融合方式,可以根据融合方式调整拆分规则,本申请不作限制。In some embodiments, when the image of the specified channel corresponding to the original YUV image and the image of the Alpha channel are obtained by restoring the image of the specified channel corresponding to the fused YUV image, the YUV image may be corresponding to the original YUV image according to the preset split rule The pixels of the image of the specified channel are split to obtain some pixels of the image of the specified channel corresponding to the original YUV image and some pixels of the image of the Alpha channel, and then according to the resolution of the YUV image and the image of the specified channel Some pixels restore the image of the specified channel corresponding to the original YUV image, and restore the Alpha channel image according to the resolution of the YUV image and some pixels of the Alpha channel image. Among them, the split rule can be determined according to the fusion method of the original YUV image and the Alpha channel image. For example, when the original YUV image and the Alpha channel image are fused into a YUV image, the odd rows of pixels of the Alpha channel image are used to replace the odd rows of pixels of the Y channel image of the original YUV image. When splitting, you can Split the odd and even rows of pixels of the fused YUV image. The odd rows of pixels are part of the Alpha channel image, and the even rows of pixels are part of the Y channel image of the original YUV image. point. Of course, if the original YUV image and the Alpha channel image are fused into a YUV image, the Y channel image and the Alpha channel image of the original YUV image are compressed by half in height respectively, and then stitched vertically to obtain the YUV image, then when decoding , The pixels of the YUV image can be divided into 2 parts in the longitudinal direction, one part is part of the pixels of the Y channel image of the original YUV image, and the other part is part of the pixels of the Alpha channel image. Of course, if other fusion methods are used in the encoding process, the splitting rules can be adjusted according to the fusion method, and this application does not limit it.
在某些实施例中,根据YUV拆分得到的部分像素点对原始YUV图像的指定通道的图像和Alpha通道图像进行还原时,可以采用插值算法进行还原,也可以采取直接复制邻近像素点的像素值作为新像素点的像素,对图像进行还原的方式。比如,可以根据融合得到的YUV图像的分辨率确定原始YUV图像的指定通道的图像和Alpha通道图像的尺寸,即像素点的数量,然后对原始YUV图像的指定通道的图像的部分像素点进行插值处理,还原得到该原始YUV图像的指定通道的图像,并且对Alpha通道 图像的部分像素点进行插值处理,还原得到该Alpha通道图像。当然,也可以通过复制指定通道的图像的部分像素点的像素值作为邻近像素点的像素值,还原得到原始YUV图像的指定通道的图像,通过复制Alpha通道图像的部分像素点的像素值作为邻近像素点的像素值,还原得到Alpha通道图像。当然,本申请不局限于上述列举的方式,现有技术中根据图像的一部分像素点对图像进行还原的方式对于本申请都适用。In some embodiments, when restoring the image of the specified channel of the original YUV image and the Alpha channel image based on the partial pixels obtained by the YUV splitting, interpolation algorithm can be used to restore, or the pixels of adjacent pixels can be directly copied. The value is used as the pixel of the new pixel to restore the image. For example, the size of the specified channel image and the alpha channel image of the original YUV image can be determined according to the resolution of the fused YUV image, that is, the number of pixels, and then some pixels of the image of the specified channel of the original YUV image can be interpolated Processing, restore the image of the designated channel of the original YUV image, and perform interpolation processing on some pixels of the Alpha channel image to restore the Alpha channel image. Of course, you can also copy the pixel values of some pixels of the image of the specified channel as the pixel values of adjacent pixels to restore the image of the specified channel of the original YUV image, and copy the pixel values of some pixels of the Alpha channel image as the adjacent pixels. The pixel value of the pixel is restored to obtain the Alpha channel image. Of course, this application is not limited to the above-listed methods, and the methods of restoring an image according to a part of the pixels of the image in the prior art are all applicable to this application.
在还原得到原始YUV图像的指定通道图像和Alpha通道图像后,可以得到原始YUV图像,然后将原始YUV图像转化为RGB通道图像,根据RGB通道图像和Alpha通道图像,即可以解码得到目标图像。After restoring the specified channel image and Alpha channel image of the original YUV image, the original YUV image can be obtained, and then the original YUV image is converted into an RGB channel image. According to the RGB channel image and the Alpha channel image, the target image can be decoded.
本申请实施例在对具有透明效果的目标图像进行解码时,解码端只需解码一个文件,对解码端性能要求较低,同时可以避免图像和视频的卡顿现象。In the embodiment of the present application, when decoding a target image with a transparent effect, the decoding end only needs to decode one file, which has lower performance requirements on the decoding end, and can avoid image and video jams.
为了进一步解释本申请的编解码方法,以下结合一个具体的实施例加以解释。In order to further explain the encoding and decoding method of the present application, the following will explain it in conjunction with a specific embodiment.
通常用户用手机、平板等设备拍摄一些小视频后,可以对视频进行编辑,比如加上一些透明的动画素材,以增加视频的趣味性,然后可以将处理后的视频发送给自己的朋友等。对于具有透明效果的图像和视频,在编码、传输和解码时,Alpha通道图像需另外独立编码成一个文件,因而在传输和解码时,需传输和解码两个文件,整体文件较大,传输过程占用带宽资源较多,对终端设备性能要求也较高,对于一些性能比较差的终端设备不太适用,易造成卡顿现象。Generally, users can edit the video after shooting some small videos with mobile phones, tablets and other devices, such as adding some transparent animation materials to increase the interest of the video, and then send the processed video to their friends. For images and videos with transparent effects, when encoding, transmitting, and decoding, the Alpha channel image needs to be separately encoded into one file. Therefore, when transmitting and decoding, two files need to be transmitted and decoded. The overall file size is large and the transmission process It occupies a lot of bandwidth resources and has high requirements for terminal equipment performance. It is not suitable for some terminal equipment with relatively poor performance, and it is easy to cause a stuck phenomenon.
为了避免上述问题,本实施例中提供一种对具有透明效果的图像和视频的编码方法,由于大多数硬件平台都支持解码H264YUV420格式的图像或视频文件,以下以该格式的文件为例加以说明,具体编码和解码过程如下:In order to avoid the above-mentioned problems, this embodiment provides a method for encoding images and videos with transparency effects. Since most hardware platforms support decoding of images or video files in H264YUV420 format, the following uses this format as an example to illustrate , The specific encoding and decoding process is as follows:
1、编码过程1. The coding process
具体的编码过程可以参考图6(a),视频中的各帧图像为RGBA图像, RGBA图像即既包含RGB通道图像,又包含Alpha通道图像。由于H264编码需将图像转为YUV格式的图像,所以,可以先将RGB通道图像转化为YUV420格式的图像,以下称为原始YUV420图像,YUV420格式的图像即每4个Y分量共用一对U分量和V分量,YUV420图像包含Y通道图像、U通道图像和V通道图像,Y通道图像的尺寸与原图像尺寸一致。可以将Y通道图像的高度或宽度按2:1的比例压缩(图中以高度压缩为例),比如一个宽高为400x400的图像,在高度上进行2:1缩放后成为一个400x200的图像,同时将Alpha通道图像的高度或宽度按2:1的比例压缩(图中以高度压缩为例),当然也可以按其他比例进行压缩,比如对编码后的图像的亮度要求较高,则Y通道图像的压缩比例可以小一些,对图像透明度要求高一些,则可以将Alpha通道图像的压缩比例设置小一些。然后将压缩后的Y通道图像和Alpha通道图像拼接在一起,形成一张拼接后的Y通道图像,拼接后的Y通道图像与原来的UV通道图像即构成了新的YUV420图像,以下称为融合YUV420图像,然后可以将融合YUV420图像发送至编码器进行H264编码处理。For the specific encoding process, refer to Figure 6(a). Each frame image in the video is an RGBA image. The RGBA image contains both RGB channel images and Alpha channel images. Since H264 encoding needs to convert the image to the YUV format image, you can first convert the RGB channel image to the YUV420 format image. Hereinafter, it is called the original YUV420 image. The YUV420 format image means that every 4 Y components share a pair of U components. And V component, YUV420 image contains Y channel image, U channel image and V channel image, the size of Y channel image is the same as the original image size. The height or width of the Y channel image can be compressed at a ratio of 2:1 (in the figure, height compression is taken as an example). For example, an image with a width and height of 400x400 can be scaled 2:1 in height to become a 400x200 image. At the same time, the height or width of the Alpha channel image is compressed at a ratio of 2:1 (in the figure, the height compression is taken as an example). Of course, it can also be compressed at other ratios. For example, if the brightness of the encoded image is higher, then the Y channel The compression ratio of the image can be smaller, and the transparency of the image is required to be higher, then the compression ratio of the Alpha channel image can be set smaller. Then the compressed Y channel image and Alpha channel image are spliced together to form a spliced Y channel image. The spliced Y channel image and the original UV channel image form a new YUV420 image, which is called fusion hereinafter YUV420 image, and then the fused YUV420 image can be sent to the encoder for H264 encoding processing.
2、解码过程2. Decoding process
具体的解码过程可以参考图6(b),解码端在接收到按照上述编码过程编码得到的待解码图像后,可以先根据H264解码标准对待解码图像进行常规的解码处理,即可以得到融合YUV420图像。然后按照预设的拆分规则对融合YUV420图像的Y通道图像的像素点进行拆分,其中具体的拆分规则可以根据编码过程中Y通道图像与Alpha通道图像的融合方式来确定。由于编码过程中,Y通道图像和Alpha通道图像是高度压缩后纵向拼接,因此,可以将融合YUV420图像的Y通道图像的像素点拆分成两部分,一部分为原始YUV图像的Y通道图像的像素点,一部分为Alpha通道图像的像素点。然后可以根据融合YUV420图像的分辨率确定原始YUV图像和Alpha通道图像的尺寸,并根据拆分出来的部分像素点对原始YUV图像和Alpha通道图像进行还原,比如将其按1:2的比例放大,具体还原 过程中,可以采用插值算法对图像的像素点进行填补,或者直接复制邻近像素点作为新的像素点对图像的像素点进行填补,然后得到还原后的原始YUV420的Y通道图像以及Alpha通道图像。得到原始YUV420图像后,可以将原始YUV420图像转化为RGB图像,然后将RGB图像和还原得到的Alpha通道图像结合,即可得到RGBA图像,从而完成图像的解码过程。For the specific decoding process, please refer to Figure 6(b). After the decoder receives the image to be decoded encoded according to the above encoding process, it can first perform conventional decoding processing on the image to be decoded according to the H264 decoding standard to obtain the fused YUV420 image. . Then, the pixels of the Y-channel image of the fused YUV420 image are split according to the preset splitting rules, where the specific splitting rules can be determined according to the fusion method of the Y-channel image and the Alpha channel image in the encoding process. In the encoding process, the Y channel image and the Alpha channel image are highly compressed and vertically stitched. Therefore, the pixels of the Y channel image of the fused YUV420 image can be split into two parts, one part is the pixel of the Y channel image of the original YUV image Point, part of which is the pixel point of the Alpha channel image. Then the size of the original YUV image and the Alpha channel image can be determined according to the resolution of the fused YUV420 image, and the original YUV image and the Alpha channel image can be restored according to the split pixels, for example, it can be enlarged by a ratio of 1:2 In the specific restoration process, interpolation algorithm can be used to fill in the pixels of the image, or the neighboring pixels can be copied directly as new pixels to fill in the pixels of the image, and then the restored original YUV420 Y channel image and Alpha can be obtained. Channel image. After the original YUV420 image is obtained, the original YUV420 image can be converted into an RGB image, and then the RGB image and the restored Alpha channel image can be combined to obtain an RGBA image, thereby completing the image decoding process.
通过这种方式,传输过程中只需传输一个文件,可以节省带宽,解码端也只需解码一个文件,对于性能较差的终端设备也适用,可以较少视频卡顿现象。In this way, only one file needs to be transmitted during the transmission process, which can save bandwidth, and the decoder only needs to decode one file, which is also suitable for terminal devices with poor performance, which can reduce video jams.
与所述编码方法相对应,本申请还提供一种编码装置,如图7所示,所述编码装置包括处理器71、存储器72、存储在所述存储器72的计算机程序,所述处理器71执行所述计算机程序时实现权利要求以下步骤:Corresponding to the encoding method, the present application also provides an encoding device. As shown in FIG. 7, the encoding device includes a processor 71, a memory 72, a computer program stored in the memory 72, and the processor 71 The following steps of the claims are realized when the computer program is executed:
获取待编码的目标图像;Obtain the target image to be encoded;
将所述目标图像对应的RGB通道图像转化为YUV图像;Converting the RGB channel image corresponding to the target image into a YUV image;
将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;Fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
对所述新的YUV图像进行编码。Encoding the new YUV image.
在某些实施例中,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像融合时,具体用于:In some embodiments, when the processor is configured to fuse the Alpha channel image corresponding to the target image with the YUV image, it is specifically configured to:
将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合,所述指定通道的图像包括Y通道图像、U通道图像或V通道图像中的至少一种。The Alpha channel image corresponding to the target image is fused with the image of the designated channel corresponding to the YUV image, and the image of the designated channel includes at least one of a Y channel image, a U channel image, or a V channel image.
在某些实施例中,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合时,具体用于:In some embodiments, when the processor is configured to fuse the Alpha channel image corresponding to the target image with the specified channel image corresponding to the YUV image, it is specifically configured to:
分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩;Respectively compressing the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image;
将压缩后的Alpha通道图像与压缩后的指定通道的图像拼接,得到所述新的YUV图像对应的所述指定通道的图像。The compressed Alpha channel image is spliced with the compressed designated channel image to obtain the designated channel image corresponding to the new YUV image.
在某些实施例中,所述处理器用于分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩时,具体用于:In some embodiments, when the processor is configured to respectively compress the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image, it is specifically configured to:
分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的宽度;或Respectively compress the width of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image; or
分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的高度。The heights of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image are compressed respectively.
在某些实施例中,所述处理器用于分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩时,具体用于:In some embodiments, when the processor is configured to respectively compress the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image, it is specifically configured to:
将所述Alpha通道图像按第一比例压缩,以及将所述指定通道的图像按第二比例压缩,所述第一比例与所述第二比例的和为1。The Alpha channel image is compressed at a first ratio, and the designated channel image is compressed at a second ratio, and the sum of the first ratio and the second ratio is 1.
在某些实施例中,所述第一比例与所述第二比例均为1/2。In some embodiments, the first ratio and the second ratio are both 1/2.
在某些实施例中,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合时,具体用于:In some embodiments, when the processor is configured to fuse the Alpha channel image corresponding to the target image with the specified channel image corresponding to the YUV image, it is specifically configured to:
用所述Alpha通道图像中指定像素点的像素值替换所述指定通道的图像中所述指定像素点对应位置的像素点的像素值,得到所述新的YUV图像对应的所述指定通道的图像。Replace the pixel value of the pixel at the corresponding position of the specified pixel in the image of the specified channel with the pixel value of the specified pixel in the Alpha channel image to obtain the image of the specified channel corresponding to the new YUV image .
在某些实施例中,所述指定像素点包括:In some embodiments, the designated pixels include:
所述Alpha通道图像中指定行的像素点;或The pixels of the specified row in the Alpha channel image; or
所述Alpha通道图像中指定列的像素点。The pixel points of the designated column in the Alpha channel image.
在某些实施例中,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。In some embodiments, the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
在某些实施例中,所述YUV图像为YUV420格式的图像,所述指定通道的图像为Y通道图像。In some embodiments, the YUV image is an image in YUV420 format, and the image of the designated channel is a Y-channel image.
其中,所述编码装置对图像和视频的具体编码细节可参考上述编码方法中各实施例的描述,本申请不作限制。For the specific encoding details of the image and video by the encoding device, reference may be made to the description of each embodiment in the foregoing encoding method, which is not limited in this application.
本申请实施例提供的编码装置,在对具有透明效果的目标图像进行编码时,可以将目标图像对应的RGB图像转为YUV图像,然后将目标图像对应的Alpha通道图像与该YUV图像进行融合,得到新的YUV图像,并且该新的YUV图像进行编码处理。通过将Alpha通道图像与YUV图像融合,从而只需编码得到一个文件,传输过程中可以节省传输带宽。The encoding device provided by the embodiments of the present application can convert the RGB image corresponding to the target image into a YUV image when encoding a target image with a transparent effect, and then merge the Alpha channel image corresponding to the target image with the YUV image, A new YUV image is obtained, and the new YUV image is encoded. By fusing the Alpha channel image with the YUV image, only one file needs to be encoded and the transmission bandwidth can be saved during the transmission process.
与所述解码方法相对应,本申请还提供一种解码装置,如图8所示,所述解码装置包括处理器81、存储器82、存储在所述存储器82的计算机程序,所述处理器81执行所述计算机程序时实现以下步骤:Corresponding to the decoding method, the present application also provides a decoding device. As shown in FIG. 8, the decoding device includes a processor 81, a memory 82, a computer program stored in the memory 82, and the processor 81 The following steps are implemented when the computer program is executed:
获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;Acquiring a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;Obtaining the original YUV image and the Alpha channel image based on the YUV image restoration;
对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。The original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
在某些实施例中,所述处理器用于基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像时,具体用于:In some embodiments, when the processor is configured to obtain the original YUV image and the Alpha channel image based on the YUV image restoration, it is specifically configured to:
基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像,所述指定通道的图像包括Y通道图像、U通道图像或V通道图像中的至少一种。Based on the image restoration of the specified channel corresponding to the YUV image, the image of the specified channel corresponding to the original YUV image and the Alpha channel image are obtained, and the image of the specified channel includes the Y channel image, the U channel image, or the V channel image. At least one of.
在某些实施例中,所述处理器用于基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像时,具体用于:In some embodiments, when the processor is configured to obtain the image of the specified channel corresponding to the original YUV image and the image of the Alpha channel based on the image restoration of the specified channel corresponding to the YUV image, it is specifically used for:
基于预设拆分规则对所述YUV图像对应的指定通道的图像的像素点进行拆分,得到所述原始YUV图像对应的指定通道的图像的部分像素点以及所述Alpha通道图像的部分像素点,所述拆分规则基于所述原始YUV图像和所述Alpha通道图像的融合方式确定;Split the pixels of the designated channel image corresponding to the YUV image based on a preset splitting rule to obtain some pixels of the designated channel image corresponding to the original YUV image and some pixels of the Alpha channel image , The split rule is determined based on the fusion mode of the original YUV image and the Alpha channel image;
基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像。Restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and restore the Alpha based on the resolution of the YUV image and some pixels of the image of the Alpha channel Channel image.
在某些实施例中,所述处理器用于基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像时,具体用于:In some embodiments, the processor is configured to restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and based on the resolution of the YUV image and all pixels. When some pixels of the Alpha channel image are restored to the Alpha channel image, they are specifically used for:
基于所述YUV图像的分辨率,对所述指定通道的图像的部分像素点进行插值处理,还原得到所述指定通道的图像,对所述Alpha通道图像的部分像素点进行插值处理,还原得到所述Alpha通道图像;或Based on the resolution of the YUV image, perform interpolation processing on some pixels of the image of the specified channel to restore the image of the specified channel, perform interpolation processing on some of the pixels of the Alpha channel image, and restore the obtained The Alpha channel image; or
基于所述YUV图像的分辨率,通过复制所述指定通道的图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述指定通道的图像,通过复制所述Alpha通道图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述Alpha通道图像。Based on the resolution of the YUV image, copy the pixel values of some pixels of the image of the specified channel as the pixel values of adjacent pixels, restore the image of the specified channel, and copy part of the image of the Alpha channel The pixel value of the pixel is used as the pixel value of the neighboring pixel, and the Alpha channel image is restored.
在某些实施例中,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。In some embodiments, the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
在某些实施例中,所述YUV图像为YUV420格式的图像,所述指定通道的图像为Y通道图像。In some embodiments, the YUV image is an image in YUV420 format, and the image of the designated channel is a Y-channel image.
在某些实施例中,所述待解码的YUV图像为经过指定解码操作处理后得到的图像,所述指定解码操作包括基于H264/H265标准的解码操作。In some embodiments, the YUV image to be decoded is an image obtained after processing by a designated decoding operation, and the designated decoding operation includes a decoding operation based on the H264/H265 standard.
其中,所述解码装置对图像和视频的具体解码细节可参考上述解码方法中各实施例的描述,本申请不作限制。For the specific decoding details of the image and video by the decoding device, reference may be made to the description of each embodiment in the foregoing decoding method, which is not limited in this application.
本申请实施例所提供的解码装置,只需解码一个文件,对解码端性能要求较低,同时可以避免图像和视频的卡顿现象。The decoding device provided by the embodiment of the present application only needs to decode one file, which has low requirements on the performance of the decoding end, and can avoid the freezing phenomenon of images and videos at the same time.
进一步的,本申请还提供一种视频传输系统,其特征在于,所述视频传输系统系统包括编码装置和解码装置;Furthermore, this application also provides a video transmission system, characterized in that the video transmission system includes an encoding device and a decoding device;
所述编码装置用于获取待编码的目标图像,将所述目标图像对应的 RGB通道图像转化为YUV图像,将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像,对所述新的YUV图像进行编码,以发送编码后的图像;The encoding device is used to obtain a target image to be encoded, convert the RGB channel image corresponding to the target image into a YUV image, and fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image , Encoding the new YUV image to send the encoded image;
所述解码装置用于在接收到编码后的图像后,对所述编码后的图像进行处理得到所述新的YUV图像,基于所述新的YUV图像还原得到所述YUV图像和所述Alpha通道图像,将所述YUV图像转化为RGB图像,基于所述RGB图像和所述Alpha通道图像得到所述目标图像。The decoding device is configured to, after receiving the encoded image, process the encoded image to obtain the new YUV image, and restore the YUV image and the Alpha channel based on the new YUV image Image, converting the YUV image into an RGB image, and obtaining the target image based on the RGB image and the Alpha channel image.
本申请实施例提供的视频传输系统,在对具有透明效果的目标图像进行编码时,可以将目标图像对应的RGB图像转为YUV图像,然后将目标图像对应的Alpha通道图像与该YUV图像进行融合,得到新的YUV图像,并且该新的YUV图像进行编码处理。通过将Alpha通道图像与YUV图像融合,从而只需编码得到一个文件,传输过程中可以节省传输带宽,并且解码端也只需解码一个文件,对解码端性能要求较低,同时可以避免图像和视频的卡顿现象。相应地,本说明书实施例还提供一种计算机存储介质,所述存储介质中存储有程序,所述程序被处理器执行时实现上述任一实施例中的编码方法或解码方法。The video transmission system provided by the embodiments of this application can convert the RGB image corresponding to the target image into a YUV image when encoding a target image with a transparent effect, and then fuse the Alpha channel image corresponding to the target image with the YUV image , A new YUV image is obtained, and the new YUV image is encoded. By fusing the Alpha channel image with the YUV image, only one file needs to be encoded, the transmission bandwidth can be saved during transmission, and the decoding end only needs to decode one file, which requires lower performance on the decoding end, while avoiding images and videos The stuttering phenomenon. Correspondingly, an embodiment of this specification also provides a computer storage medium in which a program is stored, and when the program is executed by a processor, the encoding method or the decoding method in any of the foregoing embodiments is implemented.
本说明书实施例可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。The embodiments of this specification may adopt the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program codes. Computer usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, the relevant part can refer to the part of the description of the method embodiment. The device embodiments described above are merely illustrative, where the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments. Those of ordinary skill in the art can understand and implement without creative work.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply one of these entities or operations. There is any such actual relationship or order between. The terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements that are not explicitly listed. Elements, or also include elements inherent to such processes, methods, articles, or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.
以上对本发明实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The methods and devices provided by the embodiments of the present invention are described in detail above. Specific examples are used in this article to illustrate the principles and implementations of the present invention. The descriptions of the above embodiments are only used to help understand the methods and methods of the present invention. Core idea; At the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation of the present invention .

Claims (35)

  1. 一种编码方法,其特征在于,所述方法包括:An encoding method, characterized in that the method includes:
    获取待编码的目标图像;Obtain the target image to be encoded;
    将所述目标图像对应的RGB通道图像转化为YUV图像;Converting the RGB channel image corresponding to the target image into a YUV image;
    将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;Fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
    对所述新的YUV图像进行编码。Encoding the new YUV image.
  2. 根据权利要求1所述的编码方法,其特征在于,将所述目标图像对应的Alpha通道图像与所述YUV图像融合,包括:The encoding method according to claim 1, wherein fusing the Alpha channel image corresponding to the target image with the YUV image comprises:
    将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合,所述指定通道的图像包括Y通道图像、U通道图像或V通道图像中的至少一种。The Alpha channel image corresponding to the target image is fused with the image of the designated channel corresponding to the YUV image, and the image of the designated channel includes at least one of a Y channel image, a U channel image, or a V channel image.
  3. 根据权利要求2所述的编码方法,其特征在于,将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合,包括:The encoding method according to claim 2, wherein the fusion of the Alpha channel image corresponding to the target image with the image of the designated channel corresponding to the YUV image comprises:
    分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩;Respectively compressing the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image;
    将压缩后的Alpha通道图像与压缩后的指定通道的图像拼接,得到所述新的YUV图像对应的所述指定通道的图像。The compressed Alpha channel image is spliced with the compressed designated channel image to obtain the designated channel image corresponding to the new YUV image.
  4. 根据权利要求3所述的编码方法,其特征在于,分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩,包括:The encoding method according to claim 3, wherein compressing the Alpha channel image corresponding to the target image and the image of the designated channel corresponding to the YUV image respectively comprises:
    分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的宽度;或Respectively compress the width of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image; or
    分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的高度。The heights of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image are compressed respectively.
  5. 根据权利要求3或4任一项所述的编码方法,其特征在于,分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道 的图像进行压缩,包括The encoding method according to any one of claims 3 or 4, characterized in that, respectively compressing the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image, comprising:
    将所述Alpha通道图像按第一比例压缩,以及将所述指定通道的图像按第二比例压缩,所述第一比例与所述第二比例的和为1。The Alpha channel image is compressed at a first ratio, and the designated channel image is compressed at a second ratio, and the sum of the first ratio and the second ratio is 1.
  6. 根据权利要求5所述的编码方法,其特征在于,所述第一比例与所述第二比例均为1/2。The encoding method according to claim 5, wherein the first ratio and the second ratio are both 1/2.
  7. 根据权利要求3所述的编码方法,其特征在于,将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合,包括:The encoding method according to claim 3, wherein the fusion of the Alpha channel image corresponding to the target image with the image of the designated channel corresponding to the YUV image comprises:
    用所述Alpha通道图像中指定像素点的像素值替换所述指定通道的图像中所述指定像素点对应位置的像素点的像素值,得到所述新的YUV图像对应的所述指定通道的图像。Replace the pixel value of the pixel at the corresponding position of the specified pixel in the image of the specified channel with the pixel value of the specified pixel in the Alpha channel image to obtain the image of the specified channel corresponding to the new YUV image .
  8. 根据权利要求7所述的编码方法,其特征在于,所述指定像素点包括:The encoding method according to claim 7, wherein the designated pixel point comprises:
    所述Alpha通道图像中指定行的像素点;或The pixels of the specified row in the Alpha channel image; or
    所述Alpha通道图像中指定列的像素点。The pixel points of the designated column in the Alpha channel image.
  9. 根据权利要求2-8任一项所述的编码方法,其特征在于,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。The encoding method according to any one of claims 2-8, wherein the designated channel is at least one channel, and all the images of the designated channel have the same number of pixels as the Alpha channel image.
  10. 根据权利要求2-9任一项所述的编码方法,其特征在于,所述YUV图像为YUV420图像,所述指定通道的图像为Y通道图像。The encoding method according to any one of claims 2-9, wherein the YUV image is a YUV420 image, and the image of the designated channel is a Y channel image.
  11. 一种编码装置,其特征在于,所述编码装置包括处理器、存储器、存储在所述存储器上的计算机程序,所述处理器执行所述计算机程序时实现权利要求以下步骤:An encoding device, characterized in that the encoding device includes a processor, a memory, and a computer program stored on the memory, and the processor implements the following steps in the claims when the processor executes the computer program:
    获取待编码的目标图像;Obtain the target image to be encoded;
    将所述目标图像对应的RGB通道图像转化为YUV图像;Converting the RGB channel image corresponding to the target image into a YUV image;
    将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像;Fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image;
    对所述新的YUV图像进行编码。Encoding the new YUV image.
  12. 根据权利要求11所述的编码装置,其特征在于,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像融合时,具体用于:11. The encoding device according to claim 11, wherein the processor is used for fusing an Alpha channel image corresponding to the target image with the YUV image, and is specifically used for:
    将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合,所述指定通道的图像包括Y通道图像、U通道图像或V通道图像中的至少一种。The Alpha channel image corresponding to the target image is fused with the image of the designated channel corresponding to the YUV image, and the image of the designated channel includes at least one of a Y channel image, a U channel image, or a V channel image.
  13. 根据权利要求12所述的编码装置,其特征在于,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合时,具体用于:The encoding device according to claim 12, wherein the processor is configured to merge an Alpha channel image corresponding to the target image with an image of a designated channel corresponding to the YUV image, and is specifically configured to:
    分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩;Respectively compressing the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image;
    将压缩后的Alpha通道图像与压缩后的指定通道的图像拼接,得到所述新的YUV图像对应的所述指定通道的图像。The compressed Alpha channel image is spliced with the compressed designated channel image to obtain the designated channel image corresponding to the new YUV image.
  14. 根据权利要求13所述的编码装置,其特征在于,所述处理器用于分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩时,具体用于:The encoding device according to claim 13, wherein the processor is configured to respectively compress the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image, and is specifically configured to:
    分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的宽度;或Respectively compress the width of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image; or
    分别压缩所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像的高度。The heights of the Alpha channel image corresponding to the target image and the specified channel image corresponding to the YUV image are compressed respectively.
  15. 根据权利要求13或14任一项所述的编码装置,其特征在于,所述处理器用于分别对所述目标图像对应的Alpha通道图像以及所述YUV图像对应的指定通道的图像进行压缩时,具体用于:The encoding device according to any one of claims 13 or 14, wherein the processor is configured to respectively compress the Alpha channel image corresponding to the target image and the designated channel image corresponding to the YUV image, Specifically used for:
    将所述Alpha通道图像按第一比例压缩,以及将所述指定通道的图像按第二比例压缩,所述第一比例与所述第二比例的和为1。The Alpha channel image is compressed at a first ratio, and the designated channel image is compressed at a second ratio, and the sum of the first ratio and the second ratio is 1.
  16. 根据权利要求15所述的编码装置,其特征在于,所述第一比例与所述第二比例均为1/2。The encoding device according to claim 15, wherein the first ratio and the second ratio are both 1/2.
  17. 根据权利要求13所述的编码装置,其特征在于,所述处理器用于将所述目标图像对应的Alpha通道图像与所述YUV图像对应的指定通道的图像融合时,具体用于:The encoding device according to claim 13, wherein the processor is used for fusing the Alpha channel image corresponding to the target image with the image of the designated channel corresponding to the YUV image, specifically for:
    用所述Alpha通道图像中指定像素点的像素值替换所述指定通道的图像中所述指定像素点对应位置的像素点的像素值,得到所述新的YUV图像对应的所述指定通道的图像。Replace the pixel value of the pixel at the corresponding position of the specified pixel in the image of the specified channel with the pixel value of the specified pixel in the Alpha channel image to obtain the image of the specified channel corresponding to the new YUV image .
  18. 根据权利要求17所述的编码装置,其特征在于,所述指定像素点包括:The encoding device according to claim 17, wherein the designated pixel point comprises:
    所述Alpha通道图像中指定行的像素点;或The pixels of the specified row in the Alpha channel image; or
    所述Alpha通道图像中指定列的像素点。The pixel points of the designated column in the Alpha channel image.
  19. 根据权利要求12-18任一项所述的编码装置,其特征在于,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。The encoding device according to any one of claims 12-18, wherein the designated channel is at least one channel, and all the images of the designated channel have the same number of pixels as the image of the Alpha channel.
  20. 根据权利要求12-19任一项所述的编码装置,其特征在于,所述YUV图像为YUV420格式的图像,所述指定通道的图像为Y通道图像。The encoding device according to any one of claims 12-19, wherein the YUV image is an image in YUV420 format, and the image of the designated channel is a Y-channel image.
  21. 一种解码方法,其特征在于,所述方法包括:A decoding method, characterized in that the method includes:
    获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;Acquiring a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
    基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;Obtaining the original YUV image and the Alpha channel image based on the YUV image restoration;
    对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。The original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
  22. 根据权利要求21所述的解码方法,其特征在于,基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像,包括:The decoding method according to claim 21, wherein obtaining the original YUV image and the Alpha channel image based on the YUV image restoration comprises:
    基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像,所述指定通道的图像包 括Y通道图像、U通道图像或V通道图像中的至少一种。Based on the image restoration of the specified channel corresponding to the YUV image, the image of the specified channel corresponding to the original YUV image and the Alpha channel image are obtained, and the image of the specified channel includes the Y channel image, the U channel image, or the V channel image. At least one of.
  23. 根据权利要求22所述的解码方法,其特征在于,基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像,包括:The decoding method according to claim 22, wherein the restoration of the image of the specified channel corresponding to the YUV image to obtain the image of the specified channel corresponding to the original YUV image and the image of the Alpha channel comprises:
    基于预设拆分规则对所述YUV图像对应的指定通道的图像的像素点进行拆分,得到所述原始YUV图像对应的指定通道的图像的部分像素点以及所述Alpha通道图像的部分像素点,所述拆分规则基于所述原始YUV图像和所述Alpha通道图像的融合方式确定;Split the pixels of the designated channel image corresponding to the YUV image based on a preset splitting rule to obtain some pixels of the designated channel image corresponding to the original YUV image and some pixels of the Alpha channel image , The split rule is determined based on the fusion mode of the original YUV image and the Alpha channel image;
    基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像。Restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and restore the Alpha based on the resolution of the YUV image and some pixels of the image of the Alpha channel Channel image.
  24. 根据权利要求23所述的解码方法,其特征在于,基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像,包括:The decoding method according to claim 23, wherein the image of the specified channel is restored based on the resolution of the YUV image and some pixels of the image of the specified channel, and the image of the specified channel is restored based on the resolution of the YUV image And restoring the Alpha channel image with some pixels of the Alpha channel image includes:
    基于所述YUV图像的分辨率,对所述指定通道的图像的部分像素点进行插值处理,还原得到所述指定通道的图像,对所述Alpha通道图像的部分像素点进行插值处理,还原得到所述Alpha通道图像;或Based on the resolution of the YUV image, perform interpolation processing on some pixels of the image of the specified channel to restore the image of the specified channel, perform interpolation processing on some of the pixels of the Alpha channel image, and restore the obtained The Alpha channel image; or
    基于所述YUV图像的分辨率,通过复制所述指定通道的图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述指定通道的图像,通过复制所述Alpha通道图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述Alpha通道图像。Based on the resolution of the YUV image, copy the pixel values of some pixels of the image of the specified channel as the pixel values of adjacent pixels, restore the image of the specified channel, and copy part of the image of the Alpha channel The pixel value of the pixel is used as the pixel value of the neighboring pixel, and the Alpha channel image is restored.
  25. 根据权利要求22-24任一项所述的解码方法,其特征在于,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。The decoding method according to any one of claims 22-24, wherein the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
  26. 根据权利要求22-25任一项所述的解码方法,其特征在于,所述YUV图像为YUV420格式的图像,所述指定通道的图像为Y通道图像。The decoding method according to any one of claims 22-25, wherein the YUV image is an image in YUV420 format, and the image of the designated channel is a Y channel image.
  27. 根据权利要求22-26任一项所述的解码方法,其特征在于,所述待解码的YUV图像为经过指定解码操作处理后得到的图像,所述指定解码操作包括基于H264/H265标准的解码操作。The decoding method according to any one of claims 22-26, wherein the YUV image to be decoded is an image obtained after a specified decoding operation is processed, and the specified decoding operation includes decoding based on the H264/H265 standard operate.
  28. 一种解码装置,其特征在于,所述解码装置包括处理器、存储器、存储在所述存储的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A decoding device, characterized in that the decoding device includes a processor, a memory, and a computer program stored in the storage, and the processor implements the following steps when the processor executes the computer program:
    获取待解码的YUV图像,所述YUV图像通过目标图像对应的RGB通道图像转化得到的原始YUV图像和所述目标图像对应的Alpha通道图像融合得到;Acquiring a YUV image to be decoded, where the YUV image is obtained by fusing the original YUV image obtained by conversion of the RGB channel image corresponding to the target image and the Alpha channel image corresponding to the target image;
    基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像;Obtaining the original YUV image and the Alpha channel image based on the YUV image restoration;
    对所述原始YUV图像进行转化得到所述RGB通道图像,基于所述RGB通道图像和所述Alpha通道图像得到所述目标图像。The original YUV image is converted to obtain the RGB channel image, and the target image is obtained based on the RGB channel image and the Alpha channel image.
  29. 根据权利要求28所述的解码装置,其特征在于,所述处理器用于基于所述YUV图像还原得到所述原始YUV图像和所述Alpha通道图像时,具体用于:The decoding device according to claim 28, wherein the processor is configured to obtain the original YUV image and the Alpha channel image based on the YUV image restoration, and is specifically configured to:
    基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像,所述指定通道的图像包括Y通道图像、U通道图像或V通道图像中的至少一种。Based on the image restoration of the specified channel corresponding to the YUV image, the image of the specified channel corresponding to the original YUV image and the Alpha channel image are obtained, and the image of the specified channel includes the Y channel image, the U channel image, or the V channel image. At least one of.
  30. 根据权利要求29所述的解码装置,其特征在于,所述处理器用于基于所述YUV图像对应的指定通道的图像还原得到所述原始YUV图像对应的指定通道的图像和所述Alpha通道图像时,具体用于:The decoding device according to claim 29, wherein the processor is configured to obtain the specified channel image corresponding to the original YUV image and the Alpha channel image based on the image restoration of the specified channel corresponding to the YUV image , Specifically used for:
    基于预设拆分规则对所述YUV图像对应的指定通道的图像的像素点进行拆分,得到所述原始YUV图像对应的指定通道的图像的部分像素点以及所述Alpha通道图像的部分像素点,所述拆分规则基于所述原始YUV图像和所述Alpha通道图像的融合方式确定;Split the pixels of the designated channel image corresponding to the YUV image based on a preset splitting rule to obtain some pixels of the designated channel image corresponding to the original YUV image and some pixels of the Alpha channel image , The split rule is determined based on the fusion mode of the original YUV image and the Alpha channel image;
    基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点 还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像。Restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and restore the Alpha based on the resolution of the YUV image and some pixels of the image of the Alpha channel Channel image.
  31. 根据权利要求30所述的解码装置,其特征在于,所述处理器用于基于所述YUV图像的分辨率以及所述指定通道的图像的部分像素点还原所述指定通道的图像,以及基于所述YUV图像的分辨率以及所述Alpha通道图像的部分像素点还原所述Alpha通道图像时,具体用于:The decoding device according to claim 30, wherein the processor is configured to restore the image of the specified channel based on the resolution of the YUV image and some pixels of the image of the specified channel, and based on the When the resolution of the YUV image and some pixels of the Alpha channel image are used to restore the Alpha channel image, they are specifically used for:
    基于所述YUV图像的分辨率,对所述指定通道的图像的部分像素点进行插值处理,还原得到所述指定通道的图像,对所述Alpha通道图像的部分像素点进行插值处理,还原得到所述Alpha通道图像;或Based on the resolution of the YUV image, perform interpolation processing on some pixels of the image of the specified channel to restore the image of the specified channel, perform interpolation processing on some of the pixels of the Alpha channel image, and restore the obtained The Alpha channel image; or
    基于所述YUV图像的分辨率,通过复制所述指定通道的图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述指定通道的图像,通过复制所述Alpha通道图像的部分像素点的像素值作为邻近像素点的像素值,还原得到所述Alpha通道图像。Based on the resolution of the YUV image, copy the pixel values of some pixels of the image of the specified channel as the pixel values of adjacent pixels, restore the image of the specified channel, and copy part of the image of the Alpha channel The pixel value of the pixel is used as the pixel value of the neighboring pixel, and the Alpha channel image is restored.
  32. 根据权利要求29-31任一项所述的解码装置,其特征在于,所述指定通道至少为1个通道,全部所述指定通道的图像与所述Alpha通道图像的像素点数量相同。The decoding device according to any one of claims 29-31, wherein the designated channel is at least one channel, and the images of all the designated channels have the same number of pixels as the Alpha channel image.
  33. 根据权利要求29-32任一项所述的解码装置,其特征在于,所述YUV图像为YUV420格式的图像,所述指定通道的图像为Y通道图像。The decoding device according to any one of claims 29-32, wherein the YUV image is an image in YUV420 format, and the image of the designated channel is a Y channel image.
  34. 根据权利要求29-33任一项所述的解码装置,其特征在于,所述待解码的YUV图像为经过指定解码操作处理后得到的图像,所述指定解码操作包括基于H264/H265标准的解码操作。The decoding device according to any one of claims 29-33, wherein the YUV image to be decoded is an image obtained after a specified decoding operation is processed, and the specified decoding operation includes decoding based on the H264/H265 standard operate.
  35. 一种视频传输系统,其特征在于,所述视频传输系统系统包括编码装置和解码装置;A video transmission system, characterized in that, the video transmission system includes an encoding device and a decoding device;
    所述编码装置用于获取待编码的目标图像,将所述目标图像对应的RGB通道图像转化为YUV图像,将所述目标图像对应的Alpha通道图像与所述YUV图像融合,生成新的YUV图像,对所述新的YUV图像进行编码,以发送编码后的图像;The encoding device is used to obtain a target image to be encoded, convert the RGB channel image corresponding to the target image into a YUV image, and fuse the Alpha channel image corresponding to the target image with the YUV image to generate a new YUV image , Encoding the new YUV image to send the encoded image;
    所述解码装置用于在接收到编码后的图像后,对所述编码后的图像进行处理得到所述新的YUV图像,基于所述新的YUV图像还原得到所述YUV图像和所述Alpha通道图像,将所述YUV图像转化为RGB图像,基于所述RGB图像和所述Alpha通道图像得到所述目标图像。The decoding device is configured to, after receiving the encoded image, process the encoded image to obtain the new YUV image, and restore the YUV image and the Alpha channel based on the new YUV image Image, converting the YUV image into an RGB image, and obtaining the target image based on the RGB image and the Alpha channel image.
PCT/CN2020/092920 2020-05-28 2020-05-28 Encoding method, decoding method, apparatus and system WO2021237569A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080039078.8A CN113994708A (en) 2020-05-28 2020-05-28 Encoding method, decoding method, device and system
PCT/CN2020/092920 WO2021237569A1 (en) 2020-05-28 2020-05-28 Encoding method, decoding method, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/092920 WO2021237569A1 (en) 2020-05-28 2020-05-28 Encoding method, decoding method, apparatus and system

Publications (1)

Publication Number Publication Date
WO2021237569A1 true WO2021237569A1 (en) 2021-12-02

Family

ID=78745392

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/092920 WO2021237569A1 (en) 2020-05-28 2020-05-28 Encoding method, decoding method, apparatus and system

Country Status (2)

Country Link
CN (1) CN113994708A (en)
WO (1) WO2021237569A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115550624A (en) * 2022-12-02 2022-12-30 成都索贝数码科技股份有限公司 HDMI video data transmission method carrying alpha channel value

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115834898B (en) * 2023-02-23 2023-05-12 成都索贝数码科技股份有限公司 Transmission method for carrying alpha channel value during HDMI transmission

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070053423A1 (en) * 2005-09-02 2007-03-08 Tinic Uro System and method for decompressing video data and alpha channel data using a single stream
US20070053424A1 (en) * 2005-09-02 2007-03-08 Tinic Uro System and method for compressing video data and alpha channel data using a single stream
CN106331850A (en) * 2016-09-18 2017-01-11 上海幻电信息科技有限公司 Browser live broadcast client, browser live broadcast system and browser live broadcast method
CN106937132A (en) * 2017-04-08 2017-07-07 腾讯科技(深圳)有限公司 A kind of photograph document handling method
CN107071516A (en) * 2017-04-08 2017-08-18 腾讯科技(深圳)有限公司 A kind of photograph document handling method
CN108881920A (en) * 2017-05-11 2018-11-23 腾讯科技(深圳)有限公司 A kind of method of transmission of video information, terminal and server
CN111131857A (en) * 2019-12-31 2020-05-08 北京金山云网络技术有限公司 Image compression method and device and electronic equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692336B (en) * 2009-10-09 2011-06-15 青岛海信宽带多媒体技术有限公司 Method for zooming out images
CN106327415A (en) * 2016-08-24 2017-01-11 乐视控股(北京)有限公司 Image processing method and device
CN106375759B (en) * 2016-08-31 2018-03-02 深圳超多维科技有限公司 A kind of coding and decoding method and device of vedio data
CN109348226B (en) * 2017-04-08 2022-11-11 腾讯科技(深圳)有限公司 Picture file processing method and intelligent terminal
CN110545427A (en) * 2018-05-28 2019-12-06 北京金山办公软件股份有限公司 PDF document compression method and device and electronic equipment
CN109413508A (en) * 2018-10-26 2019-03-01 广州虎牙信息科技有限公司 Method, apparatus, equipment, plug-flow method and the live broadcast system of image blend

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070053423A1 (en) * 2005-09-02 2007-03-08 Tinic Uro System and method for decompressing video data and alpha channel data using a single stream
US20070053424A1 (en) * 2005-09-02 2007-03-08 Tinic Uro System and method for compressing video data and alpha channel data using a single stream
CN106331850A (en) * 2016-09-18 2017-01-11 上海幻电信息科技有限公司 Browser live broadcast client, browser live broadcast system and browser live broadcast method
CN106937132A (en) * 2017-04-08 2017-07-07 腾讯科技(深圳)有限公司 A kind of photograph document handling method
CN107071516A (en) * 2017-04-08 2017-08-18 腾讯科技(深圳)有限公司 A kind of photograph document handling method
CN108881920A (en) * 2017-05-11 2018-11-23 腾讯科技(深圳)有限公司 A kind of method of transmission of video information, terminal and server
CN111131857A (en) * 2019-12-31 2020-05-08 北京金山云网络技术有限公司 Image compression method and device and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115550624A (en) * 2022-12-02 2022-12-30 成都索贝数码科技股份有限公司 HDMI video data transmission method carrying alpha channel value

Also Published As

Publication number Publication date
CN113994708A (en) 2022-01-28

Similar Documents

Publication Publication Date Title
US11785215B2 (en) Encoding method, decoding method, encoding/decoding system, encoder, and decoder
US10194150B2 (en) Method and device for coding image, and method and device for decoding image
US8977048B2 (en) Method medium system encoding and/or decoding an image using image slices
US9124858B2 (en) Content processing apparatus for processing high resolution content and content processing method thereof
CN108063976B (en) Video processing method and device
AU2012285356B2 (en) Tiered signal decoding and signal reconstruction
US20200213570A1 (en) Method for processing projection-based frame that includes at least one projection face and at least one padding region packed in 360-degree virtual reality projection layout
US20200036993A1 (en) Techniques for Encoding, Decoding and Representing High Dynamic Range Images
RU2693185C2 (en) Encoding method and colour conversion decoding method and corresponding devices
US20160100161A1 (en) Decoder, encoder, decoding method, encoding method, and codec system
CN106488141A (en) HDR is to the method for HDR inverse tone mapping (ITM), system and equipment
WO2013099076A1 (en) Moving image compressing apparatus, image processing apparatus, moving image compressing method, image processing method, and data structure of moving image compressed file
KR20180063226A (en) Layered representation and transmission including CRC codes of high dynamic range video
US11115691B2 (en) Custom data indicating nominal range of samples of media content
US20180054630A1 (en) Compression of image assets
WO2021237569A1 (en) Encoding method, decoding method, apparatus and system
KR20180098117A (en) Method and device for reconstructing image data from decoded image data
US20190279684A1 (en) Image processing apparatus that generates a still image file from a moving image file, image processing method, and storage medium
CN106412595B (en) Method and apparatus for encoding high dynamic range frames and applied low dynamic range frames
WO2013073138A1 (en) Motion vector coding apparatus, method and program
CN110087072A (en) Image processing apparatus
US20240095387A1 (en) Image processing apparatus, image processing method, and non-transitory computer-readable storage medium
JPH0283578A (en) Device and method for image data display
CN116366882A (en) Quick preview viewing method for ultra-high definition video file
CN115552895A (en) Luma mapping with chroma scaling for progressive decoding refresh

Legal Events

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

Ref document number: 20937793

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20937793

Country of ref document: EP

Kind code of ref document: A1