CN116600106A - Image compression method and system capable of dynamically adjusting compression rate - Google Patents

Image compression method and system capable of dynamically adjusting compression rate Download PDF

Info

Publication number
CN116600106A
CN116600106A CN202310562649.1A CN202310562649A CN116600106A CN 116600106 A CN116600106 A CN 116600106A CN 202310562649 A CN202310562649 A CN 202310562649A CN 116600106 A CN116600106 A CN 116600106A
Authority
CN
China
Prior art keywords
frequency domain
domain information
image
compression
information block
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
CN202310562649.1A
Other languages
Chinese (zh)
Other versions
CN116600106B (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.)
Shenzhen Juyuan Shixin Technology Co ltd
Original Assignee
Shenzhen Juyuan Shixin Technology Co ltd
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 Shenzhen Juyuan Shixin Technology Co ltd filed Critical Shenzhen Juyuan Shixin Technology Co ltd
Priority to CN202310562649.1A priority Critical patent/CN116600106B/en
Publication of CN116600106A publication Critical patent/CN116600106A/en
Application granted granted Critical
Publication of CN116600106B publication Critical patent/CN116600106B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/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/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • 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/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • 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/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/192Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding the adaptation method, adaptation tool or adaptation type being iterative or recursive
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an image compression method and system for dynamically adjusting compression rate, wherein the method comprises the following steps: acquiring a serial video stream and acquiring image frame data based on the serial video stream; acquiring a frequency domain information block based on the image frame data, and dynamically quantizing the frequency domain information block for adjusting the compression rate to acquire a quantized frequency domain information block; and carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream. The invention carries out dynamic quantization on the frequency domain information blocks, then carries out compression coding on the image frames based on the quantized frequency domain information blocks to obtain the compressed code stream of the video, and can realize the maximum guarantee of the image quality on the premise of avoiding data overflow by adopting dynamic adjustment of the compression rate under the condition of fixed storage space so as to ensure the balance between the storage space and the image quality.

Description

Image compression method and system capable of dynamically adjusting compression rate
Technical Field
The present invention relates to the field of image compression technologies, and in particular, to an image compression method and system capable of dynamically adjusting compression rate.
Background
The existing common compression standards of static images are JPEG, JPER-LS, JPEG-2000, PNG, TIFF and the like, and the compression standards are organically combined based on various compression methods, and mainly utilize time-space redundancy, coding redundancy, visual nonsensitive information and the like for compression processing.
Aiming at different types of image redundant information, special compression and coding methods are adopted to process the image redundant information in the prior art. A common method for eliminating space redundancy is dictionary coding, which is to collect character combinations input by history, store the combinations in a dictionary or a memory, and express the character string input currently by utilizing the character string. The common method for eliminating the time redundancy is to store the aberration of two adjacent pictures by a static compression method, and the effect of data compression can be achieved. The reason for coding redundancy is that the inefficient symbology occupies a large amount of resources, so that more efficient symbologies such as huffman coding can use as little redundant data to code to increase the compression ratio. A common method in processing visually non-sensitive information is to transform the image information from spatial to frequency domain, such as DCT (Discrete Cosine Transform ) and DWT (Discrete Wavelet Transform, discrete wavelet transform), etc. The human eye is more sensitive to low frequency information and less sensitive to high frequency information. Therefore, the high-frequency information is appropriately selected and removed by the operations such as the conversion and quantization of the spatial domain, and the data amount of the image storage can be reduced with less influence on the vision.
In practical application scenarios, the redundant information of the image is uncertain, which results in that the compression rate of the compression standard is uncertain. In order to solve the above technical problems, in the prior art, algorithms such as JPEG and the like can obtain a desired compression rate by manually adjusting the image quality, but cannot process a serial image, that is, the image quality and the compression rate cannot be effectively adjusted in a limited storage space, so as to achieve the purpose of compression storage.
Accordingly, there is a need in the art for improvement.
Disclosure of Invention
The invention aims to solve the technical problems that the serial image cannot be processed in the prior art, namely, the quality of the image cannot be effectively adjusted in a limited storage space, the compression rate cannot be balanced, and the compression storage is realized.
The technical scheme adopted by the invention for solving the problems is as follows:
in a first aspect, an embodiment of the present invention provides an image compression method for dynamically adjusting a compression rate, where the method includes:
acquiring a serial video stream and acquiring image frame data based on the serial video stream;
acquiring a frequency domain information block based on the image frame data, and dynamically quantizing the frequency domain information block for adjusting the compression rate to acquire a quantized frequency domain information block;
and carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In one implementation, the acquiring the frequency domain information block based on the image frame data includes:
and performing discrete cosine transform on the image frame data and acquiring frequency domain information blocks of the image frame data.
In one implementation, the dynamically quantizing the frequency domain information block for adjusting a compression rate to obtain a quantized frequency domain information block includes:
acquiring adjustment parameters, and calculating quantization parameters based on the adjustment parameters and a standard quantization table;
acquiring a dynamic adjustment quantization table according to the quantization parameter;
and carrying out quantization adjustment on the frequency domain information block based on the dynamic adjustment quantization table to obtain a quantized frequency domain information block.
In one implementation, the compressing encoding the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream includes:
performing ZigZag conversion on the quantized frequency domain information block to obtain a one-dimensional quantized frequency domain information block;
and carrying out entropy coding on the one-dimensional quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In one implementation, the method further comprises:
monitoring the storage space to obtain the utilization rate of the storage space;
and dynamically adjusting the quantization parameter based on the storage space utilization.
In one implementation, the dynamically adjusting the quantization parameter based on the storage space utilization includes:
if the storage space utilization rate is higher than a first preset value, the quantization parameter is increased;
and if the storage space utilization rate is lower than a second preset value, reducing the quantization parameter.
In one implementation, the method further comprises:
and adding a quantization degree header into the compressed code stream.
In a second aspect, an embodiment of the present invention further provides an image compression system for dynamically adjusting a compression rate, where the system includes:
the acquisition module is used for acquiring a serial video stream and acquiring image frame data based on the serial video stream;
the quantization module is used for acquiring a frequency domain information block based on the image frame data, and carrying out dynamic quantization for adjusting the compression rate on the frequency domain information block to acquire a quantized frequency domain information block;
and the compression coding module is used for carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In one implementation, the acquisition module includes:
and the first transformation unit is used for performing discrete cosine transformation on the image frame data and acquiring frequency domain information blocks of the image frame data.
In one implementation, the quantization module includes:
the calculating unit is used for acquiring the adjusting parameters and calculating quantization parameters based on the adjusting parameters and the standard quantization table;
the acquisition unit is used for acquiring a dynamic adjustment quantization table according to the quantization parameter;
and the quantization unit is used for carrying out quantization adjustment on the frequency domain information block based on the dynamic quantization table to obtain a quantized frequency domain information block.
In one implementation, the compression encoding module includes:
the second transformation unit is used for performing ZigZag transformation on the quantized frequency domain information block to obtain a one-dimensional quantized frequency domain information block;
and the encoding unit is used for entropy encoding the image frame data based on the one-dimensional quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In one implementation, the system further comprises:
the monitoring module is used for monitoring the storage space and acquiring the utilization rate of the storage space;
and the adjusting unit is used for dynamically adjusting the quantization parameter based on the storage space utilization rate.
In one implementation, the adjustment unit includes:
the first adjusting subunit is used for increasing the quantization parameter if the storage space utilization rate is higher than a first preset value;
and the second adjustment subunit is used for reducing the quantization parameter if the storage space utilization rate is lower than a second preset value.
In one implementation, the system further comprises:
and the header module is used for adding the quantization degree header into the compressed code stream.
In a third aspect, an embodiment of the present invention further provides a terminal device, including a memory, and one or more programs, where the one or more programs are stored in the memory, and configured to be executed by the one or more processors, where the one or more programs include an image compression method for performing the dynamic adjustment of compression rate according to any one of the above.
In a fourth aspect, embodiments of the present invention also provide a non-transitory computer-readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the image compression method of dynamically adjusting a compression rate as set forth in any one of the above.
The invention has the beneficial effects that: compared with the prior art, the invention relates to an image compression method and system for dynamically adjusting compression rate. Firstly, acquiring a serial video stream, and acquiring image frame data based on the serial video stream; then, based on the image frame data, obtaining a frequency domain information block, and carrying out dynamic quantization for adjusting the compression rate on the frequency domain information block to obtain a quantized frequency domain information block; and finally, carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream. After the frequency domain information block is obtained, the dynamic quantization adjustment is carried out on the frequency domain information block, then the image frame is compressed and encoded based on the quantized frequency domain information block, and finally the compressed code stream of the video stream is obtained, and the compression rate can be dynamically kept at a fixed level by dynamically adjusting the image quality. Under the condition of fixed storage space, the invention can ensure the quality of the image to the greatest extent on the premise of avoiding data overflow by adopting dynamic adjustment of the compression rate, and realizes the balance between the storage space and the image quality.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present invention, and other drawings may be obtained according to the drawings without inventive effort to those skilled in the art.
Fig. 1 is a flow chart of an image compression method for dynamically adjusting compression rate according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an image compression method for dynamically adjusting a compression rate according to an embodiment of the present invention.
Fig. 3 is a schematic block diagram of an image compression system for dynamically adjusting compression rate according to an embodiment of the present invention.
Fig. 4 is a schematic block diagram of an internal structure of a terminal device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more clear and clear, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
It should be noted that, if directional indications (such as up, down, left, right, front, and rear … …) are included in the embodiments of the present invention, the directional indications are merely used to explain the relative positional relationship, movement conditions, etc. between the components in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are correspondingly changed.
The embodiment provides an image compression method capable of dynamically adjusting compression rate, by which compression of serial images can be achieved. In the implementation, firstly, a serial video stream is acquired, and image frame data is acquired based on the serial video stream; then, obtaining a frequency domain information block based on the image frame data, and carrying out dynamic quantization for adjusting the compression rate on the frequency domain information block to obtain a quantized frequency domain information block; and finally, carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream. The invention carries out dynamic quantization on the frequency domain information block, then carries out compression coding processing on the image based on the quantized frequency domain information block to obtain the compressed code stream of the video to be compressed, and can ensure the quality of the image to the greatest extent on the premise of avoiding data overflow by adopting the dynamic adjustment of the compression rate under the condition of fixed storage space so as to ensure the balance between the storage space and the quality of the image.
Exemplary method
The embodiment provides an image compression method capable of dynamically adjusting compression rate, which can be applied to terminal equipment. As shown in fig. 1, the method includes:
step S100, acquiring a serial video stream and acquiring image frame data based on the serial video stream.
In this embodiment, a video stream to be subjected to image compression is first acquired, and then the video stream is subjected to framing processing so as to acquire image frame data. And carrying out framing treatment on the video to be compressed to obtain image frame data, so that different quantization parameters are adopted for each frame of image to adjust the compression rate, and the balance of the picture quality and the storage space is realized.
In one implementation, the image frame data is discrete cosine transformed and frequency domain information blocks of the image frame data are obtained. Specifically, the image frame data is discrete cosine transformed with 8×8 blocks, and the spatial domain information is converted into frequency domain information, thereby obtaining frequency domain information blocks of the image frame data. The discrete cosine transform has a good degree of frequency domain energy concentration, i.e. it is able to concentrate more important information in the image together. By processing each frame of image by discrete cosine transform, the image with higher energy is obtained on the premise of not damaging key information in the source video in the image compression process, that is to say, the frame image with higher quality is obtained, and the image is ensured to have high quality after compression as far as possible.
Step 200, obtaining a frequency domain information block based on the image frame data, and dynamically quantizing the frequency domain information block for adjusting the compression rate to obtain a quantized frequency domain information block.
In this embodiment, after obtaining image frame data, DCT processing is performed on the image frame data to obtain frequency domain information blocks, dynamic quantization with a compression rate is performed on the frequency domain information blocks to obtain quantized frequency domain information blocks, and compression encoding is performed on an image through the quantized frequency domain information blocks.
In one implementation, an adjustment parameter alpha is obtained, and a quantization parameter beta is calculated based on the adjustment parameter alpha and a standard quantization table; then, a dynamic adjustment quantization table is obtained according to the quantization parameter beta; and carrying out quantization adjustment on the frequency domain information block based on the dynamic adjustment quantization table to obtain a quantized frequency domain information block.
Specifically, after the image frame data is input to the encoder, DCT (Discrete Cosine Transform ) processing is performed in 8×8 blocks, and the spatial domain information is converted into frequency domain information, so that each data of the 8×8 frequency domain information blocks is quantized with different quantization parameters. The quantization parameter is dynamically adjusted based on the adjustment parameter and a standard quantization table. According to the compression quality of the compression algorithm, defining a regulating parameter alpha, wherein the calculating mode is that
α= (100-Quality) ×2, multiplied by 2, is to obtain higher numerical accuracy when designing hardware. Based on the adjusting parameter alpha, a quantization table Q adaptively adjusted according to the storage space can be obtained based on a JPEG standard quantization table as shown in table 1 adaptive The calculation mode is that
Q adaptive =(α·Q standard +50)/100≈IntegerRound(β·Q standard ) The method comprises the steps of carrying out a first treatment on the surface of the The compression Quality and the standard quantization table Q can be obtained by combining the adjusting parameters and the self-adaptive adjustment quantization table calculation formula std The relation between the two parameters can further obtain a quantization parameter beta, and the purpose of controlling the compression quality is achieved by adjusting the numerical value of the parameter control quantization table. And the frequency domain information block F is quantized by using a dynamically adjusted quantization table Qadaptive, and the quantized result is rounded to obtain a final quantized frequency domain information block.
Table 1 standard quantization table.
In one implementation, a storage space is monitored, and a storage space utilization rate is obtained; and dynamically adjusting the quantization parameter based on the storage space utilization. The quantization parameter of each frame of image is dynamically adjusted in real time based on the utilization rate of the storage space, so that the quality of the image is ensured to the greatest extent on the premise of avoiding data overflow under the condition of fixed storage space, and the balance between the storage space and the image quality is achieved.
In one implementation manner, if the storage space utilization rate is higher than a first preset value, the quantization parameter is increased, and the quantization parameter is used for reflecting the magnitude of the compression rate; and if the storage space utilization rate is lower than a second preset value, reducing the quantization parameter. The first preset value can be set to 90%, the second preset value can be set to 70%, the values of the first preset value and the second preset value depend on the total amount of the available storage space and the range in which the utilization rate of the storage space is expected to be stable, and the first preset value and the second preset value can be set according to actual requirements by themselves so as to meet the actual requirements.
In particular, the specific adjustment calculation depends on the monitored utilization of the storage space of the storage array, i.e., the compression ratio of the adjacent images of the previous frame. We use gradient thresholds to divide the compression quality into several levels. If the usage rate of the storage space is too high (i.e. the compression rate of the adjacent image of the previous frame is too low), the quantization parameter of the current image is adjusted, the quantization degree is improved to reduce the quality level of the image, so that the higher compression rate is ensured, and the possibility of data overflow is reduced. If the usage rate of the storage space is lower (i.e. the compression rate of the adjacent image of the previous frame is higher), the quantization parameter of the current image is also adjusted, the quantization degree is reduced to improve the quality level of the image, and meanwhile, the compression rate of the image is reduced, so that the image quality is ensured to the greatest extent in a mode of occupying more storage space.
In one implementation, for the image input by the first frame, the compression rate of the adjacent image is not used as a reference, so that compression processing is directly performed by adopting a higher quantization degree, the quantization degree is gradually adjusted by the subsequent image with reference to the compression rate result of the image input by the first frame, and finally, the balance between the storage space and the image quality is achieved.
And step S300, carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In this embodiment, after the quantized frequency domain information block is obtained, compression encoding processing is performed on the image frame data based on the quantized frequency domain information block, so as to obtain a compressed code stream. The compressed code stream obtained by compressing and encoding the video through the quantized frequency domain information blocks can ensure the quality of the image to the greatest extent on the premise of avoiding data overflow, and the balance between the storage space and the image quality is realized.
In one implementation, firstly performing ZigZag conversion on the quantized frequency domain information block to obtain a one-dimensional quantized frequency domain information block; and carrying out entropy coding on the image frame data based on the one-dimensional quantized frequency domain information block to obtain a compressed code stream of the serial video stream. The ZigZag transformation is realized by sequentially scanning and taking the elements in a matrix from the upper left corner according to a ZigZag shape, and the ZigZag transformation algorithm is simple to realize, low in time complexity and beneficial to improving the image processing efficiency.
In one implementation, a quantization level header is added to the compressed bitstream. Quantization degree header as shown in table 1. Because the quantization parameter is dynamically changed, a header marking the quantization degree of the image needs to be added into the compressed code stream so as to facilitate decompression processing. The invention comprises a compression coding module and a decompression module. The finished quantization table needs a larger header, and the compression coding module and the decompression module in the invention are matched, so that a plurality of configurable complete quantization tables are embedded in the compression coding module and the decompression module, and the quantization tables are selected through short marks. In addition, color space information, resolution information, entropy coding tables, and the like of the image are also embedded in the compression coding module and the decompression module. The embedded image compression parameters reduce the storage space required by storing the parameters and the decoding time required by reading the parameters through the parameters in the embedded compression process of the matched compression coding module and decompression module. The embedded mode ensures the consistency of encoding and decoding, reduces the time of decompression and reading while reducing the storage space for the header, and improves the overall operation efficiency of the system. Through the design of integrated circuit hardware, the effects of real-time processing and full data storage on a chip are achieved.
In one implementation, the storage array of the storage space may store one or more frames of images and perform decompression processing to recover the information of the images when needed. The decompression process is the inverse of the compression process, as shown in fig. 2, the header marked with the image quantization degree is read first, the inverse quantization parameters are adjusted, then entropy decoding, inverse quantization and inverse DCT are sequentially performed, and the decompressed original image is obtained.
Exemplary System
As shown in fig. 3, an embodiment of the present invention provides an image compression system for dynamically adjusting an image compression rate, the system comprising: the device comprises an acquisition module S10, a quantization module S20 and a compression coding module S30. Specifically, the acquiring module S10 is configured to acquire a serial video stream, and acquire image frame data based on the serial video stream; the quantization module S20 is configured to obtain a frequency domain information block based on the image frame data, and perform dynamic quantization for adjusting a compression rate on the frequency domain information block to obtain a quantized frequency domain information block; the compression encoding module S30 is configured to perform compression encoding on the image frame data based on the quantized frequency domain information block, and obtain a compressed code stream of the serial video stream.
In one implementation, the acquisition module includes:
and the first transformation unit is used for performing discrete cosine transformation on the image frame data and acquiring frequency domain information blocks of the image frame data.
In one implementation, the quantization module includes:
the calculating unit is used for acquiring the adjusting parameters and calculating quantization parameters based on the adjusting parameters and the standard quantization table;
the acquisition unit is used for acquiring a dynamic adjustment quantization table according to the quantization parameter;
and the quantization unit is used for carrying out quantization adjustment on the frequency domain information block based on the dynamic quantization table to obtain a quantized frequency domain information block.
In one implementation, the compression encoding module includes:
the second transformation unit is used for performing ZigZag transformation on the quantized frequency domain information block to obtain a one-dimensional quantized frequency domain information block;
and the encoding unit is used for entropy encoding the image frame data based on the one-dimensional quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
In one implementation, the system further comprises:
the monitoring module is used for monitoring the storage space and acquiring the utilization rate of the storage space;
and the adjusting unit is used for dynamically adjusting the quantization parameter based on the storage space utilization rate.
In one implementation, the adjustment unit includes:
the first adjusting subunit is used for increasing the quantization parameter if the storage space utilization rate is higher than a first preset value;
and the second adjustment subunit is used for reducing the quantization parameter if the storage space utilization rate is lower than a second preset value.
In one implementation, the system further comprises:
and the header module is used for adding the quantization degree header into the compressed code stream.
Based on the above embodiment, the present invention also provides a terminal device, and a schematic block diagram of the terminal device may be shown as 4. The terminal device may include one or more processors 100 (only one shown in fig. 4), a memory 101, and a computer program 102 stored in the memory 101 and executable on the one or more processors 100, for example, a program for image compression that dynamically adjusts the compression rate. The one or more processors 100, when executing the computer program 102, may implement the various steps in an embodiment of an image compression method that dynamically adjusts compression rate. Alternatively, the functions of the modules/units in the system embodiment of dynamically adjusting compression rate of image compression may be implemented by one or more processors 100 when executing computer program 102, without limitation.
In one embodiment, the processor 100 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In one embodiment, the memory 101 may be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The memory 101 may also be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the electronic device. Further, the memory 101 may also include both an internal storage unit and an external storage device of the electronic device. The memory 101 is used to store computer programs and other programs and data required by the terminal device. The memory 101 may also be used to temporarily store data that has been output or is to be output.
It will be appreciated by persons skilled in the art that the functional block diagram shown in fig. 4 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the terminal device to which the present inventive arrangements are applied, and that a particular terminal device may include more or fewer components than shown, or may combine some of the components, or may have a different arrangement of components.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of a computer program, which may be stored on a non-transitory computer readable storage medium, that when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, operational database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual operation data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
In summary, the invention discloses an image compression method and system for dynamically adjusting compression rate. Firstly, acquiring a serial video stream, and acquiring image frame data based on the serial video stream; then, based on the image frame data, obtaining a frequency domain information block, and carrying out dynamic quantization for adjusting the compression rate on the frequency domain information block to obtain a quantized frequency domain information block; and finally, carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream. After the frequency domain information block is obtained, the frequency domain information block is dynamically quantized, then the image is compressed and encoded based on the quantized frequency domain information block, and finally the compressed code stream of the video stream is obtained, and the compression rate can be dynamically kept at a fixed level by dynamically adjusting the image quality. Under the condition of fixed storage space, the invention can ensure the quality of the image to the greatest extent on the premise of avoiding data overflow by adopting dynamic quantization adjustment of the compression rate, and realizes the balance between the storage space and the image quality. The invention combines DCT (discrete cosine change), self-adaptive adjustment quantization and entropy coding, and provides an image compression method for dynamically adjusting compression rate.
It is to be understood that the invention is not limited in its application to the examples described above, but is capable of modification and variation in light of the above teachings by those skilled in the art, and that all such modifications and variations are intended to be included within the scope of the appended claims.

Claims (10)

1. An image compression method for dynamically adjusting compression rate, the method comprising:
acquiring a serial video stream and acquiring image frame data based on the serial video stream;
acquiring a frequency domain information block based on the image frame data, and dynamically quantizing the frequency domain information block for adjusting the compression rate to acquire a quantized frequency domain information block;
and carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
2. The method for compressing an image by dynamically adjusting a compression rate according to claim 1, wherein said obtaining a frequency domain information block based on said image frame data comprises:
and performing discrete cosine transform on the image frame data and acquiring frequency domain information blocks of the image frame data.
3. The method for compressing an image according to claim 1, wherein said dynamically quantizing said frequency domain information block for adjusting a compression ratio to obtain a quantized frequency domain information block, comprises:
acquiring adjustment parameters, and calculating quantization parameters based on the adjustment parameters and a standard quantization table;
acquiring a dynamic adjustment quantization table according to the quantization parameter;
and carrying out quantization adjustment on the frequency domain information block based on the dynamic adjustment quantization table to obtain a quantized frequency domain information block.
4. The method for compressing an image by dynamically adjusting a compression rate according to claim 1, wherein said compressing and encoding said image frame data based on said quantized frequency domain information block, obtaining a compressed code stream of said serial video stream, comprises:
performing ZigZag conversion on the quantized frequency domain information block to obtain a one-dimensional quantized frequency domain information block;
and carrying out entropy coding on the one-dimensional quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
5. The image compression method of dynamically adjusting a compression rate according to claim 3, wherein the method further comprises:
monitoring the storage space to obtain the utilization rate of the storage space;
and dynamically adjusting the quantization parameter based on the storage space utilization.
6. The method for compressing an image according to claim 5, wherein said dynamically adjusting said quantization parameter based on said storage space utilization comprises:
if the storage space utilization rate is higher than a first preset value, the quantization parameter is increased; and if the storage space utilization rate is lower than a second preset value, reducing the quantization parameter.
7. The image compression method of dynamically adjusting a compression rate according to claim 1, further comprising:
and adding a quantization degree header into the compressed code stream.
8. An image compression system for dynamically adjusting compression ratio, the system comprising:
the acquisition module is used for acquiring a serial video stream and acquiring image frame data based on the serial video stream;
the quantization module is used for acquiring a frequency domain information block based on the image frame data, and carrying out dynamic quantization for adjusting the compression rate on the frequency domain information block to acquire a quantized frequency domain information block;
and the compression coding module is used for carrying out compression coding on the image frame data based on the quantized frequency domain information block to obtain a compressed code stream of the serial video stream.
9. A terminal device comprising a memory, a processor and an image compression program for dynamically adjusting the compression rate stored in the memory and executable on the processor, wherein the processor, when executing the image compression program for dynamically adjusting the compression rate, performs the steps of the image compression method for dynamically adjusting the compression rate according to any one of claims 1-7.
10. A computer-readable storage medium, wherein the computer-readable storage program has stored thereon an image compression program for dynamically adjusting a compression rate, which when executed by a processor, implements the steps of the image compression method for dynamically adjusting a compression rate as claimed in any one of claims 1 to 7.
CN202310562649.1A 2023-05-18 2023-05-18 Image compression method and system capable of dynamically adjusting compression rate Active CN116600106B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310562649.1A CN116600106B (en) 2023-05-18 2023-05-18 Image compression method and system capable of dynamically adjusting compression rate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310562649.1A CN116600106B (en) 2023-05-18 2023-05-18 Image compression method and system capable of dynamically adjusting compression rate

Publications (2)

Publication Number Publication Date
CN116600106A true CN116600106A (en) 2023-08-15
CN116600106B CN116600106B (en) 2024-04-09

Family

ID=87598682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310562649.1A Active CN116600106B (en) 2023-05-18 2023-05-18 Image compression method and system capable of dynamically adjusting compression rate

Country Status (1)

Country Link
CN (1) CN116600106B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030035589A1 (en) * 2001-06-14 2003-02-20 Lg Electronics Inc. Quantization/dequantization method by making dynamic adaptive table and apparatus thereon
CN101056402A (en) * 2006-02-15 2007-10-17 宏正自动科技股份有限公司 Image transmission system
CN108574841A (en) * 2017-03-07 2018-09-25 北京金山云网络技术有限公司 A kind of coding method and device based on adaptive quantizing parameter
CN110505484A (en) * 2019-08-12 2019-11-26 深圳市华星光电技术有限公司 Data compression device and compression method
CN111630570A (en) * 2019-05-31 2020-09-04 深圳市大疆创新科技有限公司 Image processing method, apparatus and computer-readable storage medium
CN113473131A (en) * 2021-07-01 2021-10-01 成都国科微电子有限公司 Video coding code rate dynamic adjustment method and device, electronic equipment and storage medium
CN113596450A (en) * 2021-06-28 2021-11-02 展讯通信(上海)有限公司 Video image compression method, decompression method, processing method, device and equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030035589A1 (en) * 2001-06-14 2003-02-20 Lg Electronics Inc. Quantization/dequantization method by making dynamic adaptive table and apparatus thereon
CN101056402A (en) * 2006-02-15 2007-10-17 宏正自动科技股份有限公司 Image transmission system
CN108574841A (en) * 2017-03-07 2018-09-25 北京金山云网络技术有限公司 A kind of coding method and device based on adaptive quantizing parameter
CN111630570A (en) * 2019-05-31 2020-09-04 深圳市大疆创新科技有限公司 Image processing method, apparatus and computer-readable storage medium
CN110505484A (en) * 2019-08-12 2019-11-26 深圳市华星光电技术有限公司 Data compression device and compression method
CN113596450A (en) * 2021-06-28 2021-11-02 展讯通信(上海)有限公司 Video image compression method, decompression method, processing method, device and equipment
CN113473131A (en) * 2021-07-01 2021-10-01 成都国科微电子有限公司 Video coding code rate dynamic adjustment method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姚军财;刘贵忠;: "一种基于人眼对比度敏感视觉特性的图像自适应量化方法", 电子与信息学报, no. 05, 15 May 2016 (2016-05-15) *

Also Published As

Publication number Publication date
CN116600106B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
Cheng et al. Deep convolutional autoencoder-based lossy image compression
Cheng et al. Energy compaction-based image compression using convolutional autoencoder
US6847735B2 (en) Image processing system, image processing apparatus, image input apparatus, image output apparatus and method, and storage medium
US11503295B2 (en) Region-based image compression and decompression
CN101690226B (en) Statistic image improving method, image encoding method, and image decoding method
US9888245B2 (en) Image compression method and apparatus for performing amplitude decreasing processing
US10863188B2 (en) Method and apparatus for non-uniform mapping for quantization matrix coefficients between different sizes of quantization matrices in image/video coding
CN103716634B (en) Method and apparatus for data compression using error plane coding
CN111988609A (en) Image encoding device, probability model generation device, and image decoding device
CN117596413A (en) Video processing method and device
Song et al. Novel near-lossless compression algorithm for medical sequence images with adaptive block-based spatial prediction
EP1078529A1 (en) Method and apparatus for increasing memory resource utilization in an information stream decoder
CN111432213B (en) Method and apparatus for tile data size coding for video and image compression
DE102014115013A1 (en) Video coding method and apparatus, and video decoding method and apparatus performing motion compensation
CN116600106B (en) Image compression method and system capable of dynamically adjusting compression rate
US8707149B2 (en) Motion compensation with error, flag, reference, and decompressed reference data
CN113438481B (en) Training method, image encoding method, image decoding method and device
Chen et al. An adaptive quantization scheme for 2-D DWT coefficients
Zhang et al. Visual distortion sensitivity modeling for spatially adaptive quantization in remote sensing image compression
Ahumada Jr et al. Deblocking DCT compressed images
Kakarala et al. A method for signalling block-adaptive quantization in baseline sequential JPEG
KR20200096862A (en) Embedded codec (ebc) circuitry for position dependent entropy coding of residual level data
US20230039840A1 (en) Picture processing method and apparatus
EP4124036A1 (en) Video coding/decoding method, apparatus, and device
US10652543B2 (en) Embedded codec circuitry and method for frequency-dependent coding of transform coefficients

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