WO2022188070A1 - Image encoding method and apparatus, and image decoding method and apparatus - Google Patents

Image encoding method and apparatus, and image decoding method and apparatus Download PDF

Info

Publication number
WO2022188070A1
WO2022188070A1 PCT/CN2021/080029 CN2021080029W WO2022188070A1 WO 2022188070 A1 WO2022188070 A1 WO 2022188070A1 CN 2021080029 W CN2021080029 W CN 2021080029W WO 2022188070 A1 WO2022188070 A1 WO 2022188070A1
Authority
WO
WIPO (PCT)
Prior art keywords
residual
minimum
pixel value
value
block
Prior art date
Application number
PCT/CN2021/080029
Other languages
French (fr)
Chinese (zh)
Inventor
牛兵兵
赵文军
邱孟品
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2021/080029 priority Critical patent/WO2022188070A1/en
Publication of WO2022188070A1 publication Critical patent/WO2022188070A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • H04N19/122Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type

Definitions

  • the present application relates to the technical field of image processing, and in particular, to an image encoding method, apparatus, and computer-readable storage medium, and also to an image decoding method, apparatus, and computer-readable storage medium.
  • Encoding and compressing image data is an effective means to reduce bandwidth resources required for image data transmission, but the compression effect of existing image data encoding and decoding technologies still needs to be improved.
  • embodiments of the present application provide an image encoding method, device, and computer-readable storage medium, and an image decoding method, device, and computer-readable storage medium, one of the purposes is to ensure that the image quality is within an acceptable range to maximize compression performance.
  • a first aspect of the embodiments of the present application provides an image encoding method, including:
  • the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
  • the residual corresponding to each pixel value and the first minimum pixel value are compressed.
  • a second aspect of the embodiments of the present application provides an image decoding method, the method includes:
  • a plurality of pixel values for a plurality of pixels of the decoded image are determined.
  • a third aspect of the embodiments of the present application provides an image encoding apparatus, including: a processor and a memory storing a computer program, where the processor implements the following steps when executing the computer program:
  • the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
  • the residual corresponding to each pixel value and the first minimum pixel value are compressed.
  • a fourth aspect of an embodiment of the present application provides an image decoding apparatus, including: a processor and a memory storing a computer program, where the processor implements the following steps when executing the computer program:
  • a plurality of pixel values for a plurality of pixels of the decoded image are determined.
  • a fifth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image encoding method provided by the embodiments of the present application.
  • a sixth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image decoding method provided by the embodiments of the present application.
  • the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced.
  • the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness.
  • the perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
  • FIG. 1 is a flowchart of an image coding method provided by an embodiment of the present application.
  • FIG. 2 is a graph of logarithmic transformation provided by an embodiment of the present application.
  • FIG. 3 is a layout format diagram of an original raw image provided by an embodiment of the present application.
  • FIG. 4 is a graph of logarithmic transformation under specific parameters provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of block division provided by an embodiment of the present application.
  • FIG. 6 is a flowchart of an image decoding method provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an image decoding apparatus provided by an embodiment of the present application.
  • Encoding and compressing image data is an effective means to reduce the bandwidth resources required for image data transmission, but some image data encoding and decoding technologies do not consider the human eye's perception sensitivity to brightness changes, and the compression effect is not ideal.
  • FIG. 1 is a flowchart of the image encoding method provided by the embodiment of the present application.
  • the method can be applied to the encoding end, which includes the following steps:
  • S102 Acquire first data to be encoded corresponding to the image to be encoded.
  • S104 Determine a first minimum pixel value from a plurality of pixel values of the first data to be encoded.
  • the first data to be encoded may include multiple pixel values of multiple pixels in a block of the image to be encoded. Since the pixel value can represent the brightness, the pixel position with a small pixel value can correspond to the dark part in the image), and the pixel value is large. The pixel positions of can correspond to bright parts in the image.
  • the human eye's perceptual sensitivity to changes in brightness is different in dark and bright parts.
  • the human eye has a strong perceptual sensitivity to the brightness change of the dark part, that is, even a small brightness change in the dark part is easy to be detected by the human eye, while the human eye's perceptual sensitivity to the brightness change of the bright part is Relatively low, that is, it is not sensitive to the brightness change of the bright part, and has a high tolerance to the brightness error of the bright part. Therefore, in the process of image compression, high precision can be retained for the dark parts of the image, and the compression strength can be appropriately increased for the bright parts of the image, so that a balance between image quality and compression performance can be achieved. Guaranteed good picture quality.
  • the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced.
  • the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness.
  • the perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
  • the compression rate of the residual corresponding to the pixel value may be positively correlated with the size of the residual corresponding to the pixel value, that is, the larger the residual, the higher the compression rate of the residual, and the smaller the residual. The lower the compression ratio of this residual. Since the pixel value of the pixel in the dark part of the image corresponds to a small residual, and the small residual corresponds to a low compression rate, the residual corresponding to the pixel in the dark part of the image can be encoded with a low compression rate, so that the pixel in the dark part can be encoded with a low compression rate. Residuals corresponding to points can retain high accuracy.
  • the pixel value of the pixel in the bright part has a large residual error, and the large residual error corresponds to a large compression rate, a higher compression rate can be used for the pixel point in the bright part.
  • the corresponding residual is encoded, which reduces the amount of data transmitted on the basis of ensuring image quality.
  • the compression of the residual corresponding to each pixel value may be implemented by logarithmic transformation.
  • the logarithmic transformation can realize the mapping of values, that is, one value can be mapped to another value.
  • FIG. 2 is a graph of logarithmic transformation provided by an embodiment of the present application. It can be seen that the mapping relationship of the logarithmic transformation is similar to the logarithmic curve in the shape of the curve, that is, the slope of the curve tends to be flat as the independent variable increases. Therefore, the independent variable interval in the first half of the curve can be mapped to a larger The range of the independent variable in the second half can be mapped to a smaller range. It can be understood in conjunction with Figure 2.
  • the first half of the independent variable interval [a, b] can be mapped to the interval [A, B]
  • the second half of the independent variable interval of the same length as [a, b] [c,d] can be mapped to the interval [C,D] which is significantly smaller in length than [A,B].
  • the residuals corresponding to each pixel value are compressed by logarithmic transformation, so that the residuals with smaller values can retain higher precision after mapping, and the residuals with larger values can be larger.
  • the compression of strength conforms to the law that the human eye's perception sensitivity to changes in brightness is higher in the dark part than in the bright part.
  • the larger the light-sensing value of the camera Sensor ie the sensor
  • the larger the noise will be, so mapping the residual with a larger value to a smaller range can also remove the noise to a certain extent.
  • compressing the data may be to map the value of the data from the original range to a target range with a smaller overall value, and to realize this mapping, in one example, the value may be first converted into Its proportion in the original range, and then complete the final mapping according to the proportion and the target range.
  • the first residual can be used as the compression object for description, the first residual can be the residual corresponding to the first pixel value, and the first pixel value can be the first to-be-coded Any pixel value in the data.
  • the minimum residual range to which the first residual belongs may be determined, and the first target number of bits occupied by the first residual after compression may be determined , and compress the first residual according to the minimum residual range and the first target number of bits.
  • the minimum residual range to which the first residual belongs can be understood in combination with the original range described above, which can be used to convert the first residual to its proportion in the minimum residual range.
  • the first target number of bits can be understood in combination with the target range described above. For example, when the first target number of bits is 5, it means that the first residual is compressed to 5 bits, then the compressed first residual The maximum value cannot exceed 31 (2 5 -1), that is, the corresponding target range is [0,31].
  • the reason why the minimum residual error range to which the first residual belongs is determined, rather than any residual error range to which the first residual belongs, is to enable the first residual to retain higher accuracy after compression. Since the residual range to which the first residual belongs is used to convert the first residual to its corresponding proportion in the residual range, the residual range needs to match the value of the first residual, otherwise the compressed value will be reduced. The precision of the first residual. For example, if the value of the first residual is 18, the residual range to which the first residual belongs can be [0,31] (corresponding to 5 bits) or [0,63] (corresponding to 6 bits) , but the minimum residual range [0, 31] matches the first residual better, which can better preserve the accuracy of the compressed first residual.
  • the minimum residual error range corresponding to the block may be determined as the minimum residual error range to which the first residual belongs.
  • the first data to be encoded may correspond to a block in the image to be encoded
  • the first pixel value corresponding to the first residual may belong to the block
  • the minimum residual range corresponding to the block may be used as the minimum residual range to which the first residual belongs.
  • the maximum residual error may be determined from the residual errors corresponding to each pixel value of the block, and the minimum residual error range is determined according to the maximum residual error. For example, if a block can be a 16*1 data block, including 16 pixel values, the maximum residual difference diffmax among the residuals corresponding to the 16 pixel values can be determined, and the maximum residual difference diffmax can be determined according to the maximum residual difference. Determine the minimum residual range diffLD corresponding to the block.
  • the minimum residual range corresponding to this block does not have a high degree of adaptation to the first residual.
  • the residual range compresses the first residual, which will result in a larger reconstruction error of the first residual and affect the image quality.
  • the block can be divided into a plurality of sub-blocks, and the first pixel value corresponding to the first residual can belong to the first sub-block of the plurality of sub-blocks, then the The minimum residual range corresponding to a sub-block is used as the minimum residual range to which the first residual belongs. Since the sub-block contains fewer pixel values than the block, the difference between the residuals corresponding to different pixel values in the sub-block has a high probability to be reduced, so that the minimum residual value corresponding to the first sub-block will be reduced. The difference range has a higher probability and can better fit the first residual.
  • the maximum residual error may be determined according to the residual error corresponding to each pixel value in the first subblock, and the minimum residual error range may be determined according to the maximum residual error. For example, a 16*1 block can be divided into two 8*1 sub-blocks, then for the first sub-block, the residuals corresponding to the 8 pixel values in the first sub-block can be determined.
  • the maximum residual difference diffmax in , and the minimum residual error range diffLD corresponding to the first sub-block can be determined according to the maximum residual difference diffmax.
  • the residual corresponding to each pixel value is determined based on the first minimum pixel value of each pixel value in the block, after the block is divided into a plurality of sub-blocks, the first minimum pixel value only exists therein. In one sub-block, that is, for other sub-blocks, the actual minimum pixel value is not necessarily equal to the first minimum pixel value.
  • a second minimum pixel value of the plurality of pixel values in the first subblock may be determined, and a minimum value difference between the second minimum pixel value and the first minimum pixel value may be determined , the minimum residual error range corresponding to the first sub-block can be adjusted according to the minimum difference value, and the adjusted minimum residual error range can be re-determined as the minimum residual error range corresponding to the first sub-block.
  • the adjustment amount corresponding to the minimum value difference may be determined according to the first correspondence, so that The minimum residual error range corresponding to the first sub-block is adjusted according to the adjustment amount.
  • the first correspondence may be the correspondence between the minimum difference value, the adjustment amount, and the first index value.
  • the first correspondence may be the first table, and the first table may be recorded as adjTable.
  • the minimum difference value may correspond to the adjustment amount
  • the adjustment amount may correspond to the first index value adindex.
  • the second correspondence may be the correspondence between the maximum residual error, the minimum residual error range, and the second index value.
  • the second correspondence may be a second table, and the second table may be recorded as diffLDTable, in diffLDTable , the maximum residual difference diffmax may correspond to the minimum residual error range diffLD, and the minimum residual error range diffLD may correspond to the second index value diffindex.
  • the first index value corresponding to the adjustment amount may also be determined, and the first index value may be written into the code stream and transmitted to the decoding end.
  • the second index value corresponding to the minimum residual error range may also be determined, and the second index value may be written into the code stream and transmitted to the decoding end. Then, the decoding end can decode the code stream to obtain the first index value adindex and the second index value diffindex, and can determine the minimum residual error range corresponding to the first sub-interval by the following formula:
  • diffLD diffLDTable[diffindex]-adjTable[adindex].
  • the above diffLDTable table and adjTable table can be obtained by pre-configuration.
  • the maximum residual error range may be arranged in increments of the second index value, that is, the maximum residual error range corresponding to the last second index value may be set to the maximum value of the corresponding number of bits, but You can also make appropriate adjustments according to the real scene.
  • the first target number of bits occupied by the first residual after compression may be determined by allocation of the number of bits.
  • the encoding of the image data in this embodiment of the present application may adopt a fixed-length encoding manner, that is, the number of bits occupied by the image data of a specified scale after encoding may be fixed. In this way, on the basis of determining the total number of bits, the smallest block to which the first pixel value belongs (if the block is not divided, the smallest block is the block itself, if the block is divided, then The smallest block is the largest residual corresponding to the first sub-block where the first pixel value is located, and initial allocation of the number of bits is performed on the first residual.
  • the maximum residual corresponding to the minimum block is positively correlated with the number of bits available for the first residual in the initial allocation, that is, the larger the maximum residual corresponding to the minimum block, the greater the number of bits in the minimum block.
  • the residuals corresponding to the pixel values of can be allocated more bits.
  • the largest residual can correspond to the second index value based on the second correspondence
  • the first residual can also be mapped to the first residual according to the second index value corresponding to the smallest block to which the first pixel value belongs.
  • the initial allocation of the number of bits is performed.
  • the remaining bits can be preferentially allocated to the residuals corresponding to the pixel values at the division boundary.
  • the pixel value at the division boundary may be a pixel value adjacent or close to the division or division operation, for example, it may be the pixel value at the boundary of each sub-block, or the pixel at the boundary of the block. value.
  • the number of bits obtained from the initial allocation and the number of bits obtained from the remaining allocation are added to determine the first target bit corresponding to the first residual. digits.
  • the first residual can be converted into a proportion of the minimum residual range, and the proportion can be passed through gamma Transform and compress to a value range corresponding to the first target number of bits.
  • diff can represent the first residual to be compressed
  • diffLD can represent the minimum residual range to which the first residual belongs
  • It can represent the proportion corresponding to the first residual in the minimum residual range
  • the diffdepth can represent the first target number of bits corresponding to the first residual.
  • power(a, g) represents the g power of a
  • g can represent the gamma parameter value
  • 2 diffdepth -1 may represent a numerical range corresponding to the first target number of bits.
  • the value to be compressed by logarithmic transformation may be larger after compression by logarithmic transformation than before compression, which has the opposite effect. Therefore, in one embodiment, If the residual after compression is larger than the residual before compression, the value of the residual after compression may be modified to the value of the residual before compression, which corresponds to the second row of the above-mentioned first formula.
  • the decoding end reconstructs each pixel value based on the reconstructed first minimum pixel value and the residual, therefore, in order to reduce the reconstruction error, the coding end can compress the first minimum pixel value after compressing the compressed first pixel value.
  • the minimum pixel value is reconstructed (for example, it can be reconstructed by inverse logarithmic transformation) to obtain the reconstructed first minimum pixel value, so that when calculating the residual corresponding to each pixel value, each pixel value and the reconstructed first minimum value can be calculated.
  • the residual between the pixel values (which can be regarded as the corrected residual) can be compressed and transmitted to the decoding end after the residual determined based on the reconstructed first minimum pixel value.
  • a residual between each pixel value and the first minimum pixel value may be determined (the residual here is the difference between each pixel value and the original first minimum pixel value)
  • the actual residual between pixel values), and the maximum residual among the residuals corresponding to each pixel value can be determined, so that the theoretical maximum value of the first minimum pixel value can be determined according to the maximum residual, according to the theoretical maximum value
  • the second target number of bits occupied by the first minimum pixel value after compression may be determined, and the first minimum pixel value may be compressed according to the second target number of bits.
  • the number of bits corresponding to the pixel value is 12, that is, the theoretical maximum value of the pixel value can be 4095 (2 12 -1).
  • the residual between each pixel value and the first minimum pixel value is The maximum residual error in is 2500, then it can be determined that the theoretical maximum value of the first minimum pixel value is 1595, that is, 11 bits are enough to represent the first minimum pixel value, so it can be determined that the first minimum pixel value corresponds to the first minimum pixel value.
  • the target number of bits is 11, which can compress the first minimum pixel value from the original 12 bits to 11 bits.
  • the compression of the first minimum pixel value may also be performed by a logarithmic transformation.
  • the compressed first minimum pixel value may be transmitted to the decoding end, and the pixel position corresponding to the first minimum pixel value may also be written into the code stream and transmitted to the decoding end.
  • the image to be encoded may be an original raw image.
  • the original raw image may be an image in a bayer format, as shown in FIG. 3 , which is a layout format diagram of the original raw image provided by the embodiment of the present application.
  • Figure 3 shows four arrangements of (a), (b), (c), and (d) of the original raw image, which include pixels corresponding to different color components, such as R, Gr, Gb, B four pixels of each color component.
  • the original encoded data block of the to-be-encoded image may be de-interleaved to obtain the first color component. Corresponding encoded data block.
  • the original encoded data block of the to-be-encoded image can be a 128*1 data block, that is, a row of pixel values corresponding to one row (here is only an example, when memory resources are sufficient, an original encoded data block can also include multiple rows of pixel values. ), after de-interleaving the original encoded data block, two encoded data blocks corresponding to different color components of 64*1 can be obtained. Referring to FIG. 3 , when the original encoded data block corresponds to a row of pixels, the original encoded data block only includes pixel values corresponding to two color components.
  • the specific operation of de-interleaving may be to organize the pixels in the original raw image according to the color components to which they belong.
  • logarithmic transformation may be used for each pixel value in the encoded data block corresponding to the first color component.
  • compression here can reduce the size of the pixel value as a whole and improve the compression performance.
  • expression of logarithmic transformation has the same form as the first formula mentioned above, and can be expressed as follows:
  • inmax is the maximum value corresponding to the number of bits occupied by the original pixel value.
  • the number of bits occupied by the original pixel value is 14, then inmax can be 16383 (2 14-1 )
  • bl Black level
  • A is the bit occupied after compression
  • the maximum value corresponding to the number of bits can be, for example, 4095 (2 12 -1), that is, the compression target is to compress the original pixel value of each pixel to 12 bits.
  • the first to-be-encoded data block After compressing the pixel values in the encoded data block corresponding to the first color component, the first to-be-encoded data block can be obtained.
  • the encoded data block corresponding to the first color component is a 64*1 data block
  • the first to-be-encoded data block obtained by compressing it is still a 64*1 data block.
  • the first data block to be encoded may be divided to obtain a plurality of first data to be encoded. Referring to FIG. 5, FIG. 5 is a schematic diagram of block division provided by an embodiment of the present application. If the first data block to be encoded is called a block and the first data to be encoded is called a slice, in the example shown in FIG.
  • a block (64*1 data block) can be divided into 4 slices, that is, each slice can correspond to a 16*1 data block. After a plurality of first data to be encoded are obtained by division, each of the first data to be encoded may be processed separately, and the specific processing method can be described above, and will not be repeated here.
  • the remaining number of bits may be preferentially allocated to the residual corresponding to the pixel value at the division boundary.
  • the pixel values at the division boundaries may further include pixel values at the boundaries of the respective first data blocks to be encoded and pixel values at the boundaries of the first data blocks to be encoded.
  • the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced.
  • the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness.
  • the perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
  • the method provided by the embodiment of the present application takes into account the characteristics of the original raw image in the bayer format, de-interleaves the original raw image, and encodes and decodes the encoded data blocks corresponding to each color component.
  • the original raw images in the format also have better compression performance.
  • FIG. 6 is a flowchart of an image decoding method provided by an embodiment of the present application.
  • the method can be applied to the decoding end, and the method can include:
  • S602 Obtain first data to be decoded corresponding to the image to be decoded.
  • the decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and a plurality of residuals, where the residual obtained by decoding is determined based on the first minimum pixel value, so according to the plurality of residuals and The first minimum pixel value can be reconstructed to obtain multiple pixel values of the target image.
  • the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  • the data to be decoded includes the plurality of compressed residuals, and the decompressing the data to be decoded includes:
  • the compressed residuals are decompressed by inverse log transformation.
  • the decompression of the compressed residuals is performed by inverse logarithmic transformation, including:
  • the compressed first residual is decompressed according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, wherein the first residual is decompressed.
  • a residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block.
  • the compressed first residual is Unzip, including:
  • the compressed first residual is decompressed by inverse gamma transform to obtain the proportion of the first residual corresponding to the minimum residual range;
  • the first residual is determined according to the proportion and the minimum residual range.
  • the decoding end can decompress the compressed residual through inverse logarithmic transformation.
  • the decompression process is the opposite of the compression process, and the calculation formula corresponding to the decompression can be derived in combination with the first formula provided above.
  • the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error range and the second The corresponding relationship between index values, where the second index value is obtained by decoding the data to be decoded.
  • the decoding end can use the second index value decoded in the code stream and the second corresponding relationship preconfigured by the local end that is the same as that of the coding end, to Determines the minimum residual range to which the first residual belongs.
  • the minimum residual range to which the first residual belongs is determined in the following manner:
  • the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value
  • the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value
  • the first Both the index value and the second index value are decoded from the data to be decoded.
  • the decoding end can use the first index value and the second index value decoded in the code stream, according to the first index value and the first corresponding relationship pre-configured by the local end. , the adjustment amount can be determined, and according to the second index value and the second correspondence, the minimum residual error range to which the first residual belongs can be determined, so that the minimum residual error range can be adjusted according to the adjustment amount to determine the first residual error The minimum residual range to which it ultimately belongs.
  • the determining, according to the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the image to be decoded includes:
  • Decompressing is performed according to the first minimum pixel value and the plurality of residuals to obtain a plurality of pixel values of a plurality of pixels of the image to be decoded.
  • the performing decompression according to the first minimum pixel value and the plurality of residuals includes:
  • Decompression is performed by inverse log transform based on the first minimum pixel value and the plurality of residuals.
  • the decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and multiple residuals, and can, according to the multiple residuals and the first minimum pixel value, Multiple pixel values of the resulting image can be reconstructed. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, it is not necessary to transmit the original pixel value of each pixel, thus reducing the amount of data transmitted.
  • each pixel value is reconstructed based on the first minimum pixel value, so the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is related to the human eye's perception sensitivity to brightness changes.
  • the dark part is higher than the bright part in accordance with the law, which can improve the compression performance and ensure good image quality.
  • the image encoding method and the image decoding method provided by the embodiments of the present application may be applied to the process in which the camera sensor transmits the collected raw raw image to an image processing chip such as an ISP.
  • FIG. 7 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application.
  • the apparatus includes: a processor 710 and a memory 720 storing a computer program, the processor implements the following steps when executing the computer program:
  • the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
  • the residual corresponding to each pixel value and the first minimum pixel value are compressed.
  • the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  • the processor when compressing the residual corresponding to each pixel value, is configured to compress the residual corresponding to each pixel value by logarithmic transformation.
  • the processor when compressing the residual corresponding to each pixel value by logarithmic transformation, is used to determine the minimum residual range to which the first residual belongs, where the first residual is The residual corresponding to the first pixel value, the first pixel value is any pixel value in the block; determine the first target number of bits occupied by the first residual after compression; according to the minimum The residual range and the first target number of bits compress the first residual.
  • the processor is configured to convert the first residual into the minimum residual when compressing the first residual according to the minimum residual range and the first target number of bits.
  • the ratio of the residual range; the ratio is compressed into the numerical range corresponding to the first target bit number through gamma transformation.
  • the minimum residual range to which the first residual belongs is the minimum residual range corresponding to the block
  • the processor is used to determine the minimum residual range corresponding to the block when determining the minimum residual range corresponding to the block.
  • the maximum residual of the residual corresponding to each pixel value in the block; the minimum residual range is determined according to the maximum residual.
  • the block is divided into multiple sub-blocks, the first pixel value belongs to the first sub-block of the multiple sub-blocks, and the minimum residual range to which the first residual belongs is: the minimum residual error range corresponding to the first sub-block, when the processor determines the minimum residual error range corresponding to the first sub-block, to determine each pixel value in the first sub-block The corresponding maximum residual error of the residual error; the minimum residual error range is determined according to the maximum residual error.
  • the processor is further configured to determine a second minimum pixel value of a plurality of pixel values in the first subblock; according to the difference between the second minimum pixel value and the first minimum pixel value; The minimum residual error range corresponding to the first sub-block is adjusted to determine the adjusted minimum residual error range for the first sub-block.
  • the processor adjusts the minimum residual error range corresponding to the first sub-block according to the minimum value difference between the second minimum pixel value and the first minimum pixel value,
  • the adjustment amount corresponding to the minimum difference value is determined according to the first correspondence, and the first sub-block is adjusted according to the adjustment amount.
  • the minimum residual error range corresponding to the block is adjusted, and the first correspondence is the correspondence between the pre-configured minimum difference value and the adjustment amount.
  • the first corresponding relationship is the corresponding relationship between the minimum difference value, the adjustment amount and the first index value
  • the processor is further configured to determine, according to the first corresponding relationship, the first corresponding relationship of the adjustment amount.
  • An index value, the first index value is used for transmission to the decoding end.
  • the processor when determining the minimum residual error range according to the maximum residual error, is configured to determine, according to a second correspondence relationship, a minimum residual error range corresponding to the maximum residual error, and the second correspondence relationship is the correspondence between the preconfigured maximum residual and the minimum residual range.
  • the second correspondence is a correspondence between the maximum residual, the minimum residual range and the second index value
  • the processor is further configured to determine the minimum residual range according to the second correspondence The corresponding second index value, the second index value is used for transmission to the decoding end.
  • the processor determines the first target number of bits occupied by the first residual after compression, according to the corresponding pixel value in the minimum block to which the first pixel value belongs.
  • the maximum residual of the residual the initial allocation of the number of bits is performed on the first residual to determine the first target number of bits.
  • the processor is further configured to, if there is a remaining number of bits after the initial allocation, preferentially assign the remaining number of bits to the corresponding pixel values of the first data to be encoded at the division boundary. of the residuals.
  • the processor is further configured to, if the compressed residual is larger than the uncompressed residual, modify the value of the compressed residual to the value of the uncompressed residual.
  • the processor when determining the residual corresponding to each pixel value in the plurality of pixel values according to the first minimum pixel value, is configured to use the compressed first minimum pixel value. Reconstruction is performed to obtain the reconstructed first minimum pixel value; the residual between each of the pixel values and the reconstructed first minimum pixel value is determined as the residual corresponding to each pixel value.
  • the processor is configured to, when compressing the first minimum pixel value, determine the largest residual error among the residual errors corresponding to each pixel value in the plurality of pixel values;
  • the maximum residual determines the second target number of bits occupied by the first minimum pixel value after compression; the first minimum pixel value is compressed according to the second target number of bits.
  • the first data to be encoded is obtained by dividing a first data block to be encoded of the image to be encoded.
  • the to-be-encoded image includes an original raw image.
  • the first data block to be encoded is obtained based on the encoded data block corresponding to the first color component of the image to be encoded.
  • the encoded data block corresponding to the first color component is obtained by de-interleaving the original encoded data block of the image to be encoded.
  • the first data block to be encoded is obtained by compressing the encoded data block corresponding to the first color component.
  • the processor is configured to compress each pixel value in the encoded data block corresponding to the first color component by logarithmic transformation when compressing the encoded data block corresponding to the first color component.
  • the encoding end can determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and can compress the residual corresponding to each pixel value and the first minimum pixel value. Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced.
  • the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness.
  • the perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
  • FIG. 8 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application.
  • the apparatus comprises: a processor 810 and a memory 820 storing a computer program, the processor implements the following steps when executing the computer program:
  • a plurality of pixel values for a plurality of pixels of the decoded image are determined.
  • the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  • the first data to be decoded includes the plurality of compressed residuals
  • the processor is configured to, when decompressing the first data to be decoded, decompress the plurality of compressed residuals.
  • the residuals are decompressed by inverse log transformation.
  • the processor when the processor decompresses the compressed residuals through inverse logarithmic transformation, the processor is configured to, according to the minimum residual range to which the first residual belongs, and the first residual At the first target number of bits occupied after compression, decompress the compressed first residual, wherein the first residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block.
  • the processor performs a process on the compressed first residual.
  • it is used to decompress the compressed first residual through inverse gamma transform according to the first target number of bits, so as to obtain that the first residual is within the minimum residual range
  • the corresponding ratio; the first residual is determined according to the ratio and the minimum residual range.
  • the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error range and the second index value.
  • the second index value is obtained by decoding from the first data to be decoded.
  • the processor when determining the minimum residual error range to which the first residual belongs, is configured to: determine the minimum residual error range according to the second correspondence and the second index value; according to the first correspondence and The first index value determines the adjustment amount corresponding to the minimum residual error range; the minimum residual error range is adjusted according to the adjustment amount, and the adjusted minimum residual error range is determined as the one to which the first residual error belongs.
  • the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value
  • the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value
  • the first Both the index value and the second index value are decoded from the first data to be decoded.
  • the processor determines, according to the first minimum pixel value and the plurality of residuals, the plurality of pixel values for the plurality of pixels of the to-be-decoded image
  • the processor is configured to, according to the first The minimum pixel value and the multiple residuals are decompressed to obtain multiple pixel values of multiple pixels of the to-be-decoded image.
  • the first data to be decoded includes the compressed first minimum pixel value
  • the processor is used to decompress the compressed first data to be decoded.
  • a minimum pixel value is decompressed by an inverse log transform.
  • the decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and multiple residuals, and can, according to the multiple residuals and the first minimum pixel value, Multiple pixel values of the resulting image can be reconstructed. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced.
  • each pixel value is reconstructed based on the first minimum pixel value, so the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is related to the human eye's perception sensitivity to brightness changes.
  • the dark part is higher than the bright part in accordance with the law, which can improve the compression performance and ensure good image quality.
  • the embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image encoding method provided by the embodiments of the present application.
  • the embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program implements the image decoding method provided by the embodiment of the present application when the computer program is executed by the processor.
  • Embodiments of the present application may take the form of a computer program product implemented on one or more storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having program code embodied therein.
  • Computer-usable storage media includes permanent and non-permanent, removable and non-removable media, and storage of information can be accomplished by any method or technology.
  • Information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • PRAM phase-change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM Electrically Erasable Programmable Read Only Memory
  • Flash Memory or other memory technology
  • CD-ROM Compact Disc Read Only Memory
  • CD-ROM Compact Disc Read Only Memory
  • DVD Digital Versatile Disc
  • Magnetic tape cassettes magnetic tape magnetic disk storage or other magnetic storage devices or any other non-

Abstract

The present application discloses an image encoding method, comprising: acquiring first data to be encoded corresponding to an image to be encoded, wherein said first data comprises a plurality of pixel values of a plurality of pixels of a block in said image; from among the plurality of pixel values, determining a first minimum pixel value for the plurality of pixel values; according to the first minimum pixel value, determining a residual corresponding to each pixel value from among the plurality of pixel values; and compressing the residual corresponding to each pixel value, and the first minimum pixel value. By means of the image encoding and decoding methods disclosed in the present application, a relatively high precision can be retained for a dark part of an image, which conforms to the law that the sensing sensitivity of human eyes to a brightness change at a dark part is higher than that at a bright part, such that the compression performance is improved, and a good image quality is also ensured.

Description

图像编码方法、装置及图像解码方法、装置Image coding method and device, and image decoding method and device 技术领域technical field
本申请涉及图像处理技术领域,尤其涉及一种图像编码方法、装置以及计算机可读存储介质,还涉及一种图像解码方法、装置以及计算机可读存储介质。The present application relates to the technical field of image processing, and in particular, to an image encoding method, apparatus, and computer-readable storage medium, and also to an image decoding method, apparatus, and computer-readable storage medium.
背景技术Background technique
随着图像分辨率的提高以及视频帧率的提高,图像数据的规模愈加庞大,图像数据的传输将消耗大量的带宽资源。尤其对于带宽资源相对有限的系统,例如SOC(System-on-a-Chip)芯片系统,带宽不足将直接影响系统的工作效率,因此有必要采取手段以降低图像数据传输所需要的带宽资源。With the improvement of image resolution and the improvement of video frame rate, the scale of image data becomes larger and larger, and the transmission of image data will consume a lot of bandwidth resources. Especially for systems with relatively limited bandwidth resources, such as SOC (System-on-a-Chip) chip systems, insufficient bandwidth will directly affect the work efficiency of the system, so it is necessary to take measures to reduce the bandwidth resources required for image data transmission.
对图像数据进行编码压缩是一种降低图像数据传输所需带宽资源的有效手段,但现有的图像数据编解码技术的压缩效果仍有待提高。Encoding and compressing image data is an effective means to reduce bandwidth resources required for image data transmission, but the compression effect of existing image data encoding and decoding technologies still needs to be improved.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请实施例提供了一种图像编码方法、装置以及计算机可读存储介质以及一种图像解码方法、装置以及计算机可读存储介质,目的之一是在确保画质处于可接受范围的前提下尽可能提高压缩性能。In view of this, embodiments of the present application provide an image encoding method, device, and computer-readable storage medium, and an image decoding method, device, and computer-readable storage medium, one of the purposes is to ensure that the image quality is within an acceptable range to maximize compression performance.
本申请实施例第一方面提供一种图像编码方法,包括:A first aspect of the embodiments of the present application provides an image encoding method, including:
获取待编码图像对应的第一待编码数据,所述第一待编码数据包括关于所述待编码图像中一区块的多个像素的多个像素值;acquiring first data to be encoded corresponding to the image to be encoded, the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
从所述多个像素值中确定关于所述多个像素值的第一最小像素值;determining a first minimum pixel value for the plurality of pixel values from the plurality of pixel values;
根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差;determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values;
对各像素值对应的所述残差以及所述第一最小像素值进行压缩。The residual corresponding to each pixel value and the first minimum pixel value are compressed.
本申请实施例第二方面提供一种图像解码方法,所述方法包括:A second aspect of the embodiments of the present application provides an image decoding method, the method includes:
获取待解码图像对应的第一待解码数据;obtaining the first to-be-decoded data corresponding to the to-be-decoded image;
将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差;decompressing the first data to be decoded to determine a first minimum pixel value and a plurality of residuals;
根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多 个像素值。From the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the decoded image are determined.
本申请实施例第三方面提供一种图像编码装置,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:A third aspect of the embodiments of the present application provides an image encoding apparatus, including: a processor and a memory storing a computer program, where the processor implements the following steps when executing the computer program:
获取待编码图像对应的第一待编码数据,所述第一待编码数据包括关于所述待编码图像中一区块的多个像素的多个像素值;acquiring first data to be encoded corresponding to the image to be encoded, the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
从所述多个像素值中确定关于所述多个像素值的第一最小像素值;determining a first minimum pixel value for the plurality of pixel values from the plurality of pixel values;
根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差;determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values;
对各像素值对应的所述残差以及所述第一最小像素值进行压缩。The residual corresponding to each pixel value and the first minimum pixel value are compressed.
本申请实施例第四方面提供一种图像解码装置,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:A fourth aspect of an embodiment of the present application provides an image decoding apparatus, including: a processor and a memory storing a computer program, where the processor implements the following steps when executing the computer program:
获取待解码图像对应的第一待解码数据;obtaining the first to-be-decoded data corresponding to the to-be-decoded image;
将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差;decompressing the first data to be decoded to determine a first minimum pixel value and a plurality of residuals;
根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多个像素值。From the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the decoded image are determined.
本申请实施例第五方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像编码方法。A fifth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image encoding method provided by the embodiments of the present application.
本申请实施例第六方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像解码方法。A sixth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image decoding method provided by the embodiments of the present application.
本申请实施例提供的图像编码方法,编码端可以根据各像素值对应的第一最小像素值确定各像素值对应的残差,并可以将各像素值对应的残差以及第一最小像素值压缩后传输给解码端,从而解码端可以基于各像素值对应的残差以及第一最小像素值重建得到各像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,由于各像素值对应的残差是基于第一最小像素值确定的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image coding method provided by the embodiment of the present application, the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced. In addition, since the residual corresponding to each pixel value is determined based on the first minimum pixel value, the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness. The perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative labor.
图1是本申请实施例提供的图像编码方法的流程图。FIG. 1 is a flowchart of an image coding method provided by an embodiment of the present application.
图2是本申请实施例提供的对数变换的曲线图。FIG. 2 is a graph of logarithmic transformation provided by an embodiment of the present application.
图3是本申请实施例提供的原始raw图像的排布格式图。FIG. 3 is a layout format diagram of an original raw image provided by an embodiment of the present application.
图4是本申请实施例提供的特定参数下的对数变换的曲线图。FIG. 4 is a graph of logarithmic transformation under specific parameters provided by an embodiment of the present application.
图5是本申请实施例提供的block划分示意图。FIG. 5 is a schematic diagram of block division provided by an embodiment of the present application.
图6是本申请实施例提供的图像解码方法的流程图。FIG. 6 is a flowchart of an image decoding method provided by an embodiment of the present application.
图7是本申请实施例提供的图像编码装置的结构示意图。FIG. 7 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application.
图8是本申请实施例提供的图像解码装置的结构示意图。FIG. 8 is a schematic structural diagram of an image decoding apparatus provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
随着图像分辨率的提高以及视频帧率的提高,图像数据的规模愈加庞大,图像数据的传输将消耗大量的带宽资源。尤其对于带宽资源相对有限的系统,例如SOC(System-on-a-Chip)芯片系统,带宽不足将直接影响系统的工作效率,因此有必要采取手段以降低图像数据传输所需要的带宽资源。With the improvement of image resolution and the improvement of video frame rate, the scale of image data becomes larger and larger, and the transmission of image data will consume a lot of bandwidth resources. Especially for systems with relatively limited bandwidth resources, such as SOC (System-on-a-Chip) chip systems, insufficient bandwidth will directly affect the work efficiency of the system, so it is necessary to take measures to reduce the bandwidth resources required for image data transmission.
对图像数据进行编码压缩是一种降低图像数据传输所需带宽资源的有效手段,但一些图像数据编解码技术并未考虑人眼对亮度变化的感知敏感度,压缩效果不够理想。Encoding and compressing image data is an effective means to reduce the bandwidth resources required for image data transmission, but some image data encoding and decoding technologies do not consider the human eye's perception sensitivity to brightness changes, and the compression effect is not ideal.
为此,本申请实施例提供一种图像编码方法,可以参考图1,图1是本申请实施例提供的图像编码方法的流程图。该方法可以应用于编码端,其包括以下步骤:To this end, an embodiment of the present application provides an image encoding method, and reference may be made to FIG. 1 , which is a flowchart of the image encoding method provided by the embodiment of the present application. The method can be applied to the encoding end, which includes the following steps:
S102、获取待编码图像对应的第一待编码数据。S102: Acquire first data to be encoded corresponding to the image to be encoded.
S104、从第一待编码数据的多个像素值中确定第一最小像素值。S104. Determine a first minimum pixel value from a plurality of pixel values of the first data to be encoded.
S106、根据第一最小像素值,确定所述多个像素值中各像素值对应的残差。S106. Determine, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values.
S108、对各像素值对应的残差以及第一最小像素值进行压缩。S108: Compress the residual corresponding to each pixel value and the first minimum pixel value.
第一待编码数据可以包括待编码图像的一区块的多个像素的多个像素值,由于像素值可以表征亮度,因此,像素值小的像素位置可以对应图像中的暗部),像素值大的像素位置可以对应图像中的亮部。The first data to be encoded may include multiple pixel values of multiple pixels in a block of the image to be encoded. Since the pixel value can represent the brightness, the pixel position with a small pixel value can correspond to the dark part in the image), and the pixel value is large. The pixel positions of can correspond to bright parts in the image.
人眼对亮度变化的感知敏感度在暗部和亮部是不同的。具体而言,人眼对于暗部的亮度变化有较强的感知敏感度,即在暗部即便是较小的亮度变化也容易被人眼发现,而人眼对亮部的亮度变化的感知敏感度则相对较低,即对亮部的亮度变化并不敏感,对亮部的亮度误差有较高的容忍度。因此,在图像压缩的过程中,对图像的暗部可以保留较高的精度,对图像的亮部可以适当提高压缩力度,从而可以实现画质与压缩性能之间的平衡,在提高压缩性能的同时保证良好的画质。The human eye's perceptual sensitivity to changes in brightness is different in dark and bright parts. Specifically, the human eye has a strong perceptual sensitivity to the brightness change of the dark part, that is, even a small brightness change in the dark part is easy to be detected by the human eye, while the human eye's perceptual sensitivity to the brightness change of the bright part is Relatively low, that is, it is not sensitive to the brightness change of the bright part, and has a high tolerance to the brightness error of the bright part. Therefore, in the process of image compression, high precision can be retained for the dark parts of the image, and the compression strength can be appropriately increased for the bright parts of the image, so that a balance between image quality and compression performance can be achieved. Guaranteed good picture quality.
本申请实施例提供的图像编码方法,编码端可以根据各像素值对应的第一最小像素值确定各像素值对应的残差,并可以将各像素值对应的残差以及第一最小像素值压缩后传输给解码端,从而解码端可以基于各像素值对应的残差以及第一最小像素值重建得到各像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,由于各像素值对应的残差是基于第一最小像素值确定的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image coding method provided by the embodiment of the present application, the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced. In addition, since the residual corresponding to each pixel value is determined based on the first minimum pixel value, the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness. The perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
在一种实施方式中,像素值对应的残差的压缩率可以与像素值对应的残差的大小正相关,即残差越大,则该残差的压缩率越高,残差越小,该残差的压缩率越低。由于图像中暗部的像素点的像素值对应的残差较小,而残差小对应的压缩率低,从而可以对图像中暗部的像素点对应的残差采用低压缩率进行编码,使暗部像素点对应的残差可以保留较高的精度。而对于图像中亮部的像素点,由于亮部的像素点的像素值对应的残差较大,而残差大对应的压缩率也大,从而可以采用较高的压缩率对亮部像素点对应的残差进行编码,在确保画质的基础上降低了传输的数据量。In one embodiment, the compression rate of the residual corresponding to the pixel value may be positively correlated with the size of the residual corresponding to the pixel value, that is, the larger the residual, the higher the compression rate of the residual, and the smaller the residual. The lower the compression ratio of this residual. Since the pixel value of the pixel in the dark part of the image corresponds to a small residual, and the small residual corresponds to a low compression rate, the residual corresponding to the pixel in the dark part of the image can be encoded with a low compression rate, so that the pixel in the dark part can be encoded with a low compression rate. Residuals corresponding to points can retain high accuracy. For the pixels in the bright part of the image, because the pixel value of the pixel in the bright part has a large residual error, and the large residual error corresponds to a large compression rate, a higher compression rate can be used for the pixel point in the bright part. The corresponding residual is encoded, which reduces the amount of data transmitted on the basis of ensuring image quality.
在一种实施方式中,对各像素值对应的残差的压缩可以通过对数变换实现。对数变换可以实现数值的映射,既可以将一个数值映射为另一个数值。可以参考图2,图2是本申请实施例提供的对数变换的曲线图。可见,对数变换的映射关系在曲线形状上与对数曲线相似,即曲线的斜率随自变量的增大从陡峭趋于平坦,因此,曲线的前半部分的自变量区间可以被映射到较大的范围,后半部分的自变量区间可以被映射到较 小的范围。可以结合图2进行理解,如图2所示,前半部分的自变量区间[a,b]可以被映射到区间[A,B],而后半部分与[a,b]同样长度的自变量区间[c,d]可以被映射到在长度上明显小于[A,B]的区间[C,D]。In one embodiment, the compression of the residual corresponding to each pixel value may be implemented by logarithmic transformation. The logarithmic transformation can realize the mapping of values, that is, one value can be mapped to another value. Referring to FIG. 2 , FIG. 2 is a graph of logarithmic transformation provided by an embodiment of the present application. It can be seen that the mapping relationship of the logarithmic transformation is similar to the logarithmic curve in the shape of the curve, that is, the slope of the curve tends to be flat as the independent variable increases. Therefore, the independent variable interval in the first half of the curve can be mapped to a larger The range of the independent variable in the second half can be mapped to a smaller range. It can be understood in conjunction with Figure 2. As shown in Figure 2, the first half of the independent variable interval [a, b] can be mapped to the interval [A, B], and the second half of the independent variable interval of the same length as [a, b] [c,d] can be mapped to the interval [C,D] which is significantly smaller in length than [A,B].
基于对数变换的上述特点,对各像素值对应的残差通过对数变换进行压缩,可以使数值较小的残差在映射后保留较高的精度,数值较大的残差可以被更大力度的压缩,符合人眼对亮度变化的感知敏感度在暗部高于亮部的规律。并且,由于相机Sensor(即传感器)的感光值越大引入的噪声也越大,将数值较大的残差映射到较小的范围也可以在一定程度上去除噪声。Based on the above characteristics of logarithmic transformation, the residuals corresponding to each pixel value are compressed by logarithmic transformation, so that the residuals with smaller values can retain higher precision after mapping, and the residuals with larger values can be larger. The compression of strength conforms to the law that the human eye's perception sensitivity to changes in brightness is higher in the dark part than in the bright part. In addition, since the larger the light-sensing value of the camera Sensor (ie the sensor), the larger the noise will be, so mapping the residual with a larger value to a smaller range can also remove the noise to a certain extent.
在一种实施方式中,对数据进行压缩可以是将数据的数值从所在的原范围映射到一个数值整体较小的目标范围,而实现这种映射,在一个例子中,可以将数值先转化为其在所述原范围对应的占比,再根据该占比与目标范围完成最后的映射。对于各像素值对应的残差的压缩,这里,可以以第一残差为压缩对象进行说明,第一残差可以是第一像素值对应的残差,第一像素值可以是第一待编码数据中的任一像素值。In one embodiment, compressing the data may be to map the value of the data from the original range to a target range with a smaller overall value, and to realize this mapping, in one example, the value may be first converted into Its proportion in the original range, and then complete the final mapping according to the proportion and the target range. For the compression of the residual corresponding to each pixel value, here, the first residual can be used as the compression object for description, the first residual can be the residual corresponding to the first pixel value, and the first pixel value can be the first to-be-coded Any pixel value in the data.
在对第一残差通过对数变换进行压缩时,在一种实施方式中,可以确定第一残差所属的最小残差范围,确定第一残差在压缩后占用的第一目标比特位数,根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩。这里,第一残差所属的最小残差范围可以结合前文所述的原范围进行理解,其可以用于第一残差转化为其在该最小残差范围的占比。第一目标比特位数可以结合前文所述的目标范围进行理解,比如第一目标比位数是5时,即意味着将第一残差压缩至5个比特,则压缩后的第一残差在数值上最大不可超过31(2 5-1),即对应的目标范围是[0,31]。 When the first residual is compressed by logarithmic transformation, in one embodiment, the minimum residual range to which the first residual belongs may be determined, and the first target number of bits occupied by the first residual after compression may be determined , and compress the first residual according to the minimum residual range and the first target number of bits. Here, the minimum residual range to which the first residual belongs can be understood in combination with the original range described above, which can be used to convert the first residual to its proportion in the minimum residual range. The first target number of bits can be understood in combination with the target range described above. For example, when the first target number of bits is 5, it means that the first residual is compressed to 5 bits, then the compressed first residual The maximum value cannot exceed 31 (2 5 -1), that is, the corresponding target range is [0,31].
需要说明的是,之所以确定第一残差所属的最小残差范围,而不是第一残差所属的任意残差范围,是为了使第一残差在压缩后可以保留较高的精度。由于第一残差所属的残差范围用于第一残差转换为其在该残差范围对应的占比,因此该残差范围需要与第一残差的数值匹配,否则将降低压缩后的第一残差的精度。可以举个例子,若第一残差的数值是18,第一残差所属的残差范围可以是[0,31](对应5比特),也可以是[0,63](对应6比特),但最小残差范围[0,31]与第一残差更匹配,可以更好的保留压缩后的第一残差的精度。It should be noted that the reason why the minimum residual error range to which the first residual belongs is determined, rather than any residual error range to which the first residual belongs, is to enable the first residual to retain higher accuracy after compression. Since the residual range to which the first residual belongs is used to convert the first residual to its corresponding proportion in the residual range, the residual range needs to match the value of the first residual, otherwise the compressed value will be reduced. The precision of the first residual. For example, if the value of the first residual is 18, the residual range to which the first residual belongs can be [0,31] (corresponding to 5 bits) or [0,63] (corresponding to 6 bits) , but the minimum residual range [0, 31] matches the first residual better, which can better preserve the accuracy of the compressed first residual.
在确定第一残差所属的最小残差范围时,在一种实施方式中,可以将区块对应的最小残差范围确定为第一残差所属的最小残差范围。这里,第一待编码数据可以对应待编码图像中的一个区块,第一残差对应的第一像素值可以属于该区块,可以确定该区块的各像素值对应的残差共同落入的最小残差范围(即区块对应的最小残差范围), 并可以将区块对应的最小残差范围作为第一残差所属的最小残差范围。在确定区块对应的最小残差范围时,在一种实施方式中,可以从区块的各像素值对应的残差中确定最大残差,根据该最大残差确定最小残差范围。举个例子,比如一个区块可以是16*1的数据块,包括16个像素值,则可以确定该16个像素值对应的残差中的最大残差diffmax,并可以根据该最大残差diffmax确定该区块对应的最小残差范围diffLD。When determining the minimum residual error range to which the first residual belongs, in one embodiment, the minimum residual error range corresponding to the block may be determined as the minimum residual error range to which the first residual belongs. Here, the first data to be encoded may correspond to a block in the image to be encoded, the first pixel value corresponding to the first residual may belong to the block, and it may be determined that the residuals corresponding to the pixel values of the block together fall into (ie, the minimum residual range corresponding to the block), and the minimum residual range corresponding to the block may be used as the minimum residual range to which the first residual belongs. When determining the minimum residual error range corresponding to the block, in one embodiment, the maximum residual error may be determined from the residual errors corresponding to each pixel value of the block, and the minimum residual error range is determined according to the maximum residual error. For example, if a block can be a 16*1 data block, including 16 pixel values, the maximum residual difference diffmax among the residuals corresponding to the 16 pixel values can be determined, and the maximum residual difference diffmax can be determined according to the maximum residual difference. Determine the minimum residual range diffLD corresponding to the block.
考虑到在区块太大时,区块中不同像素值对应的残差之间可能差距较大,导致区块对应的最小残差范围与第一残差的适配程度可能较低,比如第一残差的数值可能是7,该第一残差最适配的残差范围是[0,7](对应3比特),但该区块中各像素值对应的残差的最大残差可能是30,则根据该最大残差确定的最小残差范围可能是[0,31],显然该区块对应的最小残差范围与第一残差的适配程度并不高,若基于该最小残差范围对第一残差进行压缩,将导致第一残差的重建误差较大,影响图像画质。Considering that when the block is too large, there may be a large gap between the residuals corresponding to different pixel values in the block, resulting in a low degree of adaptation between the minimum residual range corresponding to the block and the first residual. The value of a residual may be 7, and the most suitable residual range of the first residual is [0,7] (corresponding to 3 bits), but the maximum residual of the residual corresponding to each pixel value in the block may be is 30, then the minimum residual range determined according to the maximum residual may be [0, 31]. Obviously, the minimum residual range corresponding to this block does not have a high degree of adaptation to the first residual. The residual range compresses the first residual, which will result in a larger reconstruction error of the first residual and affect the image quality.
因此,在一种实施方式中,可以将区块划分成多个子区块,第一残差对应的第一像素值可以属于所述多个子区块中的第一子区块,则可以将第一子区块对应的最小残差范围作为第一残差所属的最小残差范围。由于子区块相比区块所包含的像素值较少,因此子区块中不同像素值对应的残差之间的差距有较高概率会减小,从而第一子区块对应的最小残差范围有较高概率可以与第一残差更好的适配。在确定第一子区块对应的最小残差范围时,可以根据第一子区块中的各像素值对应的残差确定最大残差,并根据最大残差确定最小残差范围。可以举个例子,对于16*1的区块可以划分为两个8*1的子区块,则对于第一子区块,可以确定第一子区块中的8个像素值对应的残差中的最大残差diffmax,并可以根据该最大残差diffmax确定该第一子区块对应的最小残差范围diffLD。Therefore, in one embodiment, the block can be divided into a plurality of sub-blocks, and the first pixel value corresponding to the first residual can belong to the first sub-block of the plurality of sub-blocks, then the The minimum residual range corresponding to a sub-block is used as the minimum residual range to which the first residual belongs. Since the sub-block contains fewer pixel values than the block, the difference between the residuals corresponding to different pixel values in the sub-block has a high probability to be reduced, so that the minimum residual value corresponding to the first sub-block will be reduced. The difference range has a higher probability and can better fit the first residual. When determining the minimum residual error range corresponding to the first subblock, the maximum residual error may be determined according to the residual error corresponding to each pixel value in the first subblock, and the minimum residual error range may be determined according to the maximum residual error. For example, a 16*1 block can be divided into two 8*1 sub-blocks, then for the first sub-block, the residuals corresponding to the 8 pixel values in the first sub-block can be determined. The maximum residual difference diffmax in , and the minimum residual error range diffLD corresponding to the first sub-block can be determined according to the maximum residual difference diffmax.
进一步的,由于各像素值对应的残差是基于区块中各像素值的第一最小像素值确定的,但在将区块划分为多个子区块后,第一最小像素值只存在于其中一个子区块中,即对于其他的子区块,其实际的最小像素值并不一定等于第一最小像素值。因此,在一种实施方式中,可以确定第一子区块中的多个像素值的第二最小像素值,并可以确定第二最小像素值与第一最小像素值之间的最小值差值,根据该最小值差值可以对第一子区块对应的最小残差范围进行调整,并可以将调整后的最小残差范围重新确定为第一子区块对应的最小残差范围。通过对第一子区块对应的最小残差范围进行调整,可以进一步提升第一残差的压缩精度。Further, since the residual corresponding to each pixel value is determined based on the first minimum pixel value of each pixel value in the block, after the block is divided into a plurality of sub-blocks, the first minimum pixel value only exists therein. In one sub-block, that is, for other sub-blocks, the actual minimum pixel value is not necessarily equal to the first minimum pixel value. Therefore, in one embodiment, a second minimum pixel value of the plurality of pixel values in the first subblock may be determined, and a minimum value difference between the second minimum pixel value and the first minimum pixel value may be determined , the minimum residual error range corresponding to the first sub-block can be adjusted according to the minimum difference value, and the adjusted minimum residual error range can be re-determined as the minimum residual error range corresponding to the first sub-block. By adjusting the minimum residual error range corresponding to the first sub-block, the compression accuracy of the first residual error can be further improved.
在根据所述最小值差值对第一子区块对应的最小残差范围进行调整时,在一种实施方式中,可以根据第一对应关系确定该最小值差值对应的调整量,从而可以根据该 调整量对第一子区块对应的最小残差范围进行调整。其中,第一对应关系可以是最小值差值、调整量以及第一索引值的对应关系,在一个例子中,第一对应关系可以是第一表格,该第一表格可以记为adjTable,在adjTable中,最小值差值可以与调整量对应,调整量可以与第一索引值adindex对应。When adjusting the minimum residual error range corresponding to the first sub-block according to the minimum value difference, in one embodiment, the adjustment amount corresponding to the minimum value difference may be determined according to the first correspondence, so that The minimum residual error range corresponding to the first sub-block is adjusted according to the adjustment amount. The first correspondence may be the correspondence between the minimum difference value, the adjustment amount, and the first index value. In an example, the first correspondence may be the first table, and the first table may be recorded as adjTable. Among them, the minimum difference value may correspond to the adjustment amount, and the adjustment amount may correspond to the first index value adindex.
上述在根据最大残差确定最小残差范围时,可以根据第二对应关系确定。具体的,第二对应关系可以是最大残差、最小残差范围以及第二索引值的对应关系,例如,第二对应关系可以是第二表格,该第二表格可以记为diffLDTable,在diffLDTable中,最大残差diffmax可以与最小残差范围diffLD对应,最小残差范围diffLD可以与第二索引值diffindex对应。In the above, when the minimum residual error range is determined according to the maximum residual error, it may be determined according to the second corresponding relationship. Specifically, the second correspondence may be the correspondence between the maximum residual error, the minimum residual error range, and the second index value. For example, the second correspondence may be a second table, and the second table may be recorded as diffLDTable, in diffLDTable , the maximum residual difference diffmax may correspond to the minimum residual error range diffLD, and the minimum residual error range diffLD may correspond to the second index value diffindex.
在一种实施方式中,在根据第一对应关系确定最小值差值对应的调整量后,还可以确定调整量对应的第一索引值,并可以将第一索引值写入码流,传输给解码端。在根据最大残差确定最小残差范围后,也可以确定该最小残差范围对应的第二索引值,并可以将第二索引值写入码流,传输给解码端。那么,解码端可以从码流中解码得到第一索引值adindex以及第二索引值diffindex,并可以通过以下式子确定第一子区间对应的最小残差范围:In one embodiment, after the adjustment amount corresponding to the minimum difference value is determined according to the first correspondence, the first index value corresponding to the adjustment amount may also be determined, and the first index value may be written into the code stream and transmitted to the decoding end. After the minimum residual error range is determined according to the maximum residual error, the second index value corresponding to the minimum residual error range may also be determined, and the second index value may be written into the code stream and transmitted to the decoding end. Then, the decoding end can decode the code stream to obtain the first index value adindex and the second index value diffindex, and can determine the minimum residual error range corresponding to the first sub-interval by the following formula:
diffLD=diffLDTable[diffindex]-adjTable[adindex]。diffLD=diffLDTable[diffindex]-adjTable[adindex].
上述的diffLDTable表与adjTable表均可以通过预先配置得到。对于diffLDTable表,在一种实施方式中,最大残差范围可以按第二索引值递增排布,即最后一个第二索引值对应的最大残差范围可以设置为对应比特位数的最大值,但也可以根据真实场景做适当的调整。The above diffLDTable table and adjTable table can be obtained by pre-configuration. For the diffLDTable table, in an implementation manner, the maximum residual error range may be arranged in increments of the second index value, that is, the maximum residual error range corresponding to the last second index value may be set to the maximum value of the corresponding number of bits, but You can also make appropriate adjustments according to the real scene.
第一残差在压缩后占用的第一目标比特位数可以通过比特位数分配确定。在一种实施方式中,本申请实施例对图像数据的编码可以采用定长编码的方式,即指定规模的图像数据在编码后占用的比特位数可以是固定的。如此,在总比特位数确定的基础上,可以根据第一像素值所属的最小区块(若未对区块进行划分,则最小区块为区块本身,若对区块进行了划分,则最小区块为第一像素值所在的第一子区块)对应的最大残差,对第一残差进行比特位数的初始分配。在一个例子中,所述最小区块对应的最大残差与第一残差在初始分配可得的比特位数正相关,即最小区块对应的最大残差越大,对该最小区块中的像素值对应的残差可以分配更多的比特位数。在一种实施方式中,由于最大残差基于第二对应关系可以与第二索引值对应,因此,这里也可以根据第一像素值所属的最小区块对应的第二索引值对第一残差进行比特位数的初始分配。The first target number of bits occupied by the first residual after compression may be determined by allocation of the number of bits. In an implementation manner, the encoding of the image data in this embodiment of the present application may adopt a fixed-length encoding manner, that is, the number of bits occupied by the image data of a specified scale after encoding may be fixed. In this way, on the basis of determining the total number of bits, the smallest block to which the first pixel value belongs (if the block is not divided, the smallest block is the block itself, if the block is divided, then The smallest block is the largest residual corresponding to the first sub-block where the first pixel value is located, and initial allocation of the number of bits is performed on the first residual. In one example, the maximum residual corresponding to the minimum block is positively correlated with the number of bits available for the first residual in the initial allocation, that is, the larger the maximum residual corresponding to the minimum block, the greater the number of bits in the minimum block. The residuals corresponding to the pixel values of , can be allocated more bits. In one embodiment, since the largest residual can correspond to the second index value based on the second correspondence, the first residual can also be mapped to the first residual according to the second index value corresponding to the smallest block to which the first pixel value belongs. The initial allocation of the number of bits is performed.
进一步的,若在初始分配之后仍有比特位数的剩余,可以将剩余的比特位数优先 分配给在划分边界处的像素值对应的残差。这里,划分边界处的像素值可以是与分块或划分操作处相邻或相近的像素值,比如,可以是各个子区块的边界处的像素值,也可以是区块的边界处的像素值。通过将剩余的比特位数优先分配给划分边界处的像素值对应的残差,可以使划分边界处的像素值有更高的重建精度,从而可以降低因区块划分而引发的块效应。Further, if there are still bits remaining after the initial allocation, the remaining bits can be preferentially allocated to the residuals corresponding to the pixel values at the division boundary. Here, the pixel value at the division boundary may be a pixel value adjacent or close to the division or division operation, for example, it may be the pixel value at the boundary of each sub-block, or the pixel at the boundary of the block. value. By preferentially allocating the remaining bits to the residuals corresponding to the pixel values at the division boundary, the pixel values at the division boundary can have higher reconstruction accuracy, thereby reducing the blocking effect caused by block division.
在进行比特位数的初始分配以及对剩余比特位数的分配后,将初始分配所得的比特位数与剩余分配所得的比特位数相加,即可以确定第一残差对应的第一目标比特位数。在根据最小残差范围与第一目标比特位数对第一残差进行压缩时,具体的,可以将第一残差转化为所述最小残差范围的占比,将该占比通过伽马变换压缩至第一目标比特位数对应的数值范围内。可以参考以下第一式子,该第一式子为对残差通过对数变换进行压缩的表达式:After the initial allocation of the number of bits and the allocation of the remaining number of bits, the number of bits obtained from the initial allocation and the number of bits obtained from the remaining allocation are added to determine the first target bit corresponding to the first residual. digits. When compressing the first residual according to the minimum residual range and the first target number of bits, specifically, the first residual can be converted into a proportion of the minimum residual range, and the proportion can be passed through gamma Transform and compress to a value range corresponding to the first target number of bits. You can refer to the following first formula, which is an expression for compressing the residual by logarithmic transformation:
Figure PCTCN2021080029-appb-000001
Figure PCTCN2021080029-appb-000001
其中,diff可以表示待压缩的第一残差,diffLD可以表示第一残差所属的最小残差范围,
Figure PCTCN2021080029-appb-000002
可以表示第一残差在最小残差范围对应的占比,diffdepth可以表示第一残差对应的第一目标比特位数。可见,上述式子整体与伽马变换的基本形式相对应,伽马变换的基本形式可以表示为:
Wherein, diff can represent the first residual to be compressed, diffLD can represent the minimum residual range to which the first residual belongs,
Figure PCTCN2021080029-appb-000002
It can represent the proportion corresponding to the first residual in the minimum residual range, and the diffdepth can represent the first target number of bits corresponding to the first residual. It can be seen that the above formula as a whole corresponds to the basic form of gamma transformation, and the basic form of gamma transformation can be expressed as:
out=C*power(a,g)out=C*power(a,g)
其中,power(a,g)即表示a的g次方,g可以表示gamma参数值。2 diffdepth-1可以表示第一目标比特位数对应的数值范围。 Among them, power(a, g) represents the g power of a, and g can represent the gamma parameter value. 2 diffdepth -1 may represent a numerical range corresponding to the first target number of bits.
参考图2可知,若需要通过对数变换进行压缩的数值本身很小,则该数值在通过对数变换压缩后可能比压缩前更大,起到反效果,因此,在一种实施方式中,若压缩后的残差大于压缩前的残差,则可以将压缩后的残差的数值修改为压缩前的残差的数值,即对应上述第一式子的第二行。Referring to FIG. 2, it can be seen that if the value to be compressed by logarithmic transformation is very small, the value may be larger after compression by logarithmic transformation than before compression, which has the opposite effect. Therefore, in one embodiment, If the residual after compression is larger than the residual before compression, the value of the residual after compression may be modified to the value of the residual before compression, which corresponds to the second row of the above-mentioned first formula.
考虑到解码端是基于重建的第一最小像素值和残差重建各像素值的,因此,为了减少重建的误差,编码端可以在对第一最小像素值进行压缩后,对压缩后的第一最小像素值进行重建(例如可以通过对数反变换进行重建),得到重建的第一最小像素值,从而在计算各像素值对应的残差时,可以计算各像素值与该重建的第一最小像素值之间的残差(可以认为是修正后的残差),并可以该基于重建的第一最小像素值确定的残差压缩后传输给解码端。Considering that the decoding end reconstructs each pixel value based on the reconstructed first minimum pixel value and the residual, therefore, in order to reduce the reconstruction error, the coding end can compress the first minimum pixel value after compressing the compressed first pixel value. The minimum pixel value is reconstructed (for example, it can be reconstructed by inverse logarithmic transformation) to obtain the reconstructed first minimum pixel value, so that when calculating the residual corresponding to each pixel value, each pixel value and the reconstructed first minimum value can be calculated. The residual between the pixel values (which can be regarded as the corrected residual) can be compressed and transmitted to the decoding end after the residual determined based on the reconstructed first minimum pixel value.
在对第一最小像素值进行压缩时,在一种实施方式中,可以确定各像素值与该第一最小像素值之间的残差(这里的残差是各像素值与原始的第一最小像素值之间的实际残差),并可以确定各个像素值对应的残差中的最大残差,从而,根据该最大残差可以确定第一最小像素值的理论最大值,根据该理论最大值可以确定第一最小像素值在压缩后占用的第二目标比特位数,可以根据该第二目标比特位数对第一最小像素值进行压缩。为便于理解,可以举个例子,比如像素值对应的比特位数是12,即像素值的理论最大值可以为4095(2 12-1),若各像素值与第一最小像素值的残差中的最大残差是2500,则可以确定第一最小像素值的理论最大值是1595,即利用11个比特位已经足以表示该第一最小像素值,因此可以确定第一最小像素值对应的第二目标比特位数是11,可以将第一最小像素值从原来的12比特压缩至11比特。 When compressing the first minimum pixel value, in one embodiment, a residual between each pixel value and the first minimum pixel value may be determined (the residual here is the difference between each pixel value and the original first minimum pixel value) The actual residual between pixel values), and the maximum residual among the residuals corresponding to each pixel value can be determined, so that the theoretical maximum value of the first minimum pixel value can be determined according to the maximum residual, according to the theoretical maximum value The second target number of bits occupied by the first minimum pixel value after compression may be determined, and the first minimum pixel value may be compressed according to the second target number of bits. For ease of understanding, for example, the number of bits corresponding to the pixel value is 12, that is, the theoretical maximum value of the pixel value can be 4095 (2 12 -1). If the residual between each pixel value and the first minimum pixel value is The maximum residual error in is 2500, then it can be determined that the theoretical maximum value of the first minimum pixel value is 1595, that is, 11 bits are enough to represent the first minimum pixel value, so it can be determined that the first minimum pixel value corresponds to the first minimum pixel value. The target number of bits is 11, which can compress the first minimum pixel value from the original 12 bits to 11 bits.
在一种实施方式中,对第一最小像素值的压缩也可以通过对数变换进行。压缩后的第一最小像素值可以传输给解码端,还可以将第一最小像素值对应的像素位置写入码流传输给解码端。In one embodiment, the compression of the first minimum pixel value may also be performed by a logarithmic transformation. The compressed first minimum pixel value may be transmitted to the decoding end, and the pixel position corresponding to the first minimum pixel value may also be written into the code stream and transmitted to the decoding end.
在一种实施方式中,待编码图像可以是原始raw图像。原始raw图像可以是bayer格式的图像,可以参考图3所示,图3是本申请实施例提供的原始raw图像的排布格式图。图3示出了原始raw图像的(a)、(b)、(c)、(d)四种排布方式,其中包含不同颜色分量对应的像素,例如可以包括R、Gr、Gb、B四种颜色分量的像素。考虑到同一颜色分量的像素之间有较强的相关性,冗余性也较大,因此,在一种实施方式中,可以对待编码图像的原始编码数据块进行解交织,得到第一颜色分量对应的编码数据块。举个例子,待编码图像的原始编码数据块可以是128*1的数据块,即对应一行像素值(此处仅作示例,在内存资源足够时一个原始编码数据块也可以包括多行像素值),在对该原始编码数据块进行解交织后,可以得到两个64*1的不同颜色分量对应的编码数据块。参考图3可知,在原始编码数据块对应一行像素时,原始编码数据块中仅包含两种颜色分量对应的像素值。这里,解交织的具体操作可以是将原始raw图像中的像素根据所属的颜色分量进行整理。In one embodiment, the image to be encoded may be an original raw image. The original raw image may be an image in a bayer format, as shown in FIG. 3 , which is a layout format diagram of the original raw image provided by the embodiment of the present application. Figure 3 shows four arrangements of (a), (b), (c), and (d) of the original raw image, which include pixels corresponding to different color components, such as R, Gr, Gb, B four pixels of each color component. Considering that there is a strong correlation between the pixels of the same color component, the redundancy is also large, therefore, in an implementation manner, the original encoded data block of the to-be-encoded image may be de-interleaved to obtain the first color component. Corresponding encoded data block. For example, the original encoded data block of the to-be-encoded image can be a 128*1 data block, that is, a row of pixel values corresponding to one row (here is only an example, when memory resources are sufficient, an original encoded data block can also include multiple rows of pixel values. ), after de-interleaving the original encoded data block, two encoded data blocks corresponding to different color components of 64*1 can be obtained. Referring to FIG. 3 , when the original encoded data block corresponds to a row of pixels, the original encoded data block only includes pixel values corresponding to two color components. Here, the specific operation of de-interleaving may be to organize the pixels in the original raw image according to the color components to which they belong.
在解交织得到第一颜色分量对应的编码数据块后(这里,第一颜色分量可以是任一颜色分量),可以针对第一颜色分量对应的编码数据块中的各像素值通过对数变换进行压缩。此处的压缩可以整体降低像素值的大小,提高压缩性能。其中,对数变换的表达式与前文所述的第一式子具有相同的形式,可以表达如下:After de-interleaving to obtain the encoded data block corresponding to the first color component (here, the first color component may be any color component), logarithmic transformation may be used for each pixel value in the encoded data block corresponding to the first color component. compression. The compression here can reduce the size of the pixel value as a whole and improve the compression performance. Among them, the expression of logarithmic transformation has the same form as the first formula mentioned above, and can be expressed as follows:
Figure PCTCN2021080029-appb-000003
Figure PCTCN2021080029-appb-000003
其中,in为表示输入的原始的像素值,inmax为原始的像素值所占的比特位数对应的最大值,比如原始的像素值所占的比特位数是14,则inmax可以是16383(2 14-1),bl(黑电平Black level)为偏置值,使原始的像素值在减去偏置值后再转化为占比可以进一步节省比特位数,A为压缩后所占的比特位数对应的最大值,比如可以是4095(2 12-1),即压缩目标是将各像素原始的像素值压缩至12比特。 Among them, in represents the original pixel value of the input, and inmax is the maximum value corresponding to the number of bits occupied by the original pixel value. For example, the number of bits occupied by the original pixel value is 14, then inmax can be 16383 (2 14-1 ), bl (Black level) is the offset value, so that the original pixel value can be further saved by reducing the offset value and then converting it into a proportion, and A is the bit occupied after compression The maximum value corresponding to the number of bits can be, for example, 4095 (2 12 -1), that is, the compression target is to compress the original pixel value of each pixel to 12 bits.
关于对数变换也可以结合前文中的相关说明进行理解,在此不再赘述。也可以参考图4,图4是本申请实施例提供的特定参数下的对数变换的曲线图,其中,特定参数包括:bl=512,inmax=16383,A=4095,g=0.45。The logarithmic transformation can also be understood in conjunction with the relevant descriptions in the foregoing, and will not be repeated here. Reference may also be made to FIG. 4 , which is a graph of logarithmic transformation under specific parameters provided by an embodiment of the present application, where the specific parameters include: bl=512, inmax=16383, A=4095, and g=0.45.
在对第一颜色分量对应的编码数据块中的像素值进行压缩后,可以得到第一待编码数据块。为便于理解,可以继续上述例子,第一颜色分量对应的编码数据块是64*1的数据块,对其进行压缩得到的第一待编码数据块仍然是64*1的数据块。在一种实施方式中,可以对该第一待编码数据块进行划分,从而得到多个第一待编码数据。可以参考图5,图5是本申请实施例提供的block划分示意图,若将第一待编码数据块称为block,第一待编码数据称为slice,则在图5所示的例子中,一个block(64*1的数据块)可以划分为4个slice,即每个slice可以对应16*1的数据块。在划分得到多个第一待编码数据后,可以针对每个第一待编码数据分别进行处理,具体的处理方式可以在前文已有说明,在此不再赘述。After compressing the pixel values in the encoded data block corresponding to the first color component, the first to-be-encoded data block can be obtained. For ease of understanding, the above example can be continued. The encoded data block corresponding to the first color component is a 64*1 data block, and the first to-be-encoded data block obtained by compressing it is still a 64*1 data block. In an implementation manner, the first data block to be encoded may be divided to obtain a plurality of first data to be encoded. Referring to FIG. 5, FIG. 5 is a schematic diagram of block division provided by an embodiment of the present application. If the first data block to be encoded is called a block and the first data to be encoded is called a slice, in the example shown in FIG. A block (64*1 data block) can be divided into 4 slices, that is, each slice can correspond to a 16*1 data block. After a plurality of first data to be encoded are obtained by division, each of the first data to be encoded may be processed separately, and the specific processing method can be described above, and will not be repeated here.
在一种实施方式中,通过对原始编码数据块进行多次的划分操作,包括block划分成slice的操作以及前文提及的区块划分成子区块的操作,可以避免局部不平坦引起整体的块效应,从而提高重建图像的画质。In one embodiment, by performing multiple division operations on the original encoded data block, including the operation of dividing the block into slices and the operation of dividing the block into sub-blocks mentioned above, it is possible to avoid local unevenness causing the overall block. effect, thereby improving the quality of the reconstructed image.
如前文所述,在进行比特位数分配(即码率分配)时,可以将剩余的比特位数优先分配给在划分边界处的像素值对应的残差。这里,划分边界处的像素值还可以包括各个第一待编码数据的边界处的像素值以及第一待编码数据块的边界处的像素值。As mentioned above, when the allocation of the number of bits (ie, the allocation of the code rate) is performed, the remaining number of bits may be preferentially allocated to the residual corresponding to the pixel value at the division boundary. Here, the pixel values at the division boundaries may further include pixel values at the boundaries of the respective first data blocks to be encoded and pixel values at the boundaries of the first data blocks to be encoded.
本申请实施例提供的图像编码方法,编码端可以根据各像素值对应的第一最小像素值确定各像素值对应的残差,并可以将各像素值对应的残差以及第一最小像素值压缩后传输给解码端,从而解码端可以基于各像素值对应的残差以及第一最小像素值重建得到各像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,由 于各像素值对应的残差是基于第一最小像素值确定的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image coding method provided by the embodiment of the present application, the coding end may determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and may compress the residual corresponding to each pixel value and the first minimum pixel value Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced. In addition, since the residual corresponding to each pixel value is determined based on the first minimum pixel value, the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness. The perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
此外,在一种实施方式中,本申请实施例提供的方法考虑了bayer格式的原始raw图像的特点,对原始raw图像进行解交织,针对各颜色分量对应的编码数据块分别进行编解码,bayer格式的原始raw图像也有较好的压缩性能。In addition, in an implementation manner, the method provided by the embodiment of the present application takes into account the characteristics of the original raw image in the bayer format, de-interleaves the original raw image, and encodes and decodes the encoded data blocks corresponding to each color component. The original raw images in the format also have better compression performance.
下面可以参见图6,图6是本申请实施例提供的图像解码方法的流程图。该方法可以应用于解码端,该方法可以包括:Referring to FIG. 6 below, FIG. 6 is a flowchart of an image decoding method provided by an embodiment of the present application. The method can be applied to the decoding end, and the method can include:
S602、获取待解码图像对应的第一待解码数据。S602: Obtain first data to be decoded corresponding to the image to be decoded.
S604、将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差。S604. Decompress the first data to be decoded to determine a first minimum pixel value and multiple residuals.
S606、根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多个像素值。S606. Determine multiple pixel values of multiple pixels of the decoded image according to the first minimum pixel value and the multiple residuals.
解码端可以从第一待解码数据中解压缩得到第一最小像素值和多个残差,此处解码得到的残差是基于第一最小像素值确定的,因此根据所述多个残差和第一最小像素值,可以重建得到目标图像的多个像素值。The decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and a plurality of residuals, where the residual obtained by decoding is determined based on the first minimum pixel value, so according to the plurality of residuals and The first minimum pixel value can be reconstructed to obtain multiple pixel values of the target image.
在一种实施方式中,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。In one embodiment, the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
在一种实施方式中,所述待解码数据包括压缩后的所述多个残差,所述将所述待解码数据进行解压缩,包括:In an embodiment, the data to be decoded includes the plurality of compressed residuals, and the decompressing the data to be decoded includes:
对压缩后的所述多个残差通过对数反变换进行解压缩。The compressed residuals are decompressed by inverse log transformation.
在一种实施方式中,所述对压缩后的所述多个残差通过对数反变换进行解压缩,包括:In an embodiment, the decompression of the compressed residuals is performed by inverse logarithmic transformation, including:
根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值。The compressed first residual is decompressed according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, wherein the first residual is decompressed. A residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block.
在一种实施方式中,所述根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,包括:In an embodiment, according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, the compressed first residual is Unzip, including:
根据所述第一目标比特位数,对压缩后的所述第一残差通过反伽马变换进行解压缩,得到所述第一残差在所述最小残差范围对应的占比;According to the first target number of bits, the compressed first residual is decompressed by inverse gamma transform to obtain the proportion of the first residual corresponding to the minimum residual range;
根据所述占比以及所述最小残差范围,确定所述第一残差。The first residual is determined according to the proportion and the minimum residual range.
可以理解的,由于编码端对残差通过对数变换进行压缩,因此解码端可以对压缩 后的残差通过对数反变换进行解压缩。解压缩的过程与压缩的过程是相反的过程,可以结合前文提供的第一式子推导出解压缩对应的计算式。It can be understood that since the encoding end compresses the residual through logarithmic transformation, the decoding end can decompress the compressed residual through inverse logarithmic transformation. The decompression process is the opposite of the compression process, and the calculation formula corresponding to the decompression can be derived in combination with the first formula provided above.
在一种实施方式中,所述第一残差所属的最小残差范围是根据第二对应关系以及第二索引值确定的,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第二索引值是从所述待解码数据中解码得到的。In an embodiment, the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error range and the second The corresponding relationship between index values, where the second index value is obtained by decoding the data to be decoded.
可以理解的,若编码段未对区块划分子区块,则解码端可以根据码流中解码得到的第二索引值,并结合本端预先配置的与编码端相同的第二对应关系,可以确定第一残差所属的最小残差范围。It can be understood that if the coding segment does not divide the block into sub-blocks, the decoding end can use the second index value decoded in the code stream and the second corresponding relationship preconfigured by the local end that is the same as that of the coding end, to Determines the minimum residual range to which the first residual belongs.
在一种实施方式中,所述第一残差所属的最小残差范围通过以下方式确定:In one embodiment, the minimum residual range to which the first residual belongs is determined in the following manner:
根据第二对应关系以及第二索引值确定所述最小残差范围;determining the minimum residual error range according to the second correspondence and the second index value;
根据第一对应关系以及第一索引值确定所述最小残差范围对应的调整量;Determine the adjustment amount corresponding to the minimum residual error range according to the first correspondence and the first index value;
根据所述调整量对所述最小残差范围进行调整,并将调整后的最小残差范围确定为所述第一残差所属的最小残差范围;Adjust the minimum residual error range according to the adjustment amount, and determine the adjusted minimum residual error range as the minimum residual error range to which the first residual belongs;
其中,所述第一对应关系是预先配置的调整量与第一索引值的对应关系,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第一索引值与所述第二索引值均是从所述待解码数据中解码得到的。Wherein, the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value, the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value, the first Both the index value and the second index value are decoded from the data to be decoded.
若编码段对区块进行了子区块的划分,则解码端可以根据码流中解码得到的第一索引值和第二索引值,根据第一索引值以及本端预先配置的第一对应关系,可以确定调整量,根据第二索引值和第二对应关系,可以确定第一残差所属的最小残差范围,从而可以根据调整量对所述最小残差范围进行调整,确定第一残差最终所属的最小残差范围。If the coding segment divides the block into sub-blocks, the decoding end can use the first index value and the second index value decoded in the code stream, according to the first index value and the first corresponding relationship pre-configured by the local end. , the adjustment amount can be determined, and according to the second index value and the second correspondence, the minimum residual error range to which the first residual belongs can be determined, so that the minimum residual error range can be adjusted according to the adjustment amount to determine the first residual error The minimum residual range to which it ultimately belongs.
在一种实施方式中,所述根据所述第一最小像素值和所述多个残差,确定关于所述待解码图像的多个像素的多个像素值,包括:In one embodiment, the determining, according to the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the image to be decoded includes:
根据所述第一最小像素值和所述多个残差进行解压缩,得到所述待解码图像的多个像素的多个像素值。Decompressing is performed according to the first minimum pixel value and the plurality of residuals to obtain a plurality of pixel values of a plurality of pixels of the image to be decoded.
在一种实施方式中,所述根据所述第一最小像素值和所述多个残差进行解压缩,包括:In an embodiment, the performing decompression according to the first minimum pixel value and the plurality of residuals includes:
根据所述第一最小像素值和所述多个残差通过对数反变换进行解压缩。Decompression is performed by inverse log transform based on the first minimum pixel value and the plurality of residuals.
本申请实施例提供的图像解码方法,解码端可以从第一待解码数据中解压缩得到第一最小像素值和多个残差,并可以根据所述多个残差和第一最小像素值,可以重建得到图像的多个像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及 各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,各像素值是基于第一最小像素值重建的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image decoding method provided in the embodiment of the present application, the decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and multiple residuals, and can, according to the multiple residuals and the first minimum pixel value, Multiple pixel values of the resulting image can be reconstructed. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, it is not necessary to transmit the original pixel value of each pixel, thus reducing the amount of data transmitted. Moreover, each pixel value is reconstructed based on the first minimum pixel value, so the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is related to the human eye's perception sensitivity to brightness changes. The dark part is higher than the bright part in accordance with the law, which can improve the compression performance and ensure good image quality.
需要说明的是,在一种实施方式中,本申请实施例提供的图像编码方法及图像解码方法可以应用于相机sensor将采集的原始raw图像传输给图像处理芯片如ISP的过程中。It should be noted that, in an implementation manner, the image encoding method and the image decoding method provided by the embodiments of the present application may be applied to the process in which the camera sensor transmits the collected raw raw image to an image processing chip such as an ISP.
下面可以参考图7,图7是本申请实施例提供的图像编码装置的结构示意图。该装置包括:处理器710和存储有计算机程序的存储器720,所述处理器在执行所述计算机程序时实现以下步骤:Referring to FIG. 7 below, FIG. 7 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application. The apparatus includes: a processor 710 and a memory 720 storing a computer program, the processor implements the following steps when executing the computer program:
获取待编码图像对应的第一待编码数据,所述第一待编码数据包括关于所述待编码图像中一区块的多个像素的多个像素值;acquiring first data to be encoded corresponding to the image to be encoded, the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
从所述多个像素值中确定关于所述多个像素值的第一最小像素值;determining a first minimum pixel value for the plurality of pixel values from the plurality of pixel values;
根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差;determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values;
对各像素值对应的所述残差以及所述第一最小像素值进行压缩。The residual corresponding to each pixel value and the first minimum pixel value are compressed.
可选的,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。Optionally, the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
可选的,所述处理器在对各像素值对应的所述残差进行压缩时用于,对各像素值对应的所述残差通过对数变换进行压缩。Optionally, when compressing the residual corresponding to each pixel value, the processor is configured to compress the residual corresponding to each pixel value by logarithmic transformation.
可选的,所述处理器在对各像素值对应的所述残差通过对数变换进行压缩时用于,确定第一残差所属的最小残差范围,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值;确定所述第一残差在压缩后占用的第一目标比特位数;根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩。Optionally, when compressing the residual corresponding to each pixel value by logarithmic transformation, the processor is used to determine the minimum residual range to which the first residual belongs, where the first residual is The residual corresponding to the first pixel value, the first pixel value is any pixel value in the block; determine the first target number of bits occupied by the first residual after compression; according to the minimum The residual range and the first target number of bits compress the first residual.
可选的,所述处理器在根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩时用于,将所述第一残差转化为所述最小残差范围的占比;将所述占比通过伽马变换压缩至所述第一目标比特位数对应的数值范围内。Optionally, the processor is configured to convert the first residual into the minimum residual when compressing the first residual according to the minimum residual range and the first target number of bits. The ratio of the residual range; the ratio is compressed into the numerical range corresponding to the first target bit number through gamma transformation.
可选的,所述第一残差所属的最小残差范围为所述区块对应的最小残差范围,所述处理器在确定所述区块对应的最小残差范围时用于,确定所述区块中的各像素值对应的所述残差的最大残差;根据所述最大残差确定所述最小残差范围。Optionally, the minimum residual range to which the first residual belongs is the minimum residual range corresponding to the block, and the processor is used to determine the minimum residual range corresponding to the block when determining the minimum residual range corresponding to the block. The maximum residual of the residual corresponding to each pixel value in the block; the minimum residual range is determined according to the maximum residual.
可选的,所述区块被划分为多个子区块,所述第一像素值属于所述多个子区块中的第一子区块,所述第一残差所属的最小残差范围为所述第一子区块对应的最小残差 范围,所述处理器在确定所述第一子区块对应的最小残差范围时用于,确定所述第一子区块中的各像素值对应的所述残差的最大残差;根据所述最大残差确定所述最小残差范围。Optionally, the block is divided into multiple sub-blocks, the first pixel value belongs to the first sub-block of the multiple sub-blocks, and the minimum residual range to which the first residual belongs is: the minimum residual error range corresponding to the first sub-block, when the processor determines the minimum residual error range corresponding to the first sub-block, to determine each pixel value in the first sub-block The corresponding maximum residual error of the residual error; the minimum residual error range is determined according to the maximum residual error.
可选的,所述处理器还用于,确定所述第一子区块中的多个像素值的第二最小像素值;根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的最小残差范围。Optionally, the processor is further configured to determine a second minimum pixel value of a plurality of pixel values in the first subblock; according to the difference between the second minimum pixel value and the first minimum pixel value; The minimum residual error range corresponding to the first sub-block is adjusted to determine the adjusted minimum residual error range for the first sub-block.
可选的,所述处理器在根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的残差范围时用于,根据第一对应关系确定所述最小值差值对应的调整量,并根据所述调整量对所述第一子区块对应的最小残差范围进行调整,所述第一对应关系是预先配置的最小值差值与调整量的对应关系。Optionally, the processor adjusts the minimum residual error range corresponding to the first sub-block according to the minimum value difference between the second minimum pixel value and the first minimum pixel value, When determining the adjusted residual error range for the first sub-block, the adjustment amount corresponding to the minimum difference value is determined according to the first correspondence, and the first sub-block is adjusted according to the adjustment amount. The minimum residual error range corresponding to the block is adjusted, and the first correspondence is the correspondence between the pre-configured minimum difference value and the adjustment amount.
可选的,所述第一对应关系是最小值差值、调整量与第一索引值的对应关系,所述处理器还用于,根据所述第一对应关系确定所述调整量对应的第一索引值,所述第一索引值用于传输给解码端。Optionally, the first corresponding relationship is the corresponding relationship between the minimum difference value, the adjustment amount and the first index value, and the processor is further configured to determine, according to the first corresponding relationship, the first corresponding relationship of the adjustment amount. An index value, the first index value is used for transmission to the decoding end.
可选的,所述处理器在根据所述最大残差确定所述最小残差范围时用于,根据第二对应关系确定所述最大残差对应的最小残差范围,所述第二对应关系是预先配置的最大残差与最小残差范围的对应关系。Optionally, when determining the minimum residual error range according to the maximum residual error, the processor is configured to determine, according to a second correspondence relationship, a minimum residual error range corresponding to the maximum residual error, and the second correspondence relationship is the correspondence between the preconfigured maximum residual and the minimum residual range.
可选的,所述第二对应关系是最大残差、最小残差范围与第二索引值的对应关系,所述处理器还用于,根据所述第二对应关系确定所述最小残差范围对应的第二索引值,所述第二索引值用于传输给解码端。Optionally, the second correspondence is a correspondence between the maximum residual, the minimum residual range and the second index value, and the processor is further configured to determine the minimum residual range according to the second correspondence The corresponding second index value, the second index value is used for transmission to the decoding end.
可选的,所述处理器在确定所述第一残差在压缩后占用的第一目标比特位数时用于,根据所述第一像素值所属的最小区块中的各像素值对应的残差的最大残差,对所述第一残差进行比特位数的初始分配,以确定所述第一目标比特位数。Optionally, when the processor determines the first target number of bits occupied by the first residual after compression, according to the corresponding pixel value in the minimum block to which the first pixel value belongs. The maximum residual of the residual, the initial allocation of the number of bits is performed on the first residual to determine the first target number of bits.
可选的,所述处理器还用于,若在所述初始分配后有比特位数的剩余,将剩余的比特位数优先分配给所述第一待编码数据在划分边界处的像素值对应的所述残差。Optionally, the processor is further configured to, if there is a remaining number of bits after the initial allocation, preferentially assign the remaining number of bits to the corresponding pixel values of the first data to be encoded at the division boundary. of the residuals.
可选的,所述处理器还用于,若压缩后的残差大于压缩前的残差,则将压缩后的残差的数值修改为压缩前的残差的数值。Optionally, the processor is further configured to, if the compressed residual is larger than the uncompressed residual, modify the value of the compressed residual to the value of the uncompressed residual.
可选的,所述处理器在根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差时用于,利用压缩后的所述第一最小像素值进行重建,得到重建的第一最小像素值;将各个所述像素值与所述重建的第一最小像素值之间的残差确定 为各像素值对应的所述残差。Optionally, when determining the residual corresponding to each pixel value in the plurality of pixel values according to the first minimum pixel value, the processor is configured to use the compressed first minimum pixel value. Reconstruction is performed to obtain the reconstructed first minimum pixel value; the residual between each of the pixel values and the reconstructed first minimum pixel value is determined as the residual corresponding to each pixel value.
可选的,所述处理器在对所述第一最小像素值进行压缩时用于,确定关于所述多个像素值中的各像素值对应的所述残差中的最大残差;根据所述最大残差确定所述第一最小像素值在压缩后占用的第二目标比特位数;根据所述第二目标比特位数对所述第一最小像素值进行压缩。Optionally, the processor is configured to, when compressing the first minimum pixel value, determine the largest residual error among the residual errors corresponding to each pixel value in the plurality of pixel values; The maximum residual determines the second target number of bits occupied by the first minimum pixel value after compression; the first minimum pixel value is compressed according to the second target number of bits.
可选的,所述第一待编码数据是对所述待编码图像的第一待编码数据块进行划分得到的。Optionally, the first data to be encoded is obtained by dividing a first data block to be encoded of the image to be encoded.
可选的,所述待编码图像包括原始raw图像。Optionally, the to-be-encoded image includes an original raw image.
可选的,所述第一待编码数据块是基于所述待编码图像的第一颜色分量对应的编码数据块得到的。Optionally, the first data block to be encoded is obtained based on the encoded data block corresponding to the first color component of the image to be encoded.
可选的,所述第一颜色分量对应的编码数据块是对所述待编码图像的原始编码数据块进行解交织得到的。Optionally, the encoded data block corresponding to the first color component is obtained by de-interleaving the original encoded data block of the image to be encoded.
可选的,所述第一待编码数据块是对所述第一颜色分量对应的编码数据块进行压缩得到的。Optionally, the first data block to be encoded is obtained by compressing the encoded data block corresponding to the first color component.
可选的,所述处理器在对所述第一颜色分量对应的编码数据块进行压缩时用于,将所述第一颜色分量对应的编码数据块中的各像素值通过对数变换进行压缩。Optionally, the processor is configured to compress each pixel value in the encoded data block corresponding to the first color component by logarithmic transformation when compressing the encoded data block corresponding to the first color component. .
以上所提供的图像编码装置的各种实施方式,其具体实现可以参考前文中的相关说明,在此不再赘述。For the various implementation manners of the image encoding apparatus provided above, reference may be made to the relevant descriptions above for the specific implementation, which will not be repeated here.
本申请实施例提供的图像编码装置,编码端可以根据各像素值对应的第一最小像素值确定各像素值对应的残差,并可以将各像素值对应的残差以及第一最小像素值压缩后传输给解码端,从而解码端可以基于各像素值对应的残差以及第一最小像素值重建得到各像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,由于各像素值对应的残差是基于第一最小像素值确定的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image encoding device provided by the embodiment of the present application, the encoding end can determine the residual corresponding to each pixel value according to the first minimum pixel value corresponding to each pixel value, and can compress the residual corresponding to each pixel value and the first minimum pixel value. Then, it is transmitted to the decoding end, so that the decoding end can reconstruct and obtain each pixel value based on the residual corresponding to each pixel value and the first minimum pixel value. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced. In addition, since the residual corresponding to each pixel value is determined based on the first minimum pixel value, the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is consistent with the human eye's sensitivity to changes in brightness. The perceptual sensitivity is consistent with the law that the dark part is higher than the bright part, which improves the compression performance while ensuring good image quality.
下面可以参考图8,图8是本申请实施例提供的图像编码装置的结构示意图。该装置包括:处理器810和存储有计算机程序的存储器820,所述处理器在执行所述计算机程序时实现以下步骤:Referring to FIG. 8 below, FIG. 8 is a schematic structural diagram of an image encoding apparatus provided by an embodiment of the present application. The apparatus comprises: a processor 810 and a memory 820 storing a computer program, the processor implements the following steps when executing the computer program:
获取待解码图像对应的第一待解码数据;obtaining the first to-be-decoded data corresponding to the to-be-decoded image;
将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差;decompressing the first data to be decoded to determine a first minimum pixel value and a plurality of residuals;
根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多个像素值。From the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the decoded image are determined.
可选的,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。Optionally, the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
可选的,所述第一待解码数据包括压缩后的所述多个残差,所述处理器在将所述第一待解码数据进行解压缩时用于,对压缩后的所述多个残差通过对数反变换进行解压缩。Optionally, the first data to be decoded includes the plurality of compressed residuals, and the processor is configured to, when decompressing the first data to be decoded, decompress the plurality of compressed residuals. The residuals are decompressed by inverse log transformation.
可选的,所述处理器在对压缩后的所述多个残差通过对数反变换进行解压缩时用于,根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值。Optionally, when the processor decompresses the compressed residuals through inverse logarithmic transformation, the processor is configured to, according to the minimum residual range to which the first residual belongs, and the first residual At the first target number of bits occupied after compression, decompress the compressed first residual, wherein the first residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block.
可选的,所述处理器在根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩时用于,根据所述第一目标比特位数,对压缩后的所述第一残差通过反伽马变换进行解压缩,得到所述第一残差在所述最小残差范围对应的占比;根据所述占比以及所述最小残差范围,确定所述第一残差。Optionally, according to the minimum residual range to which the first residual belongs, and the first target number of bits occupied by the first residual after compression, the processor performs a process on the compressed first residual. When performing decompression, it is used to decompress the compressed first residual through inverse gamma transform according to the first target number of bits, so as to obtain that the first residual is within the minimum residual range The corresponding ratio; the first residual is determined according to the ratio and the minimum residual range.
可选的,所述第一残差所属的最小残差范围是根据第二对应关系以及第二索引值确定的,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第二索引值是从所述第一待解码数据中解码得到的。Optionally, the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error range and the second index value. Corresponding relationship, the second index value is obtained by decoding from the first data to be decoded.
可选的,所述处理器在确定所述第一残差所属的最小残差范围时用于,根据第二对应关系以及第二索引值确定所述最小残差范围;根据第一对应关系以及第一索引值确定所述最小残差范围对应的调整量;根据所述调整量对所述最小残差范围进行调整,并将调整后的最小残差范围确定为所述第一残差所属的最小残差范围;Optionally, when determining the minimum residual error range to which the first residual belongs, the processor is configured to: determine the minimum residual error range according to the second correspondence and the second index value; according to the first correspondence and The first index value determines the adjustment amount corresponding to the minimum residual error range; the minimum residual error range is adjusted according to the adjustment amount, and the adjusted minimum residual error range is determined as the one to which the first residual error belongs. Minimum residual range;
其中,所述第一对应关系是预先配置的调整量与第一索引值的对应关系,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第一索引值与所述第二索引值均是从所述第一待解码数据中解码得到的。Wherein, the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value, the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value, the first Both the index value and the second index value are decoded from the first data to be decoded.
可选的,所述处理器在根据所述第一最小像素值和所述多个残差,确定关于所述待解码图像的多个像素的多个像素值时用于,根据所述第一最小像素值和所述多个残差进行解压缩,得到所述待解码图像的多个像素的多个像素值。Optionally, when the processor determines, according to the first minimum pixel value and the plurality of residuals, the plurality of pixel values for the plurality of pixels of the to-be-decoded image, the processor is configured to, according to the first The minimum pixel value and the multiple residuals are decompressed to obtain multiple pixel values of multiple pixels of the to-be-decoded image.
可选的,所述第一待解码数据包括压缩后的所述第一最小像素值,所述处理器在将所述第一待解码数据进行解压缩时用于,对压缩后的所述第一最小像素值通过对数反变换进行解压缩。Optionally, the first data to be decoded includes the compressed first minimum pixel value, and the processor is used to decompress the compressed first data to be decoded. A minimum pixel value is decompressed by an inverse log transform.
以上所提供的图像解码装置的各种实施方式,其具体实现可以参考前文中的相关说明,在此不再赘述。For the various implementation manners of the image decoding apparatus provided above, reference may be made to the relevant descriptions above for the specific implementation, which will not be repeated here.
本申请实施例提供的图像解码装置,解码端可以从第一待解码数据中解压缩得到第一最小像素值和多个残差,并可以根据所述多个残差和第一最小像素值,可以重建得到图像的多个像素值。可见,由于编码端与解码端之间只需传输第一最小像素值及各像素值对应的残差,无需传输各像素的原始像素值,因此降低了传输的数据量。并且,各像素值是基于第一最小像素值重建的,因此与第一最小像素值接近的像素值(图像的暗部)可以保留较高的精度,这与人眼对亮度变化的感知敏感度在暗部高于亮部的规律相符合,实现了在提高压缩性能的同时保证良好的画质。In the image decoding apparatus provided in the embodiment of the present application, the decoding end can decompress the first data to be decoded to obtain the first minimum pixel value and multiple residuals, and can, according to the multiple residuals and the first minimum pixel value, Multiple pixel values of the resulting image can be reconstructed. It can be seen that, because only the first minimum pixel value and the residual corresponding to each pixel value need to be transmitted between the encoding end and the decoding end, and the original pixel value of each pixel does not need to be transmitted, the amount of data to be transmitted is reduced. Moreover, each pixel value is reconstructed based on the first minimum pixel value, so the pixel value (dark part of the image) close to the first minimum pixel value can retain high precision, which is related to the human eye's perception sensitivity to brightness changes. The dark part is higher than the bright part in accordance with the law, which can improve the compression performance and ensure good image quality.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像编码方法。The embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image encoding method provided by the embodiments of the present application.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像解码方法。The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program implements the image decoding method provided by the embodiment of the present application when the computer program is executed by the processor.
以上针对每个保护主题均提供了多种实施方式,在不存在冲突或矛盾的基础上,本领域技术人员可以根据实际情况自由对各种实施方式进行组合,由此构成各种不同的技术方案。而本申请文件限于篇幅,未能对所有组合而得的技术方案展开说明,但可以理解的是,这些未能展开的技术方案也属于本申请实施例公开的范围。Various implementations are provided above for each protection subject. On the basis of no conflict or contradiction, those skilled in the art can freely combine various implementations according to the actual situation, thereby forming various technical solutions. . However, this application document is limited in space and cannot describe all the technical solutions obtained by combination, but it can be understood that these technical solutions that cannot be developed also belong to the scope disclosed in the embodiments of this application.
本申请实施例可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。Embodiments of the present application may take the form of a computer program product implemented on one or more storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having program code embodied therein. Computer-usable storage media includes permanent and non-permanent, removable and non-removable media, and storage of information can be accomplished by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之 间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. The terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also other not expressly listed elements, or also include elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
以上对本申请实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The methods and devices provided by the embodiments of the present application have been introduced in detail above, and specific examples are used to illustrate the principles and implementations of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the application, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as a limitation to the application. .

Claims (66)

  1. 一种图像编码方法,其特征在于,包括:An image coding method, comprising:
    获取待编码图像对应的第一待编码数据,所述第一待编码数据包括关于所述待编码图像中一区块的多个像素的多个像素值;acquiring first data to be encoded corresponding to the image to be encoded, the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
    从所述多个像素值中确定关于所述多个像素值的第一最小像素值;determining a first minimum pixel value for the plurality of pixel values from the plurality of pixel values;
    根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差;determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values;
    对各像素值对应的所述残差以及所述第一最小像素值进行压缩。The residual corresponding to each pixel value and the first minimum pixel value are compressed.
  2. 根据权利要求1所述的方法,其特征在于,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。The method according to claim 1, wherein the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  3. 根据权利要求2所述的方法,其特征在于,对各像素值对应的所述残差进行压缩,包括:The method according to claim 2, wherein compressing the residual corresponding to each pixel value comprises:
    对各像素值对应的所述残差通过对数变换进行压缩。The residual corresponding to each pixel value is compressed by logarithmic transformation.
  4. 根据权利要求3所述的方法,其特征在于,所述对各像素值对应的所述残差通过对数变换进行压缩,包括:The method according to claim 3, wherein the compressing the residual corresponding to each pixel value by logarithmic transformation, comprising:
    确定第一残差所属的最小残差范围,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值;determining the minimum residual range to which the first residual belongs, wherein the first residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block;
    确定所述第一残差在压缩后占用的第一目标比特位数;determining the first target number of bits occupied by the first residual after compression;
    根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩。The first residual is compressed according to the minimum residual range and the first target number of bits.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩,包括:The method according to claim 4, wherein the compressing the first residual according to the minimum residual range and the first target number of bits comprises:
    将所述第一残差转化为所述最小残差范围的占比;converting the first residual into the proportion of the minimum residual range;
    将所述占比通过伽马变换压缩至所述第一目标比特位数对应的数值范围内。The ratio is compressed into a numerical range corresponding to the first target number of bits by gamma transformation.
  6. 根据权利要求4所述的方法,其特征在于,所述第一残差所属的最小残差范围为所述区块对应的最小残差范围,所述区块对应的最小残差范围通过以下方式确定:The method according to claim 4, wherein the minimum residual range to which the first residual belongs is the minimum residual range corresponding to the block, and the minimum residual range corresponding to the block is in the following manner Sure:
    确定所述区块中的各像素值对应的所述残差的最大残差;determining the maximum residual of the residual corresponding to each pixel value in the block;
    根据所述最大残差确定所述最小残差范围。The minimum residual error range is determined according to the maximum residual error.
  7. 根据权利要求4所述的方法,其特征在于,所述区块被划分为多个子区块,所述第一像素值属于所述多个子区块中的第一子区块,所述第一残差所属的最小残差范围为所述第一子区块对应的最小残差范围,所述第一子区块对应的最小残差范围通过以下方式确定:The method of claim 4, wherein the block is divided into a plurality of sub-blocks, the first pixel value belongs to a first sub-block of the plurality of sub-blocks, the first The minimum residual range to which the residual belongs is the minimum residual range corresponding to the first sub-block, and the minimum residual range corresponding to the first sub-block is determined in the following manner:
    确定所述第一子区块中的各像素值对应的所述残差的最大残差;determining the maximum residual of the residuals corresponding to each pixel value in the first subblock;
    根据所述最大残差确定所述最小残差范围。The minimum residual error range is determined according to the maximum residual error.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    确定所述第一子区块中的多个像素值的第二最小像素值;determining the second minimum pixel value of the plurality of pixel values in the first subblock;
    根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的最小残差范围。According to the minimum value difference between the second minimum pixel value and the first minimum pixel value, the minimum residual error range corresponding to the first sub-block is adjusted, so as to determine the relative value of the first sub-block The adjusted minimum residual range for the block.
  9. 根据权利要求8所述的方法,其特征在于,所述根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的残差范围,包括:The method according to claim 8, wherein, according to the minimum value difference between the second minimum pixel value and the first minimum pixel value, for the minimum value corresponding to the first sub-block The residual error range is adjusted to determine the adjusted residual error range for the first sub-block, including:
    根据第一对应关系确定所述最小值差值对应的调整量,并根据所述调整量对所述第一子区块对应的最小残差范围进行调整,所述第一对应关系是预先配置的最小值差值与调整量的对应关系。The adjustment amount corresponding to the minimum difference value is determined according to the first correspondence, and the minimum residual range corresponding to the first sub-block is adjusted according to the adjustment amount, and the first correspondence is pre-configured The corresponding relationship between the minimum difference value and the adjustment amount.
  10. 根据权利要求9所述的方法,其特征在于,所述第一对应关系是最小值差值、调整量与第一索引值的对应关系,所述方法还包括:The method according to claim 9, wherein the first correspondence is the correspondence between the minimum difference value, the adjustment amount and the first index value, and the method further comprises:
    根据所述第一对应关系确定所述调整量对应的第一索引值,所述第一索引值用于传输给解码端。A first index value corresponding to the adjustment amount is determined according to the first correspondence, and the first index value is used for transmission to the decoding end.
  11. 根据权利要求6或7所述的方法,其特征在于,所述根据所述最大残差确定所述最小残差范围,包括:The method according to claim 6 or 7, wherein the determining the minimum residual error range according to the maximum residual error comprises:
    根据第二对应关系确定所述最大残差对应的最小残差范围,所述第二对应关系是预先配置的最大残差与最小残差范围的对应关系。A minimum residual error range corresponding to the maximum residual error is determined according to a second correspondence relationship, where the second correspondence relationship is a preconfigured correspondence relationship between the maximum residual error and the minimum residual error range.
  12. 根据权利要求11所述的方法,其特征在于,所述第二对应关系是最大残差、最小残差范围与第二索引值的对应关系,所述方法还包括:The method according to claim 11, wherein the second correspondence is a correspondence between the maximum residual error, the minimum residual error range and the second index value, and the method further comprises:
    根据所述第二对应关系确定所述最小残差范围对应的第二索引值,所述第二索引值用于传输给解码端。A second index value corresponding to the minimum residual error range is determined according to the second correspondence, and the second index value is used for transmission to the decoding end.
  13. 根据权利要求4所述的方法,其特征在于,所述确定所述第一残差在压缩后占用的第一目标比特位数,包括:The method according to claim 4, wherein the determining the first target number of bits occupied by the first residual after compression comprises:
    根据所述第一像素值所属的最小区块中的各像素值对应的残差的最大残差,对所述第一残差进行比特位数的初始分配,以确定所述第一目标比特位数。According to the maximum residual of the residuals corresponding to each pixel value in the smallest block to which the first pixel value belongs, an initial allocation of the number of bits is performed on the first residual to determine the first target bit. number.
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:The method of claim 13, wherein the method further comprises:
    若在所述初始分配后有比特位数的剩余,将剩余的比特位数优先分配给所述第一待编码数据在划分边界处的像素值对应的所述残差。If there is a remaining number of bits after the initial allocation, the remaining number of bits is preferentially allocated to the residual corresponding to the pixel value of the first data to be encoded at the division boundary.
  15. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method according to claim 3, wherein the method further comprises:
    若压缩后的残差大于压缩前的残差,则将压缩后的残差的数值修改为压缩前的残差的数值。If the compressed residual is larger than the uncompressed residual, the value of the compressed residual is modified to the value of the uncompressed residual.
  16. 根据权利要求1所述的方法,其特征在于,所述根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差,包括:The method according to claim 1, wherein the determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values comprises:
    利用压缩后的所述第一最小像素值进行重建,得到重建的第一最小像素值;Use the compressed first minimum pixel value for reconstruction to obtain the reconstructed first minimum pixel value;
    将各个所述像素值与所述重建的第一最小像素值之间的残差确定为各像素值对应的所述残差。A residual between each of the pixel values and the reconstructed first minimum pixel value is determined as the residual corresponding to each pixel value.
  17. 根据权利要求1所述的方法,其特征在于,对所述第一最小像素值进行压缩,包括:The method according to claim 1, wherein compressing the first minimum pixel value comprises:
    确定关于所述多个像素值中的各像素值对应的所述残差中的最大残差;determining the largest residual among the residuals corresponding to each of the plurality of pixel values;
    根据所述最大残差确定所述第一最小像素值在压缩后占用的第二目标比特位数;determining the second target number of bits occupied by the first minimum pixel value after compression according to the maximum residual error;
    根据所述第二目标比特位数对所述第一最小像素值进行压缩。The first minimum pixel value is compressed according to the second target number of bits.
  18. 根据权利要求1所述的方法,其特征在于,所述第一待编码数据是对所述待编码图像的第一待编码数据块进行划分得到的。The method according to claim 1, wherein the first data to be encoded is obtained by dividing a first data block to be encoded of the image to be encoded.
  19. 根据权利要求18所述的方法,其特征在于,所述待编码图像包括原始raw图像。The method of claim 18, wherein the to-be-encoded image comprises an original raw image.
  20. 根据权利要求19所述的方法,其特征在于,所述第一待编码数据块是基于所述待编码图像的第一颜色分量对应的编码数据块得到的。The method according to claim 19, wherein the first data block to be encoded is obtained based on the encoded data block corresponding to the first color component of the image to be encoded.
  21. 根据权利要求20所述的方法,其特征在于,所述第一颜色分量对应的编码数据块是对所述待编码图像的原始编码数据块进行解交织得到的。The method according to claim 20, wherein the encoded data block corresponding to the first color component is obtained by de-interleaving the original encoded data block of the image to be encoded.
  22. 根据权利要求20所述的方法,其特征在于,所述第一待编码数据块是对所述第一颜色分量对应的编码数据块进行压缩得到的。The method according to claim 20, wherein the first data block to be encoded is obtained by compressing the encoded data block corresponding to the first color component.
  23. 根据权利要求21所述的方法,其特征在于,对所述第一颜色分量对应的编码数据块进行压缩,包括:The method according to claim 21, wherein compressing the encoded data block corresponding to the first color component comprises:
    将所述第一颜色分量对应的编码数据块中的各像素值通过对数变换进行压缩。Each pixel value in the encoded data block corresponding to the first color component is compressed by logarithmic transformation.
  24. 一种图像解码方法,其特征在于,所述方法包括:An image decoding method, characterized in that the method comprises:
    获取待解码图像对应的第一待解码数据;obtaining the first to-be-decoded data corresponding to the to-be-decoded image;
    将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差;decompressing the first data to be decoded to determine a first minimum pixel value and a plurality of residuals;
    根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多 个像素值。From the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the decoded image are determined.
  25. 根据权利要求24所述的方法,其特征在于,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。The method according to claim 24, wherein the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  26. 根据权利要求25所述的方法,其特征在于,所述第一待解码数据包括压缩后的所述多个残差,所述将所述第一待解码数据进行解压缩,包括:The method according to claim 25, wherein the first data to be decoded comprises the plurality of compressed residuals, and the decompressing the first data to be decoded comprises:
    对压缩后的所述多个残差通过对数反变换进行解压缩。The compressed residuals are decompressed by inverse log transformation.
  27. 根据权利要求26所述的方法,其特征在于,所述对压缩后的所述多个残差通过对数反变换进行解压缩,包括:The method according to claim 26, wherein the decompressing the compressed residuals by inverse logarithmic transformation comprises:
    根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值。The compressed first residual is decompressed according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, wherein the first residual is decompressed. A residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block.
  28. 根据权利要求27所述的方法,其特征在于,所述根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,包括:The method according to claim 27, wherein, according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, the compressed The first residual is decompressed, including:
    根据所述第一目标比特位数,对压缩后的所述第一残差通过反伽马变换进行解压缩,得到所述第一残差在所述最小残差范围对应的占比;According to the first target number of bits, the compressed first residual is decompressed by inverse gamma transform to obtain the proportion of the first residual corresponding to the minimum residual range;
    根据所述占比以及所述最小残差范围,确定所述第一残差。The first residual is determined according to the proportion and the minimum residual range.
  29. 根据权利要求27所述的方法,其特征在于,所述第一残差所属的最小残差范围是根据第二对应关系以及第二索引值确定的,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第二索引值是从所述第一待解码数据中解码得到的。The method according to claim 27, wherein the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error The correspondence between the residual range and the second index value, where the second index value is decoded from the first data to be decoded.
  30. 根据权利要求27所述的方法,其特征在于,所述第一残差所属的最小残差范围通过以下方式确定:The method according to claim 27, wherein the minimum residual error range to which the first residual belongs is determined in the following manner:
    根据第二对应关系以及第二索引值确定所述最小残差范围;determining the minimum residual error range according to the second correspondence and the second index value;
    根据第一对应关系以及第一索引值确定所述最小残差范围对应的调整量;Determine the adjustment amount corresponding to the minimum residual error range according to the first correspondence and the first index value;
    根据所述调整量对所述最小残差范围进行调整,并将调整后的最小残差范围确定为所述第一残差所属的最小残差范围;Adjust the minimum residual error range according to the adjustment amount, and determine the adjusted minimum residual error range as the minimum residual error range to which the first residual belongs;
    其中,所述第一对应关系是预先配置的调整量与第一索引值的对应关系,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第一索引值与所述第二索引值均是从所述第一待解码数据中解码得到的。Wherein, the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value, the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value, the first Both the index value and the second index value are decoded from the first data to be decoded.
  31. 根据权利要求24所述的方法,其特征在于,所述根据所述第一最小像素值和 所述多个残差,确定关于所述待解码图像的多个像素的多个像素值,包括:The method according to claim 24, wherein the determining a plurality of pixel values for a plurality of pixels of the to-be-decoded image according to the first minimum pixel value and the plurality of residuals comprises:
    根据所述第一最小像素值和所述多个残差进行解压缩,得到所述待解码图像的多个像素的多个像素值。Decompressing is performed according to the first minimum pixel value and the plurality of residuals to obtain a plurality of pixel values of a plurality of pixels of the image to be decoded.
  32. 根据权利要求24所述的方法,其特征在于,所述第一待解码数据包括压缩后的所述第一最小像素值,所述将所述第一待解码数据进行解压缩,包括:The method according to claim 24, wherein the first data to be decoded comprises the compressed first minimum pixel value, and the decompressing the first data to be decoded comprises:
    对压缩后的所述第一最小像素值通过对数反变换进行解压缩。The compressed first minimum pixel value is decompressed by inverse logarithmic transformation.
  33. 一种图像编码装置,其特征在于,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:An image encoding device, characterized in that it comprises: a processor and a memory storing a computer program, wherein the processor implements the following steps when executing the computer program:
    获取待编码图像对应的第一待编码数据,所述第一待编码数据包括关于所述待编码图像中一区块的多个像素的多个像素值;acquiring first data to be encoded corresponding to the image to be encoded, the first data to be encoded includes multiple pixel values of multiple pixels of a block in the image to be encoded;
    从所述多个像素值中确定关于所述多个像素值的第一最小像素值;determining a first minimum pixel value for the plurality of pixel values from the plurality of pixel values;
    根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差;determining, according to the first minimum pixel value, a residual corresponding to each pixel value in the plurality of pixel values;
    对各像素值对应的所述残差以及所述第一最小像素值进行压缩。The residual corresponding to each pixel value and the first minimum pixel value are compressed.
  34. 根据权利要求33所述的装置,其特征在于,所述像素值对应的残差的压缩率与所述像素值对应的残差的大小正相关。The apparatus according to claim 33, wherein the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  35. 根据权利要求34所述的装置,其特征在于,所述处理器在对各像素值对应的所述残差进行压缩时用于,对各像素值对应的所述残差通过对数变换进行压缩。The device according to claim 34, wherein the processor is configured to compress the residual corresponding to each pixel value through logarithmic transformation when compressing the residual corresponding to each pixel value .
  36. 根据权利要求35所述的装置,其特征在于,所述处理器在对各像素值对应的所述残差通过对数变换进行压缩时用于,确定第一残差所属的最小残差范围,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值;确定所述第一残差在压缩后占用的第一目标比特位数;根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩。The device according to claim 35, wherein the processor is configured to determine the minimum residual error range to which the first residual belongs when compressing the residual corresponding to each pixel value by logarithmic transformation, Wherein, the first residual is the residual corresponding to the first pixel value, and the first pixel value is any pixel value in the block; determine the first residual occupied by the first residual after compression target number of bits; compressing the first residual according to the minimum residual range and the first target number of bits.
  37. 根据权利要求36所述的装置,其特征在于,所述处理器在根据所述最小残差范围与所述第一目标比特位数对所述第一残差进行压缩时用于,将所述第一残差转化为所述最小残差范围的占比;将所述占比通过伽马变换压缩至所述第一目标比特位数对应的数值范围内。The apparatus according to claim 36, wherein when the processor compresses the first residual according to the minimum residual range and the first target number of bits, the processor is configured to: The first residual is converted into a proportion of the minimum residual error range; the proportion is compressed into a numerical range corresponding to the first target number of bits through gamma transformation.
  38. 根据权利要求36所述的装置,其特征在于,所述第一残差所属的最小残差范围为所述区块对应的最小残差范围,所述处理器在确定所述区块对应的最小残差范围时用于,确定所述区块中的各像素值对应的所述残差的最大残差;根据所述最大残差确定所述最小残差范围。The apparatus according to claim 36, wherein the minimum residual range to which the first residual belongs is a minimum residual range corresponding to the block, and the processor is determining the minimum residual range corresponding to the block. When the residual error range is used, the maximum residual error of the residual error corresponding to each pixel value in the block is determined; the minimum residual error range is determined according to the maximum residual error.
  39. 根据权利要求36所述的装置,其特征在于,所述区块被划分为多个子区块,所述第一像素值属于所述多个子区块中的第一子区块,所述第一残差所属的最小残差范围为所述第一子区块对应的最小残差范围,所述处理器在确定所述第一子区块对应的最小残差范围时用于,确定所述第一子区块中的各像素值对应的所述残差的最大残差;根据所述最大残差确定所述最小残差范围。The apparatus of claim 36, wherein the block is divided into a plurality of sub-blocks, the first pixel value belongs to a first sub-block of the plurality of sub-blocks, and the first pixel value belongs to a first sub-block of the plurality of sub-blocks. The minimum residual range to which the residual belongs is the minimum residual range corresponding to the first sub-block, and the processor is used for determining the first sub-block when determining the minimum residual range corresponding to the first sub-block. The maximum residual of the residual corresponding to each pixel value in a sub-block; the minimum residual range is determined according to the maximum residual.
  40. 根据权利要求39所述的装置,其特征在于,所述处理器还用于,确定所述第一子区块中的多个像素值的第二最小像素值;根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的最小残差范围。The device according to claim 39, wherein the processor is further configured to determine a second minimum pixel value of a plurality of pixel values in the first sub-block; according to the second minimum pixel value and the minimum value difference between the first minimum pixel value, the minimum residual error range corresponding to the first sub-block is adjusted to determine the adjusted minimum residual error about the first sub-block scope.
  41. 根据权利要求34所述的装置,其特征在于,所述处理器在根据所述第二最小像素值和所述第一最小像素值之间的最小值差值,对所述第一子区块对应的最小残差范围进行调整,以确定关于所述第一子区块的调整后的残差范围时用于,根据第一对应关系确定所述最小值差值对应的调整量,并根据所述调整量对所述第一子区块对应的最小残差范围进行调整,所述第一对应关系是预先配置的最小值差值与调整量的对应关系。34. The apparatus of claim 34, wherein the processor performs the first sub-block according to a minimum value difference between the second minimum pixel value and the first minimum pixel value The corresponding minimum residual error range is adjusted to determine the adjusted residual error range about the first sub-block, and is used to determine the adjustment amount corresponding to the minimum value difference according to the first correspondence, and according to the The adjustment amount adjusts the minimum residual error range corresponding to the first sub-block, and the first correspondence relationship is a correspondence relationship between a pre-configured minimum difference value and an adjustment amount.
  42. 根据权利要求41所述的装置,其特征在于,所述第一对应关系是最小值差值、调整量与第一索引值的对应关系,所述处理器还用于,根据所述第一对应关系确定所述调整量对应的第一索引值,所述第一索引值用于传输给解码端。The apparatus according to claim 41, wherein the first correspondence is a correspondence between the minimum value difference, the adjustment amount and the first index value, and the processor is further configured to: according to the first correspondence The relationship determines the first index value corresponding to the adjustment amount, and the first index value is used for transmission to the decoding end.
  43. 根据权利要求38或39所述的装置,其特征在于,所述处理器在根据所述最大残差确定所述最小残差范围时用于,根据第二对应关系确定所述最大残差对应的最小残差范围,所述第二对应关系是预先配置的最大残差与最小残差范围的对应关系。The apparatus according to claim 38 or 39, wherein, when the processor determines the minimum residual error range according to the maximum residual error, the processor is configured to determine, according to a second correspondence relationship, a Minimum residual error range, the second correspondence is a pre-configured correspondence relationship between the maximum residual error and the minimum residual error range.
  44. 根据权利要求43所述的装置,其特征在于,所述第二对应关系是最大残差、最小残差范围与第二索引值的对应关系,所述处理器还用于,根据所述第二对应关系确定所述最小残差范围对应的第二索引值,所述第二索引值用于传输给解码端。The apparatus according to claim 43, wherein the second correspondence is a correspondence between a maximum residual error, a minimum residual error range and a second index value, and the processor is further configured to: The correspondence determines the second index value corresponding to the minimum residual error range, and the second index value is used for transmission to the decoding end.
  45. 根据权利要求36所述的装置,其特征在于,所述处理器在确定所述第一残差在压缩后占用的第一目标比特位数时用于,根据所述第一像素值所属的最小区块中的各像素值对应的残差的最大残差,对所述第一残差进行比特位数的初始分配,以确定所述第一目标比特位数。The apparatus according to claim 36, wherein when the processor determines the first target number of bits occupied by the first residual after compression, the processor is configured to: The maximum residual of the residuals corresponding to each pixel value in the small block, and initial allocation of the number of bits is performed on the first residual to determine the first target number of bits.
  46. 根据权利要求45所述的装置,其特征在于,所述处理器还用于,若在所述初始分配后有比特位数的剩余,将剩余的比特位数优先分配给所述第一待编码数据在划分边界处的像素值对应的所述残差。The device according to claim 45, wherein the processor is further configured to, if there is a remaining number of bits after the initial allocation, preferentially allocate the remaining number of bits to the first to-be-coded The residual corresponding to the pixel value of the data at the partition boundary.
  47. 根据权利要求35所述的装置,其特征在于,所述处理器还用于,若压缩后的残差大于压缩前的残差,则将压缩后的残差的数值修改为压缩前的残差的数值。The apparatus according to claim 35, wherein the processor is further configured to, if the compressed residual is larger than the uncompressed residual, modify the value of the compressed residual to the uncompressed residual value of .
  48. 根据权利要求33所述的装置,其特征在于,所述处理器在根据所述第一最小像素值,确定关于所述多个像素值中的各像素值对应的残差时用于,利用压缩后的所述第一最小像素值进行重建,得到重建的第一最小像素值;将各个所述像素值与所述重建的第一最小像素值之间的残差确定为各像素值对应的所述残差。34. The apparatus of claim 33, wherein the processor is configured to utilize compression when determining the residual corresponding to each pixel value in the plurality of pixel values according to the first minimum pixel value. The reconstructed first minimum pixel value is reconstructed to obtain the reconstructed first minimum pixel value; the residual between each of the pixel values and the reconstructed first minimum pixel value is determined as the corresponding pixel value. the residuals.
  49. 根据权利要求33所述的装置,其特征在于,所述处理器在对所述第一最小像素值进行压缩时用于,确定关于所述多个像素值中的各像素值对应的所述残差中的最大残差;根据所述最大残差确定所述第一最小像素值在压缩后占用的第二目标比特位数;根据所述第二目标比特位数对所述第一最小像素值进行压缩。The apparatus according to claim 33, wherein the processor is configured to, when compressing the first minimum pixel value, determine the residual value corresponding to each pixel value in the plurality of pixel values The maximum residual in the difference; determine the second target number of bits occupied by the first minimum pixel value after compression according to the maximum residual; to compress.
  50. 根据权利要求33所述的装置,其特征在于,所述第一待编码数据是对所述待编码图像的第一待编码数据块进行划分得到的。The apparatus according to claim 33, wherein the first data to be encoded is obtained by dividing a first data block to be encoded of the image to be encoded.
  51. 根据权利要求50所述的装置,其特征在于,所述待编码图像包括原始raw图像。The apparatus of claim 50, wherein the to-be-encoded image comprises an original raw image.
  52. 根据权利要求51所述的装置,其特征在于,所述第一待编码数据块是基于所述待编码图像的第一颜色分量对应的编码数据块得到的。The apparatus according to claim 51, wherein the first data block to be encoded is obtained based on the encoded data block corresponding to the first color component of the image to be encoded.
  53. 根据权利要求52所述的装置,其特征在于,所述第一颜色分量对应的编码数据块是对所述待编码图像的原始编码数据块进行解交织得到的。The apparatus according to claim 52, wherein the encoded data block corresponding to the first color component is obtained by de-interleaving the original encoded data block of the image to be encoded.
  54. 根据权利要求52所述的装置,其特征在于,所述第一待编码数据块是对所述第一颜色分量对应的编码数据块进行压缩得到的。The apparatus according to claim 52, wherein the first data block to be encoded is obtained by compressing the encoded data block corresponding to the first color component.
  55. 根据权利要求53所述的装置,其特征在于,所述处理器在对所述第一颜色分量对应的编码数据块进行压缩时用于,将所述第一颜色分量对应的编码数据块中的各像素值通过对数变换进行压缩。The apparatus according to claim 53, wherein when the processor compresses the encoded data block corresponding to the first color component, the processor is configured to: compress the encoded data block corresponding to the first color component Each pixel value is compressed by logarithmic transformation.
  56. 一种图像解码装置,其特征在于,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:An image decoding device, characterized in that it comprises: a processor and a memory storing a computer program, wherein the processor implements the following steps when executing the computer program:
    获取待解码图像对应的第一待解码数据;obtaining the first to-be-decoded data corresponding to the to-be-decoded image;
    将所述第一待解码数据进行解压缩,以确定第一最小像素值和多个残差;decompressing the first data to be decoded to determine a first minimum pixel value and a plurality of residuals;
    根据所述第一最小像素值和所述多个残差,确定关于已解码图像的多个像素的多个像素值。From the first minimum pixel value and the plurality of residuals, a plurality of pixel values for a plurality of pixels of the decoded image are determined.
  57. 根据权利要求56所述的装置,其特征在于,所述像素值对应的残差的压缩率 与所述像素值对应的残差的大小正相关。The apparatus according to claim 56, wherein the compression ratio of the residual corresponding to the pixel value is positively correlated with the size of the residual corresponding to the pixel value.
  58. 根据权利要求57所述的装置,其特征在于,所述第一待解码数据包括压缩后的所述多个残差,所述处理器在将所述第一待解码数据进行解压缩时用于,对压缩后的所述多个残差通过对数反变换进行解压缩。The apparatus according to claim 57, wherein the first data to be decoded comprises the plurality of compressed residuals, and the processor is used for decompressing the first data to be decoded for decompressing the first data to be decoded. , and decompress the compressed residuals through inverse logarithmic transformation.
  59. 根据权利要求58所述的装置,其特征在于,所述处理器在对压缩后的所述多个残差通过对数反变换进行解压缩时用于,根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩,其中,所述第一残差为第一像素值对应的残差,所述第一像素值为所述区块中的任一像素值。The apparatus according to claim 58, wherein when the processor decompresses the compressed residuals through inverse logarithmic transformation, the processor is configured to: according to the smallest residual to which the first residual belongs range, and the first target number of bits occupied by the first residual after compression, and decompress the compressed first residual, where the first residual is the value corresponding to the first pixel value Residual, the first pixel value is any pixel value in the block.
  60. 根据权利要求59所述的装置,其特征在于,所述处理器在根据第一残差所属的最小残差范围、以及所述第一残差在压缩后占用的第一目标比特位数,对压缩后的所述第一残差进行解压缩时用于,根据所述第一目标比特位数,对压缩后的所述第一残差通过反伽马变换进行解压缩,得到所述第一残差在所述最小残差范围对应的占比;根据所述占比以及所述最小残差范围,确定所述第一残差。The apparatus according to claim 59, wherein, according to the minimum residual range to which the first residual belongs and the first target number of bits occupied by the first residual after compression, the processor determines the When the compressed first residual is decompressed, it is used for decompressing the compressed first residual through inverse gamma transform according to the first target number of bits to obtain the first residual. The proportion of the residual error corresponding to the minimum residual error range; the first residual error is determined according to the proportion and the minimum residual error range.
  61. 根据权利要求59所述的装置,其特征在于,所述第一残差所属的最小残差范围是根据第二对应关系以及第二索引值确定的,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第二索引值是从所述第一待解码数据中解码得到的。The apparatus according to claim 59, wherein the minimum residual error range to which the first residual belongs is determined according to a second correspondence relationship and a second index value, and the second correspondence relationship is a pre-configured minimum residual error The correspondence between the residual range and the second index value, where the second index value is decoded from the first data to be decoded.
  62. 根据权利要求59所述的装置,其特征在于,所述处理器在确定所述第一残差所属的最小残差范围时用于,根据第二对应关系以及第二索引值确定所述最小残差范围;根据第一对应关系以及第一索引值确定所述最小残差范围对应的调整量;根据所述调整量对所述最小残差范围进行调整,并将调整后的最小残差范围确定为所述第一残差所属的最小残差范围;The apparatus according to claim 59, wherein when determining the minimum residual range to which the first residual belongs, the processor is configured to determine the minimum residual according to a second correspondence and a second index value difference range; determine the adjustment amount corresponding to the minimum residual error range according to the first correspondence and the first index value; adjust the minimum residual error range according to the adjustment amount, and determine the adjusted minimum residual error range is the minimum residual range to which the first residual belongs;
    其中,所述第一对应关系是预先配置的调整量与第一索引值的对应关系,所述第二对应关系是预先配置的最小残差范围与第二索引值的对应关系,所述第一索引值与所述第二索引值均是从所述第一待解码数据中解码得到的。Wherein, the first correspondence is the correspondence between the pre-configured adjustment amount and the first index value, the second correspondence is the correspondence between the pre-configured minimum residual error range and the second index value, the first Both the index value and the second index value are decoded from the first data to be decoded.
  63. 根据权利要求56所述的装置,其特征在于,所述处理器在根据所述第一最小像素值和所述多个残差,确定关于所述待解码图像的多个像素的多个像素值时用于,根据所述第一最小像素值和所述多个残差进行解压缩,得到所述待解码图像的多个像素的多个像素值。The apparatus according to claim 56, wherein the processor determines a plurality of pixel values for a plurality of pixels of the to-be-decoded image according to the first minimum pixel value and the plurality of residuals is used to perform decompression according to the first minimum pixel value and the multiple residuals to obtain multiple pixel values of multiple pixels of the to-be-decoded image.
  64. 根据权利要求56所述的装置,其特征在于,所述第一待解码数据包括压缩后 的所述第一最小像素值,所述处理器在将所述第一待解码数据进行解压缩时用于,对压缩后的所述第一最小像素值通过对数反变换进行解压缩。The apparatus according to claim 56, wherein the first data to be decoded comprises the compressed first minimum pixel value, and the processor decompresses the first data to be decoded by using Then, the compressed first minimum pixel value is decompressed by inverse logarithmic transformation.
  65. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至23任一项所述的图像编码方法。A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image encoding method according to any one of claims 1 to 23 is implemented.
  66. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求24至32任一项所述的图像解码方法。A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image decoding method according to any one of claims 24 to 32 is implemented.
PCT/CN2021/080029 2021-03-10 2021-03-10 Image encoding method and apparatus, and image decoding method and apparatus WO2022188070A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/080029 WO2022188070A1 (en) 2021-03-10 2021-03-10 Image encoding method and apparatus, and image decoding method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/080029 WO2022188070A1 (en) 2021-03-10 2021-03-10 Image encoding method and apparatus, and image decoding method and apparatus

Publications (1)

Publication Number Publication Date
WO2022188070A1 true WO2022188070A1 (en) 2022-09-15

Family

ID=83226182

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080029 WO2022188070A1 (en) 2021-03-10 2021-03-10 Image encoding method and apparatus, and image decoding method and apparatus

Country Status (1)

Country Link
WO (1) WO2022188070A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103517068A (en) * 2012-06-21 2014-01-15 富士通株式会社 Image compression method and device
US20180176564A1 (en) * 2016-12-21 2018-06-21 Arris Enterprises Llc Nonlinear local activity for adaptive quantization
CN109326251A (en) * 2017-08-01 2019-02-12 奇景光电股份有限公司 Image data compression method and sequence controller
CN110933413A (en) * 2018-09-20 2020-03-27 北京君正集成电路股份有限公司 Video frame processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103517068A (en) * 2012-06-21 2014-01-15 富士通株式会社 Image compression method and device
US20180176564A1 (en) * 2016-12-21 2018-06-21 Arris Enterprises Llc Nonlinear local activity for adaptive quantization
CN109326251A (en) * 2017-08-01 2019-02-12 奇景光电股份有限公司 Image data compression method and sequence controller
CN110933413A (en) * 2018-09-20 2020-03-27 北京君正集成电路股份有限公司 Video frame processing method and device

Similar Documents

Publication Publication Date Title
US9936199B2 (en) Encoding and decoding perceptually-quantized video content
JP3392862B2 (en) Image compression method and system using adaptive block size
TWI455571B (en) Resolution based formatting of compressed image data
TWI428837B (en) Adaptive coding decoding of wide-range coefficients
CN114631320A (en) Apparatus and method for performing Artificial Intelligence (AI) encoding and AI decoding on image
US8948530B2 (en) Adaptive image compression system and method
TWI505694B (en) Encoder and method
US20130272391A1 (en) Method and Apparatus of Quantization Matrix Coding
JP2016226001A (en) Decoder and decoding method
WO2008150818A2 (en) Bitrate reduction techniques for image transcoding
WO2019191983A1 (en) Encoding method and device, image processing system, and computer readable storage medium
US10785493B2 (en) Method of compressing and decompressing image data
US20180084281A1 (en) Storing and retrieving high bit depth image data
TW508940B (en) Method and apparatus for color image date processing and compression
KR20160019060A (en) Encoding and decoding methods for adapting the average luminance of high dynamic range pictures and corresponding encoder and decoder
CN106412595B (en) Method and apparatus for encoding high dynamic range frames and applied low dynamic range frames
JP2017005456A (en) Image compression method, image compression device and imaging apparatus
KR20140027040A (en) Adaptive predictive image compression system and method thereof
EP1769459B1 (en) Image compression for rapid high-quality imaging
WO2022188070A1 (en) Image encoding method and apparatus, and image decoding method and apparatus
JP2022548347A (en) Coding method for depth data
KR101703330B1 (en) Method and apparatus for re-encoding an image
US20190098325A1 (en) Storing and retrieving high bit depth image data
US10045022B2 (en) Adaptive content dependent intra prediction mode coding
JP2004040300A (en) Image processing apparatus

Legal Events

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

Ref document number: 21929549

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21929549

Country of ref document: EP

Kind code of ref document: A1