Image encoding and decoding device, method and storage medium

CN118283271BActive Publication Date: 2024-11-19XIAN WANXIANG ELECTRONICS TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410711811.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-11-19
Estimated Expiration
2044-06-04

Smart Images

  • Figure CN118283271B_ABST
    Figure CN118283271B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image coding and decoding device, method and storage medium, which relate to the field of image coding and decoding, and can solve the problem that the Alpha component data in the image in the image processing system cannot participate in the coding, thus causing lossy coding. The image coding device includes an acquisition module, a coding capability query module, a first encoder and a second encoder; the acquisition module is used to acquire the original image, and the original image includes a first component and a second component; the coding capability query module includes a coding capability query submodule and a processing submodule, the coding capability query submodule is used to query the coding capability of the first encoder, and the processing submodule is used to transmit the first component of the original image to the first encoder and the second component of the original image to the second encoder based on the coding capability of the first encoder and according to a preset rule; the first encoder is used to encode the first component of the original image, and the second encoder is used to encode the second component of the original image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer graphics, and in particular to an image coding and decoding device, method and storage medium. Background Art

[0002] The image encoding and decoding schemes in the related technologies are generally performed for images in the YUV space. Some encoders encode images in the RGB space, which actually converts the received RGB format image into the YUV format first, and then encodes it. That is to say, these encoders are essentially encoders for the YUV format. Correspondingly, the situation of the decoder is similar, and the decoded image format is also YUV. In the computer, the images initially collected are all in BGRA format (also called RGBA, in short, it is composed of four components R / B / G / A). The related technologies first erase the data of A, that is, the Alpha channel, and then convert the remaining three RGB components into YUV components according to the formula and send them to the encoder for encoding. This creates a problem. The data of the Alpha channel cannot be involved in the encoding, and of course there is no original Alpha data after decoding. Summary of the invention

[0003] The embodiments of the present disclosure provide an image encoding and decoding method, device and storage medium, which can solve the problem that the Alpha channel data cannot be used for encoding in the above-mentioned image encoding and decoding process at the encoding end. The technical solution is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an image encoding device, the image encoding device comprising an acquisition module, an encoding capability query module, a first encoder and a second encoder;

[0005] The acquisition module is used to acquire an original image, wherein the original image includes a first component and a second component;

[0006] A coding capability query module, comprising a coding capability query submodule and a processing submodule, wherein the coding capability query submodule is used to query the coding capability of the first encoder, and the processing submodule is used to transmit the first component of the original image to the first encoder and the second component of the original image to the second encoder according to a preset rule based on the coding capability of the first encoder;

[0007] A first encoder, used for encoding a first component of the original image;

[0008] The second encoder is used to encode the second component of the original image, wherein the second encoder includes a YUV400 encoder.

[0009] In some embodiments, the original image is in BGRA format or ARGB format, the first component includes RGB components, the second component includes A components, the original image is arranged in a compact manner, and the device further includes:

[0010] A format conversion module, used for converting the original image from a compact arrangement to a planar arrangement to obtain a pre-processed image;

[0011] The coding capability query module is further used to transmit the first component of the preprocessed image to the first encoder and the second component of the preprocessed image to the second encoder according to a preset rule;

[0012] A first encoder, configured to encode a first component of the preprocessed image;

[0013] The second encoder is used to encode the second component of the preprocessed image.

[0014] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule supports YUV444 encoding, a first encoder is started, and the processing submodule is used to: fill the data of the B, G, and R components in the first component into three plane component spaces in the YUV444 form respectively;

[0015] Fill the A component in the second component into the Y component space of YUV400.

[0016] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV420 encoding, two first encoders are started, the two first encoders include a first sub-encoder and a second sub-encoder, and the processing submodule is used to:

[0017] Fill the B component in the first component into the Y component space of the first sub-encoder;

[0018] Fill the R component in the first component into the Y component space of the second sub-encoder;

[0019] Fill the first part of the G component in the first component into the UV component space of the first sub-encoder, and fill the second part of the G component in the first component into the UV component space of the second sub-encoder;

[0020] Fill the A component in the second component into the Y component space of YUV400.

[0021] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV400 encoding, three first encoders are started, the three first encoders include a third subencoder, a fourth subencoder and a fifth subencoder, and the processing submodule is used to:

[0022] Fill the R, G, and B components in the first component into the Y component spaces of the third sub-encoder, the fourth sub-encoder, and the fifth sub-encoder respectively;

[0023] Fill the A component in the second component into the Y component space of YUV400.

[0024] In some embodiments, the first encoder and the second encoder are hardware encoders or software encoders.

[0025] According to a second aspect of an embodiment of the present disclosure, an image decoding device is provided, the device comprising a first decoder, a second decoder, a format conversion module and a display module, wherein:

[0026] A first decoder, used for receiving data from the first encoder and decoding the data to obtain a first component;

[0027] A second decoder is used to receive data from the second encoder and decode it to obtain a second component;

[0028] A format conversion module, used for performing data conversion on the first component and the second component to obtain an image to be displayed;

[0029] The display module is used to display the image to be displayed.

[0030] According to a third aspect of an embodiment of the present disclosure, there is provided an image encoding method, which is applied to the image encoding device described above, and the method includes:

[0031] Acquire an original image, wherein the original image includes a first component and a second component;

[0032] querying the encoding capability of the first encoder, and based on the encoding capability of the first encoder and according to a preset rule, transmitting the first component of the original image to the first encoder, and transmitting the second component of the original image to the second encoder;

[0033] encoding a first component of the original image by a first encoder;

[0034] The second component of the original image is encoded by a second encoder, wherein the second encoder comprises a YUV400 encoder.

[0035] In some embodiments, the original image is in BGRA format or ARGB format, the first component includes RGB components, the second component includes A components, and the original image is arranged in a compact manner. The method further includes:

[0036] The original image is converted from a compact arrangement to a planar arrangement to obtain a preprocessed image;

[0037] According to a preset rule, the first component of the preprocessed image is transmitted to the first encoder, and the second component of the preprocessed image is transmitted to the second encoder;

[0038] encoding a first component of the preprocessed image by a first encoder;

[0039] The second component of the pre-processed image is encoded by a second encoder.

[0040] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule supports YUV444 encoding, starting a first encoder, and encoding the first component of the original image by the first encoder includes:

[0041] Fill the data of B, G, and R components in the first component into the three plane component spaces in the YUV444 format respectively;

[0042] Encoding the second component of the original image by the second encoder includes:

[0043] Fill the A component in the second component into the Y component space of YUV400.

[0044] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV420 encoding, two first encoders are started, the two first encoders include a first sub-encoder and a second sub-encoder, and encoding the first component of the original image by the first encoder includes:

[0045] Fill the B component in the first component into the Y component space of the first sub-encoder;

[0046] Fill the R component in the first component into the Y component space of the second sub-encoder;

[0047] Fill the first part of the G component in the first component into the UV component space of the first sub-encoder, and fill the second part of the G component in the first component into the UV component space of the second sub-encoder;

[0048] Encoding the second component of the original image by the second encoder includes:

[0049] Fill the A component in the second component into the Y component space of YUV400.

[0050] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV400 encoding, three first encoders are started, the three first encoders include a third subencoder, a fourth subencoder, and a fifth subencoder, and encoding the first component of the original image by the first encoder includes:

[0051] Fill the R, G, and B components in the first component into the Y component spaces of the third sub-encoder, the fourth sub-encoder, and the fifth sub-encoder respectively;

[0052] Encoding the second component of the original image by the second encoder includes:

[0053] Fill the A component in the second component into the Y component space of YUV400.

[0054] According to a fourth aspect of an embodiment of the present disclosure, there is provided an image decoding method for use in the above-mentioned image decoding device, the method comprising:

[0055] receiving data from a first encoder and decoding the data to obtain a first component;

[0056] receiving data from a second encoder and decoding the data to obtain a second component;

[0057] Performing data conversion on the first component and the second component to obtain an image to be displayed;

[0058] Display the image to be displayed.

[0059] According to a fifth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the steps performed in the image decoding method described in the third aspect and any embodiment of the third aspect.

[0060] According to a sixth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, in which a computer program is stored, and the computer program is loaded and executed by a processor to implement the steps performed in the image decoding method described in the fourth aspect and any one of the embodiments of the fourth aspect. According to a seventh aspect of the embodiments of the present disclosure, a coding device is provided, the coding device includes a processor and a memory, in which a computer program is stored, and the computer program is loaded and executed by a processor to implement the steps performed in the image coding method described in the third aspect and any one of the embodiments of the third aspect.

[0061] According to an eighth aspect of an embodiment of the present disclosure, a decoding device is provided, which includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the steps performed in the image encoding method described in the third aspect and any embodiment of the third aspect.

[0062] The image encoding and decoding method provided by the present disclosure can support the participation of Alpha channel data in encoding. The characteristics of this solution are: based on any current ordinary encoder that does not support the Alpha channel, the information of the three BGRA channels can be encoded, and lossless encoding can be achieved; at the decoding end, only a general decoder is needed to achieve decoding. In the above scheme, only a small amount of pre-processing and post-processing processes need to be added, and the pre-processing and post-processing processes can be implemented independently of the codec module, so there is no need to modify the codec itself, and the common software and hardware codecs in the prior art can be reused. In other words, based on the current existing software and hardware encoding, it is possible to encode and decode BGRA data with an Alpha channel, and the effect of encoding four BGRA channels can be achieved while reusing the existing general hardware codecs.

[0063] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0065] Figure 1 is an architecture diagram of an image encoding and decoding system provided by an embodiment of the present disclosure;

[0066] Figure 2 is a structural diagram of an image encoding device provided by an embodiment of the present disclosure;

[0067] Figure 3 is a structural diagram of an image encoding device provided by an embodiment of the present disclosure;

[0068] Figure 4 is a schematic diagram of image format conversion provided by an embodiment of the present disclosure;

[0069] Figure 5 is a structural diagram of an image decoding device provided by an embodiment of the present disclosure;

[0070] Figure 6 is a schematic diagram of an image encoding process provided by an embodiment of the present disclosure;

[0071] Figure 7 is a schematic diagram of an image encoding process provided by an embodiment of the present disclosure;

[0072] Figure 8 is a schematic diagram of an image encoding process provided by an embodiment of the present disclosure;

[0073] Fig. 9is a flowchart of an image encoding method provided by an embodiment of the present disclosure;

[0074] Fig.10 is a flowchart of an image encoding method provided by an embodiment of the present disclosure;

[0075] Fig.11 is a structural schematic diagram of an encoding device provided by an embodiment of the present disclosure;

[0076] Fig.12 It is a structural diagram of a decoding device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0077] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0078] like Figure 1 As described, the image encoding and decoding method provided by the embodiment of the present disclosure can be applied to an image encoding and decoding system, and the image encoding and decoding system includes an encoding end (encoding device) 10 and a decoding end (decoding device) 20. The encoding end 10 captures the original image and encodes it, wherein the original image data is BGRA or ARGB format data, and the decoding end 20 decodes and displays the acquired image data. At the encoding end 10, the captured images are composed of four channels: Blue, Green, Red, and Alpha, wherein the Alpha channel is a transparent channel. Each pixel is composed of these four components, and for a pixel, they can have a variety of arrangements, such as BGRA, ARGB, etc., but the difference is in the order of the four components, which does not affect the implementation of this solution. For the sake of ease of description, this solution is uniformly described using the common BGRA as an example.

[0079] In some embodiments, the encoding end and the decoding end include but are not limited to one of a server, a mobile smart terminal, a vehicle-mounted smart terminal, a smart TV, a wearable device, etc. The embodiment of the present invention describes the image encoding and decoding method in detail, but is not limited to the specifics.

[0080] In some embodiments, Figure 2 As shown, the encoding device 10 includes a collection module 100 , an encoding capability query module 101 , a first encoder 103 and a second encoder 104 .

[0081] The acquisition module 100 is used to acquire an original image, wherein the original image includes a first component and a second component;

[0082] The coding capability query module 101 includes a coding capability query submodule 1011 and a processing submodule 1012 .

[0083] The encoding capability query submodule 1011 is used to query the encoding capability of the first encoder.

[0084] The processing submodule 1012 is used for transmitting the first component of the original image to the first encoder 103 and the second component of the original image to the second encoder 104 according to a preset rule based on the encoding capability of the first encoder;

[0085] A first encoder 103, used for encoding a first component of the original image;

[0086] The second encoder 104 is used to encode the second component of the original image, wherein the second encoder includes a YUV400 encoder.

[0087] In some embodiments, the original image is in BGRA format or ARGB format, the first component includes RGB components, and the second component includes A component. The original image can be arranged in a compact format or in a planar format, and is encoded according to the above embodiments.

[0088] In some embodiments, the acquisition module 100 is used to acquire the original image, wherein the format of the original image is BGRA or ARGB, and BGRA is used as an example for explanation below. In the original image, the pixels of each frame can be stored in a compact form, that is, each pixel stores the data of the four components B / G / R / A, and then the data of the four components B / G / R / A of the next pixel, until all pixels are completed.

[0089] In some embodiments, Figure 3 As shown, when the original image is arranged in a compact manner, the encoding device 10 further includes:

[0090] A format conversion module 102, used to convert the original image from a compact arrangement to a planar arrangement to obtain a pre-processed image;

[0091] The format conversion module 102 converts the compact BGRA image into a planar image. The planar image is different from the compact image. The B component of all pixels in the whole frame is stored first, then the G component of all pixels is stored, then the R component and the A component are stored. The components stored together are called a plane. Specifically, the compact image frame is converted into a planar image, such as Figure 4 shown.

[0092] In this embodiment, the encoding capability query module 101 is further used to transmit the first component of the preprocessed image to the first encoder 103 and the second component of the preprocessed image to the second encoder 104 according to a preset rule. The first encoder 103 is used to encode the first component of the preprocessed image, and the second encoder 104 is used to encode the second component of the preprocessed image.

[0093] In some embodiments, if the encoding end is regarded as a broad encoder, the first encoder 103 can be understood as a narrow encoder. The so-called narrow encoder refers to an encoder similar to that following H264 and H265. Currently, encoding devices generally have built-in narrow encoders, such as H264 and H265 encoders, which can be in software form or hardware form (for example, Nvidia's graphics card has an encoding function). For these narrow encoders, image encoding of the Alpha channel is not originally supported, but image encoding in YUV format is supported. In the disclosed embodiment, it is not necessary to change the original function of the narrow encoder, and image encoding supporting the Alpha channel can be realized by simply using these encoders. It can be understood that the encoding capabilities of the encoding end, the first encoder 103 are not the same. Some first encoders may support encoding of the YUV444 space, some first encoders may only support encoding of the YUV420 space, and some first encoders only support encoding of the YUV400 space. Among them, the YUV encoding of the image includes YUV444, YUV420 or YUV422. Among them, YUV is divided into three components. "Y" represents brightness (Luminance or Luma), that is, grayscale value; while "U" and "V" represent chrominance (Chrominance or Chroma), which is used to describe the color and saturation of the image and is used to specify the color of the pixel. In YUV 444 sampling, each Y corresponds to a group of UV components. In YUV 422 sampling, every two Ys share a group of UV components. In YUV 420 sampling, every four Ys share a group of UV components. Figure 5 As shown, the embodiment of the present disclosure also provides an image decoding device 20, which includes a format conversion module 105, a first decoder 106, a second decoder 107 and a display module 108. The first decoder 106 and the second decoder 107 correspond to the first encoder 103 and the second encoder 104 of the encoding end 10, respectively, and decode the received encoded data respectively. The format conversion module 105 splices the data output by the first decoder 106 and the second decoder 107 and converts them into a data frame in BGRA format, and then the display module 108 displays the image.

[0094] That is, the first decoder 106 is used to receive data from the first encoder and decode it to obtain a first component; the second decoder 107 is used to receive data from the second encoder and decode it to obtain a second component; the format conversion module 105 is used to convert the first component and the second component to obtain an image to be displayed; and the display module 108 is used to display the image to be displayed.

[0095] For the specific encoding and decoding process, there are multiple situations based on the encoding capability of the first encoder 103, which are described in the following examples. In some embodiments, when the result of the encoding capability query submodule 1011 shows that the first encoder supports YUV444 encoding, a first encoder is started. That is to say, if the first encoder can support YUV444 spatial encoding, starting a first encoder and a second encoder can complete the work. Figure 6 As shown, the processing submodule 1012 is used to: fill the data of the B, G, and R components in the first component into the three plane component spaces in the form of YUV444 respectively; and fill the A component in the second component into the Y component space of YUV400.

[0096] That is, the format conversion module 102 converts the BGRA image frame into Figure 4 The four components shown in the lower part. Then, as Figure 6 As shown, the data of the three components B, G, and R are filled into three plane components in the form of YUV444. Because the number of bytes of the three components B, G, and R is the same as the number of bytes of the three components Y, U, and V, they are directly put in. The YUV444 encoder (first encoder 103) instance will directly encode this frame that looks like YUV444, but actually contains BGR data, to form a code stream. At the same time, the data of the Alpha component will enter the YUV400 encoder (second encoder 104) for encoding, and it will be filled into the space of the Y component of a YUV400 and encoded according to the data of the Y component. In this way, the data of the four components of BGRA are all encoded. At the decoding end 20, decoding is performed according to the reverse process, and finally the data of the four components of BGRA are formed, which are then converted into a compact BGRA data frame through the format conversion module 105, and finally displayed through the display module 106.

[0097] In some embodiments, when the result of the encoding capability query submodule 1011 shows that the first submodule only supports YUV420 encoding, two first encoders are started, and the two first encoders include a first sub-encoder 1031 and a second sub-encoder 1032, such as Figure 7 As shown, the processing submodule 1012 is used for:

[0098] Fill the B component in the first component into the Y component space of the first sub-encoder;

[0099] Fill the R component in the first component into the Y component space of the second sub-encoder;

[0100] Fill the first part of the G component in the first component into the UV component space of the first sub-encoder, and fill the second part of the G component in the first component into the UV component space of the second sub-encoder;

[0101] Fill the A component in the second component into the Y component space of YUV400.

[0102] That is, if the first encoder can support YUV420 spatial encoding, then starting two first encoders and one second encoder can complete the work. The format conversion module 102 converts the BGRA image frame into Figure 4 The four components shown in the lower part. Then, as Figure 7 As shown, the three BGR components will be filled into two YUV420 encoder instances for encoding. The B component is filled into the Y component space of the first encoder, the R component is filled into the Y component space of the second encoder, half of the G component is filled into the UV component space of the first encoder, and the other half is filled into the UV component space of the second encoder. In this way, the two YUV420 spaces are combined to form a YUV444 space (which is equivalent to a BGR space). At the same time, the data of the Alpha component will enter the YUV400 encoder (the second encoder 104) for encoding. It is filled into the Y component space of a YUV400 and encoded according to the data of the Y component. In this way, the data of the four BGRA components are all encoded. The decoding end decodes the three frames and then splices them together to eventually form a frame in BGRA format and send it to the display module. It should be noted that the amount of data in the frames of the two YUV420 spaces is equivalent to the amount of data in the frames of a YUV444 space, which is also equivalent to the amount of data in a BGR space. Figure 7 The BGR division is just an example. Of course, there are countless other examples of division, which are not listed here one by one.

[0103] In some embodiments, when the result of the encoding capability query submodule 1011 shows that the first submodule only supports YUV400 encoding, Figure 8 As shown, three first encoders are started, the three first encoders include a third sub-encoder 1033, a fourth sub-encoder 1034 and a fifth sub-encoder 1035, and the processing sub-module 1012 is used to: fill the R, G, and B components in the first component into the Y component space of the third sub-encoder, the fourth sub-encoder and the fifth sub-encoder respectively;

[0104] Fill the A component in the second component into the Y component space of YUV400.

[0105] That is, if the first encoder only supports YUV400 spatial encoding, then starting three first encoders and one second encoder can complete the work. The format conversion module 102 converts the BGRA image frame into Figure 4 The four components shown in the lower part. Then, as Figure 8 As shown, the three BGR components are sent to three YUV400 encoders (first encoder 103) respectively. The Alpha component is still the same as mentioned above. This is also an implementation method. This implementation method requires a corresponding number of encoders on the encoding end. The usage scenarios of this embodiment include: the system does not support YUV444 or YUV420 encoding, or the user is set to specify that only YUV400 format encoding is used. In this embodiment, three first encoders are used for the three BGR components respectively. Since the inter-frame predictions between the components are independent of each other, separate encoding is more conducive to eliminating redundancy and reducing the bit stream. The bit stream generated in this way is smaller.

[0106] In some embodiments, the first encoder and the second encoder are hardware encoders or software encoders.

[0107] In some embodiments, the second encoder 104 refers to an encoder that supports YUV400, and supports YUV400 space encoding. Here, it is used to encode the Alpha channel, that is, the data of the Alpha plane. Fig. 9 The present disclosure provides an image encoding method, which is applied to the image encoding device described above. The method includes:

[0108] Step 301: Acquire an original image, wherein the original image includes a first component and a second component;

[0109] Step 303: query the encoding capability of the first encoder, and based on the encoding capability of the first encoder and according to a preset rule, transmit the first component of the original image to the first encoder, and transmit the second component of the original image to the second encoder;

[0110] Step 303: Encode the first component of the original image by using a first encoder;

[0111] Step 304: Encode the second component of the original image by using a second encoder, wherein the second encoder includes a YUV400 encoder.

[0112] In some embodiments, the original image is in BGRA format or ARGB format, the first component includes RGB components, the second component includes A components, and the original image is arranged in a compact manner. The method further includes:

[0113] The original image is converted from a compact arrangement to a planar arrangement to obtain a preprocessed image;

[0114] According to a preset rule, the first component of the preprocessed image is transmitted to the first encoder, and the second component of the preprocessed image is transmitted to the second encoder;

[0115] encoding a first component of the preprocessed image by a first encoder;

[0116] The second component of the pre-processed image is encoded by a second encoder.

[0117] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule supports YUV444 encoding, starting a first encoder, and encoding the first component of the original image by the first encoder includes:

[0118] Fill the data of B, G, and R components in the first component into the three plane component spaces in the YUV444 format respectively;

[0119] Encoding the second component of the original image by the second encoder includes:

[0120] Fill the A component in the second component into the Y component space of YUV400.

[0121] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV420 encoding, two first encoders are started, the two first encoders include a first sub-encoder and a second sub-encoder, and encoding the first component of the original image by the first encoder includes:

[0122] Fill the B component in the first component into the Y component space of the first sub-encoder;

[0123] Fill the R component in the first component into the Y component space of the second sub-encoder;

[0124] Fill the first part of the G component in the first component into the UV component space of the first sub-encoder, and fill the second part of the G component in the first component into the UV component space of the second sub-encoder;

[0125] Encoding the second component of the original image by the second encoder includes:

[0126] Fill the A component in the second component into the Y component space of YUV400.

[0127] In some embodiments, when the result of the encoding capability query submodule shows that the first submodule only supports YUV400 encoding, three first encoders are started, the three first encoders include a third subencoder, a fourth subencoder, and a fifth subencoder, and encoding the first component of the original image by the first encoder includes:

[0128] Fill the R, G, and B components in the first component into the Y component spaces of the third sub-encoder, the fourth sub-encoder, and the fifth sub-encoder respectively;

[0129] Encoding the second component of the original image by the second encoder includes:

[0130] Fill the A component in the second component into the Y component space of YUV400.

[0131] like Fig.11 The present disclosure provides an image decoding method, which is applied to the image decoding device described above. The method includes:

[0132] Step 401: Receive data from a first encoder and decode it to obtain a first component;

[0133] Step 402: receiving data from a second encoder and decoding the data to obtain a second component;

[0134] Step 403: Perform data conversion on the first component and the second component to obtain an image to be displayed;

[0135] Step 404: Display the image to be displayed.

[0136] The image encoding and decoding method provided by the present invention can support the participation of Alpha channel data in encoding. The feature of this solution is that, based on any current ordinary encoder that does not support the Alpha channel, the information of the three BGRA channels can be encoded, and lossless encoding can be achieved. Use a general decoder to decode it at the decoding end. Only a small amount of pre-processing and post-processing processes need to be added, and the pre-processing and post-processing processes can be independent of the codec module. In other words, based on the current existing software and hardware encoding, it is possible to encode and decode BGRA data with an Alpha channel. The most important feature is that the existing general hardware codec can be reused to achieve the effect of encoding four BGRA channels.

[0137] The embodiments of the present disclosure further provide a computer-readable storage medium, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the steps performed in the image decoding method described in any of the above embodiments.

[0138] An embodiment of the present disclosure also provides a computer-readable storage medium, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the steps performed in the image decoding method described in the fourth aspect and any embodiment of the fourth aspect.

[0139] refer to Fig.11 As shown, the embodiment of the present disclosure further provides a coding device 80, which includes a processor 801, a memory 802 and a bus 803, the processor 801 and the memory 802 are respectively connected to the bus 803, the memory 802 stores a computer program, and the processor 804 is used to load and execute the computer program 804 to implement the above Fig. 9 The image encoding method described in the corresponding embodiment.

[0140] refer to Fig.12 As shown, the embodiment of the present disclosure further provides a decoding device 90, the decoding device 90 includes a processor 901, a memory 902 and a bus 903, the processor 901 and the memory 902 are respectively connected to the bus 903, the memory 902 stores a computer program 904, and the processor 904 is used to load and execute the computer program to implement the above Fig.10 The image decoding method described in the corresponding embodiment.

[0141] Based on the above Fig. 9 In accordance with the image encoding method described in the embodiment, the embodiment of the present disclosure further provides a computer-readable storage medium. For example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, or an optical data storage device. The storage medium stores computer instructions for executing the above Fig. 9 The image encoding method described in the corresponding embodiment will not be repeated here.

[0142] Based on the above Fig.10 In accordance with the image decoding method described in the embodiment, the embodiment of the present disclosure further provides a computer-readable storage medium. For example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, or an optical data storage device. The storage medium stores computer instructions for executing the above Fig.10 The image decoding method described in the corresponding embodiment will not be repeated here.

[0143] A person skilled in the art will understand that all or part of the steps of implementing the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0144] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

Claims

1. An image encoding device, characterized in that: It includes a collection module, a coding capability query module, a first encoder and a second encoder; An acquisition module, used for acquiring an original image, wherein the original image includes a first component and a second component; A coding capability query module, comprising a coding capability query submodule and a processing submodule, wherein the coding capability query submodule is used to query the coding capability of the first encoder, and the processing submodule is used to transmit the first component of the original image to the first encoder and the second component of the original image to the second encoder according to a preset rule based on the coding capability of the first encoder; A first encoder, configured to encode a first component of the original image; A second encoder, configured to encode a second component of the original image, wherein the second encoder comprises a YUV400 encoder; The original images are arranged in a compact manner, and the device further comprises: A format conversion module, used for converting the original image from a compact arrangement to a planar arrangement to obtain a pre-processed image; When the result of the encoding capability query submodule shows that the first encoder supports YVU444 encoding, a first encoder is started, and the processing submodule is used to: Fill the data of the B, G, and R components in the first component into three plane component spaces in the YUV444 format respectively; Fill the A component in the second component into the Y component space of YUV400; When the result of the encoding capability query submodule shows that the first encoder only supports YVU420 encoding, two first encoders are started, the two first encoders include a first sub-encoder and a second sub-encoder, and the processing submodule is used to: Filling the B component in the first component into the Y component space of the first sub-encoder; Filling the R component in the first component into the Y component space of the second sub-encoder; Filling a first part of the G component in the first component into the UV component space of the first sub-encoder, and filling a second part of the G component in the first component into the UV component space of the second sub-encoder; Fill the A component in the second component into the Y component space of YUV400; When the result of the encoding capability query submodule shows that the first encoder only supports YVU400 encoding, three first encoders are started, the three first encoders include a third sub-encoder, a fourth sub-encoder and a fifth sub-encoder, and the processing submodule is used to: Filling the B, G, and R components in the first component into the Y component spaces of the third sub-encoder, the fourth sub-encoder, and the fifth sub-encoder respectively; Fill the A component in the second component into the Y component space of YUV400.

2. The image encoding device according to claim 1, characterized in that The original image is in BGRA format or ARGB format, the first component includes RGB components, and the second component includes A components; The encoding capability query module is further used to transmit the first component of the preprocessed image to the first encoder and the second component of the preprocessed image to the second encoder according to a preset rule; A first encoder, configured to encode a first component of the preprocessed image; The second encoder is used to encode the second component of the preprocessed image.

3. The image encoding device according to any one of claims 1 to 2, characterized in that: The first encoder and the second encoder are hardware encoders or software encoders.

4. An image decoding device, characterized in that: The image decoding device is applied to a coding and decoding system composed of the image coding device according to any one of claims 1 to 3, and the image decoding device comprises a first decoder, a second decoder, a format conversion module and a display module; The first decoder is used to receive data from the first encoder and decode it to obtain a first component; The second decoder is used to receive data from the second encoder and decode it to obtain a second component; The format conversion module is used to perform data conversion on the first component and the second component to obtain an image to be displayed; The display module is used to display the image to be displayed.

5. An image encoding method, characterized in that: Applied to the image encoding device according to any one of claims 1 to 3, the method comprising: Acquire an original image, wherein the original image includes a first component and a second component; querying the encoding capability of the first encoder, and based on the encoding capability of the first encoder and according to a preset rule, transmitting the first component of the original image to the first encoder, and transmitting the second component of the original image to the second encoder; encoding a first component of the original image by a first encoder; Encoding a second component of the original image by a second encoder, wherein the second encoder comprises a YUV400 encoder; In the case where the first encoder supports YVU444 encoding, a first encoder is started, and encoding the first component of the original image by the first encoder includes: Fill the data of the B, G, and R components in the first component into three plane component spaces in the YUV444 format respectively; The encoding of the second component of the original image by the second encoder comprises: Fill the A component in the second component into the Y component space of YUV400; In the case where the first encoder only supports YVU420 encoding, two first encoders are started, the two first encoders include a first sub-encoder and a second sub-encoder, and encoding the first component of the original image by the first encoder includes: Filling the B component in the first component into the Y component space of the first sub-encoder; Filling the R component in the first component into the Y component space of the second sub-encoder; Filling a first part of the G component in the first component into the UV component space of the first sub-encoder, and filling a second part of the G component in the first component into the UV component space of the second sub-encoder; The encoding of the second component of the original image by the second encoder comprises: Fill the A component in the second component into the Y component space of YUV400; In the case where the first encoder only supports YVU400 encoding, three first encoders are started, the three first encoders include a third sub-encoder, a fourth sub-encoder, and a fifth sub-encoder, and encoding the first component of the original image by the first encoder includes: Filling the B, G, and R components in the first component into the Y component spaces of the third sub-encoder, the fourth sub-encoder, and the fifth sub-encoder respectively; The encoding of the second component of the original image by the second encoder comprises: Fill the A component in the second component into the Y component space of YUV400.

6. The image encoding method according to claim 5, characterized in that: The original image is in BGRA format or ARGB format, the first component includes RGB components, the second component includes A components, the original image is arranged in a compact manner, and the method further includes: Converting the original image from a compact arrangement to a planar arrangement to obtain a preprocessed image; According to a preset rule, the first component of the preprocessed image is transmitted to a first encoder, and the second component of the preprocessed image is transmitted to a second encoder; the first component of the preprocessed image is encoded by the first encoder; A second component of the pre-processed image is encoded by a second encoder.

7. An image decoding method, characterized in that: Applied to the image decoding device of claim 4, the method comprising: receiving data from a first encoder and decoding the data to obtain a first component; receiving data from a second encoder and decoding the data to obtain a second component; performing data conversion on the first component and the second component to obtain an image to be displayed; The image to be displayed is displayed.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded and executed by a processor to implement the steps performed in the image encoding method according to any one of claims 5 to 6.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded and executed by a processor to implement the steps performed in the image decoding method according to claim 7.

Citation Information

Patent Citations

  • Decoding device, decoding method, encoding device, and encoding method

    CN105917658A

  • Picture file processing method and system

    CN107071515A

  • Video data processing method and device, computer equipment and storage medium

    CN110536123A

  • Method for realizing YUV444 image coding and decoding based on H.265

    CN113365083A

  • Image coding method and device, image reconstruction method and device, electronic equipment and storage medium

    CN114866779A