WO2014000443A1 - Image data compression and decompression method and device - Google Patents

Image data compression and decompression method and device Download PDF

Info

Publication number
WO2014000443A1
WO2014000443A1 PCT/CN2013/070896 CN2013070896W WO2014000443A1 WO 2014000443 A1 WO2014000443 A1 WO 2014000443A1 CN 2013070896 W CN2013070896 W CN 2013070896W WO 2014000443 A1 WO2014000443 A1 WO 2014000443A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
quantization
pixel
quantized
image block
Prior art date
Application number
PCT/CN2013/070896
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 华为技术有限公司
Publication of WO2014000443A1 publication Critical patent/WO2014000443A1/en

Links

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/124Quantisation

Definitions

  • the invention relates to a Chinese patent application filed on June 29, 2012, the Chinese Patent Application No. 2012102225166.1, the invention entitled “An image data compression and decompression method, device” Priority is hereby incorporated by reference in its entirety.
  • the present invention relates to the field of image processing, and in particular, to an image data compression and decompression method and apparatus.
  • the original file data has different loss effects.
  • the data compression technology can be divided into lossy compression and lossless compression.
  • lossy compression is a kind of loss of certain information in the process of compression loss.
  • this data compression technique acquires a large compression ratio on the premise that the loss data has little effect on understanding the original data information. Therefore, lossy compression is mostly applied to the compression of video, image and video data, and also to the compression of massive process data.
  • a prior art lossy compression method applied to image compression is: dividing an image into a plurality of image data blocks, wherein each image data block includes a plurality of pixel points; searching for maximum and minimum values of pixels of the image block to be processed; For each pixel of the image data block, the value of the minimum pixel is subtracted, and according to the correspondence of the quantization range, the quantized value of the difference is obtained; the quantized value of the difference between the maximum value, the minimum value, and each pixel point respectively Encode.
  • Embodiments of the present invention provide a data compression and decompression method and apparatus to improve coding efficiency and compression efficiency.
  • An embodiment of the present invention provides an image data compression method, where the method includes: quantizing an image block pixel minimum value and a pixel maximum value into a first quantization value and a second quantization value, respectively, where the pixel minimum value and the pixel maximum value are respectively Corresponding to the quantization step number of the first quantization step and the quantization step number of the second quantization step; mapping the value of each pixel of the image block to the quantization step number of the third quantization step, where the third quantization step is a quantization step in which a quantization interval of the first quantization value and the second quantization value is equally divided by a quantization step; a quantization step number of the first quantization step corresponding to the minimum value of the pixel, the pixel maximum The quantization step number of the second quantization step corresponding to the value and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written into the code stream.
  • An embodiment of the present invention provides an image data decompression method, where the method includes: decoding, according to a pixel block minimum value and a pixel maximum value corresponding to a quantization step number, a pixel block minimum value and a pixel maximum value respectively corresponding to the image block a first quantized value and a second quantized value; a quantization order, a first quantized value, and a second quantized value used when mapping a value of each pixel of the image block in the code stream to a quantized order number of the third quantized order, Acquiring a plurality of the third quantization steps uniformly divided by the quantization interval of the first quantization value and the second quantization value; and mapping the value of each pixel of the image block in the code stream to the third quantization step And a boundary value of each of the third quantization steps, reconstructing each pixel of the image block to obtain a value of each pixel of the image block.
  • An embodiment of the present invention provides an image data compression apparatus, where the apparatus includes: a quantization module, configured to quantize an image block pixel minimum value and a pixel maximum value into a first quantization value and a second quantization value, respectively, the pixel minimum value And a pixel maximum value respectively corresponding to the quantization step number of the first quantization step and the quantization step number of the second quantization step; a mapping module, configured to map a value of each pixel of the image block to a quantization step number of the third quantization step
  • the third quantization step is a quantization step in a plurality of quantization steps in which the quantization interval of the first quantization value and the second quantization value is uniformly divided; an encoding module, configured to use the pixel the most d, The quantization step number of the first quantization step corresponding to the value, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written
  • An embodiment of the present invention provides an image data decompressing apparatus, where the apparatus includes: a decoding module, configured to decode, according to a pixel block minimum value and a quantization step number corresponding to a pixel maximum value in a code stream, to obtain an image block pixel maximum d, a first quantized value and a second quantized value respectively corresponding to the value and the maximum value of the pixel; and an obtaining module, configured to use the quantized order used when the value of each pixel of the image block in the code stream is mapped to the quantized order number of the third quantized order, And acquiring, by the first quantized value and the second quantized value, a plurality of the third quantization steps that are uniformly divided by the quantization interval of the first quantized value and the second quantized value; and a reconstruction module, configured to The value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, and each pixel of the image
  • the last encoding object is a pixel.
  • FIG. 1 is a schematic flowchart of an image data compression method according to an embodiment of the present invention.
  • FIG. 2a is a schematic diagram of a pixel included in an image block according to an embodiment of the present invention.
  • 2b is a schematic diagram of dividing a quantization interval with end values of 0 and 255 into 16 quantization steps according to an embodiment of the present invention
  • 2c is a schematic diagram of uniformly dividing a quantization interval with a first quantized value 80 and a second quantized value 192 as end values into eight quantization steps according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of mapping a pixel value to a quantization step number according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of an image data decompression method according to an embodiment of the present invention
  • 4a is a schematic diagram of a first quantized value and a second quantized value respectively corresponding to a pixel block minimum value and a pixel maximum value obtained by decoding at a decoding end according to an embodiment of the present invention
  • FIG. 4b is a schematic diagram of values of each pixel of a reconstructed image block according to an embodiment of the present invention
  • FIG. 4c is a comparison diagram of values of pixels before compression and values of reconstructed pixels according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of an image data compression apparatus according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention.
  • FIG. 9a is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention
  • FIG. 9b is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention
  • FIG. 9c is an image data compression according to another embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of an image data decompressing apparatus according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an image data decompressing apparatus according to another embodiment of the present invention
  • FIG. 12 is a schematic structural diagram of an image data decompressing apparatus according to another embodiment of the present invention
  • FIG. 12b is an image according to another embodiment of the present invention
  • Schematic diagram of the data decompression device structure
  • FIG. 1 is a schematic flowchart of an image data compression method according to an embodiment of the present invention, which mainly includes steps S101, S102, and S103:
  • the image block pixel minimum value and the pixel maximum value are respectively quantized into a first quantization value and a second quantization value, where the pixel minimum value and the pixel maximum value respectively correspond to the quantization step number and the second quantization step of the first quantization step.
  • the quantized order number is a code that specifies the pixel minimum value and the pixel maximum value.
  • the image to be compressed may be divided into independent processing orders including several pixels. And then searching for the pixel minimum value and the pixel maximum value in the independent processing unit, and quantizing the pixel minimum value and the pixel maximum value into the first quantized value and the second quantized value, respectively.
  • the image block pixel minimum value and the pixel maximum value are respectively quantized into the first quantized value and the second quantized value
  • the image block pixel minimum value may be quantized into M quantization steps (level of quantization And a boundary value of the first quantization step
  • the image block pixel maximum value is quantized to a boundary value of the second quantization step of the M quantization steps, where M is a natural number greater than 1.
  • the image block pixel minimum value is quantized into a boundary value of the first quantization step in the M levels of quantization, and when the image block pixel maximum value is quantized to the boundary value of the second quantization step in the M quantization steps, First, the quantization interval with the end values of 0 and 255 is divided into 16 quantization steps, and then the image block pixel minimum is quantized into the boundary value of a certain quantization step among the 16 quantization steps.
  • a quantized value quantizes the image block pixel maximum value into a boundary value of another of the 16 quantization steps, the boundary value being a second quantized value.
  • the image block pixel minimum is quantized into a quantization step corresponding to a certain quantization step boundary value, which is called a first quantization step, and the image block pixel maximum value is obtained.
  • the quantization step corresponding to the boundary value of another quantization step among the quantization steps is referred to as the second quantization step.
  • the image block includes 42 pixels as an example.
  • the pixel values of the eight pixels included in the image block are 167, 154, 141, 133, 181, 152, 122, and 86, respectively.
  • the minimum pixel value is 86
  • the maximum pixel value is 181.
  • the boundary values of the quantization order are 0 and 16, respectively, and the boundary values of the first quantization step (including the left boundary value and the right boundary value) are 16 and 32, respectively, and the second quantization step
  • the boundary values (including the left boundary value and the right boundary value) are 32 and 48, respectively, and the boundary values of the third quantization step (including the left boundary value and the right boundary value) are 48 and 64, respectively, and the boundary of the fourth quantization step
  • the values (including the left and right boundary values) are 64 and 80, respectively, and the boundary values of the fifth quantization step (including the left and right boundary values) are 80 and 96, respectively, and the boundary value of the sixth quantization step.
  • the quantization of the first quantization step corresponding to the image block pixel minimum value The order number is 5; for the same reason, the image block pixel maximum value of the example of FIG. 2a is 181, within the corresponding quantization step with the left boundary value 176 and the right boundary value 192 as the end values, therefore, the image block pixel maximum corresponds to The quantization step number of the second quantization step is 11.
  • the image block pixel minimum value illustrated in FIG. 2a may be quantized to the left boundary value 80 of the fifth quantization step, and the image block pixel maximum value illustrated in FIG. 2a may be quantized to the right boundary value 192 of the eleventh quantization step. That is, the first quantization value quantized by the image block pixel minimum value of the example of FIG. 2a is 80, and the second quantization value quantized by the image block pixel maximum value of the example of FIG. 2a is 192.
  • S102 Map a value of each pixel of the image block to a quantization step number of a third quantization step, where the third quantization step is uniform by a quantization interval of the first quantized value and the second quantized value.
  • the number of the quantized steps may be determined according to the accuracy requirement of the image data compression. Generally, if the accuracy requirement is higher That is, the less information lost during compression, the more the number of divided quantization steps can be divided. Conversely, if the accuracy requirement is smaller, that is, the information lost during compression is larger, the number of divided quantization steps can be divided. The less.
  • the number of the quantized steps may be equal to the number of pixels included in the image block. With the image block shown in FIG.
  • the quantization interval with the first quantized value 80 and the second quantized value 192 as the end value can be evenly divided.
  • the 8 quantization steps, the quantization step numbers of the 8 quantization steps are 0, 1, 2, 3, 4, 5, 6, and 7, respectively, as shown in Fig. 2c.
  • the quantization interval in which the first quantized value 80 and the second quantized value 192 are the end values is divided into eight quantization steps, and the number 8 of the quantization steps may also be referred to as a quantization order.
  • the boundary value of the 0th quantization step (including the left boundary value and the right boundary value) is 0 and 94, respectively, and the boundary value of the first quantization step (including the left boundary value and the right boundary value) ) 94 and 108 respectively
  • the boundary value of the second quantization step (including the left boundary value and the right boundary value) are 108 and 122, respectively
  • the boundary value of the third quantization step (including the left boundary value and the right boundary value) respectively
  • the boundary value of the fourth quantization step (including the left boundary value and the right boundary value) is 136 and 150, respectively
  • the boundary value of the fifth quantization step (including the left boundary value and the right boundary value) is 150 respectively.
  • the boundary value of the sixth quantization step (including the left boundary value and the right boundary value) are 164 and 178, respectively, and the boundary value of the seventh quantization step (including the left boundary value and the right boundary value) are 178 and 192, respectively.
  • the boundary value of the sixth quantization step are 164 and 178, respectively
  • the boundary value of the seventh quantization step are 178 and 192, respectively.
  • the range of the left boundary value 136 and the right boundary value 150 of the four third quantization steps is within a range defined by the left boundary value 136 and the right boundary value 150. Therefore, the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 141 is 4.
  • the pixel The quantized order number of the third quantization step mapped by the value of the pixel having a value of 167 is 6, the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 154 is 5, and the pixel having the pixel value of 133
  • the quantization step number of the third quantization step mapped by the value is 3, the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 181 is 7, and the value of the pixel with the pixel value of 152 is mapped to the third.
  • the quantization step number of the quantization step is 5, and the value of the pixel whose pixel value is 122 is mapped.
  • Quantization step of the quantization step number 3 the pixel value of the pixel of the third quantization step value of 86 is mapped to the quantization step number is 0, as shown in figures 2d.
  • the first corresponding to the minimum value of the encoded pixel is compared with the prior art.
  • the number of bits used in the quantization step number of the quantization step is significantly smaller than the number of bits used to encode the minimum value of the pixel, and the number of bits used in the quantization step number of the first quantization step corresponding to the maximum value of the encoded pixel is significantly smaller than that of the encoded pixel.
  • the number of bits used for the maximum value, the number of bits used to map the resulting quantized order number for each pixel of the coded image block is also significantly less than the number of bits used to encode the difference between each pixel and the smallest pixel.
  • the number is 8 x 3 or 24 bits, in other words, the quantization step number of the first quantization step corresponding to the image block pixel minimum value illustrated in FIG. 2a, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the image The value of each pixel is mapped to the resulting quantized order number.
  • the number of bits used for encoding is 4+4+24 or 32 bits. With the prior art, the number of bits used for encoding the image block illustrated in FIG. 2a is 8+8+24 or 40 bits, and the method provided by the embodiment of the present invention significantly reduces the number of bits used for encoding. , greatly improving the coding efficiency.
  • the image data compression method since the image block pixel minimum value and the pixel maximum value are respectively quantized, and the value of each pixel of the image block is also mapped to a quantization step number quantization step number,
  • the last coding object is a quantization step number of the first quantization step corresponding to the pixel minimum value, a quantization step number of the second quantization step corresponding to the pixel maximum value, and a quantization step number obtained by mapping the value of each pixel of the image block.
  • the method provided by the embodiment of the present invention significantly reduces the number of bits used for coding, and greatly improves coding efficiency and compression efficiency.
  • the first quantization step and the second quantization step belong to the plurality of quantization steps including the plurality of quantization steps.
  • the two quantization steps for example, the first quantization step and the second quantization step belong to two quantization steps of a plurality of quantization steps including 16 quantization steps.
  • the first quantization step and the second quantization step may also belong to two quantization steps of different multiple quantization steps, for example, the first quantization step belongs to the inclusion of J.
  • One of the plurality of quantization steps of the quantization step, the second quantization step belongs to one of the plurality of quantization steps including the K quantization steps, where the J and the K are greater than 1 and are not equal Natural number.
  • the image block pixel minimum value may be quantized into the boundary value of the first quantization step in the J quantization steps
  • the image block pixel maximum value is quantized into a boundary value of the second quantization step of the K quantization steps.
  • the image block pixel minimum value 86 is quantized into 32 first quantization steps uniformly divided by quantization intervals with end values of 0 and 255.
  • the quantization interval of 0 and 255 is divided into 32 first quantization steps or 16 second quantization steps, and the number 16 or 32 of quantization steps may also be referred to as a quantization order.
  • the pixel minimum value 86 when the pixel minimum value 86 is quantized into the first quantization value, it may be 80, and the quantization step number corresponding to the 32 first quantization steps is 10, and the pixel maximum value 181 may be quantized to the second quantization value.
  • the quantization step number corresponding to the 16 second quantization steps is 11. Before mapping the value of each pixel of the image block to the quantization step number of the third quantization step, further determining that the binary number corresponding to the boundary value of the image block pixel minimum is shifted to the right by one bit and the image Whether the binary number corresponding to the boundary value quantized by the maximum value of the block pixel is equal, or determining that the binary number corresponding to the boundary value of the image block pixel maximum value is shifted right by one bit and the pixel of the image block is the most d value Whether the binary numbers corresponding to the quantized boundary values are equal.
  • the quantized order number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel minimum value is quantized is quantized into The quantized order number corresponding to the boundary value and the quantized order number of each pixel of the image block Line coding and sequentially writing to the code stream; if the binary value corresponding to the boundary value of the image block pixel minimum is right-shifted by one bit and "0" is removed, the boundary at which the maximum value of the pixel is quantized The quantized order number corresponding to the value, the quantized order number corresponding to the value obtained by right-shifting the binary value of the pixel d to the value of the boundary value quantized by one bit, and the quantized order number obtained by mapping the value of
  • the order of writing the code stream after the coded quantization step number may not be limited. For example, if the image block pixel minimum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit. It is "1", and the quantized order number corresponding to the boundary value to which the pixel maximum value is quantized, and the binary number of the boundary value to which the pixel minimum value is quantized may be shifted to the right by one bit.
  • the quantized order number and the quantized order number of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel is the most d, the binary value corresponding to the boundary value to which the value is quantized is shifted to the right.
  • the bit removed is "0", and the quantized order number corresponding to the value obtained by right shifting the binary number of the boundary value quantized to the pixel minimum value, and the boundary value corresponding to the pixel maximum value are correspondingly
  • the quantization step number and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
  • the stream includes: determining whether the binary value corresponding to the boundary value of the image block pixel maximum is quantized by right shifting one bit to remove "1" or "0"; if the image block pixel maximum value is quantized into a boundary value corresponding to The binary number is shifted to the right by one bit to remove "1", and the binary number of the boundary value to which the maximum value of the pixel is quantized is shifted right by one bit, and the quantized order number corresponding to the obtained value is the minimum value
  • the quantized order number corresponding to the quantized boundary value and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel maximum value is quantized into a binary value corresponding to the boundary value If "0" is performed to shift right by one bit, the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and the binary number of the boundary value to which the pixel maximum value is quantized are shifted right by one bit.
  • the quantization step number corresponding to the obtained value and the quantization step number obtained by mapping the value of each pixel of the image block are performed. Encode and write to the stream in sequence.
  • the order in which the encoded quantized order number is written into the code stream may not be limited. For example, if the image block pixel maximum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit. 1", the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and the quantization number corresponding to the binary value of the boundary value to which the pixel maximum value is quantized may be shifted to the right by one bit.
  • the number and the quantized order number of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel maximum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit.
  • the quantization step number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel maximum value is quantized, and the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized The quantized order number obtained by mapping the value of each pixel of the image block is encoded and sequentially written into the code stream.
  • the data hiding technique is actually used to improve the quantization precision of the pixel maximum value and the pixel minimum value, and the encoding efficiency is improved.
  • the binary number corresponding to the boundary value to which the pixel minimum value is quantized in the image block is shifted to the right by one bit, and the binary number corresponding to the boundary value to which the maximum value of the image block pixel is quantized is equal, or judged
  • the binary number corresponding to the boundary value to which the image block pixel maximum is quantized is shifted to the right by one bit, and is equal to the binary number corresponding to the boundary value of the pixel d pixel and the quantized value.
  • the image data is compressed.
  • the method is the same as that exemplified in FIG.
  • FIG. 3 is a schematic flowchart of an image data decompression method according to an embodiment of the present invention, which mainly includes steps S301, S302, and S303:
  • the image block pixel maximum value can be decoded according to the image block pixel minimum value and the pixel maximum value corresponding to the quantization step number in the code stream. a first quantized value and a second quantized value respectively corresponding to pixel maximum values.
  • the quantization step numbers corresponding to the pixel minimum value 86 and the pixel maximum value 181 are 5 and 11, respectively. Since the quantization order is 16, the image block pixel minimum can be decoded at the decoding end.
  • the value and the pixel maximum correspond to a first quantized value 80 and a second quantized value 192, respectively, as shown in Figure 4a.
  • the value mapping of each pixel of the image block in the code stream can be performed.
  • the quantization order, the first quantized value, and the second quantized value used when the quantization step number of the third quantization step is numbered. Taking the image block shown in FIG. 2a as an example, the first quantization value corresponding to the pixel minimum value 86 is 80, the second quantization value corresponding to the pixel maximum value 181 is 192, and the value of each pixel of the image block is mapped to the third quantization.
  • the quantization order of the order of the quantization step number is 8, the quantization interval with the first quantization value 80 and the second quantization value 192 as the end value is evenly divided into 8 third quantization steps, as shown in FIG. 4b. .
  • the first quantized order and the second quantized order belong to two of the different quantized orders.
  • the quantization order, the first quantized value, and the second quantized value used when the value of each pixel of the image block in the code stream is mapped to the quantized order number of the third quantization step is obtained.
  • the first quantized value and the quantized interval of the second quantized value are equally divided into a plurality of the third quantized steps, it is required to determine whether the first quantized value and the second quantized value are equal; If the quantized value and the second quantized value are not equal and the quantized order number corresponding to the maximum value of the image block in the code stream is received after receiving the most d and the quantized order number corresponding to the value of the image block in the code stream, The binary number corresponding to the first quantized value is shifted to the left by one bit and is complemented by "1" at the last bit, if the first quantized value and the second quantized value are not equal and the quantization corresponding to the maximum value of the image block pixel in the code stream is received first.
  • Image block in the stream after receiving the order number a quantization step number corresponding to the pixel minimum value, wherein the binary number corresponding to the first quantization value is shifted to the left by one bit And the "0" is added at the last position.
  • the first quantization value is obtained according to the quantization order, the first quantization value, and the second quantization value used when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step.
  • the plurality of third quantization steps which are equally divided by the quantization interval of the second quantization value, may be: quantization used when mapping the value of each pixel of the image block in the code stream to the quantization step number of the third quantization step
  • quantization used when mapping the value of each pixel of the image block in the code stream to the quantization step number of the third quantization step
  • the order, the second quantized value, and the binary number corresponding to the first quantized value are shifted by one bit to the left and the corresponding decimal number is complemented by "0" or "1” at the last bit, and the first number is obtained.
  • the binary number corresponding to the quantized value is shifted to the left by one bit, and the corresponding decimal number after the last bit is complemented by "0" or "1” and the second quantization step of the second quantized value is evenly divided.
  • the specific method is similar to the description of FIG. 4b and its corresponding text, and will not be described again.
  • the binary number corresponding to the second quantized value is shifted to the left by one bit and is complemented by "1" at the last bit, if the first quantized value and the second quantized value are not equal and the image block pixel minimum value corresponding to the received code stream is first received.
  • the quantized order number corresponding to the maximum value of the image block pixel in the code stream is received, and the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is complemented by "0".
  • the first quantization value is obtained according to the quantization order, the first quantization value, and the second quantization value used when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step.
  • the plurality of third quantization steps uniformly divided by the quantization interval of the second quantized value may be: a quantization step used when mapping the value of each pixel of the image block in the code stream to the quantization step number of the third quantization step And the binary number corresponding to the first quantized value and the second quantized value is shifted by one bit to the left and the "0" or "the corresponding decimal number is complemented in the last bit, and the binary corresponding to the second quantized value is obtained.
  • the quantization interval of the first quantization value is delimited.
  • the left boundary value or the right boundary value of the third quantization step corresponding to each quantization step number may be taken as the value of the pixel corresponding to each of the quantization step numbers.
  • the precision of the value of each pixel of the image block for each pixel of the block, or taking two boundary values of the third quantization step corresponding to each quantization step number, and rounding the average of the two boundary values The value obtained by rounding is used as the value of the pixel corresponding to each of the quantization step numbers. Taking the example shown in FIG.
  • the quantization step number of the third quantization step to which the value of the pixel having the pixel value is 141 is 4, and the quantization step number of the third quantization step to which the value of the pixel having the pixel value is 167 is mapped.
  • the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 154 is 5, and the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 133 is 3, and the pixel value is
  • the quantization step number of the third quantization step mapped by the value of the pixel of 181 is 7
  • the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 152 is 5, and the value of the pixel having the pixel value of 122 is
  • the quantized order number of the mapped third quantization step is 3, and the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 86 is 0, and then, in the 8 third quantization steps illustrated in FIG.
  • the value of the pixel is 171, which is different from the pixel value before compression by 2; the third quantization step of the quantization order number is 5, and the two boundary values (left boundary value and right boundary value) are 150 and 164, respectively.
  • the value of the reconstructed pixel is 129, which is different from the pixel value before compression by 4;
  • the value of the pixel is 185, which is different from the pixel value before compression by 4;
  • the value of the latter pixel is 129, which is different from the pixel value before compression by 7; the third quantization step of the quantization order number is 0, and the two boundary values (left boundary value and right boundary value) are 80 and 94, respectively.
  • FIG. 5 is a schematic structural diagram of an image data compression apparatus according to an embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown.
  • the image data compression apparatus illustrated in Fig. 5 includes a quantization module 501, a mapping module 502, and an encoding module 503, wherein:
  • the quantization module 501 is configured to quantize the image block pixel minimum value and the pixel maximum value into a first quantization value and a second quantization value, respectively, where the pixel maximum d, value, and pixel maximum value respectively correspond to the quantization step of the first quantization step The quantized order number of the number and the second quantization step.
  • the mapping module 502 is configured to map a value of each pixel of the image block to a quantization step number of a third quantization step, where the third quantization step is an end value of the first quantization value and the second quantization value.
  • the encoding module 503 is configured to map a quantization step number of the first quantization step corresponding to the pixel minimum value, a quantization step number of the second quantization step corresponding to the pixel maximum value, and a value of each pixel of the image block.
  • the quantization step number is encoded and written to the code stream.
  • each functional module is merely an example.
  • the foregoing functions may be implemented according to requirements, such as configuration requirements of corresponding hardware or convenience of implementation of software. Assignment is done by different functional modules, ie the image will be The internal structure of the data compression device is divided into different functional modules to perform all or part of the functions described above.
  • the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be performed by corresponding hardware to execute corresponding software.
  • the foregoing quantization module may be configured to execute the foregoing image block.
  • the pixel minimum value and the pixel maximum value are respectively quantized into hardware of the first quantized value and the second quantized value, such as a quantizer, or a general processor or other hardware device capable of executing a corresponding computer program to perform the foregoing functions;
  • the mapping module may be hardware having a function of performing the foregoing step of mapping the value of each pixel of the image block to a third quantization step, such as a mapper, or a computer program capable of executing the corresponding computer program to perform the foregoing functions.
  • a general processor or other hardware device (the various embodiments described herein may apply the above described principles).
  • the quantization module 501 illustrated in Fig. 5 may include a first quantization unit 601, such as the image data compression device provided by another embodiment of the present invention, as shown in Fig. 6.
  • the first quantization unit 601 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the M quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the M quantization steps
  • the M is a natural number greater than one.
  • the quantization module 501 of the example of FIG. 5 may also include a second quantization unit 701, such as the image data compression apparatus provided by another embodiment of the present invention as shown in FIG.
  • the second quantization unit 701 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the J quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the K quantization steps.
  • J and the K are natural numbers greater than one and not equal.
  • the image data compression device illustrated in FIG. 7 may further include a first determining module 801 or a second determining module 802. As shown in FIG. 8, the image data compressing device according to another embodiment of the present invention, wherein: the first determining module 801 And determining whether a binary number corresponding to a boundary value corresponding to the image block pixel maximum value is shifted to the right by a binary number corresponding to a boundary value to which the image block pixel minimum value is quantized is equal to one another.
  • the second judging module 802 is configured to determine whether the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is shifted to the right by one bit, and whether the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized is equal.
  • the encoding module 503 illustrated in FIG. 8 may include a first determining unit 901, a first encoding unit 902, and a second encoding unit 903, as shown in FIG. 9a, which is provided by another embodiment of the present invention.
  • Image data compression device wherein:
  • the first determining unit 901 is configured to determine whether the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized is shifted to the right by one bit to remove "1" or "0";
  • the first encoding unit 902 is configured to: if the determining unit 901 determines that the binary number corresponding to the boundary value of the image block pixel minimum is quantized by right shifting one bit to remove "1", the pixel minimum value is quantized The quantized order number corresponding to the binary value of the obtained boundary value is shifted to the right by one bit, the quantization step number corresponding to the boundary value to which the pixel maximum value is quantized, and the quantization value of each pixel of the image block are quantized. The order number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the boundary value to which the pixel maximum value is quantized, the pixel maximum d, and the binary value of the boundary value to which the value is quantized are shifted to the right. a quantized order number corresponding to a post-value obtained and a quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream;
  • a second encoding unit 903 configured to: if the determining unit 901 determines that the binary number corresponding to the boundary value of the image block pixel minimum is quantized by right shifting one bit and removing "0", the maximum value of the pixel.
  • the quantized order number corresponding to the quantized boundary value, the quantized order number corresponding to the value obtained by right-shifting the binary number of the pixel d and the boundary value to which the value is quantized, and the value of each pixel of the image block The obtained quantization step number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel minimum value is quantized, and the pixel maximum value is quantized
  • the quantization step number corresponding to the boundary value and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
  • the encoding module 503 illustrated in FIG. 8 may include a second determining unit 904, a third encoding unit 905, and a fourth encoding unit 906. As shown in FIG. 9b, an image data compression apparatus according to another embodiment of the present invention is provided. among them:
  • the second determining unit 904 is configured to determine whether the binary number corresponding to the boundary value of the image block pixel maximum value is right-shifted by one bit to remove "1" or "0";
  • the third encoding unit 905 is configured to: if the second determining unit 904 determines that the binary number corresponding to the boundary value of the image block pixel maximum value is right shifted by one bit and is “1”, the pixel is a quantized order number corresponding to the binary value of the boundary value quantized by the maximum value, a quantized order number corresponding to the obtained value, a quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and each pixel of the image block
  • the quantized order number obtained by the value mapping is encoded and sequentially written into the code stream, or the quantized order number corresponding to the boundary value to which the minimum value of the pixel is quantized, and the binary number of the boundary value to which the maximum value of the pixel is quantized is performed.
  • the fourth encoding unit 906 is configured to: if the second determining unit 904 determines that the binary number corresponding to the boundary value of the image block pixel maximum value is right shifted by one bit and is "0", then the pixel is The quantization step number corresponding to the boundary value corresponding to the most d, the value to which the value is quantized, the quantization step number corresponding to the value obtained by shifting the binary value of the boundary value to which the pixel maximum value is quantized to the right, and each pixel of the image block
  • the value of the obtained quantized order number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the obtained value of the binary number of the boundary value to which the pixel maximum value is quantized is shifted to the right, and the pixel minimum value
  • the quantized order number corresponding to the quantized boundary value and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
  • the quantization module 501 illustrated in FIG. 8 may include a first quantization unit 601, such as the image data compression device provided by another embodiment of the present invention, as shown in FIG. 9c.
  • the first quantization unit 601 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the M quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the M quantization steps.
  • the M is a natural number greater than one.
  • FIG. 10 is a schematic structural diagram of an image data decompressing apparatus according to an embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown.
  • the image of the example of Figure 10 The data decompression device includes a decoding module 1001, an obtaining module 1002, and a reconstruction module 1003, where: the decoding module 1001 is configured to decode the image block pixel according to the image block pixel minimum value and the pixel maximum value corresponding to the quantization step number in the code stream. The first quantized value and the second quantized value respectively correspond to the minimum value and the pixel maximum value.
  • the obtaining module 1002 is configured to obtain, according to the quantization step, the first quantization value, and the second quantization value, when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step, A quantized value and a quantized interval of the second quantized value are equally divided into a plurality of the third quantized steps.
  • the specific method is similar to the description of FIG. 4b and its corresponding text, and is not described herein.
  • the reconstruction module 1003 is configured to reconstruct, according to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, a value of each pixel of the image block in the code stream, and reconstruct each pixel of the image block. To obtain the value of each pixel of the image block.
  • each functional module is merely an example. In actual applications, the above may be considered according to requirements, such as configuration requirements of corresponding hardware or convenience of implementation of software.
  • the function assignment is performed by different functional modules, that is, the internal structure of the image data decompressing device is divided into different functional modules to perform all or part of the functions described above.
  • the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be executed by corresponding hardware.
  • the foregoing decoding module may have the foregoing code stream.
  • the quantization step number corresponding to the pixel minimum value of the image block and the maximum value of the pixel, and hardware for decoding the first quantization value and the second quantization value corresponding to the maximum d, the value, and the maximum pixel value of the image block may also be used.
  • a general processor or other hardware device capable of executing a corresponding computer program to perform the foregoing functions; and the obtaining module as described above may be configured to perform quantization to map the value of each pixel of the image block in the code stream to the third quantization step.
  • Functional hardware such as an acquirer, can also be capable of executing a corresponding computer program to perform the aforementioned functions
  • a general processor or other hardware device (embodiment of the present disclosure provides various embodiments of the principles described above can be applied).
  • the reconstruction module 1003 illustrated in FIG. 10 may include a first value unit 1101 or a second value unit 1102.
  • a first value unit 1101 is configured to take two boundary values of the third quantization step corresponding to each quantization step number, and round the average value of the two boundary values to round the obtained value as the a value of a pixel corresponding to the quantized order number;
  • the second value unit 1102 is configured to take a left boundary value or a right boundary value of the third quantization step corresponding to each quantization step number as a value of a pixel corresponding to each of the quantization step numbers.
  • the image data decompressing apparatus illustrated in FIG. 11 may further include a determining module 1201, a first complementing module 1202 and a second complementing module 1203, and the obtaining module 1002 may include a first obtaining unit 1204, as shown in FIG. 12a.
  • Another embodiment provides an image data decompressing apparatus, wherein:
  • the determining module 1201 is configured to determine whether the first quantized value and the second quantized value are equal.
  • the first complement module 1202 is configured to first receive the quantization step number corresponding to the maximum value of the image block pixel in the code stream after receiving the quantization step number corresponding to the minimum value of the image block pixel in the code stream, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the first quantized value is shifted left by one bit and complemented by "1" at the last bit.
  • the second complement module 1203 is configured to: if the quantization step number corresponding to the maximum value of the image block pixel in the code stream is received, the quantization step number corresponding to the image block pixel minimum value in the received code stream is received, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the first quantized value is shifted to the left by one bit and the last bit is complemented by "0".
  • the first obtaining unit 1204 is configured to: according to the quantization order used by the value of each pixel of the image block in the code stream to be the quantization step number of the third quantization step, the second quantization value, and the first quantization value
  • the binary number is shifted to the left by one bit and the corresponding decimal number is complemented by "0" or "1" at the last bit, and the binary number corresponding to the first quantized value is shifted to the left by one bit and the last bit is "0".
  • the corresponding decimal number after the "1" and the second quantized value of the second quantized value are equally divided into a plurality of the third quantization steps, and the specific method is similar to the description of FIG. 4b and its corresponding text, and is not described herein. .
  • the image data decompressing apparatus illustrated in FIG. 11 may further include a determining module 1201, a third complementing module 1205, and a fourth complementing module 1206.
  • the obtaining module 1002 may include a second acquiring unit 1207, as shown in FIG. 12b.
  • Another embodiment provides an image data decompressing apparatus, wherein:
  • the third complement module 1205 is configured to: if the quantization step number corresponding to the maximum value of the image block pixel in the code stream is received, the quantization step number corresponding to the image block pixel minimum value in the received code stream is received, and the determining module is 1201 determines that the first quantized value and the second quantized value are not equal, shifting the binary number corresponding to the second quantized value to the left by one bit and complementing "1" at the last bit;
  • the fourth complement module 1206 is configured to first receive the quantization step number corresponding to the maximum value of the image block pixel in the code stream after receiving the quantization step number corresponding to the minimum value of the image block pixel in the code stream, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is complemented by "0";
  • a second obtaining unit 1207 configured to: according to the quantization order used by the value of each pixel of the image block in the code stream to be the quantization step number of the third quantization step, the first quantization value and the second quantization value The binary number is shifted to the left by one bit and the corresponding decimal number is complemented by "0" or "1" at the last bit, and the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is "0" or " 1" after the corresponding decimal number and the first quantized value of the end value of the quantized interval are evenly divided into a plurality of said third quantization step, the specific method is similar to FIG. 4b and its corresponding text description, and will not be described again.
  • Method 1 quantizing the image block pixel minimum value and the pixel maximum value into a first quantization value and a second quantization value, respectively, wherein the pixel maximum d, value, and pixel maximum value respectively correspond to the quantization step number of the first quantization step and the first a quantization step number of the quantization step; mapping a value of each pixel of the image block to a quantization step number of a third quantization step, wherein the third quantization step is the first quantization value and the second quantization value end a quantization step of the quantization interval of the value is a quantization step of the first quantization step corresponding to the minimum value of the pixel, and a quantization step number of the second quantization step corresponding to the maximum value of the pixel
  • the quantized order number of each pixel of the image block is encoded and encoded into the code stream.
  • Method 2 Decoding, according to the pixel minimum value of the image block and the quantization step number corresponding to the pixel maximum value, the first quantized value and the second quantized value respectively corresponding to the image block pixel minimum value and the pixel maximum value; according to the code stream The amount of each pixel of the image block is mapped to the quantized order number of the third quantization step.
  • Encoding the first quantization value and the second quantization value acquiring a plurality of the third quantization steps uniformly divided by the quantization interval of the first quantization value and the second quantization value end value; according to the code stream
  • the value of each pixel of the middle image block is mapped to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, and each pixel of the image block is reconstructed to obtain each pixel of the image block. value.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.
  • ROM Read Only Memory
  • RAM Random Access Memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

Provided are an image data compression and decompression method and device to improve the coding efficiency and compression efficiency. The data compression method comprises: respectively quantifying the pixel minimum value and the pixel maximum value of an image block as a first quantization value and a second quantization value, the pixel minimum value and the pixel maximum value respectively corresponding to the quantization step number of a first quantization step and the quantization step number of a second quantization step; mapping the value of each pixel of the image block as the quantization step number of a third quantization step; and coding the first quantization step number of the first quantization step corresponding to the pixel minimum value, the quantization step number of the second quantization step corresponding to the pixel maximum value and the quantization step number obtained by mapping the value of each pixel of the image block and writing same in a code stream. The method provided in the embodiments of the present invention significantly reduces the number of bits used for coding, and greatly improves the coding efficiency and compression efficiency.

Description

一种图像数据压缩和解压缩方法、 装置 本申请要求于 2012 年 06 月 29 日提交中国专利局、 申请号为 201210222516.1、 发明名称为 "一种图像数据压缩和解压缩方法、 装置" 的中 国专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域  The invention relates to a Chinese patent application filed on June 29, 2012, the Chinese Patent Application No. 2012102225166.1, the invention entitled "An image data compression and decompression method, device" Priority is hereby incorporated by reference in its entirety. Technical field
本发明涉及图像处理领域, 尤其涉及一种图像数据压缩和解压缩方法、装 置。  The present invention relates to the field of image processing, and in particular, to an image data compression and decompression method and apparatus.
背景技术 Background technique
随着信息产业的不断发展, 流程工业中的信息量也急剧膨胀。在整个流程 工业中所集成的数据采集点数通常有几千到十几万, 数据采集间隔要达到秒 级, 数据量很大。 为了确保高效的数据存储, 在一定的精度指标下, 应尽量减 少数据的存储, 这就需要对数据进行压缩处理。 为了使工业数据库***快速、 有效地管理数据,提高磁盘存储效率, 需要保证***具有较高的压缩率和快速 的、 高精度的数据解压, 必须进行有效的数据压缩。  With the continuous development of the information industry, the amount of information in the process industry has also expanded dramatically. The number of data collection points integrated in the entire process industry is usually several thousand to several hundred thousand, and the data collection interval is up to the second level, and the amount of data is large. In order to ensure efficient data storage, under certain accuracy indicators, data storage should be minimized, which requires compression of the data. In order to enable industrial database systems to manage data quickly and efficiently, and to improve disk storage efficiency, it is necessary to ensure that the system has a high compression ratio and fast, high-precision data decompression, and effective data compression must be performed.
根据不同的编码对原始文件数据产生不同的损失效果,可以将数据压缩技 术分为有损压缩和无损压缩两大类, 其中,有损压缩是一种在压缩损失过程中 以损失一定的信息来换取较高压缩比的压缩方法。有损压缩虽然不能完全恢复 原始数据,但是这种数据压缩技术是在损失数据对理解原始数据信息的影响不 大的前提下获取较大的压缩比。 因此, 有损压缩大部分应用于影音、 图像和视 频数据的压缩, 也应用于海量过程数据的压缩。  According to different coding, the original file data has different loss effects. The data compression technology can be divided into lossy compression and lossless compression. Among them, lossy compression is a kind of loss of certain information in the process of compression loss. In exchange for a higher compression ratio compression method. Although lossy compression cannot completely recover the original data, this data compression technique acquires a large compression ratio on the premise that the loss data has little effect on understanding the original data information. Therefore, lossy compression is mostly applied to the compression of video, image and video data, and also to the compression of massive process data.
现有的一种应用于图像压缩的有损压缩方法是:将图像被分成若干图像数 据块, 其中, 每个图像数据块包含若干像素点; 搜索待处理图像块像素的最大 值和最小值; 对于图像数据块的每一个像素点, 减去最小像素点的值, 并且根 据量化范围对应关系, 取得差值的量化值; 分別对最大值、 最小值和每一个像 素点的差值的量化值进行编码。  A prior art lossy compression method applied to image compression is: dividing an image into a plurality of image data blocks, wherein each image data block includes a plurality of pixel points; searching for maximum and minimum values of pixels of the image block to be processed; For each pixel of the image data block, the value of the minimum pixel is subtracted, and according to the correspondence of the quantization range, the quantized value of the difference is obtained; the quantized value of the difference between the maximum value, the minimum value, and each pixel point respectively Encode.
本案发明人发现,上述现有技术提供的有损压缩方法对最大值和最小值没 有进行压缩, 因此, 压缩率仍然较低。 发明内容 The inventors of the present invention have found that the lossy compression method provided by the above prior art does not compress the maximum value and the minimum value, and therefore, the compression ratio is still low. Summary of the invention
本发明实施例提供一种数据压缩和解压缩方法、装置, 以提升编码效率和 压缩效率。  Embodiments of the present invention provide a data compression and decompression method and apparatus to improve coding efficiency and compression efficiency.
本发明实施例提供一种图像数据压缩方法, 所述方法包括: 将图像块像素 最小值和像素最大值分別量化为第一量化值和第二量化值,所述像素最小值和 像素最大值分別对应于第一量化阶的量化阶编号和第二量化阶的量化阶编号; 将所述图像块每个像素的值映射为第三量化阶的量化阶编号,所述第三量化阶 是以所述第一量化值和第二量化值为端值的量化区间被均勾划分的若干量化 阶中一个量化阶; 对所述像素最小值对应的第一量化阶的量化阶编号、所述像 素最大值对应的第二量化阶的量化阶编号和所述图像块每个像素的值映射所 得量化阶编号进行编码并写入码流。  An embodiment of the present invention provides an image data compression method, where the method includes: quantizing an image block pixel minimum value and a pixel maximum value into a first quantization value and a second quantization value, respectively, where the pixel minimum value and the pixel maximum value are respectively Corresponding to the quantization step number of the first quantization step and the quantization step number of the second quantization step; mapping the value of each pixel of the image block to the quantization step number of the third quantization step, where the third quantization step is a quantization step in which a quantization interval of the first quantization value and the second quantization value is equally divided by a quantization step; a quantization step number of the first quantization step corresponding to the minimum value of the pixel, the pixel maximum The quantization step number of the second quantization step corresponding to the value and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written into the code stream.
本发明实施例提供一种图像数据解压缩方法, 所述方法包括: 根据码流中 图像块像素最小值和像素最大值对应的量化阶编号,解码得到图像块像素最小 值和像素最大值分別对应的第一量化值和第二量化值;根据码流中图像块每个 像素的值映射为第三量化阶的量化阶编号时所用量化阶次、所述第一量化值和 第二量化值,获取以所述第一量化值和第二量化值为端值的量化区间被均匀划 分的若干所述第三量化阶;根据码流中图像块每个像素的值映射为第三量化阶 的量化阶编号和所述每一第三量化阶的边界值,重构所述图像块每个像素以获 取所述图像块每个像素的值。  An embodiment of the present invention provides an image data decompression method, where the method includes: decoding, according to a pixel block minimum value and a pixel maximum value corresponding to a quantization step number, a pixel block minimum value and a pixel maximum value respectively corresponding to the image block a first quantized value and a second quantized value; a quantization order, a first quantized value, and a second quantized value used when mapping a value of each pixel of the image block in the code stream to a quantized order number of the third quantized order, Acquiring a plurality of the third quantization steps uniformly divided by the quantization interval of the first quantization value and the second quantization value; and mapping the value of each pixel of the image block in the code stream to the third quantization step And a boundary value of each of the third quantization steps, reconstructing each pixel of the image block to obtain a value of each pixel of the image block.
本发明实施例提供一种图像数据压缩装置, 所述装置包括: 量化模块, 用 于将图像块像素最小值和像素最大值分別量化为第一量化值和第二量化值,所 述像素最小值和像素最大值分別对应于第一量化阶的量化阶编号和第二量化 阶的量化阶编号; 映射模块, 用于将所述图像块每个像素的值映射为第三量化 阶的量化阶编号,所述第三量化阶是以所述第一量化值和第二量化值为端值的 量化区间被均匀划分的若干量化阶中一个量化阶; 编码模块, 用于对所述像素 最 d、值对应的第一量化阶的量化阶编号、所述像素最大值对应的第二量化阶的 量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并写入 码流。 本发明实施例提供一种图像数据解压缩装置, 所述装置包括: 解码模块, 用于根据码流中图像块像素最小值和像素最大值对应的量化阶编号,解码得到 图像块像素最 d、值和像素最大值分別对应的第一量化值和第二量化值;获取模 块,用于根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所 用量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第二量 化值为端值的量化区间被均匀划分的若干所述第三量化阶; 重构模块, 用于根 据码流中图像块每个像素的值映射为第三量化阶的量化阶编号和所述每一第 三量化阶的边界值, 重构所述图像块每个像素以获取所述图像块每个像素的 值。 An embodiment of the present invention provides an image data compression apparatus, where the apparatus includes: a quantization module, configured to quantize an image block pixel minimum value and a pixel maximum value into a first quantization value and a second quantization value, respectively, the pixel minimum value And a pixel maximum value respectively corresponding to the quantization step number of the first quantization step and the quantization step number of the second quantization step; a mapping module, configured to map a value of each pixel of the image block to a quantization step number of the third quantization step The third quantization step is a quantization step in a plurality of quantization steps in which the quantization interval of the first quantization value and the second quantization value is uniformly divided; an encoding module, configured to use the pixel the most d, The quantization step number of the first quantization step corresponding to the value, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written into the code stream. An embodiment of the present invention provides an image data decompressing apparatus, where the apparatus includes: a decoding module, configured to decode, according to a pixel block minimum value and a quantization step number corresponding to a pixel maximum value in a code stream, to obtain an image block pixel maximum d, a first quantized value and a second quantized value respectively corresponding to the value and the maximum value of the pixel; and an obtaining module, configured to use the quantized order used when the value of each pixel of the image block in the code stream is mapped to the quantized order number of the third quantized order, And acquiring, by the first quantized value and the second quantized value, a plurality of the third quantization steps that are uniformly divided by the quantization interval of the first quantized value and the second quantized value; and a reconstruction module, configured to The value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, and each pixel of the image block is reconstructed to obtain the image block each The value of the pixel.
从上述本发明实施例可知,由于对图像块像素最小值和像素最大值分別进 行了量化, 而图像块每个像素的值也映射为了某种量化阶的量化阶编号, 最后 的编码对象是像素最 d、值对应的第一量化阶的量化阶编号、像素最大值对应的 第二量化阶的量化阶编号和图像块每个像素的值映射所得量化阶编号。与现有 技术提供的不对最大值和最小值进行压缩的有损压缩方法相比,本发明实施例 提供的方法显著减少了编码使用的比特数, 大大提升了编码效率和压缩效率。 附图说明  As can be seen from the above embodiments of the present invention, since the image block pixel minimum value and the pixel maximum value are separately quantized, and the value of each pixel of the image block is also mapped to a quantization step number quantization order number, the last encoding object is a pixel. The most d, the quantized order number of the first quantization step corresponding to the value, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the quantized order number obtained by mapping the value of each pixel of the image block. Compared with the lossy compression method provided by the prior art that does not compress the maximum value and the minimum value, the method provided by the embodiment of the present invention significantly reduces the number of bits used for coding, and greatly improves coding efficiency and compression efficiency. DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对现有技术或实施例 描述中所需要使用的附图作筒单地介绍,显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例,对于本领域技术人员来讲,还可以如这些附图获得其 他的附图。  In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the prior art or the embodiments will be briefly described below. Obviously, the drawings in the following description are only the present invention. For some embodiments, other figures may also be obtained as those skilled in the art from these figures.
图 1是本发明实施例提供的图像数据压缩方法流程示意图;  1 is a schematic flowchart of an image data compression method according to an embodiment of the present invention;
图 2a是本发明实施例提供的图像块包含的像素示意图;  2a is a schematic diagram of a pixel included in an image block according to an embodiment of the present invention;
图 2b是本发明实施例提供的将以 0和 255为端值的量化区间划分为 16个量 化阶的示意图;  2b is a schematic diagram of dividing a quantization interval with end values of 0 and 255 into 16 quantization steps according to an embodiment of the present invention;
图 2c是本发明实施例提供的将以第一量化值 80和第二量化值 192为端值的 量化区间均匀划分 8个量化阶的示意图;  2c is a schematic diagram of uniformly dividing a quantization interval with a first quantized value 80 and a second quantized value 192 as end values into eight quantization steps according to an embodiment of the present invention;
图 2d是本发明实施例提供的将像素的值映射为量化阶编号的示意图; 图 3是本发明实施例提供的图像数据解压缩方法流程示意图; 图 4a是本发明实施例提供的在解码端解码得到图像块像素最小值和像素 最大值分別对应的第一量化值和第二量化值的示意图; 2 is a schematic diagram of mapping a pixel value to a quantization step number according to an embodiment of the present invention; FIG. 3 is a schematic flowchart of an image data decompression method according to an embodiment of the present invention; 4a is a schematic diagram of a first quantized value and a second quantized value respectively corresponding to a pixel block minimum value and a pixel maximum value obtained by decoding at a decoding end according to an embodiment of the present invention;
图 4b是本发明实施例提供的重构图像块每个像素的值的示意图; 图 4c是本发明实施例提供的压缩前的像素的值和重构的像素的值对比示 意图;  4b is a schematic diagram of values of each pixel of a reconstructed image block according to an embodiment of the present invention; FIG. 4c is a comparison diagram of values of pixels before compression and values of reconstructed pixels according to an embodiment of the present invention;
图 5是本发明实施例提供的图像数据压缩装置结构示意图;  FIG. 5 is a schematic structural diagram of an image data compression apparatus according to an embodiment of the present invention; FIG.
图 6是本发明另一实施例提供的图像数据压缩装置结构示意图;  6 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention;
图 7是本发明另一实施例提供的图像数据压缩装置结构示意图;  FIG. 7 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention; FIG.
图 8是本发明另一实施例提供的图像数据压缩装置结构示意图;  FIG. 8 is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention; FIG.
图 9a是本发明另一实施例提供的图像数据压缩装置结构示意图; 图 9b是本发明另一实施例提供的图像数据压缩装置结构示意图; 图 9c是本发明另一实施例提供的图像数据压缩装置结构示意图; 图 10是本发明实施例提供的图像数据解压缩装置结构示意图;  9a is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention; FIG. 9b is a schematic structural diagram of an image data compression apparatus according to another embodiment of the present invention; and FIG. 9c is an image data compression according to another embodiment of the present invention. FIG. 10 is a schematic structural diagram of an image data decompressing apparatus according to an embodiment of the present invention;
图 11是本发明另一实施例提供的图像数据解压缩装置结构示意图; 图 12a是本发明另一实施例提供的图像数据解压缩装置结构示意图; 图 12b是本发明另一实施例提供的图像数据解压缩装置结构示意图。  11 is a schematic structural diagram of an image data decompressing apparatus according to another embodiment of the present invention; FIG. 12 is a schematic structural diagram of an image data decompressing apparatus according to another embodiment of the present invention; FIG. 12b is an image according to another embodiment of the present invention; Schematic diagram of the data decompression device structure.
具体实施方式 detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域技术人员所获得的所有其他实 施例, 都属于本发明保护的范围。  BRIEF DESCRIPTION OF THE DRAWINGS The technical solutions in the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention are within the scope of the present invention.
请参阅附图 1 , 是本发明实施例提供的图像数据压缩方法流程示意图, 主 要包括步骤 S101、 步骤 S102和步骤 S103:  FIG. 1 is a schematic flowchart of an image data compression method according to an embodiment of the present invention, which mainly includes steps S101, S102, and S103:
S101 ,将图像块像素最小值和像素最大值分別量化为第一量化值和第二量 化值,所述像素最小值和像素最大值分別对应于第一量化阶的量化阶编号和第 二量化阶的量化阶编号。  S101. The image block pixel minimum value and the pixel maximum value are respectively quantized into a first quantization value and a second quantization value, where the pixel minimum value and the pixel maximum value respectively correspond to the quantization step number and the second quantization step of the first quantization step. The quantized order number.
与现有技术不对图像中具有最小值的像素和最大值的像素进行压缩不同, 在本发明实施例中, 可以将待压缩的图像划分为包含若干像素的独立处理单 元, 然后, 搜索该独立处理单元内像素最小值和像素最大值, 将像素最小值和 像素最大值分別量化为第一量化值和第二量化值。 Different from the compression of the pixel having the smallest value and the maximum value in the image in the prior art, in the embodiment of the present invention, the image to be compressed may be divided into independent processing orders including several pixels. And then searching for the pixel minimum value and the pixel maximum value in the independent processing unit, and quantizing the pixel minimum value and the pixel maximum value into the first quantized value and the second quantized value, respectively.
作为本发明一个实施例,在将图像块像素最小值和像素最大值分別量化为 第一量化值和第二量化值时, 可以是将图像块像素最小值量化为 M个量化阶 ( levels of quantization ) 中第一量化阶的边界值, 将图像块像素最大值量化为 所述 M个量化阶中第二量化阶的边界值, 其中, M为大于 1的自然数。  As an embodiment of the present invention, when the image block pixel minimum value and the pixel maximum value are respectively quantized into the first quantized value and the second quantized value, the image block pixel minimum value may be quantized into M quantization steps (level of quantization And a boundary value of the first quantization step, the image block pixel maximum value is quantized to a boundary value of the second quantization step of the M quantization steps, where M is a natural number greater than 1.
以像素使用 8bit (位)表示为例, 由于像素使用 8bit表示时, 图像块像素 最小值和像素最大值不会超过 255 ( = 28 - 1 ), 因此, 作为本发明一个实施例, 在将图像块像素最小值量化为 M个量化阶( levels of quantization ) 中第一量化 阶的边界值,将图像块像素最大值量化为所述 M个量化阶中第二量化阶的边界 值时, 可以先将以 0和 255为端值的量化区间均勾划分为 16个量化阶, 然后, 将 图像块像素最小值量化为这 16个量化阶中某个量化阶的边界值,该边界值为第 一量化值, 将图像块像素最大值量化为这 16个量化阶中另一量化阶的边界值, 该边界值为第二量化值。 为了区別和描述的方便, 在以下的说明中, 将图像块 像素最小值量化为若干量化阶中某个量化阶的边界值所对应的量化阶称为第 一量化阶,将图像块像素最大值量化为若干量化阶中另一量化阶的边界值所对 应的量化阶称为第二量化阶, 以下以图像块包含 4 2个像素为例进行说明。 Taking the 8-bit (bit) representation of the pixel as an example, since the pixel uses the 8-bit representation, the image block pixel minimum value and the pixel maximum value do not exceed 255 (= 2 8 - 1 ), therefore, as an embodiment of the present invention, The image block pixel minimum value is quantized into a boundary value of the first quantization step in the M levels of quantization, and when the image block pixel maximum value is quantized to the boundary value of the second quantization step in the M quantization steps, First, the quantization interval with the end values of 0 and 255 is divided into 16 quantization steps, and then the image block pixel minimum is quantized into the boundary value of a certain quantization step among the 16 quantization steps. A quantized value quantizes the image block pixel maximum value into a boundary value of another of the 16 quantization steps, the boundary value being a second quantized value. For convenience of distinction and description, in the following description, the image block pixel minimum is quantized into a quantization step corresponding to a certain quantization step boundary value, which is called a first quantization step, and the image block pixel maximum value is obtained. The quantization step corresponding to the boundary value of another quantization step among the quantization steps is referred to as the second quantization step. Hereinafter, the image block includes 42 pixels as an example.
如附图 2a所示,图像块包含的 8个像素的像素值分別为 167、 154、 141、 133、 181、 152、 122和 86, 经搜索, 像素最小值为 86, 像素最大值为 181。 不妨将以 0和 255为端值的量化区间划分为 16个量化阶, 如附图 2b所示, 这里, 以 0和 255 为端值的量化区间划分为的 16个量化阶,量化阶的个数 16也可以被称为量化阶 次。 附图 2b示例的 16个量化阶的编号依次为 0、 1、 2、 3、 4、 5、 6、 7、 8、 9、 10、 11、 12、 13、 14和 15 , 其中, 第 0个量化阶的边界值(包括左边界值和右 边界值)分別为 0和 16, 第 1个量化阶的边界值 (包括左边界值和右边界值)分 別为 16和 32, 第 2个量化阶的边界值(包括左边界值和右边界值)分別为 32和 48 , 第 3个量化阶的边界值 (包括左边界值和右边界值) 分別为 48和 64, 第 4 个量化阶的边界值(包括左边界值和右边界值)分別为 64和 80, 第 5个量化阶 的边界值(包括左边界值和右边界值)分別为 80和 96, 第 6个量化阶的边界值 (包括左边界值和右边界值)分別为 96和 112, 第 7个量化阶的边界值 (包括左 边界值和右边界值)分別为 112和 128, 第 8个量化阶的边界值(包括左边界值 和右边界值)分別为 128和 144, 第 9个量化阶的边界值(包括左边界值和右边 界值)分別为 144和 160, 第 10个量化阶的边界值(包括左边界值和右边界值) 分別为 160和 176, 第 11个量化阶的边界值 (包括左边界值和右边界值 )分別为 176和 192, 第 12个量化阶的边界值(包括左边界值和右边界值)分別为 192和 208 , 第 13个量化阶的边界值(包括左边界值和右边界值)分別为 208和 224, 第 14个量化阶的边界值 (包括左边界值和右边界值)分別为 224和 240, 第 15 个量化阶的边界值 (包括左边界值和右边界值)分別为 240和 255。 由于附图 2a 示例的图像块像素最小值为 86,在以左边界值 80和右边界值 96为端值的对应量 化阶之内, 因此, 图像块像素最小值对应的第一量化阶的量化阶编号为 5; 同 理, 附图 2a示例的图像块像素最大值为 181 , 在以左边界值 176和右边界值 192 为端值的对应量化阶之内, 因此, 图像块像素最大值对应的第二量化阶的量化 阶编号为 11。 As shown in FIG. 2a, the pixel values of the eight pixels included in the image block are 167, 154, 141, 133, 181, 152, 122, and 86, respectively. After searching, the minimum pixel value is 86, and the maximum pixel value is 181. It is possible to divide the quantization interval with the end values of 0 and 255 into 16 quantization steps, as shown in Fig. 2b, where the quantization intervals with the end values of 0 and 255 are divided into 16 quantization steps, and the quantization steps are The number 16 can also be referred to as a quantization order. The numbers of the 16 quantization steps illustrated in FIG. 2b are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, and 15, respectively, where the 0th The boundary values of the quantization order (including the left boundary value and the right boundary value) are 0 and 16, respectively, and the boundary values of the first quantization step (including the left boundary value and the right boundary value) are 16 and 32, respectively, and the second quantization step The boundary values (including the left boundary value and the right boundary value) are 32 and 48, respectively, and the boundary values of the third quantization step (including the left boundary value and the right boundary value) are 48 and 64, respectively, and the boundary of the fourth quantization step The values (including the left and right boundary values) are 64 and 80, respectively, and the boundary values of the fifth quantization step (including the left and right boundary values) are 80 and 96, respectively, and the boundary value of the sixth quantization step. (including the left boundary value and the right boundary value) are 96 and 112 respectively, and the boundary value of the seventh quantization step (including the left boundary value and the right boundary value) are 112 and 128, respectively, and the boundary value of the eighth quantization step (including The left and right boundary values are 128 and 144, respectively, and the boundary values of the ninth quantization step (including the left and right boundary values) are 144 and 160, respectively, and the boundary value of the 10th quantization step (including the left boundary) The value and the right boundary value are 160 and 176 respectively, and the boundary value of the 11th quantization step (including the left boundary value and the right boundary value) are 176 and 192, respectively, and the boundary value of the 12th quantization step (including the left boundary value and The right boundary values are 192 and 208 respectively, and the boundary values of the 13th quantization step (including the left boundary value and the right boundary value) are 208 and 224, respectively, and the boundary values of the 14th quantization step (including the left boundary value and the right boundary) The values are 224 and 240, respectively, and the boundary values of the 15th quantization step (including the left and right boundary values) are 240 and 255, respectively. Since the image block pixel minimum value of the example of FIG. 2a is 86, within the corresponding quantization step with the left boundary value 80 and the right boundary value 96 as the end values, therefore, the quantization of the first quantization step corresponding to the image block pixel minimum value The order number is 5; for the same reason, the image block pixel maximum value of the example of FIG. 2a is 181, within the corresponding quantization step with the left boundary value 176 and the right boundary value 192 as the end values, therefore, the image block pixel maximum corresponds to The quantization step number of the second quantization step is 11.
进一步, 可以将附图 2a示例的图像块像素最小值量化为第 5个量化阶的左 边界值 80,将附图 2a示例的图像块像素最大值量化为第 11个量化阶的右边界值 192, 即附图 2a示例的图像块像素最小值所量化成的第一量化值为 80, 附图 2a 示例的图像块像素最大值所量化成的第二量化值为 192。  Further, the image block pixel minimum value illustrated in FIG. 2a may be quantized to the left boundary value 80 of the fifth quantization step, and the image block pixel maximum value illustrated in FIG. 2a may be quantized to the right boundary value 192 of the eleventh quantization step. That is, the first quantization value quantized by the image block pixel minimum value of the example of FIG. 2a is 80, and the second quantization value quantized by the image block pixel maximum value of the example of FIG. 2a is 192.
S102,将所述图像块每个像素的值映射为第三量化阶的量化阶编号,所述 第三量化阶是以所述第一量化值和第二量化值为端值的量化区间被均匀划分 的若干量化阶中一个量化阶。  S102. Map a value of each pixel of the image block to a quantization step number of a third quantization step, where the third quantization step is uniform by a quantization interval of the first quantized value and the second quantized value. One of a number of quantization steps divided into quantization steps.
以第一量化值和第二量化值为端值的量化区间被均匀划分若干量化阶时, 所划分的量化阶的数量可以根据图像数据压缩的精度要求而定, 一般地,如果 精度要求越高, 即压缩时损失的信息越少, 则划分的量化阶的数量可以划分得 越多, 反之, 如果精度要求越小, 即压缩时损失的信息越大, 则划分的量化阶 的数量可以划分得越少。在本发明实施例中, 以第一量化值和第二量化值为端 值的量化区间被均勾划分若干量化阶时,所划分的量化阶的数量可以与图像块 包含的像素数量相等。 以附图 2a所示的图像块和附图 2b所示的第一量化值、 第二量化值为例, 可 以将以第一量化值 80和第二量化值 192为端值的量化区间均匀划分 8个量化阶, 8个量化阶的量化阶编号依次为 0、 1、 2、 3、 4、 5、 6和 7, 如附图 2c所示。 这 里, 以第一量化值 80和第二量化值 192为端值的量化区间划分为的 8个量化阶, 量化阶的个数 8也可以被称为量化阶次。 附图 2c示例的量化阶中, 第 0个量化阶 的边界值(包括左边界值和右边界值)分別为 0和 94,第 1个量化阶的边界值(包 括左边界值和右边界值)分別为 94和 108, 第 2个量化阶的边界值 (包括左边界 值和右边界值)分別为 108和 122, 第 3个量化阶的边界值(包括左边界值和右 边界值 )分別为 122和 136, 第 4个量化阶的边界值 (包括左边界值和右边界值 ) 分別为 136和 150, 第 5个量化阶的边界值 (包括左边界值和右边界值)分別为 150和 164,第 6个量化阶的边界值(包括左边界值和右边界值)分別为 164和 178 , 第 7个量化阶的边界值 (包括左边界值和右边界值)分別为 178和 192。 具体地, 在将图像块每个像素的值映射为第三量化阶的量化阶编号时,若该像素的值落 入某个第三量化阶的左边界值和右边界值界定的范围之内,则该像素的值就映 射为该第三量化阶的量化阶编号, 如附图 2d所示, 由于像素值为 141的像素的 值落入附图 2c示例的 8个第三量化阶中第 4个第三量化阶的左边界值 136和右边 界值 150界定的范围之内, 因此,像素值为 141的像素的值所映射的第三量化阶 的量化阶编号为 4, 同理,像素值为 167的像素的值所映射的第三量化阶的量化 阶编号为 6, 像素值为 154的像素的值所映射的第三量化阶的量化阶编号为 5 , 像素值为 133的像素的值所映射的第三量化阶的量化阶编号为 3 , 像素值为 181 的像素的值所映射的第三量化阶的量化阶编号为 7,像素值为 152的像素的值所 映射的第三量化阶的量化阶编号为 5 ,像素值为 122的像素的值所映射的第三量 化阶的量化阶编号为 3 , 像素值为 86的像素的值所映射的第三量化阶的量化阶 编号为 0, 如附图 2d所示。 When the quantization interval with the first quantized value and the second quantized value is uniformly divided into a plurality of quantization steps, the number of the quantized steps may be determined according to the accuracy requirement of the image data compression. Generally, if the accuracy requirement is higher That is, the less information lost during compression, the more the number of divided quantization steps can be divided. Conversely, if the accuracy requirement is smaller, that is, the information lost during compression is larger, the number of divided quantization steps can be divided. The less. In the embodiment of the present invention, when the quantization interval of the first quantized value and the second quantized value is equally divided into a plurality of quantization steps, the number of the quantized steps may be equal to the number of pixels included in the image block. With the image block shown in FIG. 2a and the first quantized value and the second quantized value shown in FIG. 2b, the quantization interval with the first quantized value 80 and the second quantized value 192 as the end value can be evenly divided. The 8 quantization steps, the quantization step numbers of the 8 quantization steps are 0, 1, 2, 3, 4, 5, 6, and 7, respectively, as shown in Fig. 2c. Here, the quantization interval in which the first quantized value 80 and the second quantized value 192 are the end values is divided into eight quantization steps, and the number 8 of the quantization steps may also be referred to as a quantization order. In the quantization step illustrated in FIG. 2c, the boundary value of the 0th quantization step (including the left boundary value and the right boundary value) is 0 and 94, respectively, and the boundary value of the first quantization step (including the left boundary value and the right boundary value) ) 94 and 108 respectively, the boundary value of the second quantization step (including the left boundary value and the right boundary value) are 108 and 122, respectively, and the boundary value of the third quantization step (including the left boundary value and the right boundary value) respectively For 122 and 136, the boundary value of the fourth quantization step (including the left boundary value and the right boundary value) is 136 and 150, respectively, and the boundary value of the fifth quantization step (including the left boundary value and the right boundary value) is 150 respectively. And 164, the boundary value of the sixth quantization step (including the left boundary value and the right boundary value) are 164 and 178, respectively, and the boundary value of the seventh quantization step (including the left boundary value and the right boundary value) are 178 and 192, respectively. . Specifically, when mapping the value of each pixel of the image block to the quantization step number of the third quantization step, if the value of the pixel falls within the range defined by the left boundary value and the right boundary value of a certain third quantization step The value of the pixel is mapped to the quantization step number of the third quantization step. As shown in FIG. 2d, the value of the pixel having the pixel value of 141 falls within the eight third quantization steps of the example of FIG. 2c. The range of the left boundary value 136 and the right boundary value 150 of the four third quantization steps is within a range defined by the left boundary value 136 and the right boundary value 150. Therefore, the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 141 is 4. Similarly, the pixel The quantized order number of the third quantization step mapped by the value of the pixel having a value of 167 is 6, the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 154 is 5, and the pixel having the pixel value of 133 The quantization step number of the third quantization step mapped by the value is 3, the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 181 is 7, and the value of the pixel with the pixel value of 152 is mapped to the third. The quantization step number of the quantization step is 5, and the value of the pixel whose pixel value is 122 is mapped. Quantization step of the quantization step number 3, the pixel value of the pixel of the third quantization step value of 86 is mapped to the quantization step number is 0, as shown in figures 2d.
S103 ,对所述像素最小值对应的第一量化阶的量化阶编号、所述像素最大 值对应的第二量化阶的量化阶编号和所述图像块每个像素的值映射所得量化 阶编号进行编码并写入码流。  S103. Perform, for the quantization step number of the first quantization step corresponding to the minimum value of the pixel, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the quantization step number of the value mapping of each pixel of the image block. Encode and write to the stream.
经过步骤 S101和步骤 S102,相对于现有技术,编码像素最小值对应的第一 量化阶的量化阶编号所使用的比特数明显要少于编码像素最小值所使用的比 特数,编码像素最大值对应的第一量化阶的量化阶编号所使用的比特数明显要 少于编码像素最大值所使用的比特数,编码图像块每个像素的值映射所得量化 阶编号所使用的比特数也要明显少于编码每个像素与最小像素的差值所使用 的比特数。 以附图 2a至附图 2d为例, 使用本发明的方法, 对像素最小值 86对应 的第一量化阶的量化阶编号 5进行编码只需要 4比特( 5 = 0100 ) ,对像素最大值 171对应的第一量化阶的量化阶编号 11进行编码也只需要 4比特(11 = 1011 ); 由于附图 2a示例的图像块每个像素的值映射所得量化阶编号最大值为 7。因此, 对附图 2a示例的图像块每个像素的值映射所得量化阶编号进行编码只需要 3比 特,对附图 2a示例的图像块所有像素的值映射所得量化阶编号进行编码总共需 要的比特数为 8 x 3即 24比特,换言之, 对附图 2a示例的图像块像素最小值对应 的第一量化阶的量化阶编号、像素最大值对应的第二量化阶的量化阶编号和所 述图像块每个像素的值映射所得量化阶编号进行编码使用的比特数为 4+4+24 即 32比特。 而使用现有技术, 则对附图 2a示例的图像块编码使用的比特数为 8+8+24即 40比特, 两者相比, 本发明实施例提供的方法显著减少了编码使用 的比特数, 大大提升了编码效率。 After step S101 and step S102, the first corresponding to the minimum value of the encoded pixel is compared with the prior art. The number of bits used in the quantization step number of the quantization step is significantly smaller than the number of bits used to encode the minimum value of the pixel, and the number of bits used in the quantization step number of the first quantization step corresponding to the maximum value of the encoded pixel is significantly smaller than that of the encoded pixel. The number of bits used for the maximum value, the number of bits used to map the resulting quantized order number for each pixel of the coded image block is also significantly less than the number of bits used to encode the difference between each pixel and the smallest pixel. Taking FIG. 2a to FIG. 2d as an example, using the method of the present invention, encoding the quantization step number 5 of the first quantization step corresponding to the pixel minimum value 86 requires only 4 bits (5 = 0100), and the maximum value of the pixel is 171. The quantization step number 11 of the corresponding first quantization step also requires only 4 bits for encoding (11 = 1011); since the value of each pixel of the image block illustrated in Fig. 2a is mapped, the maximum quantization step number is 7. Therefore, it takes only 3 bits to encode the quantized order number of the value mapping of each pixel of the image block illustrated in FIG. 2a, and the total required bits are encoded for the quantized order number of all the pixel values of the image block illustrated in FIG. 2a. The number is 8 x 3 or 24 bits, in other words, the quantization step number of the first quantization step corresponding to the image block pixel minimum value illustrated in FIG. 2a, the quantization step number of the second quantization step corresponding to the pixel maximum value, and the image The value of each pixel is mapped to the resulting quantized order number. The number of bits used for encoding is 4+4+24 or 32 bits. With the prior art, the number of bits used for encoding the image block illustrated in FIG. 2a is 8+8+24 or 40 bits, and the method provided by the embodiment of the present invention significantly reduces the number of bits used for encoding. , greatly improving the coding efficiency.
从上述本发明实施例提供的图像数据压缩方法可知,由于对图像块像素最 小值和像素最大值分別进行了量化,而图像块每个像素的值也映射为了某种量 化阶的量化阶编号,最后的编码对象是像素最小值对应的第一量化阶的量化阶 编号、像素最大值对应的第二量化阶的量化阶编号和图像块每个像素的值映射 所得量化阶编号。与现有技术提供的不对最大值和最小值进行压缩的有损压缩 方法相比, 本发明实施例提供的方法显著减少了编码使用的比特数, 大大提升 了编码效率和压缩效率。  According to the image data compression method provided by the embodiment of the present invention, since the image block pixel minimum value and the pixel maximum value are respectively quantized, and the value of each pixel of the image block is also mapped to a quantization step number quantization step number, The last coding object is a quantization step number of the first quantization step corresponding to the pixel minimum value, a quantization step number of the second quantization step corresponding to the pixel maximum value, and a quantization step number obtained by mapping the value of each pixel of the image block. Compared with the lossy compression method provided by the prior art that does not compress the maximum value and the minimum value, the method provided by the embodiment of the present invention significantly reduces the number of bits used for coding, and greatly improves coding efficiency and compression efficiency.
在前述实施例中,将图像块像素最小值和像素最大值分別量化为第一量化 值和第二量化值时,第一量化阶和第二量化阶同属于包含若干量化阶的多个量 化阶中的两个量化阶, 例如, 第一量化阶和第二量化阶都属于包含 16个量化阶 的多个量化阶中的两个量化阶。在本发明实施例中, 第一量化阶和第二量化阶 也可以属于不同的多个量化阶中的两个量化阶, 例如, 第一量化阶属于包含 J 个量化阶的多个量化阶中的一个量化阶, 第二量化阶属于包含 K个量化阶的多 个量化阶中的一个量化阶, 这里, 所述 J与所述 K为大于 1且不相等的自然数。 In the foregoing embodiment, when the image block pixel minimum value and the pixel maximum value are respectively quantized into the first quantization value and the second quantization value, the first quantization step and the second quantization step belong to the plurality of quantization steps including the plurality of quantization steps. The two quantization steps, for example, the first quantization step and the second quantization step belong to two quantization steps of a plurality of quantization steps including 16 quantization steps. In the embodiment of the present invention, the first quantization step and the second quantization step may also belong to two quantization steps of different multiple quantization steps, for example, the first quantization step belongs to the inclusion of J. One of the plurality of quantization steps of the quantization step, the second quantization step belongs to one of the plurality of quantization steps including the K quantization steps, where the J and the K are greater than 1 and are not equal Natural number.
作为将图像块像素最小值和像素最大值分別量化为第一量化值和第二量 化值的另一实施例, 可以将图像块像素最小值量化为 J个量化阶中第一量化阶 的边界值, 将图像块像素最大值量化为 K个量化阶中第二量化阶的边界值。 例 如, 以附图 2a所示的包含 4 x 2个像素的图像块为例, 将图像块像素最小值 86 量化为以 0和 255为端值的量化区间被均匀划分的 32个第一量化阶中一个第一 量化阶的边界值, 将图像块像素最大值 181量化为以 0和 255为端值的量化区间 被均勾划分的 16个第二量化阶中一个第二量化阶的边界值, 这里, 以 0和 255 为端值的量化区间划分为的 32个第一量化阶或 16个第二量化阶,量化阶的个数 16或 32也可以被称为量化阶次。在本实施例中,像素最小值 86量化为第一量化 值时可以是 80, 其对应于 32个第一量化阶的量化阶编号为 10, 像素最大值 181 量化为第二量化值时可以是 192,其对应于 16个第二量化阶的量化阶编号为 11。 在将所述图像块每个像素的值映射为第三量化阶的量化阶编号之前, 进一步, 判断图像块像素最小值被量化成的边界值对应的二进制数右移一位后与所述 图像块像素最大值被量化成的边界值对应的二进制数是否相等, 或者, 判断图 像块像素最大值被量化成的边界值对应的二进制数右移一位后与所述图像块 像素最 d、值被量化成的边界值对应的二进制数是否相等。  As another embodiment of quantizing the image block pixel minimum value and the pixel maximum value into the first quantization value and the second quantization value, respectively, the image block pixel minimum value may be quantized into the boundary value of the first quantization step in the J quantization steps The image block pixel maximum value is quantized into a boundary value of the second quantization step of the K quantization steps. For example, taking the image block including 4 x 2 pixels shown in FIG. 2a as an example, the image block pixel minimum value 86 is quantized into 32 first quantization steps uniformly divided by quantization intervals with end values of 0 and 255. a boundary value of a first quantization step, and quantizing the image block pixel maximum value 181 into a boundary value of a second quantization step among the 16 second quantization steps in which the quantization intervals with 0 and 255 are end-pointed, Here, the quantization interval of 0 and 255 is divided into 32 first quantization steps or 16 second quantization steps, and the number 16 or 32 of quantization steps may also be referred to as a quantization order. In this embodiment, when the pixel minimum value 86 is quantized into the first quantization value, it may be 80, and the quantization step number corresponding to the 32 first quantization steps is 10, and the pixel maximum value 181 may be quantized to the second quantization value. 192, the quantization step number corresponding to the 16 second quantization steps is 11. Before mapping the value of each pixel of the image block to the quantization step number of the third quantization step, further determining that the binary number corresponding to the boundary value of the image block pixel minimum is shifted to the right by one bit and the image Whether the binary number corresponding to the boundary value quantized by the maximum value of the block pixel is equal, or determining that the binary number corresponding to the boundary value of the image block pixel maximum value is shifted right by one bit and the pixel of the image block is the most d value Whether the binary numbers corresponding to the quantized boundary values are equal.
若图像块中像素最小值被量化成的边界值对应的二进制数右移一位后与 所述图像块像素最大值被量化成的边界值对应的二进制数不相等,则在上述实 施例中,将所述像素最小值对应的第一量化阶的量化阶编号、所述像素最大值 对应的第二量化阶的量化阶编号和所述图像块每个像素的值映射所得量化阶 编号写入码流包括:  In the above embodiment, if the binary number corresponding to the boundary value in which the pixel minimum value is quantized in the image block is shifted to the right by one bit and the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is not equal, in the above embodiment, Generating a quantization step number of the first quantization step corresponding to the pixel minimum value, a quantization step number of the second quantization step corresponding to the pixel maximum value, and a value of each pixel of the image block The flow includes:
判断图像块像素最小值被量化成的边界值对应的二进制数进行右移一位 移除的是 "1" 还是 "0" ; 若图像块像素最小值被量化成的边界值对应的二进 制数进行右移一位移除的是 "1" , 则对所述像素最小值被量化成的边界值的二 进制数进行右移一位后所得值对应的量化阶编号、所述像素最大值被量化成的 边界值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进 行编码并依次写入码流;若图像块像素最小值被量化成的边界值对应的二进制 数进行右移一位移除的是 "0" , 则对所述像素最大值被量化成的边界值对应的 量化阶编号、将像素最 d、值被量化成的边界值的二进制数进行右移一位后所得 值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编 码并依次写入码流。 Determining whether the binary number corresponding to the boundary value of the image block pixel is quantized by right shifting one bit to remove "1" or "0"; if the image block pixel minimum value is quantized into a binary value corresponding to the boundary value When a bit is shifted to the right by "1", the quantized order number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel minimum value is quantized is quantized into The quantized order number corresponding to the boundary value and the quantized order number of each pixel of the image block Line coding and sequentially writing to the code stream; if the binary value corresponding to the boundary value of the image block pixel minimum is right-shifted by one bit and "0" is removed, the boundary at which the maximum value of the pixel is quantized The quantized order number corresponding to the value, the quantized order number corresponding to the value obtained by right-shifting the binary value of the pixel d to the value of the boundary value quantized by one bit, and the quantized order number obtained by mapping the value of each pixel of the image block Encode and write to the code stream in sequence.
在上述实施例中, 也可以对编码后的量化阶编号写入码流的顺序不做限 定, 例如, 若图像块像素最小值被量化成的边界值对应的二进制数进行右移一 位移除的是 "1" ,也可以是对所述像素最大值被量化成的边界值对应的量化阶 编号、所述像素最小值被量化成的边界值的二进制数进行右移一位后所得值对 应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并 依次写入码流;若图像块像素最 d、值被量化成的边界值对应的二进制数进行右 移一位移除的是 "0" , 也可以对像素最小值被量化成的边界值的二进制数进 行右移一位后所得值对应的量化阶编号、所述像素最大值被量化成的边界值对 应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并 依次写入码流。  In the above embodiment, the order of writing the code stream after the coded quantization step number may not be limited. For example, if the image block pixel minimum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit. It is "1", and the quantized order number corresponding to the boundary value to which the pixel maximum value is quantized, and the binary number of the boundary value to which the pixel minimum value is quantized may be shifted to the right by one bit. The quantized order number and the quantized order number of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel is the most d, the binary value corresponding to the boundary value to which the value is quantized is shifted to the right. The bit removed is "0", and the quantized order number corresponding to the value obtained by right shifting the binary number of the boundary value quantized to the pixel minimum value, and the boundary value corresponding to the pixel maximum value are correspondingly The quantization step number and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
若判断图像块像素最大值被量化成的边界值对应的二进制数右移一位后 与所述图像块像素最 d、值被量化成的边界值对应的二进制数不相等,则所述将 所述像素最 d、值对应的第一量化阶的量化阶编号、所述像素最大值对应的第二 量化阶的量化阶编号和所述图像块每个像素的值映射所得量化阶编号写入码 流包括:判断图像块像素最大值被量化成的边界值对应的二进制数进行右移一 位移除的是 "1" 还是 "0" ; 若图像块像素最大值被量化成的边界值对应的二 进制数进行右移一位移除的是 "1" , 则对所述像素最大值被量化成的边界值的 二进制数进行右移一位后所得值对应的量化阶编号、所述像素最小值被量化成 的边界值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号 进行编码并依次写入码流;若图像块像素最大值被量化成的边界值对应的二进 制数进行右移一位移除的是 "0" , 则对所述像素最小值被量化成的边界值对应 的量化阶编号、将像素最大值被量化成的边界值的二进制数进行右移一位后所 得值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行 编码并依次写入码流。 If it is determined that the binary number corresponding to the boundary value of the image block pixel maximum value is shifted to the right by one bit, and the binary number corresponding to the boundary value of the image block pixel maximum d and the value is not equal, the a quantization step number of a first quantization step corresponding to a pixel most d, a value, a quantization step number of a second quantization step corresponding to the maximum value of the pixel, and a quantization step number write code obtained by mapping the value of each pixel of the image block The stream includes: determining whether the binary value corresponding to the boundary value of the image block pixel maximum is quantized by right shifting one bit to remove "1" or "0"; if the image block pixel maximum value is quantized into a boundary value corresponding to The binary number is shifted to the right by one bit to remove "1", and the binary number of the boundary value to which the maximum value of the pixel is quantized is shifted right by one bit, and the quantized order number corresponding to the obtained value is the minimum value of the pixel. The quantized order number corresponding to the quantized boundary value and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel maximum value is quantized into a binary value corresponding to the boundary value If "0" is performed to shift right by one bit, the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and the binary number of the boundary value to which the pixel maximum value is quantized are shifted right by one bit. The quantization step number corresponding to the obtained value and the quantization step number obtained by mapping the value of each pixel of the image block are performed. Encode and write to the stream in sequence.
类似地, 也可以对编码后的量化阶编号写入码流的顺序不做限定, 例如, 若图像块像素最大值被量化成的边界值对应的二进制数进行右移一位移除的 是 " 1" , 则也可以对所述像素最小值被量化成的边界值对应的量化阶编号、 所 述像素最大值被量化成的边界值的二进制数进行右移一位后所得值对应的量 化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并依次写 入码流;若图像块像素最大值被量化成的边界值对应的二进制数进行右移一位 移除的是 "0" ,也可以对像素最大值被量化成的边界值的二进制数进行右移一 位后所得值对应的量化阶编号、所述像素最小值被量化成的边界值对应的量化 阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并依次写入 码流。  Similarly, the order in which the encoded quantized order number is written into the code stream may not be limited. For example, if the image block pixel maximum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit. 1", the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and the quantization number corresponding to the binary value of the boundary value to which the pixel maximum value is quantized may be shifted to the right by one bit. The number and the quantized order number of each pixel of the image block are encoded and sequentially written into the code stream; if the image block pixel maximum value is quantized, the binary number corresponding to the boundary value is shifted to the right by one bit. "0" , the quantization step number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel maximum value is quantized, and the quantization step number corresponding to the boundary value to which the pixel minimum value is quantized The quantized order number obtained by mapping the value of each pixel of the image block is encoded and sequentially written into the code stream.
在上述实施例中, 实际上是通过数据隐藏技术,提高了像素最大值和像素 最小值的量化精度, 并提升了编码效率。  In the above embodiment, the data hiding technique is actually used to improve the quantization precision of the pixel maximum value and the pixel minimum value, and the encoding efficiency is improved.
在上述实施例中,判断图像块中像素最小值被量化成的边界值对应的二进 制数右移一位后与所述图像块像素最大值被量化成的边界值对应的二进制数 相等,或者判断图像块像素最大值被量化成的边界值对应的二进制数右移一位 后与所述图像块像素最 d、值被量化成的边界值对应的二进制数相等,则这种情 况下图像数据压缩方法与附图 1示例的相同, 即将图像块像素最小值和像素最 大值分別量化为第一量化值和第二量化值包括:将图像块像素最 d、值量化为 M 个量化阶中第一量化阶的边界值,将图像块像素最大值量化为所述 M个量化阶 中第二量化阶的边界值, 所述 M为大于 1的自然数。 后续进一步的处理过程与 附图 1示例的步骤 S102和步骤 S103包含的内容相同, 这里不做赘述, 可参阅前 文。  In the above embodiment, it is determined that the binary number corresponding to the boundary value to which the pixel minimum value is quantized in the image block is shifted to the right by one bit, and the binary number corresponding to the boundary value to which the maximum value of the image block pixel is quantized is equal, or judged The binary number corresponding to the boundary value to which the image block pixel maximum is quantized is shifted to the right by one bit, and is equal to the binary number corresponding to the boundary value of the pixel d pixel and the quantized value. In this case, the image data is compressed. The method is the same as that exemplified in FIG. 1, that is, respectively, quantizing the image block pixel minimum value and the pixel maximum value into the first quantized value and the second quantized value, respectively, comprising: quantizing the image block pixel maximum d and the value into the first of the M quantization steps. The boundary value of the quantization step is quantized, and the image block pixel maximum value is quantized into a boundary value of the second quantization step of the M quantization steps, and the M is a natural number greater than 1. Subsequent further processing is the same as that of the steps S102 and S103 of the example of FIG. 1 and will not be described here. For reference, refer to the foregoing.
对应于附图 1示例的图像数据压缩方法,附图 3是本发明实施例提供的图像 数据解压缩方法流程示意图, 主要包括步骤 S301、 步骤 S302和步骤 S303:  FIG. 3 is a schematic flowchart of an image data decompression method according to an embodiment of the present invention, which mainly includes steps S301, S302, and S303:
S301 ,根据码流中图像块像素最小值和像素最大值对应的量化阶编号,解 码得到图像块像素最 d、值和像素最大值分別对应的第一量化值和第二量化值。  S301. Decode, according to the minimum value of the image block pixel in the code stream and the quantization step number corresponding to the pixel maximum value, to obtain a first quantized value and a second quantized value respectively corresponding to the image d pixel maximum d, the value, and the pixel maximum value.
由于编码端和解码端约定了图像块像素最小值和像素最大值分別量化为 第一量化值和第二量化值时使用的量化阶次, 因此, 在解码端, 可以根据码流 中图像块像素最小值和像素最大值对应的量化阶编号,解码得到图像块像素最 、值和像素最大值分別对应的第一量化值和第二量化值。以附图 2a所示的图像 块为例,像素最小值 86和像素最大值 181对应的量化阶编号分別为 5和 11 , 由于 量化阶次为 16,故在解码端可以解码得到图像块像素最小值和像素最大值分別 对应的第一量化值 80和第二量化值 192 , 如附图 4a所示。 Since the encoding end and the decoding end agree that the image block pixel minimum value and the pixel maximum value are respectively quantized as The first quantization value and the second quantization value are used in the quantization order. Therefore, at the decoding end, the image block pixel maximum value can be decoded according to the image block pixel minimum value and the pixel maximum value corresponding to the quantization step number in the code stream. a first quantized value and a second quantized value respectively corresponding to pixel maximum values. Taking the image block shown in FIG. 2a as an example, the quantization step numbers corresponding to the pixel minimum value 86 and the pixel maximum value 181 are 5 and 11, respectively. Since the quantization order is 16, the image block pixel minimum can be decoded at the decoding end. The value and the pixel maximum correspond to a first quantized value 80 and a second quantized value 192, respectively, as shown in Figure 4a.
S302,根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时 所用量化阶次、图像块像素最 d、值对应的第一量化值和图像块像素最大值对应 的第二量化值,获取以所述第一量化值和第二量化值为端值的量化区间被均匀 划分的若干所述第三量化阶。  S302. The quantization order used when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step, the image block pixel most d, the first quantization value corresponding to the value, and the image block pixel maximum value. And a second quantized value obtained by acquiring a plurality of the third quantization steps uniformly divided by the quantization intervals of the first quantized value and the second quantized value.
由于编码端和解码端约定了图像块每个像素的值映射为第三量化阶的量 化阶编号时所用量化阶次, 因此, 在解码端, 可以根据码流中图像块每个像素 的值映射为第三量化阶的量化阶编号时所用量化阶次、所述第一量化值和第二 量化值。 以附图 2a所示的图像块为例, 像素最小值 86对应的第一量化值为 80, 像素最大值 181对应的第二量化值为 192,图像块每个像素的值映射为第三量化 阶的量化阶编号时所用量化阶次为 8,则以所述第一量化值 80和第二量化值 192 为端值的量化区间被均匀划分 8个第三量化阶, 如附图 4b所示。  Since the encoding end and the decoding end agree on the quantization order used when the value of each pixel of the image block is mapped to the quantization step number of the third quantization step, at the decoding end, the value mapping of each pixel of the image block in the code stream can be performed. The quantization order, the first quantized value, and the second quantized value used when the quantization step number of the third quantization step is numbered. Taking the image block shown in FIG. 2a as an example, the first quantization value corresponding to the pixel minimum value 86 is 80, the second quantization value corresponding to the pixel maximum value 181 is 192, and the value of each pixel of the image block is mapped to the third quantization. When the quantization order of the order of the quantization step number is 8, the quantization interval with the first quantization value 80 and the second quantization value 192 as the end value is evenly divided into 8 third quantization steps, as shown in FIG. 4b. .
相应于将图像块像素最小值和像素最大值分別量化为第一量化值和第二 量化值时,第一量化阶和第二量化阶属于不同的多个量化阶中的两个量化阶这 一实施例,在解码端,在根据码流中图像块每个像素的值映射为第三量化阶的 量化阶编号时所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一 量化值和第二量化值为端值的量化区间被均勾划分的若干所述第三量化阶之 前, 需要判断所述第一量化值和第二量化值是否相等; 若所述第一量化值和第 二量化值不相等并且先收到码流中图像块像素最 d、值对应的量化阶编号后收 到码流中图像块像素最大值对应的量化阶编号,则将所述第一量化值对应的二 进制数左移一位并且在末位补 "1" , 若所述第一量化值和第二量化值不相等并 且先收到码流中图像块像素最大值对应的量化阶编号后收到码流中图像块像 素最小值对应的量化阶编号,则将所述第一量化值对应的二进制数左移一位并 且在末位补 "0"。 此时, 根据码流中图像块每个像素的值映射为第三量化阶的 量化阶编号时所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一 量化值和第二量化值为端值的量化区间被均勾划分的若干所述第三量化阶可 以是:根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所用 量化阶次、所述第二量化值和所述第一量化值对应的二进制数左移一位并且在 末位补 "0" 或 "1"后对应的十进制数, 获取以所述所述第一量化值对应的二 进制数左移一位并且在末位补 "0" 或 "1"后对应的十进制数和第二量化值为 端值的量化区间被均匀划分的若干所述第三量化阶,具体方法与附图 4b及其对 应的文字说明类似, 不做赘述。 Corresponding to quantizing the image block pixel minimum value and the pixel maximum value into the first quantized value and the second quantized value, respectively, the first quantized order and the second quantized order belong to two of the different quantized orders. In an embodiment, at the decoding end, the quantization order, the first quantized value, and the second quantized value used when the value of each pixel of the image block in the code stream is mapped to the quantized order number of the third quantization step is obtained. Before the first quantized value and the quantized interval of the second quantized value are equally divided into a plurality of the third quantized steps, it is required to determine whether the first quantized value and the second quantized value are equal; If the quantized value and the second quantized value are not equal and the quantized order number corresponding to the maximum value of the image block in the code stream is received after receiving the most d and the quantized order number corresponding to the value of the image block in the code stream, The binary number corresponding to the first quantized value is shifted to the left by one bit and is complemented by "1" at the last bit, if the first quantized value and the second quantized value are not equal and the quantization corresponding to the maximum value of the image block pixel in the code stream is received first. Image block in the stream after receiving the order number a quantization step number corresponding to the pixel minimum value, wherein the binary number corresponding to the first quantization value is shifted to the left by one bit And the "0" is added at the last position. At this time, the first quantization value is obtained according to the quantization order, the first quantization value, and the second quantization value used when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step. And the plurality of third quantization steps, which are equally divided by the quantization interval of the second quantization value, may be: quantization used when mapping the value of each pixel of the image block in the code stream to the quantization step number of the third quantization step The order, the second quantized value, and the binary number corresponding to the first quantized value are shifted by one bit to the left and the corresponding decimal number is complemented by "0" or "1" at the last bit, and the first number is obtained. The binary number corresponding to the quantized value is shifted to the left by one bit, and the corresponding decimal number after the last bit is complemented by "0" or "1" and the second quantization step of the second quantized value is evenly divided. The specific method is similar to the description of FIG. 4b and its corresponding text, and will not be described again.
若所述第一量化值和第二量化值不相等并且先收到码流中图像块像素最 大值对应的量化阶编号后收到码流中图像块像素最小值对应的量化阶编号,则 将所述第二量化值对应的二进制数左移一位并且在末位补 "1" , 若所述第一量 化值和第二量化值不相等并且先收到码流中图像块像素最小值对应的量化阶 编号后收到码流中图像块像素最大值对应的量化阶编号,则将所述第二量化值 对应的二进制数左移一位并且在末位补 "0"。 此时, 根据码流中图像块每个 像素的值映射为第三量化阶的量化阶编号时所用量化阶次、所述第一量化值和 第二量化值,获取以所述第一量化值和第二量化值为端值的量化区间被均匀划 分的若干所述第三量化阶可以是:根据码流中图像块每个像素的值映射为第三 量化阶的量化阶编号时所用量化阶次、所述第一量化值和所述第二量化值对应 的二进制数左移一位并且在末位补 "0" 或 " 后对应的十进制数, 获取以所 述第二量化值对应的二进制数左移一位并且在末位补 "0" 或 "1"后对应的十 进制数和第一量化值为端值的量化区间被均勾划分的若干所述第三量化阶,具 体方法与附图 4b及其对应的文字说明类似, 不做赘述。  If the first quantized value and the second quantized value are not equal and the quantized order number corresponding to the minimum value of the image block in the code stream is received after receiving the quantized order number corresponding to the maximum value of the image block pixel in the code stream, The binary number corresponding to the second quantized value is shifted to the left by one bit and is complemented by "1" at the last bit, if the first quantized value and the second quantized value are not equal and the image block pixel minimum value corresponding to the received code stream is first received. After the quantized order number is received, the quantized order number corresponding to the maximum value of the image block pixel in the code stream is received, and the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is complemented by "0". At this time, the first quantization value is obtained according to the quantization order, the first quantization value, and the second quantization value used when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step. And the plurality of third quantization steps uniformly divided by the quantization interval of the second quantized value may be: a quantization step used when mapping the value of each pixel of the image block in the code stream to the quantization step number of the third quantization step And the binary number corresponding to the first quantized value and the second quantized value is shifted by one bit to the left and the "0" or "the corresponding decimal number is complemented in the last bit, and the binary corresponding to the second quantized value is obtained. a number of the third quantization steps in which the number is shifted to the left by one bit and the corresponding decimal number is added to the last bit or "0" or "1", and the quantization interval of the first quantization value is delimited. Figure 4b and its corresponding text descriptions are similar and will not be described.
S303,根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号和 所述每一第三量化阶的边界值,重构所述图像块每个像素以获取所述图像块每 个像素的值。  S303. Reconstructing each pixel of the image block to obtain the image according to a value of each pixel of the image block in the code stream being mapped to a quantization step number of the third quantization step and a boundary value of each of the third quantization steps. The value of each pixel of the block.
具体地,可以取每一个量化阶编号所对应第三量化阶的左边界值或右边界 值作为所述每一个量化阶编号所对应像素的值。为了进一步提高重构所述图像 块每个像素时获取所述图像块每个像素的值的精度,也可以取每一个量化阶编 号所对应第三量化阶的两个边界值,对所述两个边界值的平均值取整, 以取整 所得的值作为所述每一个量化阶编号所对应像素的值。 以附图 2d所示为例,像 素值为 141的像素的值所映射的第三量化阶的量化阶编号为 4, 像素值为 167的 像素的值所映射的第三量化阶的量化阶编号为 6,像素值为 154的像素的值所映 射的第三量化阶的量化阶编号为 5 ,像素值为 133的像素的值所映射的第三量化 阶的量化阶编号为 3 ,像素值为 181的像素的值所映射的第三量化阶的量化阶编 号为 7 , 像素值为 152的像素的值所映射的第三量化阶的量化阶编号为 5 , 像素 值为 122的像素的值所映射的第三量化阶的量化阶编号为 3 ,像素值为 86的像素 的值所映射的第三量化阶的量化阶编号为 0, 那么,在附图 4b示例的 8个第三量 化阶中, 量化阶编号为 4的第三量化阶, 其两个边界值(左边界值和右边界值) 分別为 136和 150, 则该两个边界值的平均值取整为 ( 136+150 ) /2 = 143 , 即在 编码端进行压缩时, 像素值为 141的像素在解码端进行解压缩时, 重构后的像 素的值为 143 , 与压缩前的像素值相差 2; 同理, 量化阶编号为 6的第三量化阶, 其两个边界值 (左边界值和右边界值 )分別为 164和 178 , 则该两个边界值的平 均值取整为 ( 164+178 ) /2 = 171 , 即在编码端进行压缩时, 像素值为 167的像 素在解码端进行解压缩时,重构后的像素的值为 171 ,与压缩前的像素值相差 2; 量化阶编号为 5的第三量化阶, 其两个边界值(左边界值和右边界值)分別为 150和 164, 则该两个边界值的平均值取整为 ( 150+164 ) /2 = 157 , 即在编码端 进行压缩时, 像素值为 154的像素在解码端进行解压缩时, 重构后的像素的值 为 157 , 与压缩前的像素值相差 3 ; 量化阶编号为 3的第三量化阶, 其两个边界 值(左边界值和右边界值 )分別为 122和 136, 则该两个边界值的平均值取整为 ( 122+136 ) 12 = 129 , 即在编码端进行压缩时, 像素值为 133的像素在解码端 进行解压缩时, 重构后的像素的值为 129, 与压缩前的像素值相差 4; 量化阶编 号为 7的第三量化阶, 其两个边界值(左边界值和右边界值)分別为 178和 192, 则该两个边界值的平均值取整为( 178+192 ) /2 = 185 , 即在编码端进行压缩时, 像素值为 181的像素在解码端进行解压缩时, 重构后的像素的值为 185 , 与压缩 前的像素值相差 4; 量化阶编号为 5的第三量化阶, 其两个边界值(左边界值和 右边界值)分別为 150和 164, 则该两个边界值的平均值取整为(150+164 ) /2 = 157, 即在编码端进行压缩时, 像素值为 152的像素在解码端进行解压缩时, 重 构后的像素的值为 157, 与压缩前的像素值相差 5; 量化阶编号为 3的第三量化 阶, 其两个边界值(左边界值和右边界值)分別为 178和 192, 则该两个边界值 的平均值取整为 ( 122+136 ) /2 = 129, 即在编码端进行压缩时, 像素值为 122 的像素在解码端进行解压缩时, 重构后的像素的值为 129, 与压缩前的像素值 相差 7; 量化阶编号为 0的第三量化阶, 其两个边界值(左边界值和右边界值) 分別为 80和 94, 则该两个边界值的平均值取整为 (80+94 ) /2 = 87 , 即在编码 端进行压缩时,像素值为 86的像素在解码端进行解压缩时, 重构后的像素的值 为 87, 与压缩前的像素值相差 1 , 如附图 4c所示, 是附图 2a所示图像块在解压 缩后对应像素的值示意图。对于图像数据的有损压缩而言, 这些差值是可以接 受的。 Specifically, the left boundary value or the right boundary value of the third quantization step corresponding to each quantization step number may be taken as the value of the pixel corresponding to each of the quantization step numbers. In order to further improve the reconstruction of the image Obtaining the precision of the value of each pixel of the image block for each pixel of the block, or taking two boundary values of the third quantization step corresponding to each quantization step number, and rounding the average of the two boundary values The value obtained by rounding is used as the value of the pixel corresponding to each of the quantization step numbers. Taking the example shown in FIG. 2d as an example, the quantization step number of the third quantization step to which the value of the pixel having the pixel value is 141 is 4, and the quantization step number of the third quantization step to which the value of the pixel having the pixel value is 167 is mapped. 6, the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 154 is 5, and the quantization step number of the third quantization step mapped by the value of the pixel with the pixel value of 133 is 3, and the pixel value is The quantization step number of the third quantization step mapped by the value of the pixel of 181 is 7, the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 152 is 5, and the value of the pixel having the pixel value of 122 is The quantized order number of the mapped third quantization step is 3, and the quantization step number of the third quantization step mapped by the value of the pixel having the pixel value of 86 is 0, and then, in the 8 third quantization steps illustrated in FIG. 4b The third quantization step with the quantization order number 4, the two boundary values (the left boundary value and the right boundary value) are 136 and 150, respectively, and the average value of the two boundary values is rounded to (136+150) / 2 = 143, that is, when the encoding end is compressed, when the pixel with the pixel value of 141 is decompressed at the decoding end, The reconstructed pixel has a value of 143, which is different from the pixel value before compression by 2; for the same reason, the third quantization step with the quantization order number of 6 has two boundary values (left boundary value and right boundary value) of 164 respectively. And 178, the average value of the two boundary values is rounded to (164+178) /2 = 171, that is, when the encoding end is compressed, the pixel with the pixel value of 167 is decompressed at the decoding end, and then reconstructed. The value of the pixel is 171, which is different from the pixel value before compression by 2; the third quantization step of the quantization order number is 5, and the two boundary values (left boundary value and right boundary value) are 150 and 164, respectively. The average value of the boundary values is rounded to (150+164) /2 = 157, that is, when the encoding end is compressed, when the pixel with the pixel value of 154 is decompressed at the decoding end, the value of the reconstructed pixel is 157. , differs from the pixel value before compression by 3; the third quantization step with quantization order number 3, the two boundary values (left boundary value and right boundary value) are 122 and 136, respectively, and the average of the two boundary values Rounded to (122+136) 12 = 129, that is, when the encoding end is compressed, the pixel with a pixel value of 133 is performed at the decoding end. When compressed, the value of the reconstructed pixel is 129, which is different from the pixel value before compression by 4; the third quantization step with the quantization order number is 7, and the two boundary values (left boundary value and right boundary value) are respectively 178 And 192, the average value of the two boundary values is rounded to (178+192) /2 = 185, that is, when the encoding end is compressed, when the pixel with the pixel value of 181 is decompressed at the decoding end, after reconstruction The value of the pixel is 185, which is different from the pixel value before compression by 4; the third quantization step of the quantization order number is 5, and the two boundary values (left boundary value and The right boundary values are 150 and 164, respectively, and the average of the two boundary values is rounded to (150+164) /2 = 157, that is, when the encoding end is compressed, the pixel with the pixel value of 152 is performed at the decoding end. When decompressing, the reconstructed pixel has a value of 157, which is different from the pixel value before compression by 5; the quantization step number is 3, the third quantization step, and the two boundary values (left boundary value and right boundary value) are respectively 178 and 192, the average of the two boundary values is rounded to (122+136) /2 = 129, that is, when the encoding end is compressed, the pixel with the pixel value of 122 is reconstructed when decompressing at the decoding end. The value of the latter pixel is 129, which is different from the pixel value before compression by 7; the third quantization step of the quantization order number is 0, and the two boundary values (left boundary value and right boundary value) are 80 and 94, respectively. The average value of the two boundary values is rounded to (80+94) /2 = 87, that is, when the pixel is compressed at the encoding end, when the pixel with the pixel value of 86 is decompressed at the decoding end, the value of the reconstructed pixel is 87, differs from the pixel value before compression by 1, as shown in FIG. 4c, which is the corresponding pixel of the image block shown in FIG. 2a after decompression Value map. These differences are acceptable for lossy compression of image data.
请参阅附图 5 , 是本发明实施例提供的图像数据压缩装置结构示意图。 为 了便于说明,仅仅示出了与本发明实施例相关的部分。 附图 5示例的图像数据 压缩装置包括量化模块 501、 映射模块 502和编码模块 503 , 其中:  FIG. 5 is a schematic structural diagram of an image data compression apparatus according to an embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown. The image data compression apparatus illustrated in Fig. 5 includes a quantization module 501, a mapping module 502, and an encoding module 503, wherein:
量化模块 501 , 用于将图像块像素最小值和像素最大值分別量化为第一量 化值和第二量化值,所述像素最 d、值和像素最大值分別对应于第一量化阶的量 化阶编号和第二量化阶的量化阶编号。  The quantization module 501 is configured to quantize the image block pixel minimum value and the pixel maximum value into a first quantization value and a second quantization value, respectively, where the pixel maximum d, value, and pixel maximum value respectively correspond to the quantization step of the first quantization step The quantized order number of the number and the second quantization step.
映射模块 502, 用于将所述图像块每个像素的值映射为第三量化阶的量化 阶编号,所述第三量化阶是以所述第一量化值和第二量化值为端值的量化区间 被均匀划分的若干量化阶中一个量化阶。  The mapping module 502 is configured to map a value of each pixel of the image block to a quantization step number of a third quantization step, where the third quantization step is an end value of the first quantization value and the second quantization value. One of a number of quantization steps in which the quantization interval is evenly divided.
编码模块 503 , 用于对所述像素最小值对应的第一量化阶的量化阶编号、 所述像素最大值对应的第二量化阶的量化阶编号和所述图像块每个像素的值 映射所得量化阶编号进行编码并写入码流。  The encoding module 503 is configured to map a quantization step number of the first quantization step corresponding to the pixel minimum value, a quantization step number of the second quantization step corresponding to the pixel maximum value, and a value of each pixel of the image block. The quantization step number is encoded and written to the code stream.
需要说明的是, 以上图像数据压缩装置的实施方式中,各功能模块的划分 仅是举例说明, 实际应用中可以根据需要, 例如相应硬件的配置要求或者软件 的实现的便利考虑, 而将上述功能分配由不同的功能模块完成, 即将所述图像 数据压缩装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者 部分功能。 而且, 实际应用中, 本实施例中的相应的功能模块可以是由相应的 硬件实现,也可以由相应的硬件执行相应的软件完成,例如,前述的量化模块, 可以是具有执行前述将图像块像素最小值和像素最大值分別量化为第一量化 值和第二量化值的硬件, 例如量化器, 也可以是能够执行相应计算机程序从而 完成前述功能的一般处理器或者其他硬件设备; 再如前述的映射模块, 可以是 具有执行前述将所述图像块每个像素的值映射为第三量化阶的量化阶编号功 能的硬件, 例如映射器,也可以是能够执行相应计算机程序从而完成前述功能 的一般处理器或者其他硬件设备(本说明书提供的各个实施例都可应用上述描 述原则)。 It should be noted that, in the implementation of the foregoing image data compression apparatus, the division of each functional module is merely an example. In actual applications, the foregoing functions may be implemented according to requirements, such as configuration requirements of corresponding hardware or convenience of implementation of software. Assignment is done by different functional modules, ie the image will be The internal structure of the data compression device is divided into different functional modules to perform all or part of the functions described above. Moreover, in practical applications, the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be performed by corresponding hardware to execute corresponding software. For example, the foregoing quantization module may be configured to execute the foregoing image block. The pixel minimum value and the pixel maximum value are respectively quantized into hardware of the first quantized value and the second quantized value, such as a quantizer, or a general processor or other hardware device capable of executing a corresponding computer program to perform the foregoing functions; The mapping module may be hardware having a function of performing the foregoing step of mapping the value of each pixel of the image block to a third quantization step, such as a mapper, or a computer program capable of executing the corresponding computer program to perform the foregoing functions. A general processor or other hardware device (the various embodiments described herein may apply the above described principles).
附图 5示例的量化模块 501可以包括第一量化单元 601,如附图 6所示本发明 另一实施例提供的图像数据压缩装置。 第一量化单元 601用于将图像块像素最 小值量化为 M个量化阶中第一量化阶的边界值,将图像块像素最大值量化为所 述 M个量化阶中第二量化阶的边界值, 所述 M为大于 1的自然数。  The quantization module 501 illustrated in Fig. 5 may include a first quantization unit 601, such as the image data compression device provided by another embodiment of the present invention, as shown in Fig. 6. The first quantization unit 601 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the M quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the M quantization steps The M is a natural number greater than one.
附图 5示例的量化模块 501也可以包括第二量化单元 701 ,如附图 7所示本发 明另一实施例提供的图像数据压缩装置。 第二量化单元 701用于将图像块像素 最小值量化为 J个量化阶中第一量化阶的边界值,将图像块像素最大值量化为 K 个量化阶中第二量化阶的边界值, 所述 J与所述 K为大于 1且不相等的自然数。  The quantization module 501 of the example of FIG. 5 may also include a second quantization unit 701, such as the image data compression apparatus provided by another embodiment of the present invention as shown in FIG. The second quantization unit 701 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the J quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the K quantization steps. J and the K are natural numbers greater than one and not equal.
附图 7示例的图像数据压缩装置还可以包括第一判断模块 801或第二判断 模块 802, 如附图 8所示本发明另一实施例提供的图像数据压缩装置, 其中: 第一判断模块 801 , 用于判断图像块像素最小值被量化成的边界值对应的 二进制数右移一位后与所述图像块像素最大值被量化成的边界值对应的二进 制数是否相等。  The image data compression device illustrated in FIG. 7 may further include a first determining module 801 or a second determining module 802. As shown in FIG. 8, the image data compressing device according to another embodiment of the present invention, wherein: the first determining module 801 And determining whether a binary number corresponding to a boundary value corresponding to the image block pixel maximum value is shifted to the right by a binary number corresponding to a boundary value to which the image block pixel minimum value is quantized is equal to one another.
第二判断模块 802, 用于判断图像块像素最大值被量化成的边界值对应的 二进制数右移一位后与所述图像块像素最小值被量化成的边界值对应的二进 制数是否相等。  The second judging module 802 is configured to determine whether the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is shifted to the right by one bit, and whether the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized is equal.
若附图 8示例的第一判断模块 801判断图像块中像素最小值被量化成的边 界值对应的二进制数右移一位后与所述图像块像素最大值被量化成的边界值 对应的二进制数不相等, 则附图 8示例的编码模块 503可以包括第一判断单元 901、 第一编码单元 902和第二编码单元 903 , 如附图 9a所示本发明另一实施例 提供的图像数据压缩装置, 其中: If the first judging module 801 illustrated in FIG. 8 determines that the binary number corresponding to the boundary value in which the pixel minimum value is quantized in the image block is shifted right by one bit, and the boundary value of the image block pixel maximum value is quantized. The corresponding binary numbers are not equal, and the encoding module 503 illustrated in FIG. 8 may include a first determining unit 901, a first encoding unit 902, and a second encoding unit 903, as shown in FIG. 9a, which is provided by another embodiment of the present invention. Image data compression device, wherein:
第一判断单元 901 , 用于判断图像块像素最小值被量化成的边界值对应的 二进制数进行右移一位移除的是 "1" 还是 "0" ;  The first determining unit 901 is configured to determine whether the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized is shifted to the right by one bit to remove "1" or "0";
第一编码单元 902,用于若所述判断单元 901判断图像块像素最小值被量化 成的边界值对应的二进制数进行右移一位移除的是 "1" , 则对像素最小值被量 化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像素 最大值被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映射 所得量化阶编号进行编码并依次写入码流, 或者,对所述像素最大值被量化成 的边界值对应的量化阶编号、所述像素最 d、值被量化成的边界值的二进制数进 行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值映射所得 量化阶编号进行编码并依次写入码流;  The first encoding unit 902 is configured to: if the determining unit 901 determines that the binary number corresponding to the boundary value of the image block pixel minimum is quantized by right shifting one bit to remove "1", the pixel minimum value is quantized The quantized order number corresponding to the binary value of the obtained boundary value is shifted to the right by one bit, the quantization step number corresponding to the boundary value to which the pixel maximum value is quantized, and the quantization value of each pixel of the image block are quantized. The order number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the boundary value to which the pixel maximum value is quantized, the pixel maximum d, and the binary value of the boundary value to which the value is quantized are shifted to the right. a quantized order number corresponding to a post-value obtained and a quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream;
第二编码单元 903 ,用于若所述判断单元 901判断图像块像素最小值被量化 成的边界值对应的二进制数进行右移一位移除的是 "0" , 则对所述像素最大值 被量化成的边界值对应的量化阶编号、将像素最 d、值被量化成的边界值的二进 制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值映 射所得量化阶编号进行编码并依次写入码流, 或者,对像素最小值被量化成的 边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像素最大值 被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映射所得量 化阶编号进行编码并依次写入码流。  a second encoding unit 903, configured to: if the determining unit 901 determines that the binary number corresponding to the boundary value of the image block pixel minimum is quantized by right shifting one bit and removing "0", the maximum value of the pixel The quantized order number corresponding to the quantized boundary value, the quantized order number corresponding to the value obtained by right-shifting the binary number of the pixel d and the boundary value to which the value is quantized, and the value of each pixel of the image block The obtained quantization step number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the value obtained by right-shifting the binary number of the boundary value to which the pixel minimum value is quantized, and the pixel maximum value is quantized The quantization step number corresponding to the boundary value and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
若附图 8示例的第二判断模块 802判断图像块像素最大值被量化成的边界 值对应的二进制数右移一位后与所述图像块像素最小值被量化成的边界值对 应的二进制数不相等,则附图 8示例的编码模块 503可以包括第二判断单元 904、 第三编码单元 905和第四编码单元 906,如附图 9b所示本发明另一实施例提供的 图像数据压缩装置, 其中:  If the second judging module 802 illustrated in FIG. 8 determines that the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is shifted right by one bit, the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized is not The encoding module 503 illustrated in FIG. 8 may include a second determining unit 904, a third encoding unit 905, and a fourth encoding unit 906. As shown in FIG. 9b, an image data compression apparatus according to another embodiment of the present invention is provided. among them:
第二判断单元 904, 用于判断图像块像素最大值被量化成的边界值对应的 二进制数进行右移一位移除的是 "1" 还是 "0" ; 第三编码单元 905 ,用于若所述第二判断单元 904判断图像块像素最大值被 量化成的边界值对应的二进制数进行右移一位移除的是 "1" , 则对所述像素最 大值被量化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、 所述像素最小值被量化成的边界值对应的量化阶编号和所述图像块每个像素 的值映射所得量化阶编号进行编码并依次写入码流, 或者,对所述像素最小值 被量化成的边界值对应的量化阶编号、所述像素最大值被量化成的边界值的二 进制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值 映射所得量化阶编号进行编码并依次写入码流; The second determining unit 904 is configured to determine whether the binary number corresponding to the boundary value of the image block pixel maximum value is right-shifted by one bit to remove "1" or "0"; The third encoding unit 905 is configured to: if the second determining unit 904 determines that the binary number corresponding to the boundary value of the image block pixel maximum value is right shifted by one bit and is “1”, the pixel is a quantized order number corresponding to the binary value of the boundary value quantized by the maximum value, a quantized order number corresponding to the obtained value, a quantization step number corresponding to the boundary value to which the pixel minimum value is quantized, and each pixel of the image block The quantized order number obtained by the value mapping is encoded and sequentially written into the code stream, or the quantized order number corresponding to the boundary value to which the minimum value of the pixel is quantized, and the binary number of the boundary value to which the maximum value of the pixel is quantized is performed. The quantized order number corresponding to the value obtained by shifting one bit to the right and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream;
第四编码单元 906,用于若所述第二判断单元 904判断图像块像素最大值被 量化成的边界值对应的二进制数进行右移一位移除的是 "0" , 则对所述像素 最 d、值被量化成的边界值对应的量化阶编号、将像素最大值被量化成的边界值 的二进制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素 的值映射所得量化阶编号进行编码并依次写入码流, 或者,对像素最大值被量 化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像素 最小值被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映射 所得量化阶编号进行编码并依次写入码流。  The fourth encoding unit 906 is configured to: if the second determining unit 904 determines that the binary number corresponding to the boundary value of the image block pixel maximum value is right shifted by one bit and is "0", then the pixel is The quantization step number corresponding to the boundary value corresponding to the most d, the value to which the value is quantized, the quantization step number corresponding to the value obtained by shifting the binary value of the boundary value to which the pixel maximum value is quantized to the right, and each pixel of the image block The value of the obtained quantized order number is encoded and sequentially written into the code stream, or the quantized order number corresponding to the obtained value of the binary number of the boundary value to which the pixel maximum value is quantized is shifted to the right, and the pixel minimum value The quantized order number corresponding to the quantized boundary value and the quantized order number obtained by mapping the value of each pixel of the image block are encoded and sequentially written into the code stream.
若附图 8示例的第一判断模块 801判断图像块中像素最小值被量化成的边 界值对应的二进制数右移一位后与所述图像块像素最大值被量化成的边界值 对应的二进制数相等, 或者, 第二判断模块 802判断图像块像素最大值被量化 成的边界值对应的二进制数右移一位后与所述图像块像素最小值被量化成的 边界值对应的二进制数相等,则附图 8示例的量化模块 501可以包括第一量化单 元 601 , 如附图 9c所示本发明另一实施例提供的图像数据压缩装置。 第一量化 单元 601用于将图像块像素最小值量化为 M个量化阶中第一量化阶的边界值, 将图像块像素最大值量化为所述 M个量化阶中第二量化阶的边界值, 所述 M为 大于 1的自然数。  If the first judging module 801 illustrated in FIG. 8 determines that the binary number corresponding to the boundary value in which the pixel minimum value is quantized in the image block is shifted right by one bit, the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is determined. Or, the second determining module 802 determines that the binary number corresponding to the boundary value to which the image block pixel maximum value is quantized is shifted to the right by one bit, and is equal to the binary number corresponding to the boundary value to which the image block pixel minimum value is quantized. The quantization module 501 illustrated in FIG. 8 may include a first quantization unit 601, such as the image data compression device provided by another embodiment of the present invention, as shown in FIG. 9c. The first quantization unit 601 is configured to quantize the image block pixel minimum value into a boundary value of the first quantization step of the M quantization steps, and quantize the image block pixel maximum value into a boundary value of the second quantization step of the M quantization steps. The M is a natural number greater than one.
请参阅附图 10, 是本发明实施例提供的图像数据解压缩装置结构示意图。 为了便于说明, 仅仅示出了与本发明实施例相关的部分。 附图 10示例的图像 数据解压缩装置包括解码模块 1001、 获取模块 1002和重构模块 1003, 其中: 解码模块 1001 ,用于根据码流中图像块像素最小值和像素最大值对应的量 化阶编号,解码得到图像块像素最小值和像素最大值分別对应的第一量化值和 第二量化值。 FIG. 10 is a schematic structural diagram of an image data decompressing apparatus according to an embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown. The image of the example of Figure 10 The data decompression device includes a decoding module 1001, an obtaining module 1002, and a reconstruction module 1003, where: the decoding module 1001 is configured to decode the image block pixel according to the image block pixel minimum value and the pixel maximum value corresponding to the quantization step number in the code stream. The first quantized value and the second quantized value respectively correspond to the minimum value and the pixel maximum value.
获取模块 1002,用于根据码流中图像块每个像素的值映射为第三量化阶的 量化阶编号时所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一 量化值和第二量化值为端值的量化区间被均勾划分的若干所述第三量化阶,具 体方法与附图 4b及其对应的文字说明类似, 不做赘述。  The obtaining module 1002 is configured to obtain, according to the quantization step, the first quantization value, and the second quantization value, when the value of each pixel of the image block in the code stream is mapped to the quantization step number of the third quantization step, A quantized value and a quantized interval of the second quantized value are equally divided into a plurality of the third quantized steps. The specific method is similar to the description of FIG. 4b and its corresponding text, and is not described herein.
重构模块 1003,用于根据码流中图像块每个像素的值映射为第三量化阶的 量化阶编号和所述每一第三量化阶的边界值,重构所述图像块每个像素以获取 所述图像块每个像素的值。  The reconstruction module 1003 is configured to reconstruct, according to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, a value of each pixel of the image block in the code stream, and reconstruct each pixel of the image block. To obtain the value of each pixel of the image block.
需要说明的是, 以上图像数据解压缩装置的实施方式中,各功能模块的划 分仅是举例说明, 实际应用中可以根据需要, 例如相应硬件的配置要求或者软 件的实现的便利考虑, 而将上述功能分配由不同的功能模块完成, 即将所述图 像数据解压缩装置的内部结构划分成不同的功能模块,以完成以上描述的全部 或者部分功能。 而且, 实际应用中, 本实施例中的相应的功能模块可以是由相 应的硬件实现, 也可以由相应的硬件执行相应的软件完成, 例如, 前述的解码 模块,可以是具有执行前述根据码流中图像块像素最小值和像素最大值对应的 量化阶编号,解码得到图像块像素最 d、值和像素最大值分別对应的第一量化值 和第二量化值的硬件, 例如解码器,也可以是能够执行相应计算机程序从而完 成前述功能的一般处理器或者其他硬件设备; 再如前述的获取模块, 可以是具 有执行前述根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号 时所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第 二量化值为端值的量化区间被均匀划分的若干所述第三量化阶功能的硬件,例 如获取器,也可以是能够执行相应计算机程序从而完成前述功能的一般处理器 或者其他硬件设备(本说明书提供的各个实施例都可应用上述描述原则)。  It should be noted that, in the implementation of the above image data decompressing apparatus, the division of each functional module is merely an example. In actual applications, the above may be considered according to requirements, such as configuration requirements of corresponding hardware or convenience of implementation of software. The function assignment is performed by different functional modules, that is, the internal structure of the image data decompressing device is divided into different functional modules to perform all or part of the functions described above. Moreover, in practical applications, the corresponding functional modules in this embodiment may be implemented by corresponding hardware, or may be executed by corresponding hardware. For example, the foregoing decoding module may have the foregoing code stream. The quantization step number corresponding to the pixel minimum value of the image block and the maximum value of the pixel, and hardware for decoding the first quantization value and the second quantization value corresponding to the maximum d, the value, and the maximum pixel value of the image block, for example, a decoder, may also be used. A general processor or other hardware device capable of executing a corresponding computer program to perform the foregoing functions; and the obtaining module as described above may be configured to perform quantization to map the value of each pixel of the image block in the code stream to the third quantization step. Obtaining, by the first quantization value, the first quantization value and the second quantization value, the number of the third quantization steps uniformly divided by the quantization interval of the first quantization value and the second quantization value end value Functional hardware, such as an acquirer, can also be capable of executing a corresponding computer program to perform the aforementioned functions A general processor or other hardware device (embodiment of the present disclosure provides various embodiments of the principles described above can be applied).
附图 10示例的重构模块 1003可以包括第一取值单元 1101或第二取值单元 1102, 如附图 11所示本发明另一实施例提供的图像数据解压缩装置, 其中: 第一取值单元 1101 ,用于取每一个量化阶编号所对应第三量化阶的两个边 界值,对所述两个边界值的平均值取整, 以取整所得的值作为所述每一个量化 阶编号所对应像素的值; The reconstruction module 1003 illustrated in FIG. 10 may include a first value unit 1101 or a second value unit 1102. As shown in FIG. 11, another embodiment of the present invention provides an image data decompressing apparatus, wherein: The first value unit 1101 is configured to take two boundary values of the third quantization step corresponding to each quantization step number, and round the average value of the two boundary values to round the obtained value as the a value of a pixel corresponding to the quantized order number;
第二取值单元 1102 ,用于取每一个量化阶编号所对应第三量化阶的左边界 值或右边界值作为所述每一个量化阶编号所对应像素的值。  The second value unit 1102 is configured to take a left boundary value or a right boundary value of the third quantization step corresponding to each quantization step number as a value of a pixel corresponding to each of the quantization step numbers.
附图 11示例的图像数据解压缩装置还可以包括判断模块 1201、第一补位模 块 1202和第二补位模块 1203, 获取模块 1002可以包括第一获取单元 1204,如附 图 12a所示本发明另一实施例提供的图像数据解压缩装置, 其中:  The image data decompressing apparatus illustrated in FIG. 11 may further include a determining module 1201, a first complementing module 1202 and a second complementing module 1203, and the obtaining module 1002 may include a first obtaining unit 1204, as shown in FIG. 12a. Another embodiment provides an image data decompressing apparatus, wherein:
判断模块 1201 , 用于判断所述第一量化值和第二量化值是否相等。  The determining module 1201 is configured to determine whether the first quantized value and the second quantized value are equal.
第一补位模块 1202,用于若先收到码流中图像块像素最小值对应的量化阶 编号后收到码流中图像块像素最大值对应的量化阶编号并且所述判断模块 1201判断所述第一量化值和第二量化值不相等时,将所述第一量化值对应的二 进制数左移一位并且在末位补 "1"。  The first complement module 1202 is configured to first receive the quantization step number corresponding to the maximum value of the image block pixel in the code stream after receiving the quantization step number corresponding to the minimum value of the image block pixel in the code stream, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the first quantized value is shifted left by one bit and complemented by "1" at the last bit.
第二补位模块 1203,用于若先收到码流中图像块像素最大值对应的量化阶 编号后收到码流中图像块像素最小值对应的量化阶编号并且并且所述判断模 块 1201判断所述第一量化值和第二量化值不相等时,将所述第一量化值对应的 二进制数左移一位并且在末位补 "0"。  The second complement module 1203 is configured to: if the quantization step number corresponding to the maximum value of the image block pixel in the code stream is received, the quantization step number corresponding to the image block pixel minimum value in the received code stream is received, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the first quantized value is shifted to the left by one bit and the last bit is complemented by "0".
第一获取单元 1204,用于根据码流中图像块每个像素的值映射为第三量化 阶的量化阶编号时所用量化阶次、所述第二量化值和所述第一量化值对应的二 进制数左移一位并且在末位补 "0" 或 "1"后对应的十进制数, 获取以所述所 述第一量化值对应的二进制数左移一位并且在末位补 "0" 或 "1"后对应的十 进制数和第二量化值为端值的量化区间被均勾划分的若干所述第三量化阶,具 体方法与附图 4b及其对应的文字说明类似, 不做赘述。  The first obtaining unit 1204 is configured to: according to the quantization order used by the value of each pixel of the image block in the code stream to be the quantization step number of the third quantization step, the second quantization value, and the first quantization value The binary number is shifted to the left by one bit and the corresponding decimal number is complemented by "0" or "1" at the last bit, and the binary number corresponding to the first quantized value is shifted to the left by one bit and the last bit is "0". Or the corresponding decimal number after the "1" and the second quantized value of the second quantized value are equally divided into a plurality of the third quantization steps, and the specific method is similar to the description of FIG. 4b and its corresponding text, and is not described herein. .
附图 11示例的图像数据解压缩装置还可以包括判断模块 1201、第三补位模 块 1205和第四补位模块 1206, 获取模块 1002可以包括第二获取单元 1207,如附 图 12b所示本发明另一实施例提供的图像数据解压缩装置, 其中:  The image data decompressing apparatus illustrated in FIG. 11 may further include a determining module 1201, a third complementing module 1205, and a fourth complementing module 1206. The obtaining module 1002 may include a second acquiring unit 1207, as shown in FIG. 12b. Another embodiment provides an image data decompressing apparatus, wherein:
第三补位模块 1205,用于若先收到码流中图像块像素最大值对应的量化阶 编号后收到码流中图像块像素最小值对应的量化阶编号并且所述判断模块 1201判断所述第一量化值和第二量化值不相等时,将所述第二量化值对应的二 进制数左移一位并且在末位补 "1" ; The third complement module 1205 is configured to: if the quantization step number corresponding to the maximum value of the image block pixel in the code stream is received, the quantization step number corresponding to the image block pixel minimum value in the received code stream is received, and the determining module is 1201 determines that the first quantized value and the second quantized value are not equal, shifting the binary number corresponding to the second quantized value to the left by one bit and complementing "1" at the last bit;
第四补位模块 1206,用于若先收到码流中图像块像素最小值对应的量化阶 编号后收到码流中图像块像素最大值对应的量化阶编号并且并且所述判断模 块 1201判断所述第一量化值和第二量化值不相等时,将所述第二量化值对应的 二进制数左移一位并且在末位补 "0" ;  The fourth complement module 1206 is configured to first receive the quantization step number corresponding to the maximum value of the image block pixel in the code stream after receiving the quantization step number corresponding to the minimum value of the image block pixel in the code stream, and the determining module 1201 determines When the first quantized value and the second quantized value are not equal, the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is complemented by "0";
第二获取单元 1207,用于根据码流中图像块每个像素的值映射为第三量化 阶的量化阶编号时所用量化阶次、所述第一量化值和所述第二量化值对应的二 进制数左移一位并且在末位补 "0" 或 "1"后对应的十进制数, 获取以所述第 二量化值对应的二进制数左移一位并且在末位补 "0"或 "1"后对应的十进制 数和第一量化值为端值的量化区间被均匀划分的若干所述第三量化阶,具体方 法与附图 4b及其对应的文字说明类似, 不做赘述。  a second obtaining unit 1207, configured to: according to the quantization order used by the value of each pixel of the image block in the code stream to be the quantization step number of the third quantization step, the first quantization value and the second quantization value The binary number is shifted to the left by one bit and the corresponding decimal number is complemented by "0" or "1" at the last bit, and the binary number corresponding to the second quantized value is shifted to the left by one bit and the last bit is "0" or " 1" after the corresponding decimal number and the first quantized value of the end value of the quantized interval are evenly divided into a plurality of said third quantization step, the specific method is similar to FIG. 4b and its corresponding text description, and will not be described again.
需要说明的是, 上述装置各模块 /单元之间的信息交互、 执行过程等内容, 由于与本发明方法实施例基于同一构思,其带来的技术效果与本发明方法实施 例相同, 具体内容可参见本发明方法实施例中的叙述, 此处不再赘述。  It should be noted that the information interaction, the execution process, and the like between the modules/units of the foregoing device are the same as the embodiment of the method of the present invention. Reference is made to the description in the method embodiment of the present invention, and details are not described herein again.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,比如以下各种方法的一种或多种 或全部:  One of ordinary skill in the art will appreciate that all or a portion of the various methods of the above-described embodiments can be performed by a program to instruct the associated hardware, such as one or more or all of the following various methods:
方法一:将图像块像素最小值和像素最大值分別量化为第一量化值和第二 量化值,所述像素最 d、值和像素最大值分別对应于第一量化阶的量化阶编号和 第二量化阶的量化阶编号;将所述图像块每个像素的值映射为第三量化阶的量 化阶编号,所述第三量化阶是以所述第一量化值和第二量化值为端值的量化区 间被均勾划分的若干量化阶中一个量化阶;对所述像素最小值对应的第一量化 阶的量化阶编号、所述像素最大值对应的第二量化阶的量化阶编号和所述图像 块每个像素的值映射所得量化阶编号进行编码并写入码流。  Method 1: quantizing the image block pixel minimum value and the pixel maximum value into a first quantization value and a second quantization value, respectively, wherein the pixel maximum d, value, and pixel maximum value respectively correspond to the quantization step number of the first quantization step and the first a quantization step number of the quantization step; mapping a value of each pixel of the image block to a quantization step number of a third quantization step, wherein the third quantization step is the first quantization value and the second quantization value end a quantization step of the quantization interval of the value is a quantization step of the first quantization step corresponding to the minimum value of the pixel, and a quantization step number of the second quantization step corresponding to the maximum value of the pixel The quantized order number of each pixel of the image block is encoded and encoded into the code stream.
方法二: 根据码流中图像块像素最小值和像素最大值对应的量化阶编号, 解码得到图像块像素最小值和像素最大值分別对应的第一量化值和第二量化 值;根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所用量 化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第二量化值 为端值的量化区间被均匀划分的若干所述第三量化阶;根据码流中图像块每个 像素的值映射为第三量化阶的量化阶编号和所述每一第三量化阶的边界值,重 构所述图像块每个像素以获取所述图像块每个像素的值。 Method 2: Decoding, according to the pixel minimum value of the image block and the quantization step number corresponding to the pixel maximum value, the first quantized value and the second quantized value respectively corresponding to the image block pixel minimum value and the pixel maximum value; according to the code stream The amount of each pixel of the image block is mapped to the quantized order number of the third quantization step. Encoding the first quantization value and the second quantization value, acquiring a plurality of the third quantization steps uniformly divided by the quantization interval of the first quantization value and the second quantization value end value; according to the code stream The value of each pixel of the middle image block is mapped to the quantization step number of the third quantization step and the boundary value of each of the third quantization steps, and each pixel of the image block is reconstructed to obtain each pixel of the image block. value.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读 存储介质中, 存储介质可以包括: 只读存储器( ROM, Read Only Memory ) 、 随机存取存储器(RAM, Random Access Memory ) 、 磁盘或光盘等。  A person skilled in the art may understand that all or part of the various steps of the foregoing embodiments may be completed by a program instructing related hardware. The program may be stored in a computer readable storage medium, and the storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.
以上对本发明实施例提供的一种图像数据压缩和解压缩方法、装置进行了 上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时,对于本 领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会 有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制。  The above description of the image data compression and decompression method and apparatus provided by the embodiments of the present invention is only for assisting in understanding the method of the present invention and its core ideas. Meanwhile, for those skilled in the art, according to the present invention, The present invention is not limited by the scope of the present invention.

Claims

权 利 要 求 Rights request
1、 一种图像数据压缩方法, 其特征在于, 所述方法包括: 1. An image data compression method, characterized in that the method includes:
将图像块像素最 d、值和像素最大值分別量化为第一量化值和第二量化值, 所述像素最小值和像素最大值分別对应于第一量化阶的量化阶编号和第二量 化阶的量化阶编号; The pixel minimum value and the pixel maximum value of the image block are respectively quantized into a first quantization value and a second quantization value. The pixel minimum value and the pixel maximum value respectively correspond to the quantization stage number of the first quantization stage and the second quantization stage. The quantization stage number;
将所述图像块每个像素的值映射为第三量化阶的量化阶编号,所述第三量 化阶是以所述第一量化值和第二量化值为端值的量化区间被均勾划分的若干 量化阶中一个量化阶; The value of each pixel of the image block is mapped to a quantization stage number of a third quantization stage. The third quantization stage is evenly divided by a quantization interval with the first quantization value and the second quantization value as end values. One quantization order among several quantization orders;
对所述像素最小值对应的第一量化阶的量化阶编号、所述像素最大值对应 的第二量化阶的量化阶编号和所述图像块每个像素的值映射所得量化阶编号 进行编码并写入码流。 The quantization step number of the first quantization step corresponding to the minimum value of the pixel, the quantization step number of the second quantization step corresponding to the maximum value of the pixel, and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and Write code stream.
2、 如权利要求 1所述的方法, 其特征在于, 所述将图像块像素最小值和像 素最大值分別量化为第一量化值和第二量化值包括: 2. The method of claim 1, wherein quantizing the minimum pixel value and the maximum pixel value of the image block into a first quantized value and a second quantized value respectively includes:
将图像块像素最 d、值量化为 M个量化阶中第一量化阶的边界值,将图像块 像素最大值量化为所述 M个量化阶中第二量化阶的边界值, 所述 M为大于 1的 自然数。 The maximum pixel value of the image block is quantized to the boundary value of the first quantization stage among the M quantization stages, and the maximum pixel value of the image block is quantized to the boundary value of the second quantization stage among the M quantization stages, and M is A natural number greater than 1.
3、 如权利要求 1所述的方法, 其特征在于, 所述将图像块像素最小值和像 素最大值分別量化为第一量化值和第二量化值包括: 3. The method of claim 1, wherein quantizing the minimum pixel value and the maximum pixel value of the image block into a first quantized value and a second quantized value respectively includes:
将图像块像素最小值量化为 J个量化阶中第一量化阶的边界值, 将图像块 像素最大值量化为 K个量化阶中第二量化阶的边界值, 所述 J与所述 K为大于 1 且不相等的自然数。 The minimum pixel value of the image block is quantized to the boundary value of the first quantization stage among J quantization stages, and the maximum pixel value of the image block is quantized to the boundary value of the second quantization stage among K quantization stages. The J and K are Natural numbers greater than 1 and not equal.
4、 如权利要求 3所述的方法, 其特征在于, 所述将所述图像块每个像素的 值映射为第三量化阶的量化阶编号之前还包括: 4. The method of claim 3, wherein before mapping the value of each pixel of the image block to the quantization stage number of the third quantization stage, the step further includes:
判断图像块像素最小值被量化成的边界值对应的二进制数右移一位后与 所述图像块像素最大值被量化成的边界值对应的二进制数是否相等; 或者 Determine whether the binary number corresponding to the boundary value into which the minimum value of the pixel of the image block is quantized is shifted one bit to the right and whether the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is equal; or
判断图像块像素最大值被量化成的边界值对应的二进制数右移一位后与 所述图像块像素最 d、值被量化成的边界值对应的二进制数是否相等。 Determine whether the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted by one bit to the right and whether it is equal to the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized.
5、 如权利要求 4所述的方法, 其特征在于, 若判断图像块中像素最小值被 量化成的边界值对应的二进制数右移一位后与所述图像块像素最大值被量化 成的边界值对应的二进制数不相等,则所述将所述像素最小值对应的第一量化 阶的量化阶编号、所述像素最大值对应的第二量化阶的量化阶编号和所述图像 块每个像素的值映射所得量化阶编号写入码流包括:判断图像块像素最 d、值被 量化成的边界值对应的二进制数进行右移一位移除的是 "1" 还是 "0" ; 若图 像块像素最小值被量化成的边界值对应的二进制数进行右移一位移除的是 "1" ,则对所述像素最小值被量化成的边界值的二进制数进行右移一位后所得 值对应的量化阶编号、所述像素最大值被量化成的边界值对应的量化阶编号和 所述图像块每个像素的值映射所得量化阶编号进行编码并依次写入码流, 或 者,对所述像素最大值被量化成的边界值对应的量化阶编号、所述像素最小值 被量化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号和所 述图像块每个像素的值映射所得量化阶编号进行编码并依次写入码流;若图像 块像素最小值被量化成的边界值对应的二进制数进行右移一位移除的是 "0" , 则对所述像素最大值被量化成的边界值对应的量化阶编号、将像素最 d、值被量 化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号和所述图 像块每个像素的值映射所得量化阶编号进行编码并依次写入码流, 或者,对像 素最小值被量化成的边界值的二进制数进行右移一位后所得值对应的量化阶 编号、所述像素最大值被量化成的边界值对应的量化阶编号和所述图像块每个 像素的值映射所得量化阶编号进行编码并依次写入码流; 5. The method according to claim 4, characterized in that if it is determined that the minimum value of the pixel in the image block is If the binary number corresponding to the quantized boundary value is shifted one bit to the right and is not equal to the binary number corresponding to the boundary value quantized to the maximum pixel value of the image block, then the first quantization step corresponding to the minimum pixel value is The quantization stage number, the quantization stage number of the second quantization stage corresponding to the maximum value of the pixel, and the quantization stage number mapped to the value of each pixel of the image block are written into the code stream, including: judging the maximum pixel of the image block, the value being The binary number corresponding to the quantized boundary value is shifted to the right by one bit to remove "1" or "0"; if the minimum value of the image block pixel is quantized to the binary number corresponding to the boundary value, the binary number corresponding to the boundary value is shifted to the right and removed by one bit. is "1", then the binary number of the boundary value into which the minimum value of the pixel is quantized is right-shifted by one bit, the quantization order number corresponding to the value obtained, and the quantization order corresponding to the boundary value into which the maximum value of the pixel is quantized. The quantization order number obtained by mapping the number and the value of each pixel of the image block is encoded and written into the code stream sequentially, or the quantization order number corresponding to the boundary value from which the maximum value of the pixel is quantized, and the minimum value of the pixel The binary number of the quantized boundary value is shifted right by one bit and the quantization order number corresponding to the value is mapped to the value of each pixel of the image block. The resulting quantization order number is encoded and written into the code stream in sequence; if the image block pixel The binary number corresponding to the boundary value into which the minimum value is quantized is shifted to the right by one bit and "0" is removed. Then, for the quantization order number corresponding to the boundary value into which the maximum value of the pixel is quantized, the maximum value of the pixel is The binary number of the quantized boundary value is right-shifted by one bit and the quantization order number corresponding to the value is mapped to the value of each pixel of the image block. The resulting quantization order number is encoded and written into the code stream in sequence, or the pixels are The quantization order number corresponding to the binary number of the boundary value into which the minimum value is quantized is right-shifted by one bit, the quantization order number corresponding to the boundary value into which the maximum value of the pixel is quantized, and the quantization order number of each pixel of the image block. The quantization order numbers obtained by value mapping are encoded and written into the code stream in sequence;
若判断图像块像素最大值被量化成的边界值对应的二进制数右移一位后 与所述图像块像素最 d、值被量化成的边界值对应的二进制数不相等,则所述将 所述像素最 d、值对应的第一量化阶的量化阶编号、所述像素最大值对应的第二 量化阶的量化阶编号和所述图像块每个像素的值映射所得量化阶编号写入码 流包括:判断图像块像素最大值被量化成的边界值对应的二进制数进行右移一 位移除的是 "1" 还是 "0" ; 若图像块像素最大值被量化成的边界值对应的二 进制数进行右移一位移除的是 "1" , 则对所述像素最大值被量化成的边界值的 二进制数进行右移一位后所得值对应的量化阶编号、所述像素最小值被量化成 的边界值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号 进行编码并依次写入码流, 或者,对所述像素最小值被量化成的边界值对应的 量化阶编号、所述像素最大值被量化成的边界值的二进制数进行右移一位后所 得值对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行 编码并依次写入码流;若图像块像素最大值被量化成的边界值对应的二进制数 进行右移一位移除的是 "0" , 则对所述像素最小值被量化成的边界值对应的量 化阶编号、将像素最大值被量化成的边界值的二进制数进行右移一位后所得值 对应的量化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码 并依次写入码流, 或者,对像素最大值被量化成的边界值的二进制数进行右移 一位后所得值对应的量化阶编号、所述像素最 d、值被量化成的边界值对应的量 化阶编号和所述图像块每个像素的值映射所得量化阶编号进行编码并依次写 入码流。 If it is determined that the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted one bit to the right and the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is not equal to the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized, then the The quantization step number of the first quantization step corresponding to the maximum value of the pixel, the quantization step number of the second quantization step corresponding to the maximum value of the pixel, and the quantization step number obtained by mapping the value of each pixel of the image block are written into the code. The stream includes: Determine whether the binary number corresponding to the boundary value that the maximum pixel value of the image block is quantized into is shifted to the right by one bit and removes "1" or "0"; if the maximum pixel value of the image block is quantized into the boundary value corresponding to If the binary number is shifted to the right by one bit and "1" is removed, then the binary number of the boundary value to which the maximum value of the pixel is quantized is shifted to the right by one bit and the resulting value corresponds to the quantization level number and the minimum value of the pixel. The quantization order number corresponding to the quantized boundary value and the value of each pixel of the image block are mapped to the quantization order number. Encode and write into the code stream sequentially, or right-shift one bit of the binary number of the quantization step number corresponding to the boundary value into which the minimum value of the pixel is quantized, and the boundary value into which the maximum value of the pixel is quantized. The quantization order number corresponding to the value and the value of each pixel of the image block are mapped to the quantization order number, which is encoded and written into the code stream sequentially; if the maximum value of the pixel of the image block is quantized into a boundary value, the binary number corresponding to the boundary value is shifted right by one If the bit removed is "0", then the quantization step number corresponding to the boundary value into which the minimum value of the pixel is quantized, and the binary number of the boundary value into which the maximum value of the pixel is quantized are right-shifted by one bit, corresponding to The quantization level number obtained by mapping the quantization level number and the value of each pixel of the image block is encoded and written into the code stream sequentially, or the binary number of the boundary value into which the maximum value of the pixel is quantized is right-shifted by one bit. The quantization step number corresponding to the value, the maximum d of the pixel, the quantization step number corresponding to the boundary value into which the value is quantized, and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written into the code stream in sequence.
6、 如权利要求 4所述的方法, 其特征在于, 若判断图像块中像素最小值被 量化成的边界值对应的二进制数右移一位后与所述图像块像素最大值被量化 成的边界值对应的二进制数相等,或者判断图像块像素最大值被量化成的边界 值对应的二进制数右移一位后与所述图像块像素最小值被量化成的边界值对 应的二进制数相等,则所述将图像块像素最小值和像素最大值分別量化为第一 量化值和第二量化值包括: 6. The method according to claim 4, characterized in that, if it is determined that the binary number corresponding to the boundary value into which the minimum value of the pixel in the image block is quantized is shifted one bit to the right and the binary number corresponding to the boundary value into which the maximum pixel value in the image block is quantized is The binary numbers corresponding to the boundary values are equal, or it is determined that the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted one bit to the right and is equal to the binary number corresponding to the boundary value into which the minimum pixel value of the image block is quantized, Then, quantizing the minimum pixel value and the maximum pixel value of the image block into the first quantization value and the second quantization value respectively includes:
将图像块像素最 d、值量化为 M个量化阶中第一量化阶的边界值,将图像块 像素最大值量化为所述 M个量化阶中第二量化阶的边界值, 所述 M为大于 1的 自然数。 The maximum pixel value of the image block is quantized to the boundary value of the first quantization stage among the M quantization stages, and the maximum pixel value of the image block is quantized to the boundary value of the second quantization stage among the M quantization stages, and M is A natural number greater than 1.
7、 一种图像数据解压缩方法, 其特征在于, 所述方法包括: 7. An image data decompression method, characterized in that the method includes:
根据码流中图像块像素最小值和像素最大值对应的量化阶编号,解码得到 图像块像素最 d、值和像素最大值分別对应的第一量化值和第二量化值; According to the quantization order number corresponding to the minimum pixel value and the maximum pixel value of the image block in the code stream, the first quantization value and the second quantization value corresponding to the maximum pixel value and the maximum pixel value of the image block are obtained by decoding;
根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所用 量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第二量化 值为端值的量化区间被均匀划分的若干所述第三量化阶; According to the quantization order used when the value of each pixel of the image block in the code stream is mapped to the quantization stage number of the third quantization stage, the first quantization value and the second quantization value, the first quantization value and the second quantization value are obtained. A number of the third quantization steps in which the quantization interval whose quantization value is the end value is evenly divided;
根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号和所述 每一第三量化阶的边界值,重构所述图像块每个像素以获取所述图像块每个像 素的值。 According to the quantization stage number of the third quantization stage mapped to the value of each pixel of the image block in the code stream and the boundary value of each third quantization stage, reconstruct each pixel of the image block to obtain each pixel of the image block. image prime value.
8、 如权利要求 7所述的方法, 其特征在于, 所述根据码流中图像块每个像 素的值映射为第三量化阶的量化阶编号和所述每一第三量化阶的边界值,重构 所述图像块每个像素以获取所述图像块每个像素的值包括: 8. The method of claim 7, wherein the value of each pixel of the image block in the code stream is mapped to the quantization stage number of the third quantization stage and the boundary value of each third quantization stage. , reconstructing each pixel of the image block to obtain the value of each pixel of the image block includes:
取每一个量化阶编号所对应第三量化阶的两个边界值,对所述两个边界值 的平均值取整, 以取整所得的值作为所述每一个量化阶编号所对应像素的值; 或者 Take the two boundary values of the third quantization level corresponding to each quantization level number, round the average of the two boundary values, and use the rounded value as the value of the pixel corresponding to each quantization level number. ; or
取每一个量化阶编号所对应第三量化阶的左边界值或右边界值作为所述 每一个量化阶编号所对应像素的值。 The left boundary value or the right boundary value of the third quantization level corresponding to each quantization level number is taken as the value of the pixel corresponding to each quantization level number.
9、 如权利要求 7所述的方法, 其特征在于, 所述根据码流中图像块每个像 素的值映射为第三量化阶的量化阶编号时所用量化阶次、所述第一量化值和第 二量化值,获取以所述第一量化值和第二量化值为端值的量化区间被均匀划分 的若干所述第三量化阶之前包括: 判断所述第一量化值和第二量化值是否相 等;若所述第一量化值和第二量化值不相等并且先收到码流中图像块像素最小 值对应的量化阶编号后收到码流中图像块像素最大值对应的量化阶编号,则将 所述第一量化值对应的二进制数左移一位并且在末位补 "1" , 若所述第一量化 值和第二量化值不相等并且先收到码流中图像块像素最大值对应的量化阶编 号后收到码流中图像块像素最小值对应的量化阶编号,则将所述第一量化值对 应的二进制数左移一位并且在末位补 "0" ; 或者 9. The method of claim 7, wherein the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the first quantization value and a second quantization value. Obtaining several third quantization steps evenly divided into quantization intervals with the first quantization value and the second quantization value as end values includes: judging the first quantization value and the second quantization value. Whether the values are equal; if the first quantized value and the second quantized value are not equal and the quantization order number corresponding to the minimum value of the image block pixel in the code stream is received first, and then the quantization order corresponding to the maximum value of the image block pixel in the code stream is received number, then shift the binary number corresponding to the first quantized value to the left by one bit and add "1" to the last bit. If the first quantized value and the second quantized value are not equal and the image block in the code stream is received first After receiving the quantization stage number corresponding to the maximum pixel value in the code stream and receiving the quantization stage number corresponding to the minimum pixel value of the image block in the code stream, the binary number corresponding to the first quantized value is shifted to the left by one bit and "0" is added to the last bit; or
所述根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时 所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第二 量化值为端值的量化区间被均匀划分的若干所述第三量化阶之前包括:判断所 述第一量化值和第二量化值是否相等;若所述第一量化值和第二量化值不相等 并且先收到码流中图像块像素最大值对应的量化阶编号后收到码流中图像块 像素最小值对应的量化阶编号,则将所述第二量化值对应的二进制数左移一位 并且在末位补 "1" , 若所述第一量化值和第二量化值不相等并且先收到码流中 图像块像素最小值对应的量化阶编号后收到码流中图像块像素最大值对应的 量化阶编号,则将所述第二量化值对应的二进制数左移一位并且在末位补" 0" ; 所述根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时 所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化值和第二 量化值为端值的量化区间被均匀划分的若干所述第三量化阶包括: According to the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the first quantization value and the second quantization value, obtain the first quantization value and The process of several third quantization stages in which the quantization interval with the second quantization value as the end value is evenly divided includes: judging whether the first quantization value and the second quantization value are equal; if the first quantization value and the second quantization value are equal, The values are not equal and the quantization order number corresponding to the maximum pixel value of the image block in the code stream is first received and then the quantization order number corresponding to the minimum pixel value of the image block in the code stream is received, then the binary number corresponding to the second quantization value is left Shift one bit and add "1" to the last bit. If the first quantized value and the second quantized value are not equal and the quantization order number corresponding to the minimum pixel value of the image block in the code stream is received first and then the image in the code stream is received The quantization level number corresponding to the maximum value of the block pixel, then shift the binary number corresponding to the second quantization value to the left by one bit and fill in the last bit with "0"; According to the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the first quantization value and the second quantization value, obtain the first quantization value and The plurality of third quantization steps in which the quantization interval with the second quantization value as the end value is evenly divided includes:
根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所用 量化阶次、所述第二量化值和所述第一量化值对应的二进制数左移一位并且在 末位补 "0" 或 "1"后对应的十进制数, 获取以所述第一量化值对应的二进制 数左移一位并且在末位补 "0" 或 "1"后对应的十进制数和第二量化值为端值 的量化区间被均勾划分的若干所述第三量化阶; 或者 According to the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the binary number corresponding to the second quantization value and the first quantization value is left shifted by one bit and The corresponding decimal number after the last digit is supplemented with "0" or "1", and the binary number corresponding to the first quantized value is shifted to the left by one position and the corresponding decimal number is obtained after the last digit is supplemented with "0" or "1". The second quantization value is a plurality of the third quantization steps whose quantization interval is evenly divided into end values; or
根据码流中图像块每个像素的值映射为第三量化阶的量化阶编号时所用 量化阶次、所述第一量化值和所述第二量化值对应的二进制数左移一位并且在 末位补 "0" 或 "1"后对应的十进制数, 获取以所述第二量化值对应的二进制 数左移一位并且在末位补 "0" 或 "1"后对应的十进制数和第一量化值为端值 的量化区间被均匀划分的若干所述第三量化阶。 According to the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the binary number corresponding to the first quantization value and the second quantization value is left shifted by one bit and The corresponding decimal number after the last digit is supplemented with "0" or "1", and the binary number corresponding to the second quantized value is shifted to the left by one position and the corresponding decimal number is obtained after the last digit is supplemented by "0" or "1". The first quantization value is a plurality of the third quantization steps in which the quantization interval of the end value is evenly divided.
10、 一种图像数据压缩装置, 其特征在于, 所述装置包括: 10. An image data compression device, characterized in that the device includes:
量化模块,用于将图像块像素最小值和像素最大值分別量化为第一量化值 和第二量化值,所述像素最小值和像素最大值分別对应于第一量化阶的量化阶 编号和第二量化阶的量化阶编号; A quantization module, configured to quantize the minimum pixel value and the maximum pixel value of the image block into a first quantization value and a second quantization value respectively. The minimum pixel value and the maximum pixel value respectively correspond to the quantization stage number and the quantization stage number of the first quantization stage. The quantization stage number of the second quantization stage;
映射模块,用于将所述图像块每个像素的值映射为第三量化阶的量化阶编 号,所述第三量化阶是以所述第一量化值和第二量化值为端值的量化区间被均 勾划分的若干量化阶中一个量化阶; A mapping module configured to map the value of each pixel of the image block to a quantization stage number of a third quantization stage, where the third quantization stage is a quantization with the first quantization value and the second quantization value as end values. One quantization order among several quantization orders whose intervals are evenly divided;
编码模块, 用于对所述像素最小值对应的第一量化阶的量化阶编号、所述 像素最大值对应的第二量化阶的量化阶编号和所述图像块每个像素的值映射 所得量化阶编号进行编码并写入码流。 An encoding module, configured to map the quantization step number of the first quantization step corresponding to the minimum value of the pixel, the quantization step number of the second quantization step corresponding to the maximum value of the pixel, and the value of each pixel of the image block. The stage number is encoded and written into the code stream.
11、 如权利要求 10所述的装置, 其特征在于, 所述量化模块包括: 第一量化单元,用于将图像块像素最小值量化为 M个量化阶中第一量化阶 的边界值, 将图像块像素最大值量化为所述 M个量化阶中第二量化阶的边界 值, 所述 M为大于 1的自然数。 11. The device according to claim 10, wherein the quantization module includes: a first quantization unit for quantizing the minimum pixel value of the image block into the boundary value of the first quantization level among M quantization levels, The maximum pixel value of the image block is quantized as the boundary value of the second quantization level among the M quantization levels, where M is a natural number greater than 1.
12、 如权利要求 10所述的装置, 其特征在于, 所述量化模块包括: 第二量化单元, 用于将图像块像素最小值量化为 J个量化阶中第一量化阶 的边界值, 将图像块像素最大值量化为 K个量化阶中第二量化阶的边界值, 所 述 J与所述 K为大于 1且不相等的自然数。 12. The device according to claim 10, wherein the quantization module includes: The second quantization unit is used to quantize the minimum pixel value of the image block into the boundary value of the first quantization stage among the J quantization stages, and to quantize the maximum pixel value of the image block into the boundary value of the second quantization stage among the K quantization stages, so The above J and the above K are natural numbers greater than 1 and not equal.
13、 如权利要求 12所述的装置, 其特征在于, 所述装置还包括: 第一判断模块,用于判断图像块像素最小值被量化成的边界值对应的二进 制数右移一位后与所述图像块像素最大值被量化成的边界值对应的二进制数 是否相等; 或者 13. The device according to claim 12, characterized in that the device further includes: a first judgment module, used to judge the binary number corresponding to the boundary value into which the minimum value of the pixel of the image block is quantized and then right-shifted by one bit with the binary number. Whether the binary numbers corresponding to the boundary values into which the maximum pixel value of the image block is quantized are equal; or
第二判断模块,用于判断图像块像素最大值被量化成的边界值对应的二进 制数右移一位后与所述图像块像素最 d、值被量化成的边界值对应的二进制数 是否相等。 The second judgment module is used to judge whether the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted by one bit to the right and whether the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is equal to .
14、 如权利要求 12所述的装置, 其特征在于, 若所述第一判断模块判断图 像块中像素最小值被量化成的边界值对应的二进制数右移一位后与所述图像 块像素最大值被量化成的边界值对应的二进制数不相等,则所述编码模块包括 第一判断单元、 第一编码单元和第二编码单元; 14. The device of claim 12, wherein if the first determination module determines that the binary number corresponding to the boundary value to which the minimum value of the pixel in the image block is quantized is shifted one bit to the right and is the same as the pixel of the image block, If the binary numbers corresponding to the boundary values into which the maximum value is quantized are not equal, the encoding module includes a first judgment unit, a first encoding unit and a second encoding unit;
所述第一判断单元,用于判断图像块像素最小值被量化成的边界值对应的 二进制数进行右移一位移除的是 "1" 还是 "0" ; The first judgment unit is used to judge whether the binary number corresponding to the boundary value into which the minimum value of the pixel of the image block is quantized is shifted to the right by one bit and removed by "1" or "0";
所述第一编码单元,用于若所述第一判断单元判断图像块像素最小值被量 化成的边界值对应的二进制数进行右移一位移除的是 "1" , 则对像素最小值被 量化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像 素最大值被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映 射所得量化阶编号进行编码并依次写入码流, 或者,对所述像素最大值被量化 成的边界值对应的量化阶编号、所述像素最 d、值被量化成的边界值的二进制数 进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值映射所 得量化阶编号进行编码并依次写入码流; The first encoding unit is used to perform a right shift of one bit on the binary number corresponding to the boundary value into which the minimum pixel value of the image block is quantized, and remove "1" if the first judgment unit determines that the minimum value of the pixel is "1". The quantization step number corresponding to the binary number that is quantized into a boundary value that is shifted right by one bit, the quantization step number corresponding to the boundary value that the maximum value of the pixel is quantized into, and the value mapping of each pixel of the image block The obtained quantization step number is encoded and written into the code stream sequentially, or the quantization step number corresponding to the boundary value into which the maximum value of the pixel is quantized, the binary number of the boundary value into which the maximum value of the pixel is quantized is processed. The quantization order number corresponding to the value obtained after shifting one bit to the right is mapped to the value of each pixel of the image block, and the resulting quantization order number is encoded and written into the code stream in sequence;
所述第二编码单元,用于若所述第一判断单元判断图像块像素最小值被量 化成的边界值对应的二进制数进行右移一位移除的是 "0" , 则对所述像素最大 值被量化成的边界值对应的量化阶编号、将像素最 d、值被量化成的边界值的二 进制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值 映射所得量化阶编号进行编码并依次写入码流, 或者,对像素最小值被量化成 的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像素最大 值被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映射所得 量化阶编号进行编码并依次写入码流; 或者 The second encoding unit is configured to perform a right shift of one bit on the binary number corresponding to the boundary value to which the minimum value of the image block pixel is quantized and remove "0" if the first judgment unit determines that the pixel is The quantization order number corresponding to the boundary value into which the maximum value is quantized, the quantization order number corresponding to the value obtained by right-shifting the binary number of the boundary value into which the maximum value is quantized by one bit, and each pixel of the image block value The mapped quantization step number is encoded and written into the code stream sequentially, or the binary number of the boundary value into which the minimum value of the pixel is quantized is right-shifted by one bit and the resulting value corresponds to the quantization step number and the maximum value of the pixel is quantized. The quantization step number corresponding to the resulting boundary value and the value of each pixel of the image block are mapped to the quantization step number, encoded, and written into the code stream sequentially; or
若所述第二判断模块判断图像块像素最大值被量化成的边界值对应的二 进制数右移一位后与所述图像块像素最小值被量化成的边界值对应的二进制 数不相等,则所述编码模块包括第二判断单元、第三编码单元和第四编码单元; 所述第二判断单元,用于判断图像块像素最大值被量化成的边界值对应的 二进制数进行右移一位移除的是 "1" 还是 "0" ; If the second judgment module determines that the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted one bit to the right and the binary number corresponding to the boundary value into which the minimum pixel value of the image block is quantized is not equal, then The encoding module includes a second judgment unit, a third encoding unit and a fourth encoding unit; the second judgment unit is used to judge the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized and right-shift one bit Whether "1" or "0" is removed;
所述第三编码单元,用于若所述第二判断单元判断图像块像素最大值被量 化成的边界值对应的二进制数进行右移一位移除的是 "1" , 则对所述像素最大 值被量化成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所 述像素最小值被量化成的边界值对应的量化阶编号和所述图像块每个像素的 值映射所得量化阶编号进行编码并依次写入码流, 或者,对所述像素最小值被 量化成的边界值对应的量化阶编号、所述像素最大值被量化成的边界值的二进 制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的值映 射所得量化阶编号进行编码并依次写入码流; The third encoding unit is used to, if the second judgment unit judges that the binary number corresponding to the boundary value into which the maximum value of the pixel of the image block is quantized is "1", which is shifted to the right and removed by one bit, then the pixel is The quantization order number corresponding to the binary number of the boundary value into which the maximum value is quantized is right-shifted by one bit, the quantization order number corresponding to the boundary value into which the minimum value of the pixel is quantized, and the quantization order number of each pixel of the image block. The quantization step number obtained by value mapping is encoded and written into the code stream sequentially, or the quantization step number corresponding to the boundary value into which the minimum value of the pixel is quantized and the binary number of the boundary value into which the maximum value of the pixel is quantized are encoded. The quantization order number corresponding to the value obtained after shifting one bit to the right is mapped to the value of each pixel of the image block, and the resulting quantization order number is encoded and written into the code stream in sequence;
所述第四编码单元,用于若所述第二判断单元判断图像块像素最大值被量 化成的边界值对应的二进制数进行右移一位移除的是 "0" , 则对所述像素最 、值被量化成的边界值对应的量化阶编号、将像素最大值被量化成的边界值的 二进制数进行右移一位后所得值对应的量化阶编号和所述图像块每个像素的 值映射所得量化阶编号进行编码并依次写入码流, 或者,对像素最大值被量化 成的边界值的二进制数进行右移一位后所得值对应的量化阶编号、所述像素最 小值被量化成的边界值对应的量化阶编号和所述图像块每个像素的值映射所 得量化阶编号进行编码并依次写入码流。 The fourth encoding unit is used to perform a right shift of one bit on the binary number corresponding to the boundary value to which the maximum value of the pixel of the image block is quantized, and remove "0" if the second judgment unit determines that the pixel is Finally, the quantization order number corresponding to the boundary value into which the value is quantized, the quantization order number corresponding to the value obtained by right-shifting the binary number of the boundary value into which the maximum value of the pixel is quantized by one bit, and the quantization order number corresponding to each pixel of the image block. The quantization order number obtained by value mapping is encoded and written into the code stream in sequence, or the binary number of the boundary value into which the maximum value of the pixel is quantized is right-shifted by one bit and the quantization order number corresponding to the obtained value, the minimum value of the pixel is The quantization step number corresponding to the quantized boundary value and the quantization step number obtained by mapping the value of each pixel of the image block are encoded and written into the code stream sequentially.
15、 如权利要求 12所述的装置, 其特征在于, 若所述第一判断模块判断图 像块中像素最小值被量化成的边界值对应的二进制数右移一位后与所述图像 块像素最大值被量化成的边界值对应的二进制数相等,或者所述第二判断模块 判断图像块像素最大值被量化成的边界值对应的二进制数右移一位后与所述 图像块像素最 d、值被量化成的边界值对应的二进制数相等, 所述量化模块包 括: 15. The device of claim 12, wherein if the first determination module determines that the binary number corresponding to the boundary value to which the minimum value of the pixel in the image block is quantized is shifted by one bit to the right and then matched with the pixel of the image block, The binary number corresponding to the boundary value that the maximum value is quantized into is equal, or the second judgment module It is determined that the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized is shifted one bit to the right and is equal to the binary number corresponding to the boundary value into which the maximum pixel value of the image block is quantized. The quantization module includes:
第一量化单元,用于将图像块像素最小值量化为 M个量化阶中第一量化阶 的边界值, 将图像块像素最大值量化为所述 M个量化阶中第二量化阶的边界 值, 所述 M为大于 1的自然数。 The first quantization unit is used to quantize the minimum pixel value of the image block into the boundary value of the first quantization level among the M quantization levels, and to quantize the maximum pixel value of the image block into the boundary value of the second quantization level among the M quantization levels. , the M is a natural number greater than 1.
16、 一种图像数据解压缩装置, 其特征在于, 所述装置包括: 16. An image data decompression device, characterized in that the device includes:
解码模块,用于根据码流中图像块像素最小值和像素最大值对应的量化阶 编号,解码得到图像块像素最小值和像素最大值分別对应的第一量化值和第二 量化值; The decoding module is used to decode the first quantization value and the second quantization value respectively corresponding to the minimum pixel value and the maximum pixel value of the image block according to the quantization order numbers corresponding to the minimum pixel value and the maximum pixel value of the image block in the code stream;
获取模块,用于根据码流中图像块每个像素的值映射为第三量化阶的量化 阶编号时所用量化阶次、所述第一量化值和第二量化值, 获取以所述第一量化 值和第二量化值为端值的量化区间被均匀划分的若干所述第三量化阶; An acquisition module, configured to obtain the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the first quantization value and the second quantization value, and obtain the first quantization value. A number of the third quantization steps in which the quantization interval with the quantization value and the second quantization value as end values is evenly divided;
重构模块,用于根据码流中图像块每个像素的值映射为第三量化阶的量化 阶编号和所述每一第三量化阶的边界值,重构所述图像块每个像素以获取所述 图像块每个像素的值。 A reconstruction module, configured to reconstruct each pixel of the image block to Get the value of each pixel of the image block.
17、 如权利要求 16所述的装置, 其特征在于, 所述重构模块包括: 第一取值单元, 用于取每一个量化阶编号所对应第三量化阶的两个边界 值,对所述两个边界值的平均值取整, 以取整所得的值作为所述每一个量化阶 编号所对应像素的值; 或者 17. The device according to claim 16, wherein the reconstruction module includes: a first value unit, configured to obtain two boundary values of the third quantization stage corresponding to each quantization stage number, for each quantization stage number. The average value of the two boundary values is rounded, and the rounded value is used as the value of the pixel corresponding to each quantization stage number; or
第二取值单元,用于取每一个量化阶编号所对应第三量化阶的左边界值或 右边界值作为所述每一个量化阶编号所对应像素的值。 The second value unit is used to obtain the left boundary value or the right boundary value of the third quantization level corresponding to each quantization level number as the value of the pixel corresponding to each quantization level number.
18、 如权利要求 17所述的装置, 其特征在于, 所述装置还包括判断模块、 第一补位模块和第二补位模块, 或者, 所述装置还包括判断模块、 第三补位模 块和第四补位模块; 18. The device according to claim 17, wherein the device further includes a judgment module, a first filling module and a second filling module, or the device further includes a judging module and a third filling module. and the fourth filling module;
所述判断模块, 用于判断所述第一量化值和第二量化值是否相等; 所述第一补位模块,用于若先收到码流中图像块像素最小值对应的量化阶 编号后收到码流中图像块像素最大值对应的量化阶编号并且所述判断模块判 断所述第一量化值和第二量化值不相等时,将所述第一量化值对应的二进制数 左移一位并且在末位补 " ; The judgment module is used to judge whether the first quantized value and the second quantized value are equal; the first filling module is used to first receive the quantization order number corresponding to the minimum value of the pixel of the image block in the code stream. The quantization order number corresponding to the maximum pixel value of the image block in the code stream is received and the judgment module determines When it is determined that the first quantized value and the second quantized value are not equal, shift the binary number corresponding to the first quantized value to the left by one bit and fill in the last bit with ";
所述第二补位模块,用于若先收到码流中图像块像素最大值对应的量化阶 编号后收到码流中图像块像素最小值对应的量化阶编号并且并且所述判断模 块判断所述第一量化值和第二量化值不相等时,将所述第一量化值对应的二进 制数左移一位并且在末位补 "0" ; The second padding module is used to first receive the quantization stage number corresponding to the maximum value of the image block pixel in the code stream and then receive the quantization stage number corresponding to the minimum value of the image block pixel in the code stream and the judgment module determines When the first quantized value and the second quantized value are not equal, shift the binary number corresponding to the first quantized value to the left by one bit and add "0" to the last bit;
所述第三补位模块,用于若先收到码流中图像块像素最大值对应的量化阶 编号后收到码流中图像块像素最 d、值对应的量化阶编号并且所述判断模块判 断所述第一量化值和第二量化值不相等时,将所述第二量化值对应的二进制数 左移一位并且在末位补 "1" ; The third filling module is used to first receive the quantization order number corresponding to the maximum pixel value of the image block in the code stream and then receive the quantization order number corresponding to the maximum value of the image block pixel in the code stream and the judgment module When it is determined that the first quantized value and the second quantized value are not equal, the binary number corresponding to the second quantized value is shifted to the left by one bit and "1" is added to the last bit;
所述第四补位模块,用于若先收到码流中图像块像素最小值对应的量化阶 编号后收到码流中图像块像素最大值对应的量化阶编号并且并且所述判断模 块判断所述第一量化值和第二量化值不相等时,将所述第二量化值对应的二进 制数左移一位并且在末位补 "0" ; The fourth padding module is used to first receive the quantization stage number corresponding to the minimum value of the pixel of the image block in the code stream and then receive the quantization stage number corresponding to the maximum value of the pixel of the image block in the code stream and the judgment module determines When the first quantized value and the second quantized value are not equal, shift the binary number corresponding to the second quantized value to the left by one bit and add "0" to the last bit;
所述获取模块包括第一获取单元或者第二获取单元; The acquisition module includes a first acquisition unit or a second acquisition unit;
所述第一获取单元,用于根据码流中图像块每个像素的值映射为第三量化 阶的量化阶编号时所用量化阶次、所述第二量化值和所述第一量化值对应的二 进制数左移一位并且在末位补 "0" 或 "1"后对应的十进制数, 获取以所述第 一量化值对应的二进制数左移一位并且在末位补 "0"或 "1"后对应的十进制 数和第二量化值为端值的量化区间被均匀划分的若干所述第三量化阶; 所述第二获取单元,用于根据码流中图像块每个像素的值映射为第三量化阶的 量化阶编号时所用量化阶次、所述第一量化值和所述第二量化值对应的二进制 数左移一位并且在末位补 "0" 或 "1"后对应的十进制数, 获取以所述第二量 化值对应的二进制数左移一位并且在末位补 "0" 或 "1"后对应的十进制数和 第一量化值为端值的量化区间被均匀划分的若干所述第三量化阶。 The first acquisition unit is configured to map the quantization order used when mapping the value of each pixel of the image block in the code stream to the quantization stage number of the third quantization stage, the second quantization value and the first quantization value. The binary number is shifted one bit to the left and the last bit is filled with "0" or "1", and the corresponding decimal number is obtained. The binary number corresponding to the first quantized value is shifted one bit to the left and the last bit is filled with "0" or "0". The corresponding decimal number after "1" and the second quantization value are the end values of a number of the third quantization steps that are evenly divided; The quantization order used when the value is mapped to the quantization stage number of the third quantization stage, the binary number corresponding to the first quantization value and the second quantization value is left shifted by one bit and "0" or "1" is added to the last bit. After the corresponding decimal number, obtain the quantization interval with the binary number corresponding to the second quantized value shifted one bit to the left and the corresponding decimal number and the first quantized value as the end value after adding "0" or "1" to the last bit. Several third quantization steps are evenly divided.
PCT/CN2013/070896 2012-06-29 2013-01-23 Image data compression and decompression method and device WO2014000443A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210222516.1A CN103517022B (en) 2012-06-29 2012-06-29 A kind of Image Data Compression and decompression method, device
CN201210222516.1 2012-06-29

Publications (1)

Publication Number Publication Date
WO2014000443A1 true WO2014000443A1 (en) 2014-01-03

Family

ID=49782169

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/070896 WO2014000443A1 (en) 2012-06-29 2013-01-23 Image data compression and decompression method and device

Country Status (2)

Country Link
CN (1) CN103517022B (en)
WO (1) WO2014000443A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016127271A1 (en) * 2015-02-13 2016-08-18 Xiaoou Tang An apparatus and a method for reducing compression artifacts of a lossy-compressed image
CN106851280B (en) * 2017-01-04 2018-04-13 西安万像电子科技有限公司 The method and apparatus of compression of images

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5878168A (en) * 1995-06-05 1999-03-02 Sony Corporation Method and apparatus for picture encoding and decoding
CN1231100A (en) * 1997-07-11 1999-10-06 索尼公司 Image encoder and image encoding method, image decoder and image decoding method, and image processor and image processing method
CN101511025A (en) * 2009-01-22 2009-08-19 炬力集成电路设计有限公司 Method and apparatus for compressing and decompressing image

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2103449B (en) * 1981-06-29 1985-05-30 Nippon Telegraph & Telephone Method and apparatus for gray level signal processing
CN1878311B (en) * 2001-11-27 2013-04-03 三星电子株式会社 Method and apparatus for encoding and decoding bit stream and orientation interpolator
JP4508132B2 (en) * 2006-02-27 2010-07-21 ソニー株式会社 Imaging device, imaging circuit, and imaging method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5878168A (en) * 1995-06-05 1999-03-02 Sony Corporation Method and apparatus for picture encoding and decoding
CN1231100A (en) * 1997-07-11 1999-10-06 索尼公司 Image encoder and image encoding method, image decoder and image decoding method, and image processor and image processing method
CN101511025A (en) * 2009-01-22 2009-08-19 炬力集成电路设计有限公司 Method and apparatus for compressing and decompressing image

Also Published As

Publication number Publication date
CN103517022A (en) 2014-01-15
CN103517022B (en) 2017-06-20

Similar Documents

Publication Publication Date Title
US9454552B2 (en) Entropy coding and decoding using polar codes
KR101654777B1 (en) Apparatus and method for scalable encoding 3d mesh, and apparatus and method for scalable decoding 3d mesh
RU2503138C2 (en) Embedded graphics coding for images with sparse histograms
US20200373946A1 (en) Decompression apparatus and control method thereof
US7800519B2 (en) Method and apparatus for compressing and decompressing data
CN109379598B (en) Image lossless compression method based on FPGA
CN107565971B (en) Data compression method and device
CN102970043B (en) A kind of compression hardware system based on GZIP and accelerated method thereof
JP2013508867A5 (en)
TWI479456B (en) Method and apparatus for data compression using error plane coding
CN110943744B (en) Data compression, decompression and processing method and device based on data compression and decompression
CN111641826B (en) Method, device and system for encoding and decoding data
CN112514264A (en) Data compression method, data decompression method, related device, electronic equipment and system
CN101977061B (en) Lossless compression and decompression method for general information
CN110021369B (en) Gene sequencing data compression and decompression method, system and computer readable medium
CN110249384B (en) Quantizer with index coding and bit arrangement
US20120033880A1 (en) Image processing systems employing image compression and accelerated image decompression
WO2020115471A1 (en) Bit plane encoding of data arrays
WO2021012278A1 (en) Data processing method, system, encoder, and decoder
CN110334066A (en) A kind of Gzip decompression method, apparatus and system based on FPGA
WO2014000443A1 (en) Image data compression and decompression method and device
Al-Hashemi et al. A new lossless image compression technique based on Bose, Chandhuri and Hocquengham (BCH) codes
WO2023159820A1 (en) Image compression method, image decompression method, and apparatuses
JP2006238036A (en) Computer graphic data encoding device, decoding device, encoding method, and decoding method
CN111787321A (en) Image compression and decompression method and system for edge end based on deep learning

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: 13809234

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: 13809234

Country of ref document: EP

Kind code of ref document: A1