CN115022628A - JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method - Google Patents

JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method Download PDF

Info

Publication number
CN115022628A
CN115022628A CN202210930753.7A CN202210930753A CN115022628A CN 115022628 A CN115022628 A CN 115022628A CN 202210930753 A CN202210930753 A CN 202210930753A CN 115022628 A CN115022628 A CN 115022628A
Authority
CN
China
Prior art keywords
pixel
coding
coded
pixels
image
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202210930753.7A
Other languages
Chinese (zh)
Other versions
CN115022628B (en
Inventor
杨方超
马德
朱国权
凡军海
金孝飞
孙世春
何煜坤
章明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Zhejiang Lab
Original Assignee
Zhejiang University ZJU
Zhejiang Lab
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 Zhejiang University ZJU, Zhejiang Lab filed Critical Zhejiang University ZJU
Priority to CN202210930753.7A priority Critical patent/CN115022628B/en
Publication of CN115022628A publication Critical patent/CN115022628A/en
Application granted granted Critical
Publication of CN115022628B publication Critical patent/CN115022628B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/93Run-length coding

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a high-throughput lossless image compression method based on JPEG-LS, which comprises the following steps: accessing an image memory and reading an image, and constructing a causal template of pixels to be coded of the read image; step two, calculating local gradient values among adjacent image pixels of the pixels to be coded, if the absolute value of the local gradient values is less than or equal to near-lossless degree, performing run-length coding on the pixels to be coded, otherwise, performing conventional coding after quantizing, sign correcting and combining the local gradient values; and step three, outputting a code stream after the coding of the step two, completing the compression coding of the read image, and returning to the step one for compression coding again if the compression coding of the read image is not completed. The invention can reduce the complexity of hardware realization and effectively improve the clock frequency and the throughput rate of the image compression algorithm.

Description

JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method
Technical Field
The invention belongs to the technical field of image compression, and particularly relates to a high-throughput-rate lossless image compression method based on JPEG-LS.
Background
The JPEG-LS algorithm is based on LOCO-I (Low COmplexity COmpression for images) algorithm developed by Hewlett-packard laboratory, and provides LOssless COmpression and near LOssless COmpression functions. Due to the moderate complexity of the algorithm, only subtraction and shift of data and other similar and simple processing processes are needed to be realized, the complexity and the efficiency have good balance, the hardware implementation is easy, and the algorithm is widely applied to the fields of medical images, artificial intelligence, remote sensing detection and the like.
When the traditional JPEG-LS hardware algorithm is realized, the pixel value to be coded and other four pixel values around the pixel value are required to be read for multiple times during context modeling, so that the reading efficiency is low; secondly, in a local gradient merging module, multiplication operation and overlong combinational logic operation are very likely to become a key path, so that the clock frequency and the throughput rate of an encoder are limited; finally, in the Golomb-granny coding algorithm of the conventional coding module, the Golomb-granny coding of the variable-length coding increases the implementation complexity of hardware, so that the coding efficiency is reduced, thereby affecting the clock frequency and throughput rate of the encoder.
Therefore, it is necessary to optimize the algorithm, remove the multiplication operation in the encoder algorithm as much as possible, and optimize the combinational logic and the Golomb coding rule, thereby realizing a high-throughput, high-efficiency JPEG-LS-based lossless image compression method.
Disclosure of Invention
In order to solve the technical problems in the prior art, the invention provides a high-throughput-rate lossless image compression method based on JPEG-LS, which is suitable for the real-time application field of JPEG-LS lossless image compression coding standard algorithm and has the following specific technical scheme:
a high-throughput lossless image compression method based on JPEG-LS comprises the following steps:
accessing an image memory, reading an image, and constructing a causal template of pixels to be coded of the read image;
step two, calculating local gradient values among adjacent image pixels of the pixels to be coded, if the absolute value of the local gradient values is less than or equal to near-lossless degree, performing run-length coding on the pixels to be coded, otherwise, performing conventional coding after quantizing, sign correcting and combining the local gradient values;
and step three, outputting a code stream after the coding of the step two, completing the compression coding of the read image, and returning to the step one for compression coding again if the compression coding of the read image is not completed.
Further, the first step specifically comprises: and only reading the pixel Ix to be coded and 1 new adjacent pixel Rd of the pixel Ix to be coded for the read image by using the causal template of the last coded pixel and the value of the last row of coded pixels, and directly acquiring the remaining 3 adjacent pixels Ra, Rb and Rc from the last coded pixel register or the last row of image pixel register, thereby completing the construction of the causal template of the pixel to be coded.
Further, the using the causal template of the last encoded pixel and the last row of encoded pixel values specifically includes: when the non-first-column image pixels are read, respectively assigning a pixel Ix00 at a position x, a pixel Rb at a position b and a pixel Rd at a position d of a last encoded pixel cause and effect template to a pixel Ra at a position a, a pixel Rc at a position c and a pixel Rb at a position b of the pixel to be encoded;
when reading the first column of image pixels, assigning the stored pixel Ix00 at the position x, the pixel Ra at the position a and the pixel Ix01 at the position x of the encoded pixel cause and effect template of the first column of the previous row to the pixel Rb at the position b, the pixel Rc at the position c and the pixel Rd at the position d of the pixel to be encoded respectively.
Further, if the pixel to be encoded is in the first row of the read image, the values of the adjacent three pixels are all equal to 0; if the pixel to be coded is in the last column of the image, the pixel value Rd = Rb.
Further, the calculating the local gradient value between the pixels of the adjacent image of the pixel to be encoded specifically includes: and sequentially carrying out difference on every two of the four pixel values adjacent to the pixel to be coded to obtain a local gradient value.
Further, the run-length encoding specifically includes: firstly, scanning the run length of pixels to be coded; then judging the reason of the run length scanning termination, if the pixels at the end of the line are scanned, the run length coding mode is switched out after the run length coding, otherwise, the run length interruption coding is carried out on the difference pixels after the run length coding; then calculating the predicted value of the difference pixel; calculating, correcting and subtracting the prediction error; computing context parameters, mapping coefficients and Golomb Gramb encoding parameters; then mapping the prediction error, and continuing to perform Golomb Gramb coding on the mapped prediction error; and finally updating the context parameters, and exiting the run-length coding mode after the variable is updated.
Further, the performing quantization, symbol correction, and combination on the local gradient values and then performing conventional encoding specifically includes: quantizing the local gradient values
Figure 100002_DEST_PATH_IMAGE002
And then combined into 9 integers: Q1-Q9, the expression is as follows:
Figure 100002_DEST_PATH_IMAGE004
wherein i belongs to 1 … 9, T1, T2 and T3 are thresholds for local gradient value quantization; the quantizers of the local gradient values are symmetric about 0 difference, the quantized local gradient values with opposite signs are combined, and then conventional encoding is carried out;
the conventional coding is specifically: firstly, edge detection is carried out on a current pixel to be coded to obtain a predicted value of the current pixel to be coded, then the predicted value is corrected and normalized, then a prediction error of the current pixel to be coded is calculated, the prediction error is corrected and reduced in a mode, then Golomb Gramb encoding parameters are calculated, then the prediction error is mapped, and finally Golomb Gramb encoding is carried out on the mapped prediction error.
Further, the local gradient value merging process adopts shift operation, specifically: optimization is performed based on the gradient value combining function Q = (Q1 × 9+ Q2) × 9+ Q3, a temporary variable temp = Q1< <3+ Q1+ Q2 is defined and rewritten as Q = temp < <3+ temp + Q3, the combinational logic path of the combining process has 4 levels, and is continuously optimized as Q = ((Q1+ Q2) + (Q3+ (Q2< <3)) + ((Q1< <4) + (Q1< <6)), and the combinational logic is shortened to 3 levels.
Further, the method of Golomb granny coding adopts a median search method for optimization, and specifically comprises the following steps: firstly, feeding N [ Q ] into a shift register to shift left by 3 bits, if (N [ Q ] < <3) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 5 bits, if (N [ Q ] < < 5) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 6 bits, otherwise, shifting left by 4 bits; if (N [ Q ] < <6) < a [ Q ] is satisfied, the granny coding parameter k =7, otherwise k = 6; k =5 if (N [ Q ] < <4) < a [ Q ] is satisfied, otherwise k = 4; if (N [ Q ] < <3) > A [ Q ] is satisfied, sending N [ Q ] into the shift register for left shift by 1 bit, if (N [ Q ] < < 1) < A [ Q ] is satisfied, sending N [ Q ] into the shift register for left 2 bits, otherwise, not carrying out shift operation; k =3 if (N [ Q ] < < 2) < a [ Q ] is satisfied, otherwise k = 2; if (N [ Q ]) < a [ Q ] is satisfied, k =1, otherwise k = 0; where N [ Q ] and A [ Q ] are variables indexed by Q.
Further, the Golomb granny code is implemented by a method based on a lookup table, which specifically comprises: for 8-bit images, according to the different k value ranges obtained by calculation, the range of mapping errors MERrval is 0-255, and the maximum code length LIMIT is 32 bits; storing a Golomb Gramb code table in 8 memories in advance according to different k values, wherein the bit width is 37 bits, the first 5 bits represent the length of actual codes, and the second 32 bits represent actual code values; and taking the Golomb coding parameter k as a chip selection signal of the memory bank, so that a Golomb coding value can be obtained in a reading period.
Has the advantages that:
according to the method, the causal template of the last coded pixel and the last column of coded pixel values are utilized, so that the causal template construction can be completed only by accessing the image memory for 2 times for all pixels to be coded, and the throughput rate of image compression is effectively improved; secondly, when local gradient values are combined, a multiplier of a combining function Q = (Q1 multiplied by 9+ Q2) × 9+ Q3 is optimized and replaced by shift and addition, so that hardware implementation is facilitated; and finally, optimizing the calculation method of the Golomb Gramb coding parameter k by using a median search method, and in addition, because the Golomb Gramb coding is variable length coding, realizing the coding by using a method of a lookup table to replace a direct calculation method, reducing the complexity of hardware realization and effectively improving the clock frequency and the throughput rate of the image compression algorithm.
Drawings
FIG. 1 is a flow chart of a high throughput lossless image compression method based on JPEG-LS according to the present invention;
FIG. 2 is a block diagram illustrating a detailed flowchart of a JPEG-LS based lossless image compression method according to an embodiment of the present invention;
FIG. 3a is a schematic diagram illustrating a causal template construction when reading non-first-column image pixels according to an embodiment of the present invention;
FIG. 3b is a schematic diagram illustrating a causal template construction for reading a first row of image pixels according to an embodiment of the present invention;
FIG. 4 is a block diagram of a local gradient value merging process according to an embodiment of the present invention;
FIG. 5 is a schematic process diagram of optimizing a Golomb Gramb-based encoding method based on a median search method according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of an overall process of implementing Golomb Gramb coding by a lookup table-based method according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a JPEG-LS based high-throughput lossless image compression apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and technical effects of the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and examples.
The invention discloses a high-throughput lossless image compression method based on JPEG-LS, which mainly comprises the following steps: firstly, reading in an image and constructing a causal template of pixels to be coded; and then, calculating gradient values between adjacent pixels, if the gradient values are less than or equal to Near lossless Near, performing run-length coding, otherwise, performing quantization, symbol correction and combination on local gradient values, and performing conventional coding. In each causal template construction process, the pixel values are generally required to be read from the image memory 5 times, which is inefficient.
The method is improved, and all pixels to be coded can finish the construction of the causal template only by accessing the image memory for 2 times by utilizing the causal template of the last coded pixel and the last column of coded pixel values, so that the throughput rate of image compression is effectively improved; secondly, when local gradient values are combined, a multiplier of a combining function Q = (Q1 multiplied by 9+ Q2) × 9+ Q3 is optimized and replaced by shifting and adding, so that the method is convenient for hardware implementation. Finally, optimizing a computing method of a Golomb coding parameter k by using a median search method; in addition, because the Golomb Gramb code is variable-length code, the code is realized by using a method of a lookup table instead of a direct calculation method, the hardware realization complexity can be reduced, and the clock frequency and the throughput rate of the image compression algorithm can be effectively improved.
As shown in fig. 1 and fig. 2, the high-throughput lossless image compression method based on JPEG-LS of the present invention includes the following steps:
accessing an image memory and reading an image, and constructing a causal template of pixels to be coded of the read image.
And based on the causal template of the last coded pixel and the value of the last row of coded pixels, completing the construction of the causal template of the pixels to be coded of the read image after accessing the image memory.
In general, when reading a compressed image pixel from an image memory, it is necessary to access the image memory 5 times, read and register a pixel Ix to be encoded and four adjacent pixels Ra, Rb, Rc, and Rd thereof, respectively, and thus the reading efficiency is low.
In the embodiment of the invention, by using the causal template of the last coded pixel and the value of the last row of coded pixels, the pixel Ix to be coded and 1 new adjacent pixel Rd thereof are only needed to be read for reading the image, and the remaining 3 adjacent pixels Ra, Rb and Rc are directly obtained from the last coded pixel register or the last row of image pixel register, that is, only 2 times of image memory access is needed, and compared with the method that 5 times of image memory access is needed each time, the access time of 3 times is saved.
In more detail, as shown in fig. 3a, when reading a non-first column of image pixels, a pixel Ix00 at position x, a pixel Rb at position b and a pixel Rd at position d of the last encoded pixel causal template are respectively assigned to a pixel Ra at position a, a pixel Rc at position c and a pixel Rb at position b of the current pixel to be encoded causal template. When reading the image pixels of the first column, as shown in fig. 3b, the stored pixel Ix00 at the position x of the causal template of the encoded pixel in the first column of the previous row, the pixel Ra at the position a and the pixel Ix01 at the position x of the encoded pixel in the second column of the previous row are respectively assigned to the pixel Rb at the position b, the pixel Rc at the position c and the pixel Rd at the position d of the causal template of the current pixel to be encoded. By the method, the reading time of all image pixels is shortened from 5 times to 2 times, and the encoding frequency and the throughput rate are improved.
In one embodiment of the present invention, if the current pixel to be encoded is in the first row of the image, the adjacent three pixel values Rb = Rc = Rd = 0; if the current pixel to be encoded is in the last column of the image, the pixel value Rd = Rb.
And step two, calculating local gradient values among adjacent image pixels of the pixels to be coded, if the absolute value of the local gradient values is less than or equal to near-lossless degree, performing run-length coding on the pixels to be coded, and otherwise, performing conventional coding after quantizing, sign correcting and combining the local gradient values.
Specifically, the local gradient values D1, D2 and D3 are obtained by sequentially performing pairwise difference on four pixel values adjacent to the pixel to be encoded.
And if the absolute values of the local gradient values are all less than or equal to the Near-lossless degree Near, the current pixel to be coded enters a run coding mode, otherwise, the current pixel to be coded enters a local gradient value quantization mode.
The local gradient value quantization mode specifically comprises the following steps: to avoid generating a large amount of context data, the local gradient values are further processed, the local gradient values having similar characteristics
Figure 323071DEST_PATH_IMAGE002
Quantized and combined into 9 integers: q1~ Q9, be convenient for operation and statistics, the expression is as follows:
Figure DEST_PATH_IMAGE005
wherein i belongs to 1 … 9, T1, T2 and T3 are thresholds for local gradient value quantization; the quantizer of the local gradient values is symmetric about 0 difference, and reduces the maximum possible 729 vector data to 365 by combining the local gradient values with opposite signs after quantization; and then carrying out conventional coding, specifically: firstly, edge detection is carried out on a current pixel to be coded to obtain a predicted value of the current pixel to be coded, then the predicted value is corrected and normalized, then a prediction error of the current pixel to be coded is calculated, the prediction error is corrected and reduced in a mode, then Golomb Gramb encoding parameters are calculated, then the prediction error is mapped, and finally Golomb Gramb encoding is carried out on the mapped prediction error.
The run length coding specifically comprises: firstly, scanning the run length of pixels to be coded; then judging the reason of the run length scanning termination, if the pixels at the end of the line are scanned, the run length coding mode is switched out after the run length coding, otherwise, the run length interruption coding is carried out on the difference pixels after the run length coding; then calculating the predicted value of the difference pixel; calculating, correcting and subtracting the prediction error; then calculating a context parameter, a mapping coefficient and a Golomb Gramb coding parameter; then mapping the prediction error, and continuing to perform Golomb Gramb coding on the mapped prediction error; and finally updating the context parameters, and exiting the run-length coding mode after the variable is updated.
In one embodiment of the present invention, the Near lossless Near takes the value 0 in the lossless mode.
As shown in fig. 4, in the hardware implementation process of the local gradient value combination function Q = (Q1 × 9+ Q2) × 9+ Q3 expression, the multiplier not only occupies more logic resources, but also calculates that one time consumes a plurality of clock cycles, so that a shift operation is used instead of a multiplication operation, a temporary variable temp = Q1< <3+ Q1+ Q2 is defined and the formula is rewritten as Q = temp < <3+ temp + Q3, then the combinational logic path of the combination process has 4 stages, and continues to be optimized as Q = ((Q1+ Q2) + (Q3+ (Q2< <3)) + ((Q1< <4) + (Q1< <6)), and the combinational logic is shortened to 3 stages, thereby effectively increasing the clock frequency of the image compression algorithm and ensuring the throughput of the image compression algorithm.
As shown in fig. 5, the Golomb granny code method adopts a median search optimization, and reduces 7 shifts and comparison operations in a sequential comparison method to 3 shifts and comparison operations, which specifically includes: firstly, feeding N [ Q ] into a shift register to shift left by 3 bits, if (N [ Q ] < <3) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 5 bits, if (N [ Q ] < < 5) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 6 bits, otherwise, shifting left by 4 bits; if (N [ Q ] < <6) < a [ Q ] is satisfied, the granny coding parameter k =7, otherwise k = 6; k =5 if (N [ Q ] < <4) < a [ Q ] is satisfied, otherwise k = 4; if (N [ Q ] < <3) > A [ Q ] is satisfied, then N [ Q ] is sent to the left of the shift register and shifted by 1 bit, if (N [ Q ] < < 1) < A [ Q ] is satisfied, then N [ Q ] is sent to the left 2 bits of the shift register, otherwise, no shift operation is carried out; k =3 if (N [ Q ] < < 2) < a [ Q ] is satisfied, otherwise k = 2; if (N [ Q ]) < a [ Q ] is satisfied, k =1, otherwise k = 0. Where N [ Q ] and A [ Q ] are variables indexed by Q.
In an embodiment of the present invention, as shown in fig. 6, a method based on a lookup table replaces a direct calculation method to implement Golomb granny codes, which specifically includes:
for 8-bit images, according to the different k value ranges obtained by calculation, the range of mapping errors MERrval is 0-255, and the maximum code length LIMIT is 32 bits; storing a Golomb Gramb code table in 8 memories in advance according to different k values, wherein the bit width is 37 bits, the first 5 bits represent the length of actual codes, and the second 32 bits represent actual code values; and taking the parameter k as a chip selection signal of the memory group, so that a Golomb Gramb code value can be obtained in a reading period.
And step three, outputting a code stream after the coding of the step two, completing the compression coding of the read image, and returning to the step one for compression coding again if the compression coding of the read image is not completed.
The invention also provides an embodiment of the high-throughput lossless image compression device based on JPEG-LS, which corresponds to the embodiment of the high-throughput lossless image compression method based on JPEG-LS.
Referring to fig. 7, an embodiment of the present invention provides a high-throughput lossless image compression apparatus based on JPEG-LS, which includes one or more processors, and is configured to implement the high-throughput lossless image compression method based on JPEG-LS in the foregoing embodiment.
The embodiment of the high-throughput lossless image compression apparatus based on JPEG-LS of the invention can be applied to any equipment with data processing capability, such as computers and other equipment or devices. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for running through the processor of any device with data processing capability. In terms of hardware, as shown in fig. 7, a hardware structure diagram of an arbitrary device with data processing capability in which the JPEG-LS based lossless image compression apparatus according to the present invention is located is shown, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 7, in the embodiment, the arbitrary device with data processing capability in which the apparatus is located may generally include other hardware according to the actual function of the arbitrary device with data processing capability, which is not described again.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement without inventive effort.
An embodiment of the present invention further provides a computer-readable storage medium, on which a program is stored, which, when executed by a processor, implements the JPEG-LS based high throughput lossless image compression method in the above-described embodiments.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any data processing capability device described in any of the foregoing embodiments. The computer readable storage medium may also be an external storage device of the wind turbine, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), and the like, provided on the device. Further, the computer readable storage medium may include both internal storage units and external storage devices of any data processing capable device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing-capable device, and may also be used for temporarily storing data that has been output or is to be output.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way. Although the foregoing has described the practice of the present invention in detail, it will be apparent to those skilled in the art that modifications may be made to the practice of the invention as described in the foregoing examples, or that certain features may be substituted in the practice of the invention. All changes, equivalents and the like which come within the spirit and principles of the invention are desired to be protected.

Claims (10)

1. A high-throughput lossless image compression method based on JPEG-LS is characterized by comprising the following steps:
accessing an image memory and reading an image, and constructing a causal template of pixels to be coded of the read image;
step two, calculating local gradient values among adjacent image pixels of the pixels to be coded, if the absolute value of the local gradient values is less than or equal to near-lossless degree, performing run-length coding on the pixels to be coded, otherwise, performing conventional coding after quantizing, sign correcting and combining the local gradient values;
and step three, outputting a code stream after the coding of the step two, completing the compression coding of the read image, and returning to the step one for compression coding again if the compression coding of the read image is not completed.
2. The JPEG-LS based high-throughput lossless image compression method as claimed in claim 1, wherein the step one is specifically as follows: and only reading the pixel Ix to be coded and 1 new adjacent pixel Rd of the pixel Ix to be coded for the read image by using the causal template of the last coded pixel and the value of the last row of coded pixels, and directly acquiring the remaining 3 adjacent pixels Ra, Rb and Rc from the last coded pixel register or the last row of image pixel register, thereby completing the construction of the causal template of the pixel to be coded.
3. The JPEG-LS based high throughput lossless image compression method as claimed in claim 2, wherein said causal template for the last encoded pixel and the last line of encoded pixel values are used, and specifically: when reading a non-first column of image pixels, respectively assigning a pixel Ix00 at a position x, a pixel Rb at a position b and a pixel Rd at a position d of a last encoded pixel cause and effect template to a pixel Ra at a position a, a pixel Rc at a position c and a pixel Rb at a position b of the pixel to be encoded;
when reading the first column of image pixels, assigning the stored pixel Ix00 at the position x, the pixel Ra at the position a and the pixel Ix01 at the position x of the encoded pixel cause and effect template of the first column of the previous row to the pixel Rb at the position b, the pixel Rc at the position c and the pixel Rd at the position d of the pixel to be encoded respectively.
4. The JPEG-LS based high throughput lossless image compression method as claimed in claim 3, wherein if the pixel to be encoded is in the first row of the read image, the values of the adjacent three pixels are all equal to 0; if the pixel to be coded is in the last column of the image, the pixel value Rd = Rb.
5. The JPEG-LS based high throughput lossless image compression method as claimed in claim 2, wherein the calculating the local gradient values between the neighboring image pixels of the pixel to be encoded is specifically as follows: and sequentially carrying out difference on every two of the four pixel values adjacent to the pixel to be coded to obtain a local gradient value.
6. The JPEG-LS based high throughput lossless image compression method according to claim 5, wherein the run-length coding is specifically: firstly, scanning the run length of pixels to be coded; then judging the reason of the run length scanning termination, if the pixels at the end of the line are scanned, the run length coding mode is switched out after the run length coding, otherwise, the run length interruption coding is carried out on the difference pixels after the run length coding; then calculating the predicted value of the difference pixel; calculating, correcting and subtracting the prediction error; then calculating a context parameter, a mapping coefficient and a Golomb Gramb coding parameter; then mapping the prediction error, and continuing to perform Golomb Gramb coding on the mapped prediction error; and finally updating the context parameters, and exiting the run-length coding mode after the variable is updated.
7. The JPEG-LS based high throughput lossless image compression method as claimed in claim 5, wherein the local gradient values are quantized, sign corrected and combined and then conventionally encoded, specifically: quantizing the local gradient values
Figure DEST_PATH_IMAGE002
And then are combined into 9 integers: Q1-Q9, the expression is as follows:
Figure DEST_PATH_IMAGE004
wherein i belongs to 1 … 9, T1, T2 and T3 are thresholds for local gradient value quantization; the quantizers of the local gradient values are symmetric about 0 difference, the quantized local gradient values with opposite signs are combined, and then conventional encoding is carried out;
the conventional coding is specifically: firstly, edge detection is carried out on a current pixel to be coded to obtain a predicted value of the current pixel to be coded, then the predicted value is corrected and normalized, then a prediction error of the current pixel to be coded is calculated, the prediction error is corrected and reduced in a mode, then Golomb Gramb encoding parameters are calculated, then the prediction error is mapped, and finally Golomb Gramb encoding is carried out on the mapped prediction error.
8. The JPEG-LS based high throughput lossless image compression method as claimed in claim 7, wherein the local gradient value combination process employs a shift operation, specifically: optimization is performed based on the gradient value combining function Q = (Q1 × 9+ Q2) × 9+ Q3, a temporary variable temp = Q1< <3+ Q1+ Q2 is defined and rewritten as Q = temp < <3+ temp + Q3, the combinational logic path of the combining process has 4 levels, and is continuously optimized as Q = ((Q1+ Q2) + (Q3+ (Q2< <3)) + ((Q1< <4) + (Q1< <6)), and the combinational logic is shortened to 3 levels.
9. The JPEG-LS based high throughput lossless image compression method of claim 7, wherein the Golomb Gramb coding method adopts a median search method for optimization, and specifically comprises the following steps: firstly, feeding N [ Q ] into a shift register to shift left by 3 bits, if (N [ Q ] < <3) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 5 bits, if (N [ Q ] < < 5) < A [ Q ] is met, feeding N [ Q ] into the shift register to shift left by 6 bits, otherwise, shifting left by 4 bits; if (N [ Q ] < <6) < a [ Q ] is satisfied, the granny coding parameter k =7, otherwise k = 6; k =5 if (N [ Q ] < <4) < a [ Q ] is satisfied, otherwise k = 4; if (N [ Q ] < <3) > A [ Q ] is satisfied, sending N [ Q ] into the shift register for left shift by 1 bit, if (N [ Q ] < < 1) < A [ Q ] is satisfied, sending N [ Q ] into the shift register for left 2 bits, otherwise, not carrying out shift operation; k =3 if (N [ Q ] < < 2) < a [ Q ] is satisfied, otherwise k = 2; if (N [ Q ]) < a [ Q ] is satisfied, k =1, otherwise k = 0; where N [ Q ] and A [ Q ] are variables indexed by Q.
10. The JPEG-LS based high throughput lossless image compression method of claim 9, wherein the Golomb Gramb coding is implemented by a lookup table based method, specifically comprising: for 8-bit images, according to the different k value ranges obtained by calculation, the range of mapping errors MERrval is 0-255, and the maximum code length LIMIT is 32 bits; storing a Golomb Gramb code table in 8 memories in advance according to different k values, wherein the bit width is 37 bits, the first 5 bits represent the length of actual codes, and the second 32 bits represent actual code values; and taking the Golomb coding parameter k as a chip selection signal of the memory bank, so that a Golomb coding value can be obtained in a reading period.
CN202210930753.7A 2022-08-04 2022-08-04 JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method Active CN115022628B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210930753.7A CN115022628B (en) 2022-08-04 2022-08-04 JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210930753.7A CN115022628B (en) 2022-08-04 2022-08-04 JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method

Publications (2)

Publication Number Publication Date
CN115022628A true CN115022628A (en) 2022-09-06
CN115022628B CN115022628B (en) 2022-12-13

Family

ID=83066351

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210930753.7A Active CN115022628B (en) 2022-08-04 2022-08-04 JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method

Country Status (1)

Country Link
CN (1) CN115022628B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5903676A (en) * 1994-11-10 1999-05-11 The Chinese University Of Hong Kong Context-based, adaptive, lossless image codec
US20040213471A1 (en) * 2003-04-25 2004-10-28 Stmicroelectronics S.R.I. Loss-less compression of still images at enhanced speed
US20070019743A1 (en) * 2002-10-01 2007-01-25 Avocent Corporation Video compression encoder
CN101534373A (en) * 2009-04-24 2009-09-16 北京空间机电研究所 Remote sensing image near-lossless compression hardware realization method based on improved JPEG-LS algorithm
CN102801981A (en) * 2012-08-30 2012-11-28 西安空间无线电技术研究所 Multipath compressed kernel parallel encoding control method on basis of JPEG-LS (Joint Pho-tographic Experts Group-Lossless Standard) algorithm
US20130124631A1 (en) * 2011-11-04 2013-05-16 Fidelus Technologies, Llc. Apparatus, system, and method for digital communications driven by behavior profiles of participants
CN105828070A (en) * 2016-03-23 2016-08-03 华中科技大学 Anti-error code propagation JPEG-LS image lossless/near-lossless compression algorithm hardware realization method
CN110049333A (en) * 2019-04-23 2019-07-23 东南大学 A kind of JPEG_LS compression of images exports coding code stream splicing system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5903676A (en) * 1994-11-10 1999-05-11 The Chinese University Of Hong Kong Context-based, adaptive, lossless image codec
US20070019743A1 (en) * 2002-10-01 2007-01-25 Avocent Corporation Video compression encoder
US20040213471A1 (en) * 2003-04-25 2004-10-28 Stmicroelectronics S.R.I. Loss-less compression of still images at enhanced speed
CN101534373A (en) * 2009-04-24 2009-09-16 北京空间机电研究所 Remote sensing image near-lossless compression hardware realization method based on improved JPEG-LS algorithm
US20130124631A1 (en) * 2011-11-04 2013-05-16 Fidelus Technologies, Llc. Apparatus, system, and method for digital communications driven by behavior profiles of participants
CN102801981A (en) * 2012-08-30 2012-11-28 西安空间无线电技术研究所 Multipath compressed kernel parallel encoding control method on basis of JPEG-LS (Joint Pho-tographic Experts Group-Lossless Standard) algorithm
CN105828070A (en) * 2016-03-23 2016-08-03 华中科技大学 Anti-error code propagation JPEG-LS image lossless/near-lossless compression algorithm hardware realization method
CN110049333A (en) * 2019-04-23 2019-07-23 东南大学 A kind of JPEG_LS compression of images exports coding code stream splicing system and method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
FIDHA NAZAR,ET AL.: "Implementation of JPEG-LS compression algorithm for real time applications", 《 2016 INTERNATIONAL CONFERENCE ON ELECTRICAL, ELECTRONICS, AND OPTIMIZATION TECHNIQUES (ICEEOT)》 *
RADHIKA AMASHI,ET AL.: "Experimental study on JPEG-LS algorithm", 《2017 IEEE INTERNATIONAL CONFERENCE ON POWER, CONTROL, SIGNALS AND INSTRUMENTATION ENGINEERING (ICPCSI)》 *
宋鸿梅等.: "图像无损压缩算法JPEG-LS实现及性能研究", 《光学仪器》 *
牛慧卓等: "JPEG-LS图像压缩算法的研究与实现", 《中国铁路》 *
韩俊萍等: "JPEG-LS图像无损压缩的IP固核设计", 《太原理工大学学报》 *

Also Published As

Publication number Publication date
CN115022628B (en) 2022-12-13

Similar Documents

Publication Publication Date Title
CN110070178B (en) Convolutional neural network computing device and method
CN111010883B (en) Matrix processing method and device and logic circuit
US20180167083A1 (en) Lossless data compression
US8306108B2 (en) Adaptive canonical Huffman decoder and method thereof and video decoder
US20100259427A1 (en) Entropy coding apparatus
KR20060013021A (en) Context adaptive binary arithmetic decoder method and apparatus
JPS62261230A (en) Method of compressing multiplexed level signal
US20220224947A1 (en) Coding method and related device
JP2798172B2 (en) Image encoding / decoding device
CN103929642A (en) Method for rapidly calculating deviation value of entropy coding context model of HEVC transformation coefficients
CN110049333B (en) JPEG _ LS image compression output coding code stream splicing system and method
JPH09298668A (en) Digital information coder, digital information decoder, digital information coding/decoding device, digital information coding method and digital information decoding method
CN115022628B (en) JPEG-LS (joint photographic experts group-LS) -based high-throughput lossless image compression method
Kau et al. High performance architecture for the encoder of JPEG-LS on SOPC platform
CN111083479A (en) Video frame prediction method and device and terminal equipment
JP3929312B2 (en) Arithmetic coding apparatus and image processing apparatus
CN117097905B (en) Lossless image block compression method, lossless image block compression equipment and storage medium
CN116828196A (en) Implementation method of JPEG-LS encoder based on FPGA
JPS6360952B2 (en)
Li et al. Design and FPGA implementation of JPEG-LS image decompression
US20220108480A1 (en) Bit plane decoding method and apparatus
JPH0918350A (en) Coding/decoding device and coding/decoding method
CN108449092A (en) A kind of Turbo code interpretation method and its device based on cycle compression
US20230289588A1 (en) Deep Neural Network Processing Device with Decompressing Module, Decompressing Method and Compressing Method
CN112073729B (en) Model updating method, device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant