A method and device for generating coding blocks for image compression

By using two storage devices to process wavelet subband data separately in the JPEG 2000 encoding block generation module, the problem of not being able to adapt to different input sizes in the prior art is solved, and the correct output of the encoded data and the processing speed are improved.

CN119653086BActive Publication Date: 2025-05-13ZHONGKE YIHAI MICROELECTRONICS TECH (CHENGDU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510157278.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-05-13
Estimated Expiration
2045-02-13

AI Technical Summary

Technical Problem

The existing JPEG 2000 encoding block generation module cannot adapt to image data of different input sizes, resulting in an error in encoding data.

Method used

Two storage devices are used to store and process wavelet subband data separately, and the write and read selection signals of the storage device are controlled by writing and reading selection signals to ensure that the data does not cross the boundary when the size changes.

Benefits of technology

The correct output of the encoded data is realized when the input data size changes, avoiding the problem of data out of bounds and improving the adaptability and speed of encoding processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119653086B_ABST
    Figure CN119653086B_ABST
Patent Text Reader

Abstract

The present invention provides a method for generating coding blocks for image compression, including using two storage devices to store wavelet subband data respectively, wherein one of the storage devices is used to store the currently entered wavelet subband data; the other storage device is used to process the last written wavelet subband data; the storage device performing the write operation performs the operation of writing the wavelet subband data according to the write selection signal; the storage device performing the read operation performs the operation of reading the wavelet subband data according to the read selection signal; when the length of the wavelet subband data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control the other storage device to perform the write operation; when the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control the other storage device to perform the read operation. The present invention also provides a device for generating coding blocks for image compression.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular to a method and device for generating a coding block for image compression. Background Art

[0002] JPEG 2000 is a still image compression standard, formally known as ISO15444, which is mainly used in the fields of medicine, digital film, aerospace, etc. It is a new generation of still image compression standard developed by ISO / IEC JTC 1 SC29 standardization group. As an upgraded version of JPEG, JPEG 2000 has a compression rate about 30% higher than JPEG and still has good display effect at low bit rate.

[0003] The JPEG 2000 encoder is highly complex and its software implementation is slow, which cannot meet the real-time requirements. Therefore, in order to accelerate the encoding process, FPGA is used in the prior art to accelerate the image encoding process to achieve real-time processing performance.

[0004] In JPEG 2000, the most basic processing unit of an image is a coding block, which is usually 32x32 pixels or 64x64 pixels in size. However, the resolution of an image is varied, and the size after wavelet transformation is also varied, so a module is needed to convert wavelet subbands into coding blocks for bit plane coding.

[0005] The conventional coding block generation module has a fixed input size. After the module is initially completed, it cannot be changed during operation and needs to be reinitialized to work. This method is time-consuming. Taking 128*128 pixel input image data as an example, the general 64*64 coding block generation module will convert it into 4 coding blocks; when the new size image data (such as 256*256) enters, it will still generate 4 coding blocks according to the original size, which will lead to incorrect output.

[0006] Therefore, it is necessary to develop a new coding block generation method that can adapt to the coding output of image data of different input sizes. Summary of the invention

[0007] The present invention provides a method and device for generating coding blocks for image compression. In the coding process, the coding data error will not be caused by the size change of the input data, the adaptability is stronger, and the coding processing speed is fast.

[0008] Other purposes and advantages of the present invention can be further understood from the technical features disclosed in the present invention.

[0009] To achieve one or part or all of the above purposes or other purposes, a technical solution of the present invention provides a method for generating coding blocks for image compression, including using two storage devices to store wavelet sub-band data respectively, wherein one of the storage devices is used to store the currently entered wavelet sub-band data; the other storage device is used to process the wavelet sub-band data written last time; the two storage devices are respectively used for writing data and reading data in a data operation cycle; the storage device performing the write operation performs the operation of writing the wavelet sub-band data according to a write selection signal; the storage device performing the read operation performs the operation of reading the wavelet sub-band data according to a read selection signal; when the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control the other storage device to perform the write operation; when the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control the other storage device to perform the read operation. The technical effect produced by the present invention is different from that produced by the prior art in that wavelet sub-band data is written and read respectively through two storage devices, and the storage device is controlled according to a write address upper limit control signal when performing a write operation, and is controlled according to a read address upper limit control signal when performing a read operation. After the write data size changes, the read data changes according to the read data address upper limit control signal, and will not change instantaneously due to a change in the input data size, thereby ensuring that data reading will not cross the boundary.

[0010] When the storage device writes the wavelet sub-band data, it caches the size of the written data and updates the write address upper limit signal and the write selection signal.

[0011] The read address upper limit selection signal is updated according to the write address upper limit selection signal.

[0012] After the storage device completes the write operation, a write address upper limit selection signal is registered, and the registered write address upper limit selection signal is used as a read address upper limit selection signal for the storage device that completes the write operation to perform a read operation.

[0013] The upper limit of the read address and the upper limit of the write address are: the upper limit of the number of rows is the maximum number of rows of the output coding block data size, and the upper limit of the single row of data is the number of pixels in the wavelet subband data row currently written.

[0014] The wavelet sub-band data are sequentially written into the storage device in the order of rows. When a piece of data is written into the storage device, the write address of the storage device is increased by one.

[0015] The data in the storage device is read, and the coded block data is taken out in order from left to right and from top to bottom.

[0016] The coding block generation method for image compression is used to divide the quantized wavelet subband data in the JPGE 2000 image compression standard into coding blocks of the same size.

[0017] A technical solution of the invention provides a coding block generation device for image compression, which is used to implement the above-mentioned coding block generation method for image compression. The coding block generation device is used to receive wavelet sub-band data. The coding block generation device includes a first storage device and a second storage device. The data receiving ends of the first storage device and the second storage device are connected to the same data line and the same signal line, and are used to receive input wavelet sub-band data and write selection signals; the data sending ends of the first storage device and the second storage device are connected to the same data line and the same signal line, and are used to output coding block data and receive read selection signals.

[0018] The first storage device and the second storage device are respectively used for writing data and reading data in a data operation cycle; the storage device performing the write operation performs the operation of writing the wavelet sub-band data according to the write selection signal; the storage device performing the read operation performs the operation of reading the wavelet sub-band data according to the read selection signal; when the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control the other storage device to perform the write operation; when the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control the other storage device to perform the read operation.

[0019] Compared with the prior art, the beneficial effects of the present invention mainly include: 1. Wavelet sub-band data is written and read respectively through two storage devices, and the storage device is controlled according to the write address upper limit control signal when performing a write operation, and is controlled according to the read address upper limit control signal when performing a read operation. After the write data size changes, the read data changes according to the read data address upper limit control signal, and will not change instantly due to a change in the input data size, thereby ensuring that data reading will not cross the boundary.

[0020] 2. After the input data size is changed, the write address does not need to wait until the last coding block is completely generated before the input wavelet subband data size can be changed. The scheme of the present invention can achieve seamless change of the input data size, and the wavelet subband data of the current size can be input along with the wavelet subband data of the previous size.

[0021] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the specific embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 It is a schematic diagram of the JPGE 2000 image processing and encoding process of the present invention.

[0024] Figure 2 It is a schematic diagram of converting sub-band data of different sizes into a coding block of a single output size according to the present invention.

[0025] Figure 3 It is a schematic diagram of a coding block generating device of the present invention. DETAILED DESCRIPTION

[0026] The above and other technical contents, features and effects of the present invention will be clearly presented in the following detailed description of a preferred embodiment with reference to the drawings. The directional terms mentioned in the following embodiments, such as up, down, left, right, front or back, etc., are only referenced to the directions of the attached drawings. Therefore, the directional terms used are used to illustrate and not to limit the present invention.

[0027] Example 1

[0028] Embodiment 1 provides a method for generating coding blocks for image compression, including using two storage devices to store wavelet sub-band data respectively, wherein one of the storage devices is used to store the currently entered wavelet sub-band data; the other storage device is used to process the wavelet sub-band data written last time; the two storage devices are respectively used for writing data and reading data in a data operation cycle; the storage device performing the write operation performs the operation of writing the wavelet sub-band data according to a write selection signal; the storage device performing the read operation performs the operation of reading the wavelet sub-band data according to a read selection signal; when the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control the other storage device to perform the write operation; when the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control the other storage device to perform the read operation.

[0029] The coding block generation method in Example 1 writes and reads wavelet subband data respectively through two storage devices, and the storage device is controlled according to the write address upper limit control signal when performing a write operation, and is controlled according to the read address upper limit control signal when performing a read operation. After the write data size changes, the read data changes according to the read data address upper limit control signal, and will not change instantly due to a change in the input data size, thereby ensuring that the data reading will not cross the boundary.

[0030] The following is a detailed description of the image compression coding block generation method of the present invention in conjunction with the accompanying drawings. Figure 1 ,JPGE 2000 image coding process includes the following steps: ,After preprocessing, the original image enters the discrete wavelet transform (DWT) module to ,independently process each color component, decompose the original image into ,multiple sub-bands at different resolution levels, and the quantized ,wavelet coefficients are divided into coding blocks of the same size, ,which are commonly 64*64, 32*32 or 16*16. ,Finally, each coding block will undergo separate entropy coding (Tier-1 and Tier-2) to generate a compressed code stream.

[0031] The coding block generation method in Embodiment 1 is used to generate a coding block of a fixed size and acts between the quantization device and the Tier-1 encoder, see Figure 2 In the present invention, generating a coding block refers to generating sub-band data of different sizes into a coding block of a single size. The sub-band data size can be 128*128, 64*64, 32*32, etc., and the common size of the coding block is 64*64, 32*32 or 16*16. Example 1 takes the generation of a 32*32 coding block as an example for description. The method specifically includes the following:

[0032] Two storage devices are provided (Example 1 takes two groups of random access memories RAM as an example, other storage devices can perform similar functions and can also be used as storage devices for achieving the purpose of the present invention, which is not limited here). The two RAMs are used to store wavelet sub-band data respectively, one RAM is used to store the currently entered wavelet sub-band data; the other RAM is used to process the last written wavelet sub-band data; the two RAMs are used to write data and read data respectively in one data operation cycle.

[0033] In order to meet the requirements of real-time processing, the coding block generation method in Example 1 adopts a ping-pong operation to store wavelet subband data. The ping-pong operation here refers to a pipeline operation method that can improve the processing speed of FPGA or digital chips. Specifically, two storage devices are used to store the data to be processed. First, the first RAM stores the current incoming data. After the first RAM storage is completed, the group of data is read out and processed. At the same time, the second RAM caches the current incoming data. When the second RAM caches, the group of data is read out and processed. At the same time, the first RAM caches the current incoming data. This cycle is repeated to process data uninterruptedly. That is, one RAM stores the current incoming data, and the other RAM processes the last written data. Taking the input of 32*32 data as an example, one RAM stores the current 32 lines of data, and the other RAM reads the last stored 32 lines of data according to the coding block size of 32*32.

[0034] The storage device that performs a write operation performs a write operation of the wavelet sub-band data according to a write selection signal; the storage device that performs a read operation performs a read operation of the wavelet sub-band data according to a read selection signal.

[0035] Specifically, the write RAM uses the write RAM selection signal RAM_SEL_WR and the write address upper limit selection signal N_WR; the read RAM uses the read RAM selection signal RAM_SEL_RD and the read address upper limit selection signal N_RD. The read and write operations of the two RAMs are controlled by separate read and write selection signals.

[0036] When the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control the other storage device to perform a write operation; when the read address of the storage device performing a read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control the other storage device to perform a read operation.

[0037] For the data writing step: the wavelet sub-band data is written into the write RAM in order of rows. When a data is written to the write RAM, the write address of the storage device is increased by one. When the storage device writes the wavelet sub-band data, it caches the size of the written data and updates the write address upper limit signal N_WR and the write selection signal RAM_SEL_WR. The write address upper limit selection signal N_WR is the maximum number of rows of the output coding block × the number of pixel points of the wavelet sub-band rows currently being written. Taking the output coding block of size 32*32 as an example, when the input wavelet sub-band data size is 128*128, the write address upper limit selection signal N_WR is 32*128. For write RAM, the write address upper limit selection signal N_WR is updated with the input data (taking the 32*32 encoding block output size as an example, when the input data changes from 64*64 to 128*128, the write address upper limit is updated to 32*128 along with the new input data). When the write data address reaches N_WR, the write selection signal RAM_SEL_WR is immediately switched, from writing the first RAM to writing the second RAM or from writing the second RAM to writing the first RAM. Since the write address upper limit selection signal will be updated according to the written data, when new size data is input, the RAM will write the input new size data according to the updated write address upper limit selection signal to achieve seamless data writing.

[0038] For the data reading step: read the data in the read RAM, and take out the coded block data in order from left to right and from top to bottom. For the read RAM, the write address upper limit selection signal N_WR is registered when the RAM is written. The N_WR registered here can be used as the read operation address upper limit selection signal N_RD when the RAM performs a read operation. When the read address reaches N_RD, the read address selection signal RAM_SEL_RD is immediately switched, from reading the first RAM to reading the second RAM or from reading the second RAM to reading the first RAM. Since the read address upper limit selection signal is updated according to the write address upper limit selection signal, that is, the write address upper limit signal will be cached as the read address upper limit signal only after the write operation is completed, the read operation will not change instantly due to the change in the size of the write address, and it can be ensured that the data will not cross the boundary when reading.

[0039] The data writing step and the data reading step in Example 1 can realize instantaneous transmission when the data transmission does not need to rely on the completion of the previous step, and can also ensure that the data reading will not have the problem of crossing the boundary. The ping-pong operation in the prior art uses the same read-write RAM switching flag and the read-write address upper limit N to perform ping-pong operation on the wavelet subband data, where N=32*the number of pixel points of the wavelet subband row currently written. Specifically: the read-write RAM uses the same switching flag RAM_SEL, and the default value of RAM_SEL is 0, that is, when the first RAM input address reaches N, RAM_SEL switches to 1, starts the data reading of the first RAM, and writes the incoming wavelet to the second RAM; when the second RAM input address reaches the switching boundary N, RAM_SEL switches to 0, starts the data reading of the second RAM, and writes the incoming wavelet to the first RAM. This cycle is repeated to complete the processing of all data.

[0040] This method is simple to process and is applicable to wavelet coefficients of the same input size. However, when wavelet sub-band data of different sizes enter continuously, data may be lost and conversion may be abnormal. It is necessary to wait until the processing of the wavelet coefficients of the previous size is completed before new processing. The reason is that when this method is used, the read data may be overwritten. Take the input of the coding block generation device from 64*64 sub-band to 128*128 sub-band as an example. Assume that the 128*128 sub-band data has been written to the last 32 rows at this time, and the read-write RAM group switching flag RAM_SEL is switched to 0. At this time, the second group of data should be read out; at the same time, the 128*128 sub-band data is being written to the first group of data, and the read-write address upper limit N is immediately updated from 32*64 to 32*128. At this time, the reading data may be wrong. The reading data should be read to the 32*64 interval range of the last 64*64 sub-band, but the upper limit of the read address is updated immediately, and the data will be read to the 32*128 range, while the 32* (65-128) data has not been written, which will cause the encoding size to be abnormal. In this way, a complete wavelet sub-band processing (reading data) must be completed before a new conversion can be started.

[0041] The coding block generation method for image compression in Embodiment 1 is used to divide the quantized wavelet subband data into coding blocks of the same size in the JPGE 2000 image compression standard.

[0042] Example 2

[0043] Embodiment 2 provides a coding block generation device for image compression, which is used to implement the coding block generation method for image compression in embodiment 1. The coding block generation device is used to receive wavelet subband data to generate a coding block of a fixed size. Figure 3The coding block generating device comprises a first storage device RAM1 and a second storage device RAM2, wherein the data receiving ends of the first storage device RAM1 and the second storage device RAM2 are connected to the same data line and the same signal line for receiving input wavelet subband data ( Figure 3 The wavelet subband data input in) and the write select signal ( Figure 3 The data sending end of the first storage device RAM1 and the second storage device RAM2 are connected to the same data line and the same signal line for outputting the coded block data ( Figure 3 coded block data in) and receiving a read select signal ( Figure 3 sel_rd in the .

[0044] The first storage device RAM1 and the second storage device RAM2 are used for writing data and reading data respectively in a data operation cycle; the storage device performing the write operation performs the operation of writing wavelet subband data according to the write selection signal RAM_sel_wr; the storage device performing the read operation performs the operation of reading wavelet subband data according to the read selection signal RAM_sel_rd; when the length of the wavelet subband data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control another storage device to perform the write operation; when the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control another storage device to perform the read operation. Using the image compression coding block generation device of embodiment 2, image ping-pong operation can be performed.

[0045] As an optional solution, when the storage device writes wavelet sub-band data, the size of the write data is cached, and the write address upper limit signal and the write selection signal are updated. The read address upper limit selection signal is updated according to the write address upper limit selection signal. After the storage device completes the write operation, the write address upper limit selection signal is stored, and the stored write address upper limit selection signal is used as the read address upper limit selection signal for the storage device that has completed the write operation to perform the read operation. Since the read address upper limit selection signal will not be updated immediately, even if data of different sizes are written continuously, the read address upper limit signal will not be updated until the data is written. The read operation will not be switched immediately, and the problem of out-of-bounds reading of data will not occur when reading data.

[0046] The above is a detailed introduction to a method and device for generating a coding block for image compression provided by the present invention. This article uses specific examples to illustrate the structure and working principle of the present invention. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A method for generating a coding block for image compression, characterized in that: The coding block generation method for image compression is used to divide the quantized wavelet subband data in the JPGE 2000 image compression standard into coding blocks of the same size; The method comprises using two storage devices to store wavelet sub-band data respectively, wherein one storage device is used to store the currently input wavelet sub-band data; the other storage device is used to process the last written wavelet sub-band data; the two storage devices are used to write data and read data respectively in one data operation cycle; The storage device performing the write operation performs the operation of writing the wavelet sub-band data according to the write selection signal; The storage device performing the read operation performs the operation of reading the wavelet sub-band data according to the read selection signal; When the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control another storage device to perform a write operation; When the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control another storage device to perform the read operation; When the storage device writes the wavelet sub-band data, the size of the written data is cached and a write address upper limit signal and a write selection signal are updated; After the storage device completes the write operation, the write address upper limit selection signal is stored, and the read address upper limit selection signal is updated according to the write address upper limit selection signal.

2. The method for generating a coding block for image compression according to claim 1, characterized in that: The registered write address upper limit selection signal is used as a read address upper limit selection signal for the storage device that has completed the write operation to perform a read operation.

3. The method for generating a coding block for image compression according to claim 1, characterized in that: The upper limit of the read address and the upper limit of the write address are: the upper limit of the number of rows is the maximum number of rows of the output coding block data size, and the upper limit of the single row of data is the number of pixels in the wavelet subband data row currently written.

4. The method for generating a coding block for image compression according to claim 1, characterized in that: The wavelet sub-band data are sequentially written into the storage device in the order of rows. When a piece of data is written into the storage device, the write address of the storage device is increased by one.

5. The method for generating a coding block for image compression according to claim 4, characterized in that: The data in the storage device is read, and the coded block data is taken out in order from left to right and from top to bottom.

6. A coding block generation device for image compression, used to implement the coding block generation method for image compression according to any one of claims 1 to 5, characterized in that: The coding block generation device is used to receive wavelet sub-band data, and the coding block generation device includes a first storage device and a second storage device, wherein data receiving ends of the first storage device and the second storage device are connected to the same data line and the same signal line, and are used to receive input wavelet sub-band data and a write selection signal; The data sending ends of the first storage device and the second storage device are connected to the same data line and the same signal line, and are used to output the coding block data and receive the read selection signal.

7. The device for generating a coding block for image compression according to claim 6, characterized in that: The first storage device and the second storage device are used for writing data and reading data respectively in one data operation cycle; The storage device performing the write operation performs the operation of writing the wavelet sub-band data according to the write selection signal; The storage device performing the read operation performs the operation of reading the wavelet sub-band data according to the read selection signal; When the length of the wavelet sub-band data written by the current storage device reaches the upper limit of the write address, the write selection signal is immediately switched to control another storage device to perform a write operation; When the read address of the storage device performing the read operation reaches the upper limit of the read address, the read selection signal is immediately switched to control another storage device to perform the read operation.

Citation Information

Patent Citations

  • VLSI image compression encoder based on wavelet transformation

    CN101404772A

  • Apparatus and method for pre-storage processing before image data compression

    CN1731448A