An image data encoding method, an encoding device, a decoding method, and a decoding device
By converting the RGB color space to the YCbCr color space and dynamically adjusting the number of bits for secondary color components, the problem of large image and video data volume is solved, achieving more efficient data representation.
Patent Information
- Application Number
- CN202211262206.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-14
- Publication Date
- 2026-05-15
- Estimated Expiration
- 2042-10-14
AI Technical Summary
Under the same accuracy conditions, existing technologies result in a large amount of data for image and video data, which is difficult to reduce effectively.
By converting the RGB color space to the YCbCr color space, and using preset conversion relationships and quantization levels, the number of bits for secondary color components is dynamically adjusted to form encoded data.
Without reducing accuracy, the amount of image and video data has been reduced, achieving more efficient data representation.
Smart Images

Figure CN115633175B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image and video technology, and in particular to an image data encoding method, encoding device, decoding method, and decoding device. Background Technology
[0002] There are various methods for representing colors, such as RGB, YUV, YIQ, YCbCr, Lab, HSI, etc., collectively known as color spaces. In digital cameras and camcorders, RGB information is typically captured for image and video data acquisition, followed by storage or transmission. RGB can also be converted to other color spaces for compression encoding.
[0003] In the field of digital television, the YCbCr color space specified by standards such as CCIR BT.601 / 709 / 2020 is commonly used. YCbCr decomposes color into luminance and two color difference signals. Based on the different resolutions of the human eye for luminance and color difference signals, the color difference signal can be downsampled, thereby reducing the data volume of digital images and videos, facilitating subsequent encoding, storage, and transmission. When displaying images and videos on a monitor, the YCbCr color information is then converted to RGB format. Summary of the Invention
[0004] In view of the shortcomings of the prior art described above, the purpose of this application is to provide an image data encoding method, encoding device, decoding method and decoding device that can represent image data with fewer bits under the same precision conditions, thereby reducing the data volume of digital images and digital videos.
[0005] Firstly, an image data encoding method is provided, including:
[0006] Obtain the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space;
[0007] Based on the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space, the analog values of the fourth color component, the fifth color component, and the sixth color component of the target pixel in the second color space are obtained using the first preset conversion relationship.
[0008] Based on the analog value of the fourth color component and the preset quantization level, obtain the number of bits, quantization value and reconstructed analog value of the fourth color component;
[0009] Based on the reconstructed simulated value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components.
[0010] Based on the quantization level, value range, and analog value of the fifth and sixth color components, obtain the quantized values of the fifth and sixth color components.
[0011] The quantization values of the fourth, fifth, and sixth color components are represented by the number of bits of each component and arranged in a preset order to form encoded data.
[0012] Optionally, the first color space is the RGB color space, and the first, second, and third color components are the R component, G component, and B component, respectively; the second color space is the YCbCr color space, and the fourth, fifth, and sixth color components are the Y component, Cr component, and Cb component, respectively.
[0013] Optionally, the first preset conversion relationship is:
[0014] Y = α*R + B*G + γ*B
[0015] Cb=(BY) / (2-2*γ)
[0016] Cr=(RY) / (2-2*γ)
[0017] Where Y represents the simulated value of the Y component, R, G, and B represent the simulated values of the R, G, and B components in the RGB color space, respectively, α, β, and γ represent the contribution rates of the R, G, and B components to the Y component, respectively, and Cb and Cr represent the simulated values of the Cr and Cb components, respectively.
[0018] Optionally, based on the analog value of the fourth color component and a preset quantization level, the number of bits, quantization value, and reconstructed analog value of the fourth color component are obtained, specifically including:
[0019] Get 2 ty-1 <= L < 2 ty The ty value is used as the number of bits in the Y component, where L is the preset quantization level of the Y component;
[0020] The quantized value Y of the Y component is:
[0021] Y = floor(Y*L), where Y is the simulated value of the Y component;
[0022] The reconstructed simulated value Y' of the Y component is:
[0023] Y'=( Y +0.5) / L.
[0024] Optionally, based on the reconstructed analog value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and analog value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including:
[0025] The minimum value Crmin, the maximum value Crmax, and the interval length Crlen of the fifth color component are obtained according to the following formula:
[0026] Rmin = max{(Y'-1+α) / α, 0}
[0027] Rmax = min{Y' / α, 1}
[0028] Crmin=(Rmin-Y') / (2-2*α)
[0029] Crmax=(Rmax-Y') / (2-2*α),
[0030] Where Rmin and Rmax are the minimum and maximum values of the first color component R, respectively;
[0031] When 1 / 2 m+ 1 < Crlen <= 1 / 2 m Then through M = L / 2 m Obtain the quantization level M of the fifth color component, and obtain the number of bits tcr representing the fifth color component by tcr = ty - m;
[0032] according to Cr =floor((Cr-Crmin)*M) retrieves the quantized value of the Cr component. Cr .
[0033] Optionally, based on the reconstructed analog value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and analog value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including:
[0034] The minimum value Cbmin, maximum value Cbmax, and interval length Cblen of the Cb component are obtained according to the following formula:
[0035] Cr'=( Cr +0.5) / M+Crmin
[0036] R'=Cr'*(2-2*α)+Y'
[0037] Bmin=max{(Y'-β-α*R') / γ, 0}
[0038] Bmax = min{(Y'-α*R') / γ, 1}
[0039] Cbmin=(Bmin-Y') / (2-2*γ)
[0040] Cbmax=(Bmax-Y') / (2-2*γ)
[0041] Cblen = Cbmax - Cbmin
[0042] Where Cr' is the reconstructed simulated value of the Cr component, R' is the reconstructed simulated value of the R component, and Bmin and Bmax are the minimum and maximum values of the B component, respectively.
[0043] When 1 / 2 n+1 <Crlen<=1 / 2 n Then through N = L / 2 n Obtain the quantization level N of the Cb color component, and obtain the number of bits tcb of the Cb component through tcb = ty - n;
[0044] according to Cb =floor((Cb-Cbmin)*N) retrieves the quantized value of the Cb component. Cb .
[0045] Optionally, based on the reconstructed analog value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and analog value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including:
[0046] When the analog value of the Y component is 1, the quantized value of the Y component is Y = L-1.
[0047] When the simulated value of the Cr component is Cr = Crmax, then the quantized value of the Cr component is... Cr =M-1;
[0048] When the simulated value of the Cb component is Cb = Cbmax, then the quantized value of the Cb component is... Cb =N-1.
[0049] Secondly, an image data encoding device is provided, comprising:
[0050] The first data acquisition module is used to acquire the analog values of the first color component, the second color component and the third color component of the target pixel in the first color space;
[0051] The first color conversion module is used to obtain the simulated values of the fourth, fifth, and sixth color components of the target pixel in the second color space based on the simulated values of the first, second, and third color components of the target pixel in the first color space and using a first preset conversion relationship.
[0052] The first calculation module is used to obtain the number of bits, quantization value and reconstructed analog value of the fourth color component based on the analog value of the fourth color component and the preset quantization level.
[0053] The second calculation module is used to obtain the value range of the fifth and sixth color components based on the reconstructed simulation value of the fourth color component, so as to determine the quantization level and number of bits of the fifth and sixth color components.
[0054] The third calculation module is used to obtain the quantized values of the fifth and sixth color components based on the quantization level, value range, and analog value of the fifth and sixth color components.
[0055] The bit representation module is used to represent the quantization values of the fourth, fifth, and sixth color components using the number of bits of each component, and arranges them in a preset order to form encoded data.
[0056] Thirdly, an image data decoding method is provided, including:
[0057] Obtain the encoded data of the target pixel;
[0058] The preset quantization level and number of bits of the fourth color component of the target pixel in the second color space are obtained based on the encoded data of the target pixel.
[0059] The quantization value of the fourth color component is obtained from the encoded data based on the number of bits of the fourth color component;
[0060] The reconstructed simulation value of the fourth color component is obtained based on the quantization value of the fourth color component;
[0061] Based on the reconstructed simulated value of the fourth color component, the value range of the fifth and sixth color components of the target pixel in the second color space is obtained, so as to determine the quantization level and number of bits of the fifth and sixth color components.
[0062] The quantization values of the fifth and sixth color components are obtained from the encoded data based on the number of bits of the fifth and sixth color components.
[0063] Based on the quantization level, value range, and quantization value of the fifth and sixth color components, the reconstructed simulated values of the fifth and sixth color components are obtained.
[0064] Based on the reconstructed analog values of the fourth, fifth, and sixth color components, the reconstructed analog values of the first, second, and third color components of the target pixel in the first color space are obtained using the second preset conversion relationship to complete the decoding.
[0065] Fourthly, an image data decoding apparatus is provided, comprising:
[0066] The encoding data acquisition module is used to acquire the encoding data of the target pixel, and to acquire the preset quantization level and number of bits of the fourth color component of the target pixel in the second color space based on the encoding data of the target pixel.
[0067] The first quantization value acquisition module is used to acquire the quantization value of the fourth color component from the encoded data according to the number of bits of the fourth color component;
[0068] The fourth calculation module is used to obtain the reconstructed simulation value of the fourth color component based on the quantization value of the fourth color component;
[0069] The fifth calculation module is used to obtain the value range of the fifth and sixth color components of the target pixel in the second color space based on the reconstructed simulated value of the fourth color component, so as to determine the quantization level and number of bits of the fifth and sixth color components.
[0070] The second quantization value acquisition module is used to acquire the quantization values of the fifth color component and the sixth color component from the encoded data based on the number of bits of the fifth color component and the sixth color component.
[0071] The sixth calculation module is used to obtain the reconstructed simulated values of the fifth and sixth color components based on the quantization level, value range, and quantization value of the fifth and sixth color components.
[0072] The second color conversion module is used to obtain the reconstructed analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space based on the reconstructed analog values of the fourth color component, the fifth color component, and the sixth color component, using a second preset conversion relationship, so as to complete the decoding.
[0073] The above image data encoding method involves: acquiring the analog values of the first, second, and third color components of a target pixel in a first color space; acquiring the analog values of the fourth, fifth, and sixth color components of the target pixel in a second color space using a first preset conversion relationship based on the analog values of the first, second, and third color components in the first color space; acquiring the number of bits, quantization value, and reconstructed analog value of the fourth color component based on the analog value of the fourth color component and a preset quantization level; acquiring the value range of the fifth and sixth color components based on the reconstructed analog value of the fourth color component to determine the quantization level and number of bits of the fifth and sixth color components; acquiring the quantization value of the fifth and sixth color components based on the quantization level, value range, and analog value of the fifth and sixth color components; and representing their respective quantization values using the number of bits of the fourth, fifth, and sixth color components, and arranging them in a preset order to form encoded data. Using this invention, the value ranges of the secondary color components (the fifth and sixth color components) can be obtained based on the analog value of the primary color component (the fourth color component). The number of bits representing the secondary color components can be dynamically adjusted according to the value range of the secondary color components, and the adjusted number of bits can be used to represent the quantization value of each color component to form encoded data. This achieves the goal of representing the secondary color components with as few bits as possible. Attached Figure Description
[0074] Figure 1 A schematic diagram of the system architecture of the technical solution of this application is shown.
[0075] Figure 2 A flowchart illustrating the image data encoding method of this application is shown.
[0076] Figure 3 A functional block diagram of the image data encoding apparatus of this application is shown.
[0077] Figure 4 A flowchart illustrating the image data decoding method of this application is shown.
[0078] Figure 5 A functional block diagram of the image data decoding apparatus of this application is shown. Detailed Implementation
[0079] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application.
[0080] Please see Figure 1-5 It should be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0081] To better understand the embodiments of the present invention, the color spaces involved in the embodiments of the present invention will be introduced first.
[0082] Color spaces (or color systems) are typically represented by three-dimensional models, specifying three-dimensional coordinates that represent three parameters. This describes the position of a specific color within those coordinates. Therefore, color spaces are also referred to as color models (or color systems) in specific applications. Different color spaces can be designed based on their coordinate parameters. In the additive color mixing model, if a certain color and another color mixed with different proportions of the three primary colors appear identical to the human eye, we call these three primary color components the trichromatic stimulation values of that color. For questions regarding how to select the three primary colors, how to quantify them, and how to determine the stimulation values, there is a universal standard—the International Commission on Illumination (CIE) standard colorimetric system. This standard provides many color spaces, such as CIE 1931 RGB, CIE 1931 XYZ, CIE 1931 xyY, CIE 1976 L*u*v, and CIE 1976 L*a*b color spaces. Besides these, other color spaces can also be defined, such as LMS, CMYK, CIEYUV, HSL, HSB(HSV), YCbCr, etc. Color spaces can be expressed in various ways, and different color spaces may have different characteristics, but they can be converted to each other.
[0083] The system architecture involved in the embodiments of this application is described below. Please refer to... Figure 1 ,like Figure 1 A schematic diagram of an exemplary system architecture that can be applied to one or more embodiments of this application is shown. Figure 1As shown, the system architecture includes a source device 10, a network 30, and a terminal device 20. The source device 10 generates video data / image data encoded by image data. The terminal device 20 can decode and display the video data / image data encoded by image data. The network 120 can be a communication medium of various connection types that can provide a communication link between the source device 10 and the terminal device 20, such as a wired communication link or a wireless communication link.
[0084] Various embodiments of the source device 10 and the end device 20, or a combination of both, may include one or more processors and memory coupled to the one or more processors. The memory may include, but is not limited to, RAM, ROM, EEPROM, flash memory, or any other media as described herein that can be used to store desired program code in the form of computer-accessible instruction or data structures.
[0085] Source device 10 and / or end device 20 may include a variety of devices, including desktop computers, mobile computing devices, notebook (e.g., laptops), tablets, set-top boxes, mobile phones, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, monitors, projectors, video surveillance equipment, video conferencing equipment, webcasting equipment, or the like.
[0086] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of source devices 10, network 30, and terminal devices 20. Furthermore, the technical solutions provided in this application embodiment can be applied to the source device 10, or to the terminal device 20, or can be implemented jointly by the source device 10 and the terminal device 20; this application does not impose any special limitations in this regard.
[0087] In one embodiment of this application, the source device 10 can acquire the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space; based on the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space, it uses a first preset conversion relationship to acquire the analog values of the fourth color component, the fifth color component, and the sixth color component in the second color space; based on the analog value of the fourth color component and a preset quantization level, it acquires the number of bits, the quantization value, and the reconstructed analog value of the fourth color component; based on the reconstructed analog value of the fourth color component, it acquires the value range of the fifth color component and the sixth color component to determine the quantization level and the number of bits of the fifth color component and the sixth color component; based on the quantization level, the value range, and the analog value of the fifth color component and the sixth color component, it acquires the quantization value of the fifth color component and the sixth color component; it uses the number of bits of the fourth color component, the fifth color component, and the sixth color component to represent their respective quantization values, and arranges them in a preset order to form encoded data. It can obtain the value range of the secondary color components (the fifth and sixth color components) based on the analog value of the primary color component (the fourth color component), and dynamically adjust the number of bits representing the secondary color components according to the value range of the secondary color components. The adjusted number of bits is used to represent the quantization value of each color component to form encoded data, thereby achieving the goal of representing the secondary color components with the fewest possible number of bits.
[0088] In one embodiment of this application, the terminal device 20 can acquire encoded data of a target pixel; acquire a preset quantization level and number of bits of the fourth color component of the target pixel in the second color space based on the encoded data of the target pixel; acquire the quantization value of the fourth color component from the encoded data based on the number of bits of the fourth color component; acquire the reconstructed analog value of the fourth color component based on the quantization value of the fourth color component; and acquire the value range of the fifth and sixth color components of the target pixel in the second color space based on the reconstructed analog value of the fourth color component, so as to determine the fifth color component... The decoding process involves: determining the quantization level and number of bits for the fifth and sixth color components; obtaining the quantization values of the fifth and sixth color components from the encoded data based on their number of bits; obtaining the reconstructed analog values of the fifth and sixth color components based on their quantization level, range, and quantization value; and using a second preset conversion relationship to obtain the reconstructed analog values of the first, second, and third color components of the target pixel in the first color space, thereby completing the decoding.
[0089] The technical solution of the present invention will be described in detail below through specific embodiments.
[0090] Please see Figure 2 As shown, Figure 2 This is a flowchart illustrating an image data encoding method provided in an embodiment of this application. The image data encoding method of this application includes the following steps:
[0091] First, step S11 is executed: The analog values of the first color component, second color component, and third color component of the target pixel in the first color space are obtained. The target pixel can be, for example, a pixel to be encoded in video frame data or individual image data.
[0092] In an exemplary embodiment, the first color space is the RGB color space, and the first color component, the second color component, and the third color component are the R component, the G component, and the B component, respectively.
[0093] Obtain the three color components R, G, and B, each with a value range of [0, 1]. If the three components are quantized integers, denote them as follows: R , G , B Let the quantization level be K; then let the simulated values of the three components R, G, and B be:
[0094] R = ( R +0.5) / K
[0095] G = ( G +0.5) / K
[0096] B = ( B +0.5) / K.
[0097] Next, step S12 is executed: based on the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space, the analog values of the fourth color component, the fifth color component, and the sixth color component of the target pixel in the second color space are obtained using the first preset conversion relationship.
[0098] In one exemplary embodiment, the second color space is a YCbCr color space, and the fourth, fifth, and sixth color components are the luminance (Y) component, color difference (Cr) component, and color difference (Cb) component, respectively. The analog values of the R, G, and B color components can be converted to analog values of the Y, Cr, and Cb components using the following first preset conversion relationship. Since the human eye is more sensitive to the Y component of video or images, the Y component can be used as the primary color component, and the Cr and Cb components as secondary color components.
[0099] The first preset conversion relationship is as follows:
[0100] Y = α*R + B*G + γ*B
[0101] Cb=(BY) / (2-2*γ)
[0102] Cr=(RY) / (2-2*γ)
[0103] In the formula, Y represents the simulated value of the Y component, R, G, and B represent the simulated values of the R, G, and B components in the RGB color space, respectively, α, β, and γ represent the contribution rates of the R, G, and B components to the Y component, respectively, Cb and Cr represent the simulated values of the Cr and Cb components, and the values of α, β, and γ should be widely accepted values or values obtained through testing that conform to their physical meaning, such as 0.299, 0.587, and 0.114.
[0104] Next, step S13 is executed: based on the analog value of the fourth color component and the preset quantization level, the number of bits, quantization value and reconstructed analog value of the fourth color component are obtained.
[0105] In an exemplary embodiment, the preset quantization level L of the Y component can be reasonably set according to the accuracy requirements. After setting the preset quantization level L, the desired accuracy can be obtained. ty-1 <= L < 2 ty The ty value is used as the number of bits in the Y component, where L is the preset quantization level of the Y component;
[0106] Obtain the quantization value of the Y component Y for:
[0107] Y =floor(Y*L), where Y is the simulated value of the Y component;
[0108] The reconstructed simulation value Y' of the Y component is obtained as follows:
[0109] Y'=( Y +0.5) / L.
[0110] Next, steps S14 and S15 are executed: based on the reconstructed analog value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; based on the quantization level, value range, and analog value of the fifth and sixth color components, the quantized values of the fifth and sixth color components are obtained, wherein the value range includes the maximum value, minimum value, and interval length.
[0111] In an exemplary embodiment, the minimum value Crmin, the maximum value Crmax, and the interval length Crlen of the fifth color component (Cr component) can be obtained according to the following formula:
[0112] Rmin = max{(Y'1+α) / α, 0}
[0113] Rmax = min{Y' / α, 1}
[0114] Crmin=(Rmin-Y') / (2-2*d)
[0115] Crmax=(Rmax-Y') / (2-2*α),
[0116] Where Rmin and Rmax are the minimum and maximum values of the first color component R, respectively;
[0117] When 1 / 2 m+1 <Crlen <= 1 / 2 m Then through M = L / 2 m Obtain the quantization level M of the fifth color component, and obtain the number of bits tcr representing the fifth color component by tcr = ty - m;
[0118] according to Cr =floor((Cr-Crmin)*M) retrieves the quantized value of the Cr component. Cr The function floor(x) returns the largest integer less than or equal to x.
[0119] The minimum value Cbmin, maximum value Cbmax, and interval length Cblen of the Cb component can usually be obtained using the following formula:
[0120] Cr'=( Cr +0.5) / M+Crmin
[0121] R'=Cr'*(2-2*α)+Y'
[0122] Bmin=max{(Y'-β-α*R') / γ, 0}
[0123] Bmax = min{(Y'-α*R') / γ, 1}
[0124] Cbmin=(Bmin-Y') / (2-2*γ)
[0125] Cbmax=(Bmax-Y') / (2-2*γ)
[0126] Cblen = Cbmax - Cbmin
[0127] Where Cr' is the reconstructed simulated value of the Cr component, R' is the reconstructed simulated value of the R component, and Bmin and Bmax are the minimum and maximum values of the B component, respectively.
[0128] When 1 / 2 n+1 <Crlen <= 1 / 2 n Then through N = L / 2 n Obtain the quantization level N of the Cb color component, and obtain the number of bits tcb of the Cb component through tcb = ty - n;
[0129] according to Cb =floor((Cb-Cbmin)*N) retrieves the quantized value of the Cb component. Cb Let the reconstructed value of the Cb component be Cb' = ( Cb +0.5) / N+Cbmin.
[0130] It should be noted that, in the following special cases, the quantization values of the Y, Cr, and Cb components are obtained using the following methods:
[0131] When the analog value of the Y component is 1, the quantized value of the Y component is Y = L-1.
[0132] When the simulated value of the Cr component is Cr = Crmax, then the quantized value of the Cr component is... Cr =M-1;
[0133] When the simulated value of the Cb component is Cb = Cbmax, then the quantized value of the Cb component is... Cb =N-1.
[0134] As can be seen from the above, in this specific embodiment, the value range of the Cr component can be determined based on the value of the Y component, the value range of the Cb component can be determined based on the values of the Y and Cr components, and the number of bits representing the quantization values of Cr and Cb can be dynamically adjusted according to the value range of the Cr and Cb components, thereby achieving the goal of representing the Cr and Cb components with as few bits as possible.
[0135] It should be noted that in practical applications, the Cb component can be calculated first, and then the Cr component can be calculated. Only the calculation formula needs to be adjusted.
[0136] Finally, step S16 is executed: the number of bits of the fourth color component, the fifth color component, and the sixth color component are used to represent their respective quantization values, and they are arranged in a preset order to form encoded data.
[0137] In one exemplary embodiment, it can be based on quantized values. Y , Cr , Cb The bits are arranged in order to form the encoded data. Of course, the quantization values...Y , Cr , Cb The order can be adjusted as needed and is not limited to... Y , Cr , Cb The order.
[0138] It should be noted that the steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0139] The following example illustrates the encoding process of a single pixel in the RGB color space for image data. The entire encoding process includes:
[0140] Step 1: Obtain the values of the R, G, and B components of a pixel, for example, R = 0.7, G = 0.9, B = 0.8.
[0141] Step 2: Obtain the contribution rates of the R, G, and B components to the luminance component: α = 0.299, β = 0.587, γ = 0.114, and calculate the luminance Y.
[0142] Y = α*R + β*G + γ*B
[0143] = 0.299*0.4 + 0.587*0.6 + 0.114*0.8
[0144] =0.8288.
[0145] Step 3: Calculate Cb and Cr according to the following formulas.
[0146] Cb=(BY) / (2-2*γ)=-0.01625282;
[0147] Cr=(RY) / (2-2*α)=-0.09186876.
[0148] Step 4: Set the quantization level L of the brightness Y to 220. 8-1 <= L < 2 8 Let ty = 8, representing the number of bits for brightness Y.
[0149] Y =floor(Y*L)=182;
[0150] Y'=( Y +0.5) / L=0.82954545.
[0151] Step 5: Calculate the minimum value Crmin, the maximum value Crmax, and the interval length Crlen according to the following formulas:
[0152] Rmin=max{(Y'-1+α) / α,0}=max{0.42991789,0}=0.42991789;
[0153] Rmax=min{Y' / α,1}=min{2.7743995,1}=1;
[0154] Crmin=(Rmin-Y') / (2-2*α)=-0.2850411;
[0155] Crmax=(Rmax-Y') / (2-2*α)=0.12157956;
[0156] Crlen=Crmax-Crmin=0.40662066.
[0157] Step 6: Determine the quantization level of Cr and the number of bits representing Cr based on the quantization level L of Y and Crlen; since 1 / 2 2 <Crlen <= 1 / 2, the quantization series of Cr is M = L / 2 = 110, tcr = ty-1 = 7; let
[0158] Cr =floor((Cr-Crmin)*M)=21;
[0159] Cr'=( Cr +0.5) / M+Crmin=-0.08958655.
[0160] Step 7: Calculate the minimum value Cbmin, the maximum value Cbmax, and the interval length Cblen using the following formulas:
[0161] R'=Cr'*(2-2*α)+Y'=0.70394511;
[0162] Bmin=max{(Y'-β-α*R') / γ, 0}=0.03206586;
[0163] Bmax=min{(Y'-α*R') / γ, 1}=0.61906586;
[0164] Cbmin=(Bmin-Y') / (2-2*γ)=-0.4500449;
[0165] Cbmax=(Bmax-Y') / (2-2*γ)=-0.1187808;
[0166] Cblen=Cbmax-Cbmin=0.3312641.
[0167] Step 8: Determine the quantization level of Cb and the number of bits representing Cb based on the quantization level L of Y and Cblen; if 1 / 2 2 If <Cblen <= 1 / 2, then let the quantization series of Cb be N = L / 2 = 110, and tcb = ty-1 = 7. Let
[0168] Cb =floor((Cb-Cbmin)*N)=floor((-0.01625282-(-0.4500449))*110)=47;
[0169] Cb'=( Cb +0.5) / N+Cbmin=(47+0.5) / 110+(-0.4500449)=-0.01822672.
[0170] Step 9, according to Y, Cr , Cb The bits are arranged in order to form the encoded data:
[0171] 10110110,0010101,0101111.
[0172] As can be seen from the above example, the image data encoding method of this application can obtain the value range of Cr through the value of Y, and obtain the value range of Cb based on the values of Y and Cr. The number of bits representing Cr and Cb can be dynamically adjusted according to the value range of Cr and Cb, reducing the number of bits representing Cr and Cb to 7, thereby achieving the goal of representing Cr and Cb with as few bits as possible, thereby reducing the amount of data in digital images and digital videos.
[0173] It should be noted that the image data encoding method of this embodiment can also be combined with color difference signal downsampling. That is, color difference signal downsampling is performed first to reduce the amount of data in digital images and digital videos, and then the image data encoding method of this embodiment is used to further reduce the amount of data in digital images and digital videos.
[0174] Figure 3 This is a functional block diagram of an image data encoding apparatus provided in an embodiment of this application. Please refer to... Figure 3 As shown, the image data encoding device 11 includes a first data acquisition module 111, a first color conversion module 112, a first calculation module 113, a second calculation module 114, a third calculation module 115, and a bit representation module 116.
[0175] The first data acquisition module 111 is used to acquire the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space; the first color conversion module 112 is used to acquire the analog values of the fourth color component, the fifth color component, and the sixth color component of the target pixel in the second color space based on the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space, using a first preset conversion relationship; the first calculation module 113 is used to acquire the number of bits, the quantization value, and the weight of the fourth color component based on the analog value of the fourth color component and a preset quantization level. The system constructs simulated values; the second calculation module 114 is used to obtain the value range of the fifth and sixth color components based on the reconstructed simulated values of the fourth color component, so as to determine the quantization level and number of bits of the fifth and sixth color components; the third calculation module 115 is used to obtain the quantized values of the fifth and sixth color components based on the quantization level, value range and simulated values of the fifth and sixth color components; the bit representation module 116 is used to represent the quantized values of the fourth, fifth and sixth color components using the number of bits of the fourth, fifth and sixth color components, and arrange them in a preset order to form encoded data.
[0176] It should be noted that the image data encoding device of this embodiment is a device corresponding to the image data encoding method described above, and the functional modules in the image data encoding device may correspond to the corresponding steps in the image data encoding method. The image data encoding device of this embodiment can be implemented in conjunction with the image data encoding method. Accordingly, the relevant technical details mentioned in the image data encoding device of this embodiment can also be applied to the image data encoding method described above.
[0177] It should be noted that the functional modules of the image data encoding device 11 described above can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via a processing element; they can be fully implemented in hardware; or some modules can be implemented by the processing element calling software, while others are implemented in hardware. Additionally, these modules can be fully or partially integrated together, or implemented independently. The processing element mentioned here can be an integrated circuit with signal processing capabilities. In the implementation process, some or all of the steps of the above method, or the functional modules mentioned above, can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0178] The image data encoding method and encoding apparatus of this application acquire analog values of a first color component, a second color component, and a third color component of a target pixel in a first color space; based on the analog values of the first, second, and third color components of the target pixel in the first color space, acquire analog values of a fourth color component, a fifth color component, and a sixth color component of the target pixel in a second color space using a first preset conversion relationship; based on the analog value of the fourth color component and a preset quantization level, acquire the number of bits, the quantization value, and the reconstructed analog value of the fourth color component; based on the reconstructed analog value of the fourth color component, acquire the value range of the fifth and sixth color components to determine the quantization level and the number of bits of the fifth and sixth color components; based on the quantization level, the value range, and the analog value of the fifth and sixth color components, acquire the quantization value of the fifth and sixth color components; use the number of bits of the fourth, fifth, and sixth color components to represent their respective quantization values, and arrange them in a preset order to form encoded data. Using this invention, the value ranges of the secondary color components (the fifth and sixth color components) can be obtained based on the analog value of the primary color component (the fourth color component). The number of bits representing the secondary color components can be dynamically adjusted according to the value range of the secondary color components, and the adjusted number of bits can be used to represent the quantization value of each color component to form encoded data. This achieves the goal of representing the secondary color components with as few bits as possible.
[0179] It should be noted that the image data decoding method of this application embodiment can also be applied to encoding from RGB color space to YIQ, YUV, and YC1C2 color spaces.
[0180] Please see Figure 4 As shown, Figure 4 This is a flowchart illustrating an image data decoding method provided in an embodiment of this application. The image data decoding method in this embodiment includes the following steps:
[0181] Step S21: Obtain the encoded data of the target pixel, and the preset quantization level and number of bits of the fourth color component of the target pixel in the second color space;
[0182] Step S22: Obtain the quantization value of the fourth color component from the encoded data according to the number of bits of the fourth color component;
[0183] Step S23: Obtain the reconstructed simulation value of the fourth color component based on the quantization value of the fourth color component;
[0184] Step S24: Based on the reconstructed simulated value of the fourth color component, obtain the value range of the fifth and sixth color components of the target pixel in the second color space, so as to determine the quantization level and number of bits of the fifth and sixth color components;
[0185] Step S25: Obtain the quantization values of the fifth and sixth color components from the encoded data according to the number of bits of the fifth and sixth color components;
[0186] Step S26: Obtain the reconstructed simulated values of the fifth and sixth color components based on their quantization levels, value ranges, and quantization values.
[0187] Step S27: Based on the reconstructed analog values of the fourth, fifth, and sixth color components, use the second preset conversion relationship to obtain the reconstructed analog values of the first, second, and third color components of the target pixel in the first color space, so as to complete the decoding.
[0188] The image data decoding method in this application corresponds to the image data encoding method described above, and therefore will not be described in detail.
[0189] In an exemplary embodiment, the decoding process of the encoded YCbCr data obtained after encoding using the above-described image data encoding method is as follows:
[0190] Step 1: Obtain the encoded data of the target pixel () Y Quantization series L and representation Y Given the number of bits ty, obtain the contribution rates α, β, γ, where 2 ty-1 <= L < 2 ty .
[0191] Step 2: Read ty bits to obtain Y, and calculate Y' according to the following formula:
[0192] Y'=( Y +0.5) / L.
[0193] Step 3: Calculate the minimum value Crmin, the maximum value Crmax, and the interval length Crlen representing the Cr component. The calculation method is as follows:
[0194] Rmin=max{(Y'1+α) / α, 0};
[0195] Rmax = min{Y' / α, 1};
[0196] Crmin=(Rmin-Y') / (2-2*α);
[0197] Crmax = (Rmax - Y') / (2 - 2 * α);
[0198] Crlen = Crmax - Crmin.
[0199] Step 4: Calculate the quantization level M of the Cr component and the number of bits tcr representing Cr. If 1 / 2 m+1 <Crlen <= 1 / 2 m Let the quantization order of Cr be M = L / 2 m , tcr = ty - m;
[0200] Step 5: Read Cr And calculate Cr' as follows:
[0201] Cr'=( Cr +0.5) / M+Crmin.
[0202] Step 6: Calculate the minimum value Cbmin, the maximum value Cbmax, and the interval length Cblen representing the Cb component. The calculation method is as follows:
[0203] R'=Cr'*(2-2*α)+Y';
[0204] Bmin=max{(Y'-β-α*R') / γ, 0};
[0205] Bmax=min{(Y'-α*R') / γ, 1};
[0206] Cbmin=(Bmin-Y') / (2-2*γ);
[0207] Cbmax=(Bmax-Y') / (2-2*γ);
[0208] Cblen = Cbmax - Cbmin.
[0209] Step 7: Calculate the quantization series N and representation of the Cb components. Cb The number of bits tcb, if 1 / 2 n+1 <Cblen<=1 / 2 n Let the quantization series of Cb be M = L / 2 n , tcb=ty-n.
[0210] Step 8: Read Cb And calculate Cb' as follows:
[0211] Cb'=( Cb +0.5) / N+Cbmin.
[0212] Step 9: Calculate R', G', B' according to the second preset transformation relationship:
[0213] B' = Cb'*(2-2*γ)+Y';
[0214] R'=Cr'*(2-2*α)+Y';
[0215] G' = (Y' - α*R' - γ*B') / β;
[0216] Where R', G', and B' are the decoded values of the R, G, and B components.
[0217] The following will take the decoding process of the encoded data of a target pixel in image data as an example. The entire decoding process includes:
[0218] Step 1: Obtain the encoded data (10110110, 0010101, 0101111), obtain the quantization level L of Y and the number of bits representing Y ty, and obtain the contribution rates α = 0.299, β = 0.587, γ = 0.114. These data are agreed upon in advance by the encoder and decoder and are considered to be obtainable by the decoder.
[0219] Step 2: Read ty = 8 bits (10110110), treat it as an 8-bit binary integer, and obtain... Y =182, calculate Y' according to the following formula
[0220] Y'=(182+0.5) / 220=0.82954545.
[0221] Step 3: Calculate the minimum value Crmin, the maximum value Crmax, and the interval length Crlen representing Cr. The calculation method is as follows:
[0222] Rmin=max{(Y'1+α) / α,0}=max{0.42991789,0}=0.42991789;
[0223] Rmax=min{Y' / α,1}=min{2.7743995,1}=1;
[0224] Crmin=(Rmin-Y') / (2-2*α)=-0.2850411;
[0225] Crmax=(Rmax-Y') / (2-2*α)=0.12157956;
[0226] Crlen=Crmax-Crmin=0.40662066.
[0227] Step 4: Calculate the quantization order M and representation of Cr. Cr The number of bits tcr, 1 / 2 2<Crlen<=1 / 2, the quantization order of Cr is M=L / 2=110, tcr=ty-m=7.
[0228] Step 5: Read Cr The bits represent 0010101, thus Cr =21;
[0229] Cr'=( Cr +0.5) / M+Crmin=-0.08958655.
[0230] Step 6: Calculate the minimum, maximum, and interval length of Cb. The calculation method is as follows:
[0231] R'=Cr'*(2-2*α)+Y'=0.70394511
[0232] Bmin=max{(Y'-β-α*R') / γ, 0}=0.03206586
[0233] Bmax=min{(Y'-α*R') / γ, 1}=0.61906586
[0234] Cbmin=(Bmin-Y') / (2-2*γ)=-0.4500449
[0235] Cbmax=(Bmax-Y') / (2-2*γ)=-0.1187808
[0236] Cblen=Cbmax-Cbmin=0.3312641
[0237] Step 7: Calculate the quantization series N and representation of Cb. Cb The number of bits tcb, 1 / 2 2 If <Cblen <= 1 / 2, then the quantization series of Cb is M = L / 2 = 110, and tcb = ty - n = 7;
[0238] Step 8: Read Cb The bits represent 0101111, thus Cb =47, and calculate Cb' as follows.
[0239] Cb'=( Cb +0.5) / N+Cbmin=(47+0.5) / 110+(-0.4500449)=-0.01822672;
[0240] At this point, the values of Y, Cb, and Cr have been restored: Y', Cb', and Cr'. We can now continue to restore R', G', and B'.
[0241] Step 9: Calculate R', G', and B' using the following methods.
[0242] B'=Cb'*(2-2*γ)+Y'=0.797248;
[0243] R'=Cr'*(2-2*α)+Y'=0.703945;
[0244] G'=(Y'-α*R'-γ*B') / β=0.899795;
[0245] Where R', G', and B' are the decoded values of R, G, and B.
[0246] Figure 5 This is a functional block diagram of an image data decoding device provided in an embodiment of this application. Referring to the figure, the image data decoding device 21 includes an encoded data acquisition module 211, a first quantization value acquisition module 212, a fourth calculation module 213, a fifth calculation module 214, a second quantization value acquisition module 215, a sixth calculation module 216, and a second color conversion module 217.
[0247] The system includes: an encoding data acquisition module 211, used to acquire the encoding data of a target pixel, and a preset quantization level and number of bits for the fourth color component of the target pixel in the second color space; a first quantization value acquisition module 212, used to acquire the quantization value of the fourth color component from the encoding data based on the number of bits for the fourth color component; a fourth calculation module 213, used to acquire the reconstructed simulated value of the fourth color component based on the quantization value of the fourth color component; and a fifth calculation module 214, used to acquire the value ranges of the fifth and sixth color components of the target pixel in the second color space based on the reconstructed simulated value of the fourth color component, so as to determine the quantization of the fifth and sixth color components. The system includes: a level and a number of bits; a second quantization value acquisition module 215, used to acquire the quantization values of the fifth and sixth color components from the encoded data based on the number of bits of the fifth and sixth color components; a sixth calculation module 216, used to acquire the reconstructed analog values of the fifth and sixth color components based on the quantization level, value range, and quantization value of the fifth and sixth color components; and a second color conversion module 217, used to acquire the reconstructed analog values of the first, second, and third color components of the target pixel in the first color space using a second preset conversion relationship based on the reconstructed analog values of the fourth, fifth, and sixth color components, in order to complete the decoding.
[0248] It should be noted that the image data decoding device of this embodiment is a device corresponding to the image data decoding method described above, and the functional modules in the image data decoding device correspond to the corresponding steps in the image data decoding method. The image data decoding device of this embodiment can be implemented in conjunction with the image data decoding method. Accordingly, the relevant technical details mentioned in the image data decoding device of this embodiment can also be applied to the image data decoding method described above.
[0249] It should be noted that the functional modules of the aforementioned image data decoding device 22 can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via a processing element; they can be fully implemented in hardware; or some modules can be implemented by the processing element calling software, while others are implemented in hardware. Additionally, these modules can be fully or partially integrated together, or implemented independently. The processing element mentioned here can be an integrated circuit with signal processing capabilities. During implementation, some or all steps of the above method, or the functional modules mentioned above, can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0250] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application.
[0251] The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. An image data encoding method, characterized in that, include: Obtain the analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space, wherein the first color space is the RGB color space, and the first color component, the second color component, and the third color component are the R component, the G component, and the B component, respectively. Based on the analog values of the first, second, and third color components of the target pixel in the first color space, the analog values of the fourth, fifth, and sixth color components of the target pixel in the second color space are obtained using a first preset conversion relationship. The second color space is a YCbCr color space, and the fourth, fifth, and sixth color components are the Y component, Cr component, and Cb component, respectively. The first preset conversion relationship is as follows: Y = a* R+β*G+γ *B Cb = (BY) / (2-2*γ) Cr = (RY) / (2-2*γ) Where Y represents the simulated value of the Y component, R, G, and B represent the simulated values of the R, G, and B components in the RGB color space, respectively, α, β, and γ represent the contribution rates of the R, G, and B components to the Y component, respectively, and Cb and Cr represent the simulated values of the Cr and Cb components. Based on the analog value of the fourth color component and the preset quantization level, obtain the number of bits, quantization value, and reconstructed analog value of the fourth color component, including: obtaining the value that satisfies 2... ty-1 <=L<2 ty The ty value is used as the number of bits in the Y component, where L is the preset quantization level of the Y component; the quantization value of the Y component... Y for: Y = floor ( Y*L), where Y is the simulated value of the Y component; the reconstructed simulated value Y' of the Y component is: Y' = ( Y +0.5) / L; Based on the reconstructed simulated value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components. Based on the quantization level, value range, and analog value of the fifth and sixth color components, obtain the quantized values of the fifth and sixth color components. The quantization values of the fourth, fifth, and sixth color components are represented by the number of bits of each component and arranged in a preset order to form encoded data.
2. The image data encoding method according to claim 1, characterized in that, Based on the reconstructed simulated value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and simulated value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including: The minimum value Crmin, the maximum value Crmax, and the interval length Crlen of the fifth color component are obtained according to the following formula: Rmin = max{ (Y'-1+α) / α, 0} Rmax = min{ Y' / α, 1} Crmin = (Rmin-Y') / (2-2*α) Crmax = (Rmax-Y') / (2-2*α) , Where Rmin and Rmax are the minimum and maximum values of the first color component R, respectively; When 1 / 2 m+1 <Crlen<=1 / 2 m Then by M=L / 2 m Obtain the quantization level M of the fifth color component, and obtain the number of bits tcr representing the fifth color component by tcr=ty-m; according to Cr = floor ((Cr-Crmin)*M) to obtain the quantized value of the Cr component. Cr .
3. The image data encoding method according to claim 2, characterized in that, Based on the reconstructed simulated value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and simulated value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including: The minimum value Cbmin, maximum value Cbmax, and interval length Cblen of the Cb component are obtained according to the following formula: Cr’=( Cr +0.5) / M + Crmin R’ = Cr’* (2-2 *α)+ Y’ Bmin = max{ (Y'-β-α*R') / γ, 0} Bmax = min{ (Y'-α*R') / γ, 1} Cbmin = (Bmin-Y') / (2-2*γ) Cbmax = (Bmax-Y') / (2-2*γ) Cblen = Cbmax – Cbmin, Where Cr' is the reconstructed simulated value of the Cr component, R' is the reconstructed simulated value of the R component, and Bmin and Bmax are the minimum and maximum values of the B component, respectively. When 1 / 2 n+1 <Cblen<=1 / 2 n Then, through N=L / 2 n Obtain the quantization level N of the Cb color component, and obtain the number of bits tcb of the Cb component through tcb=ty-n; according to Cb = floor ((Cb-Cbmin)*N) obtains the quantized value of the Cb component. Cb .
4. The image data encoding method according to claim 3, characterized in that, Based on the reconstructed simulated value of the fourth color component, the value ranges of the fifth and sixth color components are obtained to determine the quantization level and number of bits of the fifth and sixth color components; and based on the quantization level, value range, and simulated value of the fifth and sixth color components, the quantization values of the fifth and sixth color components are obtained, specifically including: When the analog value of the Y component = 1, then the quantized value of the Y component is... Y = L – 1; When the simulated value of the Cr component is Cr = Crmax, then the quantized value of the Cr component is... Cr = M – 1; When the simulated value of the Cb component is Cb = Cbmax, then the quantized value of the Cb component is... Cb = N – 1.
5. An image data encoding device, characterized in that, include: The first data acquisition module is used to acquire the analog values of the first color component, the second color component and the third color component of the target pixel in the first color space, wherein the first color space is the RGB color space, and the first color component, the second color component and the third color component are the R component, the G component and the B component, respectively. The first color conversion module is used to obtain the analog values of the fourth, fifth, and sixth color components of the target pixel in the second color space based on the analog values of the first, second, and third color components in the first color space, using a first preset conversion relationship. The second color space is a YCbCr color space, and the fourth, fifth, and sixth color components are the Y component, Cr component, and Cb component, respectively. The first preset conversion relationship is as follows: Y = a* R+β*G+γ *B Cb = (BY) / (2-2*γ) Cr = (RY) / (2-2*γ) Where Y represents the simulated value of the Y component, R, G, and B represent the simulated values of the R, G, and B components in the RGB color space, respectively, α, β, and γ represent the contribution rates of the R, G, and B components to the Y component, respectively, and Cb and Cr represent the simulated values of the Cr and Cb components. The first calculation module is used to obtain the number of bits, quantization value, and reconstructed analog value of the fourth color component based on the analog value of the fourth color component and a preset quantization level, including: obtaining the value that satisfies 2 ty-1 <=L<2 ty The ty value is used as the number of bits in the Y component, where L is the preset quantization level of the Y component; the quantization value of the Y component... Y for: Y = floor ( Y*L), where Y is the simulated value of the Y component; the reconstructed simulated value Y' of the Y component is: Y' = ( Y +0.5) / L; The second calculation module is used to obtain the value range of the fifth and sixth color components based on the reconstructed simulation value of the fourth color component, so as to determine the quantization level and number of bits of the fifth and sixth color components. The third calculation module is used to obtain the quantized values of the fifth and sixth color components based on the quantization level, value range, and analog value of the fifth and sixth color components. The bit representation module is used to represent the quantization values of the fourth, fifth, and sixth color components using the number of bits of each component, and arranges them in a preset order to form encoded data.
6. An image data decoding method, characterized in that, include: The encoded data of the target pixel is obtained, as well as the preset quantization level and number of bits of the fourth color component of the target pixel in the second color space, wherein the encoded data of the target pixel is obtained based on the image data encoding method according to any one of claims 1-4; The quantization value of the fourth color component is obtained from the encoded data based on the number of bits of the fourth color component; The reconstructed simulation value of the fourth color component is obtained based on the quantization value of the fourth color component; Based on the reconstructed simulated value of the fourth color component, the value range of the fifth and sixth color components of the target pixel in the second color space is obtained, so as to determine the quantization level and number of bits of the fifth and sixth color components. The quantization values of the fifth and sixth color components are obtained from the encoded data based on the number of bits of the fifth and sixth color components. Based on the quantization level, value range, and quantization value of the fifth and sixth color components, the reconstructed simulated values of the fifth and sixth color components are obtained. Based on the reconstructed analog values of the fourth, fifth, and sixth color components, the reconstructed analog values of the first, second, and third color components of the target pixel in the first color space are obtained using the second preset conversion relationship to complete the decoding.
7. An image data decoding device, characterized in that, include: The encoding data acquisition module is used to acquire the encoding data of the target pixel, and the preset quantization level and number of bits of the fourth color component of the target pixel in the second color space, wherein the encoding data of the target pixel is acquired based on the image data encoding method according to any one of claims 1-4; The first quantization value acquisition module is used to acquire the quantization value of the fourth color component from the encoded data according to the number of bits of the fourth color component; The fourth calculation module is used to obtain the reconstructed simulation value of the fourth color component based on the quantization value of the fourth color component; The fifth calculation module is used to obtain the value range of the fifth and sixth color components of the target pixel in the second color space based on the reconstructed simulated value of the fourth color component, so as to determine the quantization level and number of bits of the fifth and sixth color components. The second quantization value acquisition module is used to acquire the quantization values of the fifth color component and the sixth color component from the encoded data based on the number of bits of the fifth color component and the sixth color component. The sixth calculation module is used to obtain the reconstructed simulated values of the fifth and sixth color components based on the quantization level, value range, and quantization value of the fifth and sixth color components. The second color conversion module is used to obtain the reconstructed analog values of the first color component, the second color component, and the third color component of the target pixel in the first color space based on the reconstructed analog values of the fourth color component, the fifth color component, and the sixth color component, using a second preset conversion relationship, so as to complete the decoding.