CN116896641A - Image compression method, device, equipment and storage medium - Google Patents

Image compression method, device, equipment and storage medium Download PDF

Info

Publication number
CN116896641A
CN116896641A CN202311161327.2A CN202311161327A CN116896641A CN 116896641 A CN116896641 A CN 116896641A CN 202311161327 A CN202311161327 A CN 202311161327A CN 116896641 A CN116896641 A CN 116896641A
Authority
CN
China
Prior art keywords
bits
block
blocks
difference value
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311161327.2A
Other languages
Chinese (zh)
Other versions
CN116896641B (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.)
Yuchuang Semiconductor Shenzhen Co ltd
Original Assignee
Yuchuang Semiconductor Shenzhen 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 Yuchuang Semiconductor Shenzhen Co ltd filed Critical Yuchuang Semiconductor Shenzhen Co ltd
Priority to CN202311161327.2A priority Critical patent/CN116896641B/en
Publication of CN116896641A publication Critical patent/CN116896641A/en
Application granted granted Critical
Publication of CN116896641B publication Critical patent/CN116896641B/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/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/176Methods 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 block, e.g. a macroblock
    • 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/186Methods 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 a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Landscapes

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

Abstract

The application relates to the technical field of data compression, and provides an image compression method, device, equipment and storage medium, wherein the method comprises the following steps: acquiring a compressed image, dividing the compressed image into a plurality of blocks, and setting serial numbers corresponding to the compressed image for all the blocks; calculating the brightness value of each pixel in each block aiming at each block, and calculating the difference value between the maximum brightness value and the minimum brightness value in all brightness values; compressing all blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value, and setting an identification code to obtain a plurality of target macro blocks; the method can prevent the problem of uneven distribution of the whole image quality of the compressed image caused by the difference of the image content.

Description

Image compression method, device, equipment and storage medium
Technical Field
The present application relates to the field of data compression technologies, and in particular, to an image compression method, apparatus, device, and storage medium.
Background
With the widespread use of digital images, image compression has become an important research area. The conventional image compression method mainly reduces the data size of the image by reducing redundant information. In order to further improve the compression ratio and maintain the image quality, researchers have proposed many new compression methods.
However, the current image compression method can cause the problem of uneven quality distribution of the whole compressed image due to the difference of image contents.
Disclosure of Invention
The present application provides an image compression method, apparatus, device and storage medium, so as to solve the problems set forth in the background art.
In a first aspect, the present application provides an image compression method, including:
obtaining a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks;
calculating a brightness value of each pixel in each block for each block, and calculating a difference value between a maximum brightness value and a minimum brightness value in all the brightness values;
compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
In one possible implementation manner, the compressing all the blocks based on the first number of bits, the second number of bits, the third number of bits and the difference value and setting an identification code to obtain a second number of target macro blocks includes:
comparing the difference value with a preset difference value for each block;
if the difference value is larger than the preset difference value, determining a target quantization level of the block based on the difference value, and compressing the block based on the target quantization level;
calculating the number of available bits of the target macroblock based on the first number of bits and the third number of bits,
comparing a fourth number of bits with the available number of bits; wherein the fourth number of bits is the number of bits of the block compressed based on the target quantization level;
and if the fourth bit number is not greater than the available bit number, taking the block compressed based on the target quantization level as a part of the target macroblock corresponding to the first bit number at present, and setting an identification code for the block compressed based on the target quantization level based on the serial number corresponding to the block.
In a possible implementation manner, after comparing the difference value with a preset difference value for each block, the method further includes:
if the difference value is smaller than the preset difference value, compressing the block based on a preset quantization level;
comparing a fifth number of bits with the available number of bits; wherein the fifth number of bits is the number of bits of the block compressed based on the predetermined quantization level;
and if the fifth bit number is not greater than the available bit number, taking the block compressed based on the preset quantization level as a part of the target macro block corresponding to the first bit number at present, and setting an identification code for the block compressed based on the preset quantization level based on the serial number corresponding to the block.
In one possible implementation, the dividing the compressed image into a first number of blocks includes:
dividing the compressed image into a plurality of image frames;
and dividing each image frame based on a preset image division model to obtain a first number of blocks.
In a second aspect, the present application provides an image compression apparatus, comprising:
the acquisition module is used for acquiring a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks;
a calculation module, configured to calculate, for each of the blocks, a luminance value of each pixel in the block, and calculate a difference between a maximum luminance value and a minimum luminance value among all the luminance values;
the processing module is used for compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
In a third aspect, the present application provides a terminal device comprising a processor, a memory and a computer program stored on the memory and executable by the processor, wherein the computer program, when executed by the processor, implements any of the image compression methods as described above.
In a fourth aspect, the present application provides a computer readable storage medium, where a computer program is stored, where the computer program is stored on the computer readable storage medium when executed by a processor, and where the computer program is executed by the processor to implement the image compression method according to any one of the above.
The application provides an image compression method, an image compression device, image compression equipment and a storage medium, wherein the method comprises the steps of obtaining a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks; calculating a brightness value of each pixel in each block for each block, and calculating a difference value between a maximum brightness value and a minimum brightness value in all the brightness values; compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number. According to the method, on one hand, the compressed image is divided into a plurality of blocks, serial numbers are set for all the blocks, after the compressed image is compressed, the blocks are integrated into the image to be compressed according to the serial numbers of the blocks after the compressed image is decompressed, so that the integrity and consistency of the compressed image before and after the compressed image is ensured, on the other hand, the brightness value of each pixel in each block is calculated for each block, the difference value between the maximum brightness value and the minimum brightness value in all the brightness values is calculated, and all the blocks are compressed and the identification codes are set based on the first bit number, the second bit number, the third bit number, the serial numbers and the difference value, so that a second number of target macro blocks are obtained, the detail information of the image in the compression process can be better reserved, and meanwhile, the problem that the whole image quality distribution is uneven due to the difference of the compressed image content is avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of an image compression method according to an embodiment of the present application;
fig. 2 is a schematic block diagram of an image compression apparatus according to an embodiment of the present application;
fig. 3 is a schematic block diagram of a structure of a terminal device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The flow diagrams depicted in the figures are merely illustrative and not necessarily all of the elements and operations/steps are included or performed in the order described. For example, some operations/steps may be further divided, combined, or partially combined, so that the order of actual execution may be changed according to actual situations.
It is also to be understood that the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
With the widespread use of digital images, image compression has become an important research area. The conventional image compression method mainly reduces the data size of the image by reducing redundant information. In order to further improve the compression ratio and maintain the image quality, researchers have proposed many new compression methods.
However, the current image compression method can cause the problem of uneven quality distribution of the whole compressed image due to the difference of image contents. Therefore, embodiments of the present application provide a method, apparatus, device and storage medium for image compression to solve the above-mentioned problems.
Some embodiments of the present application are described in detail below with reference to the accompanying drawings. The following embodiments and features of the embodiments may be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a flowchart of an image compression method according to an embodiment of the application, and as shown in fig. 1, the image compression method according to an embodiment of the application includes steps S100 to S300.
Step S100, obtaining a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks.
The dividing the compressed image into a first number of blocks may include the steps of:
dividing the compressed image into a plurality of image frames;
and dividing each image frame based on a preset image division model to obtain a first number of blocks.
It will be understood that setting the serial numbers corresponding to the compressed images for all the blocks means setting the serial numbers for all the blocks according to the playing order of the images and the positions of each of the blocks on the respective image frames.
Step S200, for each block, calculating a luminance value of each pixel in the block, and calculating a difference between a maximum luminance value and a minimum luminance value of all the luminance values.
Step S300, compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
The preset bit number of each target macro block is consistent, and each target macro block comprises a plurality of compressed blocks.
According to the method provided by the embodiment, on one hand, the compressed image is divided into a plurality of blocks, serial numbers are set for all the blocks, after the compressed image is compressed and after the compressed image is decompressed, the blocks are integrated into the image to be compressed according to the serial numbers of the blocks, so that the integrity and consistency of the compressed image before and after the compression are ensured, on the other hand, the brightness value of each pixel in each block is calculated for each block, the difference value between the maximum brightness value and the minimum brightness value in all the brightness values is calculated, and on the basis of the first bit number, the second bit number, the third bit number, the serial numbers and the difference value, all the blocks are compressed and identification codes are set, so that the second number of target macro blocks are obtained, the detail information of the image in the compression process can be better reserved, and meanwhile, the problem that the overall image quality distribution is uneven due to the difference of contents of the compressed image is avoided.
In some embodiments, the compressing all the blocks based on the first bit number, the second bit number, the third bit number, and the difference value and setting an identification code to obtain a second number of target macro blocks includes:
comparing the difference value with a preset difference value for each block;
if the difference value is larger than the preset difference value, determining a target quantization level of the block based on the difference value, and compressing the block based on the target quantization level;
calculating the number of available bits of the target macroblock based on the first number of bits and the third number of bits,
comparing a fourth number of bits with the available number of bits; wherein the fourth number of bits is the number of bits of the block compressed based on the target quantization level;
and if the fourth bit number is not greater than the available bit number, taking the block compressed based on the target quantization level as a part of the target macroblock corresponding to the first bit number at present, and setting an identification code for the block compressed based on the target quantization level based on the serial number corresponding to the block.
Wherein the target quantization level represents a compression ratio when compressing the block, the larger the difference value is, the larger the compression ratio is, and the greater the compression ratio is, the smaller the degree of compressing the block is.
Wherein the identification code is a sequence number of the block compressed based on the target quantization level.
It should be noted that, if the fourth bit number is greater than the available bit number, a target macroblock with the available bit number greater than the fourth bit number is found in all the existing target macroblocks, and the block compressed based on the target quantization level is used as a part of the target macroblock with the available bit number greater than the fourth bit number.
For example, the current corresponding target macroblock of the first number of bits is the target macroblock 5, and the existing target macroblock further includes the target macroblock 1, the target macroblock 2, the target macroblock 3 and the target macroblock 4, wherein the available number of bits of the target macroblock 1 is 3, the available number of bits of the target macroblock 2 is 2, the available number of bits of the target macroblock 3 is 4, the available number of bits of the target macroblock 4 is 6, the available number of bits of the target macroblock 5 is 1, and the fourth number of bits is 5, so that the target macroblock having a larger available number of bits than the fourth number of bits needs to be found in the target macroblock 1, the target macroblock 2, the target macroblock 3 and the target macroblock 4, and it is obvious that the available number of bits of the target macroblock 4 is larger than the fourth number of bits, so that the target macroblock 4 is a part of the target macroblock 4 after being compressed based on the target quantization level.
It should be further noted that if the number of available bits of all existing target macroblocks is smaller than the fourth number of bits, a new target macroblock is created, and the block compressed based on the target quantization level is used as a part of the new target macroblock.
By adopting the method of this embodiment, on the one hand, by comparing the difference value with the preset difference value, and determining the target quantization level of the block based on the difference value when the difference value is greater than the preset difference value, this can achieve that when each block is compressed, different compression strategies are adopted according to different characteristics of each block, so that the image quality of each block can be better balanced, the problem that the overall image quality distribution is uneven due to the difference of the image contents of the compressed image is prevented, on the other hand, according to the fourth bit number and the available bit number of all the macro blocks, the target macro block to which the block based on the target quantization level belongs is determined, so that all the available bit numbers of each target macro block can be maximally applied, and on the other hand, the embodiment can set an identification for the block compressed based on the target quantization level based on the serial number of the block, and can further improve the compression performance of each compressed image in sequence before the compressed image is decompressed according to the identification.
In some embodiments, after comparing the difference value with a preset difference value for each of the blocks, the method further comprises:
if the difference value is smaller than the preset difference value, compressing the block based on a preset quantization level;
comparing a fifth number of bits with the available number of bits; wherein the fifth number of bits is the number of bits of the block compressed based on the predetermined quantization level;
and if the fifth bit number is not greater than the available bit number, taking the block compressed based on the preset quantization level as a part of the target macro block corresponding to the first bit number at present, and setting an identification code for the block compressed based on the preset quantization level based on the serial number corresponding to the block.
It should be noted that, if the fifth bit number is greater than the available bit number, a target macroblock with the available bit number greater than the fifth bit number is found in all the existing target macroblocks, and the block compressed based on the initial quantization level is used as a part of the target macroblock with the available bit number greater than the fifth bit number.
For example, the current corresponding target macroblock of the first number of bits is the target macroblock 5, the existing target macroblock further includes the target macroblock 1, the target macroblock 2, the target macroblock 3 and the target macroblock 4, the available number of bits of the target macroblock 1 is 3, the available number of bits of the target macroblock 2 is 2, the available number of bits of the target macroblock 3 is 4, the available number of bits of the target macroblock 4 is 7, the available number of bits of the target macroblock 5 is 1, and the fifth number of bits is 7, and since the fifth number of bits is greater than the available number of bits of the target macroblock 5, it is necessary to find a target macroblock of which the available number of bits is greater than the fifth number of bits in the target macroblock 1, the target macroblock 2, the target macroblock 3 and the target macroblock 4, it is obvious that the available number of bits of the target macroblock 4 is greater than the fifth number of bits, so the target macroblock 4 compressed based on the initial quantization level is a part of the target macroblock 4.
It should be further noted that if the number of available bits of all existing target macroblocks is smaller than the fifth number of bits, a new target macroblock is created, and the block compressed based on the initial quantization level is used as a part of the new target macroblock.
According to the method, on one hand, when the difference value is smaller than the preset difference value, the blocks are compressed based on the preset quantization level, so that the image compression efficiency can be improved, on the other hand, according to the fifth bit number and the available bit numbers of all the existing macro blocks, the target macro blocks to which the blocks based on the initial quantization level belong are determined, all the available bit numbers of each target macro block can be furthest applied, and therefore the image compression effect is improved, on the other hand, according to the method, the identification codes are set for the blocks based on the initial quantization level after compression based on the serial numbers corresponding to the blocks, and when the compressed image is decompressed, each block can be decompressed in sequence according to the identification codes, and the consistency of the compressed image before and after compression is further improved.
Referring to fig. 2, fig. 2 is a schematic block diagram of an image compression apparatus 100 according to an embodiment of the present application, and as shown in fig. 2, the image compression apparatus 100 according to an embodiment of the present application includes:
the obtaining module 110 is configured to obtain a compressed image, divide the compressed image into a first number of blocks, and set serial numbers corresponding to the compressed image for all the blocks.
The calculating module 120 is configured to calculate, for each of the blocks, a luminance value of each pixel in the block, and calculate a difference between a maximum luminance value and a minimum luminance value among all the luminance values.
The processing module 130 is configured to compress all the blocks and set an identification code based on the first number of bits, the second number of bits, the third number of bits, the sequence number and the difference value, so as to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
It should be noted that, for convenience and brevity of description, the specific working process of the above-described apparatus and each module may refer to the corresponding process in the foregoing embodiment of the image compression method, which is not described herein again.
The image compression apparatus 100 provided in the above embodiment may be implemented in the form of a computer program that can be run on the terminal device 200 as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a structure of a terminal device 200 according to an embodiment of the present application, where the terminal device 200 includes a processor 201 and a memory 202, and the processor 201 and the memory 202 are connected through a system bus 203, and the memory 202 may include a nonvolatile storage medium and an internal memory.
The non-volatile storage medium may store a computer program. The computer program comprises program instructions that, when executed by the processor 201, cause the processor 201 to perform any of the image compression methods described above.
The processor 201 is used to provide computing and control capabilities supporting the operation of the overall terminal device 200.
The internal memory provides an environment for the execution of a computer program in a non-volatile storage medium that, when executed by the processor 201, causes the processor 201 to perform any of the image compression methods described above.
It will be appreciated by those skilled in the art that the structure shown in fig. 3 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation of the terminal device 200 related to the present application, and that a specific terminal device 200 may include more or less components than those shown in the drawings, or may combine some components, or have a different arrangement of components.
It should be appreciated that the processor 201 may be a central processing unit (Central Processing Unit, CPU), and the processor 201 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field 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. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In some embodiments, the processor 201 is configured to execute a computer program stored in the memory to implement the following steps:
obtaining a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks;
calculating a brightness value of each pixel in each block for each block, and calculating a difference value between a maximum brightness value and a minimum brightness value in all the brightness values;
compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
In some embodiments, when implementing the compressing all the blocks based on the first number of bits, the second number of bits, the third number of bits, and the difference value and setting the identification code, the processor 201 is configured to implement:
comparing the difference value with a preset difference value for each block;
if the difference value is larger than the preset difference value, determining a target quantization level of the block based on the difference value, and compressing the block based on the target quantization level;
calculating the number of available bits of the target macroblock based on the first number of bits and the third number of bits,
comparing a fourth number of bits with the available number of bits; wherein the fourth number of bits is the number of bits of the block compressed based on the target quantization level;
and if the fourth bit number is not greater than the available bit number, taking the block compressed based on the target quantization level as a part of the target macroblock corresponding to the first bit number at present, and setting an identification code for the block compressed based on the target quantization level based on the serial number corresponding to the block.
In some embodiments, after implementing the comparing the difference value with a preset difference value for each of the blocks, the processor 201 is further configured to implement:
if the difference value is smaller than the preset difference value, compressing the block based on a preset quantization level;
comparing a fifth number of bits with the available number of bits; wherein the fifth number of bits is the number of bits of the block compressed based on the predetermined quantization level;
and if the fifth bit number is not greater than the available bit number, taking the block compressed based on the preset quantization level as a part of the target macro block corresponding to the first bit number at present, and setting an identification code for the block compressed based on the preset quantization level based on the serial number corresponding to the block.
In some embodiments, the processor 201, when implementing the partitioning of the compressed image into a first number of blocks, is configured to implement:
dividing the compressed image into a plurality of image frames;
and dividing each image frame based on a preset image division model to obtain a first number of blocks.
It should be noted that, for convenience and brevity of description, the specific working process of the terminal device 200 described above may refer to the corresponding process of the image compression method, and will not be described herein.
Embodiments of the present application also provide a computer readable storage medium storing a computer program, which when executed by one or more processors, causes the one or more processors to implement an image compression method as provided by the embodiments of the present application.
The computer readable storage medium may be an internal storage unit of the terminal device 200 of the foregoing embodiment, for example, a hard disk or a memory of the terminal device 200. The computer readable storage medium may also be an external storage device of the terminal device 200, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which the terminal device 200 is equipped with.
While the application has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (7)

1. An image compression method, comprising:
obtaining a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks;
calculating a brightness value of each pixel in each block for each block, and calculating a difference value between a maximum brightness value and a minimum brightness value in all the brightness values;
compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
2. The method of claim 1, wherein compressing all the blocks based on the first number of bits, the second number of bits, the third number of bits, and the difference value and setting an identification code to obtain a second number of target macro blocks, comprises:
comparing the difference value with a preset difference value for each block;
if the difference value is larger than the preset difference value, determining a target quantization level of the block based on the difference value, and compressing the block based on the target quantization level;
calculating the number of available bits of the target macroblock based on the first number of bits and the third number of bits,
comparing a fourth number of bits with the available number of bits; wherein the fourth number of bits is the number of bits of the block compressed based on the target quantization level;
and if the fourth bit number is not greater than the available bit number, taking the block compressed based on the target quantization level as a part of the target macroblock corresponding to the first bit number at present, and setting an identification code for the block compressed based on the target quantization level based on the serial number corresponding to the block.
3. The image compression method according to claim 2, wherein after comparing the difference value with a preset difference value for each of the blocks, the method further comprises:
if the difference value is smaller than the preset difference value, compressing the block based on a preset quantization level;
comparing a fifth number of bits with the available number of bits; wherein the fifth number of bits is the number of bits of the block compressed based on the predetermined quantization level;
and if the fifth bit number is not greater than the available bit number, taking the block compressed based on the preset quantization level as a part of the target macro block corresponding to the first bit number at present, and setting an identification code for the block compressed based on the preset quantization level based on the serial number corresponding to the block.
4. The method of image compression according to claim 1, wherein the dividing the compressed image into a first number of blocks comprises:
dividing the compressed image into a plurality of image frames;
and dividing each image frame based on a preset image division model to obtain a first number of blocks.
5. An image compression apparatus, the apparatus comprising:
the acquisition module is used for acquiring a compressed image, dividing the compressed image into a first number of blocks, and setting serial numbers corresponding to the compressed image for all the blocks;
a calculation module, configured to calculate, for each of the blocks, a luminance value of each pixel in the block, and calculate a difference between a maximum luminance value and a minimum luminance value among all the luminance values;
the processing module is used for compressing all the blocks based on the first bit number, the second bit number, the third bit number, the serial number and the difference value and setting identification codes to obtain a second number of target macro blocks; the first number of bits is the number of used bits of the target macroblock, the second number of bits is the number of bits of the block, the third number of bits is the number of preset bits of the target macroblock, and the first number is greater than the second number.
6. A terminal device comprising a processor, a memory and a computer program stored on the memory and executable by the processor, wherein the computer program when executed by the processor implements the image compression method according to any one of claims 1 to 4.
7. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, wherein the computer program, when executed by a processor, implements the image compression method according to any one of claims 1 to 4.
CN202311161327.2A 2023-09-11 2023-09-11 Image compression method, device, equipment and storage medium Active CN116896641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311161327.2A CN116896641B (en) 2023-09-11 2023-09-11 Image compression method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311161327.2A CN116896641B (en) 2023-09-11 2023-09-11 Image compression method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116896641A true CN116896641A (en) 2023-10-17
CN116896641B CN116896641B (en) 2023-12-12

Family

ID=88313800

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311161327.2A Active CN116896641B (en) 2023-09-11 2023-09-11 Image compression method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116896641B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002165222A (en) * 2000-11-28 2002-06-07 Hiroaki Kunieda High-performance code compression system of dynamic image information
CN1774072A (en) * 2004-11-12 2006-05-17 扬智科技股份有限公司 Digital camera image format variable length decoding apparatus and method
CN109308710A (en) * 2017-07-27 2019-02-05 南宁富桂精密工业有限公司 Monitoring method, computing device and computer readable storage medium
WO2022012183A1 (en) * 2020-07-17 2022-01-20 Oppo广东移动通信有限公司 Encoding method, encoder and computer readable storage medium
CN114584773A (en) * 2022-02-08 2022-06-03 海宁奕斯伟集成电路设计有限公司 Image compression device, method, electronic device, and computer-readable storage medium
CN116489368A (en) * 2023-06-21 2023-07-25 禹创半导体(深圳)有限公司 Image dynamic compression method and image dynamic compression device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002165222A (en) * 2000-11-28 2002-06-07 Hiroaki Kunieda High-performance code compression system of dynamic image information
CN1774072A (en) * 2004-11-12 2006-05-17 扬智科技股份有限公司 Digital camera image format variable length decoding apparatus and method
CN109308710A (en) * 2017-07-27 2019-02-05 南宁富桂精密工业有限公司 Monitoring method, computing device and computer readable storage medium
WO2022012183A1 (en) * 2020-07-17 2022-01-20 Oppo广东移动通信有限公司 Encoding method, encoder and computer readable storage medium
CN114584773A (en) * 2022-02-08 2022-06-03 海宁奕斯伟集成电路设计有限公司 Image compression device, method, electronic device, and computer-readable storage medium
US20230254484A1 (en) * 2022-02-08 2023-08-10 Haining Eswin Ic Design Co., Ltd. Image Compression Apparatus, Image Compression Method, Electronic Device, and Computer-Readable Storage Medium
CN116489368A (en) * 2023-06-21 2023-07-25 禹创半导体(深圳)有限公司 Image dynamic compression method and image dynamic compression device

Also Published As

Publication number Publication date
CN116896641B (en) 2023-12-12

Similar Documents

Publication Publication Date Title
CN111149095B (en) System and method for concave compression of image frames in a system on chip
CN108399052B (en) Picture compression method and device, computer equipment and storage medium
US7747097B2 (en) Method for simple hardware implementation of JPEG size limiter
EP3726837A1 (en) Coding unit division determining method and device, computing device and readable storage medium
CN116896641B (en) Image compression method, device, equipment and storage medium
US20070019870A1 (en) Image processing apparatus, printing apparatus and image processing method
US20140133768A1 (en) Electronic device and method for splitting image
EP2731342A1 (en) Electronic device and method for splitting image
US20060088223A1 (en) Image processing apparatus, printer and control method of the image processing
CN110874284A (en) Data processing method and device
CN111683189B (en) Picture compression method, system, terminal and storage medium
US9232222B2 (en) Lossless color image compression adaptively using spatial prediction or inter-component prediction
CN110460854B (en) Image compression method
CN110442557B (en) Data compression and decompression method, electronic device and computer readable storage medium
CN113497627A (en) Data compression and decompression method, device and system
CN108765503B (en) Skin color detection method, device and terminal
CN110851433B (en) Key optimization method for key value storage system, storage medium, electronic device and system
US20140133772A1 (en) Electronic device and method for splitting image
WO2022179355A1 (en) Data processing method and apparatus for sample adaptive offset sideband compensating mode
CN112927324B (en) Data processing method and device of boundary compensation mode of sample point self-adaptive compensation
CN114584781A (en) Video compression method and device and computer readable storage medium
CN110662047B (en) Image storage method and device, electronic equipment and computer storage medium
WO2018068259A1 (en) Image coding/decoding method and device, and image processing apparatus
CN110945870A (en) Video processing apparatus and method
US20140133771A1 (en) Electronic device and method for splitting image

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