Implementation method of JPEG-LS encoder based on FPGA
By implementing a JPEG-LS encoder based on FPGA, the Golomb coding and context parameter update were optimized, solving the problem of insufficient compression speed and compression ratio in the hardware implementation of the JPEG-LS algorithm, and achieving lossless high compression ratio encoding effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LANZHOU UNIV
- Filing Date
- 2023-07-10
- Publication Date
- 2026-07-21
AI Technical Summary
The existing JPEG-LS algorithm still has insufficient compression speed and compression ratio in hardware implementation, making it difficult to meet the needs of high-speed interface devices, and it is also highly complex and resource-intensive.
An FPGA-based JPEG-LS encoder implementation method is adopted, including context modeling, edge detection, adaptive prediction correction, prediction residual calculation, calculation of Golomb coding parameter K, mapping of prediction error MErrval, context parameter update, and bitstream splicing. The calculation process of Golomb coding is optimized by adopting binary search and multi-stage pipeline design, which reduces hardware complexity and resource consumption.
It achieves lossless high compression ratio JPEG-LS encoding, with a compression ratio of 18% to 25%, reduces hardware resource consumption, avoids reverse compression, and improves the compression performance of the encoder.
Smart Images

Figure CN116828196B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically relating to an implementation method of a JPEG-LS encoder based on FPGA. Background Technology
[0002] JPEG-LS (Joint Photographic Experts Group-Lossless) is a lossless and near-lossless compression standard for continuous-tone still images, developed by the International Organization for Standardization (ISO) in December 1999 and the International Telecommunication Union (ITU) Telecommunication Standardization Sector in June 1998. The JPEG-LS algorithm is based on the LOCO-I algorithm developed by Hewlett-Packard Laboratories, providing lossless and near-lossless compression capabilities. It was selected for inclusion in the JPEG-LS standard due to its good balance between complexity and efficiency. This algorithm avoids data transformations such as Fast Fourier Transform or Discrete Cosine Transform, as well as other complex data conversion processes, requiring only data subtraction, shifting, and other similar simple processing. Compared to algorithms like JPEG and JPEG2000, the JPEG-LS algorithm is characterized by lower complexity and ease of hardware implementation.
[0003] As researchers continue to study the hardware and software implementation of the JPEG-LS algorithm, its compression performance has improved to some extent, achieving enhancements in compression ratio, compression speed, application range, and area / power consumption. However, with the widespread adoption of high-speed interface devices and the ever-increasing demands for JPEG-LS compression performance, compression speed and compression ratio remain key research areas. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and propose an implementation method for an FPGA-based JPEG-LS encoder with excellent performance of lossless and high compression ratio.
[0005] The present invention discloses an implementation method of an FPGA-based JPEG-LS encoder, the method comprising, in sequence, context modeling, edge detection, adaptive prediction correction, prediction residual calculation, calculation of Golomb coding parameter K, mapping of prediction error MErrval, Golomb coding of prediction error MErrval, context parameter update, and bitstream concatenation; the Golomb coding algorithm is a three-level compression algorithm.
[0006] Furthermore, the formula for calculating the Golomb encoding parameter K in the implementation method is as follows: , The calculation is performed using the binary search method, specifically a three-level calculation. The most common basic algorithm in the prior art is a seven-level calculation. If a general sequential comparison method is used, that is, first compare the sizes of N<<0 and A, then compare the sizes of N<<1 and A, and so on, then it is necessary to compare the sizes of A and N up to 7 times to determine the value of k. In this application, the optimized algorithm uses binary search for calculation. Starting from the middle value for comparison each time, it only takes up to three comparisons to obtain the result, which is a three-level calculation, saving resources and optimizing the timing.
[0007] Further, the process of performing Golomb coding on the prediction error MErrval in the implementation method specifically includes the following steps: S1: Perform a right shift of k bits on the prediction error MErrval to obtain the quotient q of MErrval divided by k; S2: If q + 2 + k <= LIMIT and q < LIMIT - qbpp - 1, then transfer to S3; if q + 2 + k > LIMIT and q < LIMIT - qbpp - 1, then transfer to S4; if q ≥ LIMIT - qbpp - 1, then transfer to S5; where LIMIT is the maximum length of the Golomb coding codeword, and qbpp is the number of bits required to represent the mapped prediction error MErrval; the most common basic compression algorithm in the prior art is a two-level compression, and the optimized algorithm in this application adopts a three-level compression, greatly improving the compression ratio.
[0008] S3: Perform unary coding on q: that is, first append q 1-bit 0s to the coding code stream, then append 1 1-bit 1 to the coding code stream, and finally append the low k bits of the prediction error MErrval in binary form to the coding code stream, with the high bits in front and the low bits at the back; S4: First perform unary coding on q + 1: that is, first append q 1-bit 0s to the coding code stream, then append 1 1-bit 1 to the coding code stream, and finally append the low k bits of the prediction error MErrval in binary form to the coding code stream, with the high bits in front and the low bits at the back; S5: First perform unary coding on LIMIT - qbpp - 1: that is, first append LIMIT - qbpp - 1 1-bit 0s to the coding code stream, then append 1 1-bit 1 to the coding code stream, and finally append the low qbpp bits of the prediction error MErrval - 1 in binary form to the coding code stream, with the high bits in front and the low bits at the back.
[0009] Furthermore, the context modeling in the implementation method includes three parts: gradient calculation, gradient quantization, and index value solving, ultimately yielding the index parameter Q and its symbol sign. The index parameter Q is used for addressing and updating the parameters A, B, C, and N of the pixel at that point. That is, it is the process of obtaining an index parameter Q through the gradient between the pixel at that point and its neighboring pixels. The clock included in the context modeling is a changeable clock; the system clock is 50MHz, and the encoder operating clock is 1MHz.
[0010] Furthermore, all clocks involved in the implementation method described in this application can be changed, and can be adjusted according to actual needs.
[0011] Furthermore, the gradient calculation process in the implementation method specifically involves calculating the differences D1, D2, and D3 between the adjacent pixels a, b, c, and d of the current pixel x, which are modeled in advance; The gradient quantization process specifically involves quantizing the local gradient value Qi into nine integers (-4, 4); where i = 1, 2, or 3 in the local gradient value Qi. The formula for calculating the local gradient value Qi is:
[0012] Where i = 1, 2, or 3; T1, T2, and T3 are the thresholds for quantizing local gradient values, with values of 3, 7, and 21 respectively; since it is lossless compression, NEAR = 0; The index value is calculated by determining the index parameter Q. Specifically, the process involves reducing the number of vectors with the most local gradient values (9*9*9=729) to 365. The index parameter Q ranges from (0, 365), and its calculation formula is as follows: Q = 9*(9Q1+Q2)+Q3, The sign of the index parameter Q satisfies any of the following conditions: (1) Q1 < 0; (2) Q1 = 0 and Q2 < 0; (3) Q1 = Q2 = 0 and Q3 < 0, then the sign of the index parameter Q is assigned the value -1, otherwise it is 1.
[0013] Furthermore, the edge detection in the implementation method predicts the current pixel x. Specifically, the process involves taking one of the three numbers Ra, Rb, and Ra + Rb - Rc as the initial predicted value Px for the current pixel x.
[0014] Furthermore, the adaptive prediction correction process in the implementation method specifically involves correcting the initial prediction value Px based on the sign of the index parameter Q, the residual correction value C[Q], and the parameter Maxval to obtain the final prediction value; wherein the parameter Maxval is the maximum value of the number of bits that the image pixels account for. The parameter Maxval is determined by the image pixel precision.
[0015] Furthermore, the process of calculating the prediction residual in the implementation method specifically involves calculating the difference Errval between the image pixel value and the final predicted value; The mapping process of the prediction error MErrval specifically involves mapping the difference Errval to a prediction error MErrval of (0-255) for Golomb coding. Golomb coding can only encode non-negative integers, while the sign of the quantized prediction residual can be positive or negative, approximately following a Laplace distribution. The geometric distribution of Golomb-Rice coding has a more ideal effect, so it is necessary to transform the distribution of the prediction residual into a geometric distribution and perform mapping, that is, mapping the difference Errval to a prediction error MErrval of (0-255).
[0016] Furthermore, the context parameter update process in the implementation method is as follows: each context environment is correspondingly set with a set of context parameters A[Q], B[Q], C[Q], and N[Q] to store the corresponding context information; after each pixel is encoded, the context parameters A[Q], B[Q], C[Q], and N[Q] are updated in real time so that the context parameters A[Q], B[Q], C[Q], and N[Q] can match the current pixel's context environment to the greatest extent, thereby improving the compression coding performance of the current pixel x. Here, A[Q] is an accumulator of the absolute value of the quantization residual, which is used to estimate the Golomb coding parameters K; B[Q] is an accumulator of the reconstruction residual, which helps calculate the prediction bias C[Q], which stores the average prediction bias value corresponding to the context environment, used to correct the initial prediction value Px of the pixel; and N[Q] is a counter for the corresponding context environment, storing the number of times the context environment appears.
[0017] Furthermore, the bitstream concatenation in the implementation method includes concatenating the remaining bitstream from the previous concatenation and concatenating the current encoded bitstream to obtain the final encoded bitstream; the bitstream concatenation is performed in 32-bit units, and encoded bitstreams with less than 32 bits are temporarily stored.
[0018] Compared with the prior art, the present invention has the following beneficial technical effects: The FPGA-based JPEG-LS encoder implementation method of this invention, on the one hand, relies entirely on hardware implementation without the aid of software. During image compression, it eliminates the need for discrete cosine transform and arithmetic coding, performing only prediction and Golomb-Rice coding, thus achieving the JPEG-LS lossless high-compression-rate encoder function entirely on hardware. On the other hand, it abandons run-length encoding in the JPEG-LS standard, reducing not only the complexity of hardware implementation but also the consumption of hardware resources in the designed encoder, preventing inverse compression that may occur in run-length encoding mode, and improving the compression ratio. Therefore, this application is particularly effective for relatively uneven pixels. Furthermore, the implementation method of this application completes the construction of the causal template for the next pixel to be encoded during the context parameter update process; it optimizes the calculation process of the Golomb encoding parameter K using a binary search method, saving resources and optimizing timing. It also optimizes the Golomb encoding method from two-stage compression to three-stage compression. Moreover, the implementation method of this application largely uses left and right shifts for functionality, resulting in high speed, and also employs a multi-stage pipeline to reduce the latency of each stage of computation. Ultimately, after multiple tests, the JPEG-LS encoder described in this application achieved a compression rate of 18% to 25%, which greatly improves compression performance compared to the approximately 50% compression rate of traditional JPEG-LS encoders. Attached Figure Description
[0019] Figure 1 This is the context modeling diagram in the JPEG-LS encoder described in this invention; Figure 2 This is a schematic diagram of the JPEG-LS encoder principle described in this invention; Figure 3 This is a flowchart of the JPEG-LS encoder described in this invention. Implementation
[0020] The present invention will be further described in detail below with reference to specific embodiments. Example
[0021] like Figure 1-3 As shown, an implementation method of an FPGA-based JPEG-LS encoder includes the following steps: Context modeling, edge detection, adaptive prediction correction, prediction residual calculation, Golomb coding parameter K calculation, prediction error mapping, Golomb coding of prediction error MErrval, context parameter update, and bitstream concatenation.
[0022] The context modeling includes three parts: gradient calculation, gradient quantization, and index value solving, ultimately yielding the index parameter Q and its sign; that is, obtaining an index parameter Q by comparing the gradient of a pixel with its neighboring pixels. The index parameter Q is used for addressing and updating the parameters A, B, C, and N of the pixel at that point. In this embodiment 1, the clocks included in the context modeling are all changeable clocks: the system clock is 50MHz, and the encoder operating clock is 1MHz.
[0023] Specifically, the gradient calculation process involves calculating the differences D1, D2, and D3 between the adjacent pixels a, b, c, and d of the current pixel x, which are modeled in advance. The gradient quantization process specifically involves quantizing the local gradient value Qi into nine integers (-4, 4), where i = 1, 2, or 3 in the local gradient value Qi. The formula for calculating the local gradient value Qi is:
[0024] Where i = 1, 2, or 3; T1, T2, and T3 are the thresholds for quantizing local gradient values, with values of 3, 7, and 21 respectively; since it is lossless compression, NEAR = 0; The index value is calculated by determining the index parameter Q. Specifically, the process involves reducing the number of vectors with the most local gradient values (9*9*9=729) to 365. The index parameter Q ranges from (0, 365), and its calculation formula is as follows: Q = 9*(9Q1+Q2)+Q3, The sign of the index parameter Q satisfies any of the following conditions: (1) Q1 < 0; (2) Q1 = 0 and Q2 < 0; (3) Q1 = Q2 = 0 and Q3 < 0, then the sign of the index parameter Q is assigned the value -1, otherwise it is 1.
[0025] The edge detection predicts the current pixel x. Specifically, it uses one of the three numbers Ra, Rb, and Ra + Rb - Rc as the initial predicted value Px for the current pixel x.
[0026] The adaptive prediction correction process specifically involves correcting the initial prediction value Px based on the sign of the index parameter Q, the residual correction value C[Q], and the parameter Maxval to obtain the final prediction value; where the parameter Maxval is the maximum value of the number of bits that the image pixels account for. The parameter Maxval is determined by the image pixel precision.
[0027] The process of calculating the prediction residual specifically involves calculating the difference Errval between the image pixel value and the final predicted value. The Golomb coding process sequentially includes the calculation of the Golomb coding parameter K, the mapping of the prediction error MErrval, and the Golomb coding of the mapped prediction error MErrval.
[0028] The calculation formula for the Golomb coding parameter K is: , The dichotomy search method is used for calculation, specifically a three-level calculation. The most common basic algorithm in the prior art is a seven-level calculation. The optimized algorithm in this application uses the dichotomy search for calculation, which is a three-level calculation, saving resources and optimizing the timing.
[0029] The process of mapping the prediction error MErrval is specifically to map the difference Errval into the prediction error MErrval of (0 - 255) for Golomb coding. Since Golomb coding can only encode non-negative integers, and the sign of the quantized prediction residual can be positive or negative and approximately follows a Laplace distribution, and the Golomb-Rice coding of the geometric distribution has an ideal effect, it is necessary to transform the prediction residual distribution into a geometric distribution for mapping, that is, map the difference Errval into the prediction error MErrval of (0 - 255).
[0030] The Golomb coding of the mapped prediction error MErrval specifically includes the following steps: S1: Perform a right shift of k bits on the prediction error MErrval to obtain the quotient q of MErrval divided by k; S2: If q + 2 + k <= LIMIT and q < LIMIT - qbpp - 1, then transfer to S3; if q + 2 + k > LIMIT and q < LIMIT - qbpp - 1, then transfer to S4; if q ≥ LIMIT - qbpp - 1, then transfer to S5; where LIMIT is the maximum length of the Golomb coding codeword, and qbpp is the number of bits required to represent the mapped prediction error MErrval; the most common basic compression algorithm in the prior art is a two-level compression, and the optimized algorithm in this application adopts a three-level compression, greatly improving the compression ratio.
[0031] S3: Perform unary coding on q: first append q 1-bit 0s to the coding bitstream, then append 1-bit 1 to the coding bitstream, and finally append the low k bits of the prediction error MErrval in binary form to the coding bitstream, with the high bits in front and the low bits at the back, and the output coding bitstream length is (q + 1 + k) bit; S4: First, perform unary coding on :q + 1: That is, first append q 1-bit 0s to the encoded bitstream, then append 1 1-bit 1 to the encoded bitstream, and finally append the lower k bits of the prediction error MErrval to the encoded bitstream in binary form, with the high bits in front and the low bits at the back. The output encoded bitstream has a length of (q + 2 + k) bits; S5: First, perform unary coding on LIMIT - qbpp - 1: That is, first append LIMIT - qbpp - 1 1-bit 0s to the encoded bitstream, then append 1 1-bit 1 to the encoded bitstream, and finally append the lower qbpp bits of the prediction error MErrval - 1 to the encoded bitstream in binary form, with the high bits in front and the low bits at the back. The output encoded bitstream has a length of 16 bits.
[0032] For example, when MErrval = 2, according to step S1, q = 0, k = 2, it can be calculated that it meets the conditions (q + 2 + k <= LIMIT, and q < LIMIT - qbpp - 1), then transfer to S3, and perform the above steps in sequence. Append 1 1-bit 1 to the encoded bitstream, and finally append the lower 2 bits of MErrval to the encoded bitstream in binary form, with the high bits in front and the low bits at the back. The encoding bit width is 16 bits, and the output bitstream is output with a one-beat delay. So the output bitstream length is: k + 1 + q = 3; The output encoded bitstream is: 1100000000000000. Since the effective length of the output bitstream is 3 bits, the final output bitstream is 110.
[0033] So the number of effective bits in the bitstream is 3, and 8-bit data is compressed into 3-bit data.
[0034] The process of updating the context parameters is specifically as follows: Each context environment is correspondingly set with a set of context parameters A[Q], B[Q], C[Q], N[Q] to save the corresponding context information; After encoding each pixel point, the context parameters A[Q], B[Q], C[Q], N[Q] are updated in real time so that the context parameters A[Q], B[Q], C[Q], N[Q] can match the context environment of the current pixel to the greatest extent and improve the compression coding performance of the current pixel x. Among them, A[Q] is an accumulator for the absolute value of the quantization residual, and its function is to estimate the Golomb coding parameter K. B[Q] is an accumulator for the reconstructed residual, and its function is to help calculate the prediction deviation C[Q]. C[Q] stores the average prediction deviation value corresponding to this context environment and is used to correct the preliminary prediction value Px of the pixel. N[Q] is a counter for the corresponding context environment and stores the number of times this context environment appears.
[0035] The bitstream concatenation includes concatenating the remaining bitstream from the previous concatenation and concatenating the current encoded bitstream to obtain the final encoded bitstream. The bitstream concatenation is performed in 32-bit units, and encoded bitstreams with less than 32 bits are temporarily stored.
[0036] Compression ratio refers to the ratio of the amount of information in the compressed image to the amount of information in the original image. The test image in this application is 196*92 resolution, and the four ARGB channels are all randomly selected. Taking one test result as an example, the input data is 442368 bits, and the compressed encoded stream is 90848 bits. Therefore, the compression ratio can be calculated to be 20.5%. After multiple tests, the compression ratio of this application can be basically stabilized at 18% ~ 25%, which greatly improves the compression performance of the encoder.
Claims
1. A method for implementing a JPEG-LS encoder based on FPGA, characterized in that, The method successively includes context modeling, edge detection, adaptive prediction correction, prediction residual calculation, calculation of Golomb coding parameter K, mapping of prediction error MErrval, Golomb coding of prediction error MErrval, context parameter update, and bitstream splicing; The algorithm of the Golomb coding is three-level compression; The calculation method of the Golomb coding parameter K is as follows: , The calculation is performed by using the binary search method, specifically three-level calculation; The process of performing Golomb coding on the prediction error MErrval specifically includes the following steps: S1: Perform a right shift of k bits on the prediction error MErrval to obtain the quotient q of MErrval divided by k; S2: If q + 2 + k <= LIMIT and q < LIMIT - qbpp - 1, then transfer to S3; if q + 2 + k > LIMIT and q < LIMIT - qbpp - 1, then transfer to S4; if q ≥ LIMIT - qbpp - 1, then transfer to S5; where LIMIT is the maximum length of the Golomb coding codeword, and qbpp is the number of bits required to represent the mapped prediction error MErrval; S3: Perform unary coding on q: that is, first append q 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low k bits of the prediction error MErrval in binary form to the coding bitstream, with the high bits in front and the low bits at the back; S4: First perform unary coding on q + 1: that is, first append q 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low k bits of the prediction error MErrval in binary form to the coding bitstream, with the high bits in front and the low bits at the back; S5: First perform unary coding on LIMIT - qbpp - 1: that is, first append LIMIT - qbpp - 1 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low qbpp bits of the prediction error MErrval - 1 in binary form to the coding bitstream, with the high bits in front and the low bits at the back.
2. The implementation method according to claim 1, characterized in that, The context modeling includes three parts: gradient calculation, gradient quantization, and index value solution, and finally obtains the index parameter Q and the sign sign of the index parameter Q; the clock included in the context modeling is a clock that can be changed.
3. The implementation method according to claim 2, characterized in that, The process of the gradient calculation is specifically to calculate the differences D1, D2, D3 between the adjacent pixels a, b, c, d of the currently modeled pixel x; The process of the gradient quantization is specifically that the local gradient value Qi is quantized into 9 integers in (-4, 4), where i = 1 or 2 or 3 in the local gradient value Qi; The calculation formula of the local gradient value Qi is: , where i = 1 or 2 or 3; T1, T2, T3 are the thresholds for local gradient value quantization, and the values of T1, T2, T3 are 3, 7, 21 respectively; since it is lossless compression, NEAR = 0; The index value is calculated by finding the index parameter Q. Specifically, the process of calculating the index value involves finding the index with the largest local gradient value. The number of vectors is reduced from 1 to 365, and the index parameter Q ranges from (0, 365). The formula for calculating the index parameter Q is as follows: , The sign of the index parameter Q satisfies any of the following conditions: (1) Q1 < 0; (2) Q1 = 0 and Q2 < 0; (3) Q1 = Q2 = 0, and Q3 < 0. When these conditions are met, the sign of the index parameter Q is assigned -1, otherwise it is 1.
4. The implementation method according to claim 3, characterized in that, The edge detection predicts the current pixel x. Specifically, one of the three numbers Ra, Rb, and Ra + Rb - Rc is used as the preliminary prediction value Px of the current pixel x.
5. The implementation method according to claim 4, characterized in that, The process of adaptive prediction correction is specifically to correct the preliminary prediction value Px based on the sign of the index parameter Q, the residual correction value C[Q], and the parameter Maxval to obtain the final prediction value PX. Where the value of the parameter Maxval is the maximum value of the number of bits occupied by the image pixels.
6. The implementation method according to claim 5, characterized in that, The process of calculating the prediction residual is specifically to calculate the difference Errval between the image pixel value and the final prediction value PX. The process of mapping the prediction error MErrval is specifically to map the difference Errval into a prediction error MErrval of (0 - 255) for Golomb coding. The process of performing Golomb coding on the prediction error MErrval specifically includes the following steps: S1: Perform a right shift of k bits on the prediction error MErrval to obtain the quotient q of MErrval divided by k. S2: If q + 2 + k <= LIMIT and q < LIMIT - qbpp - 1, then go to S3; if q + 2 + k > LIMIT and q < LIMIT - qbpp - 1, then go to S4; if q ≥ LIMIT - qbpp - 1, then go to S5. Here, LIMIT is the maximum length of the Golomb coding codeword, and qbpp is the number of bits required to represent the mapped prediction error MErrval. S3: Perform unary coding on q: First, append q 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low k bits of the prediction error MErrval in binary form to the coding bitstream, with the high bits in front and the low bits at the back. S4: First, perform unary coding on q + 1: First, append q 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low k bits of the prediction error MErrval in binary form to the coding bitstream, with the high bits in front and the low bits at the back. S5: First, perform unary coding on LIMIT - qbpp - 1: First, append LIMIT - qbpp - 1 1-bit 0s to the coding bitstream, then append 1 1-bit 1 to the coding bitstream, and finally append the low qbpp bits of the prediction error MErrval - 1 in binary form to the coding bitstream, with the high bits in front and the low bits at the back.
7. The implementation method according to claim 6, characterized in that, The process of updating the context parameters is as follows: each context environment is set with a set of context parameters A[Q], B[Q], C[Q], and N[Q] to store the corresponding context information; after each pixel is encoded, the context parameters A[Q], B[Q], C[Q], and N[Q] are updated in real time so that the context parameters A[Q], B[Q], C[Q], and N[Q] can match the current pixel's context environment to the greatest extent, thereby improving the compression encoding performance of the current pixel x.
8. The implementation method according to claim 7, characterized in that, The bitstream concatenation includes concatenating the remaining bitstream from the previous concatenation and concatenating the current encoded bitstream to obtain the final encoded bitstream. The bitstream concatenation is performed in 32-bit units, and encoded bitstreams with less than 32 bits are temporarily stored.