CN110971904B - Control method for image compression - Google Patents
Control method for image compression Download PDFInfo
- Publication number
- CN110971904B CN110971904B CN201811193544.9A CN201811193544A CN110971904B CN 110971904 B CN110971904 B CN 110971904B CN 201811193544 A CN201811193544 A CN 201811193544A CN 110971904 B CN110971904 B CN 110971904B
- Authority
- CN
- China
- Prior art keywords
- pixel point
- image data
- value
- component
- component corresponding
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/182—Methods 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 pixel
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods 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 invention provides a control method of image compression, which compresses original image data based on components of different pixel points to obtain compressed image data, and comprises the following steps: a. calculating and storing a difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, executing the step b if the component corresponding to the difference value is smaller than a first threshold value, executing the step c if the component corresponding to the difference value is larger than the first threshold value, enabling the comparison pixel point to be located at an adjacent position in one side direction of the current pixel point, and assigning the component corresponding to the comparison pixel point as the component corresponding to the difference value when the step a is executed again; b. after reducing the bit number of the component corresponding to the difference value, assigning the component as a first compression form of the component corresponding to the corresponding pixel point; c. and after the bit number of the component corresponding to the current pixel point is reduced, assigning the component as a second compression form of the corresponding pixel point corresponding to the component. The invention has the advantages of convenient use, simple operation, circuit cost reduction and extremely high commercial value.
Description
Technical Field
The invention relates to the field of image compression, in particular to a control method of image compression.
Background
In order to transmit image data more quickly in our daily life, save space and facilitate management, image data is often compressed, image compression is an application of a data compression technology to digital images, the purpose of the image compression is to reduce redundant information in the image data so as to store and transmit the data in a more efficient format, and the image compression can be either lossy data compression or lossless data compression. Lossless compression is preferred for technical drawings, charts or caricatures as drawn, because lossy compression methods, especially at low bit rates, will introduce compression distortion. Compression of such valuable content as medical images or scanned images for archiving has also tried to choose a lossless compression method. Lossy methods are well suited to natural images, for example, in some applications a slight loss of image may be acceptable (and sometimes imperceptible), which can significantly reduce the bit rate.
In the prior art, the industry implementation of image fixed-ratio compression is mainly the DSC algorithm specified by VESA association, which can implement one-third and one-half fixed-ratio compression of images and can implement visual lossless compression. However, the conventional DSC compression operation is complex, and image compression needs to rely on the previous line of image data, that is, an operation circuit needs to store one more line of data, which increases the cost of the circuit.
At present, an image compression algorithm which is simple in DSC compression operation, high in running speed, free of storing the previous line of image data and capable of reducing circuit cost does not exist, and specifically, an image compression control method capable of solving the technical problems does not exist.
Disclosure of Invention
Aiming at the technical defects in the prior art, the invention aims to provide a control method for image compression, which is used for compressing original image data based on components of different pixel points to obtain compressed image data, wherein the components comprise an R value, a G value and a B value, and the control method comprises the following steps:
a. calculating and storing a difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, executing the step b if the component corresponding to the difference value is smaller than a first threshold value, and executing the step c if the component corresponding to the difference value is larger than the first threshold value, wherein the comparison pixel point is positioned at an adjacent position in one side direction of the current pixel point, and the component corresponding to the comparison pixel point is assigned as the component corresponding to the difference value when the step a is executed again;
b. after reducing the bit number of the component corresponding to the difference value, assigning a value as a first compression form of the component corresponding to the corresponding pixel point;
c. and after reducing the bit number of the component corresponding to the current pixel point, assigning the component as a second compression form of the component corresponding to the corresponding pixel point.
Preferably, the one-side direction is a left side, a right side, an upper side, or a lower side.
Preferably, in the step a, the component corresponding to the difference is any one of the R value, the G value and the B value.
Preferably, in the step a, the components corresponding to the difference are at least two of the R value, the G value and the B value.
Preferably, in the step b, the highest bit of the component corresponding to the first compressed pixel point is determined as a flag bit.
Preferably, the flag bit is assigned as M, and M is any one character in the range of 0-1.
Preferably, in the step a, the first threshold value is in a range of 16 to 128.
Preferably, in the step b, the component corresponding to the compressed pixel point is a bit allocation of RGB-343.
Preferably, the bit allocation of RGB-343 is expressed as: "RRRGGGGBBB", where "RRR" represents the number of coded bits of the difference between the current value of the red component and the reconstruction value of the pixel on one side, "GGGG" represents the number of coded bits of the difference between the current value of the green component and the reconstruction value of the pixel on one side, and "BBB" represents the number of coded bits of the difference between the current value of the blue component and the reconstruction value of the pixel on one side.
Preferably, in the step c, the highest bit of the component corresponding to the second compressed pixel point is determined as a flag bit.
Preferably, the flag bit is assigned as N, and N is any two characters in the range from 00 to 11.
Preferably, the number of bits of the component includes:
-bit allocation of RGB-242;
-bit allocation of RGB-234; or
-bit allocation of RGB-432.
Preferably, the original image data is sorted into S columns, the contrast pixel point is located in the P-1 th column, the current pixel point is located in the P-th column, and P is more than or equal to 2 and less than or equal to S.
Preferably, the remaining pixel points except for the 1 st column are determined as the current pixel point, and the steps a to c are repeatedly executed according to the arrangement sequence to obtain a plurality of compressed pixel points, so that the data corresponding to the 1 st column pixel point and the data corresponding to the plurality of compressed pixel points form the compressed image data.
Preferably, the original image data is sorted into W rows, the contrast pixel points are located on the Q-1 th row, the current pixel points are located on the Q-th row, and Q is more than or equal to 2 and less than or equal to W.
Preferably, the remaining pixel points except for the 1 st row are determined as the current pixel point, and the steps a to c are repeatedly executed according to the ranking sequence to obtain a plurality of compressed pixel points, so that the data corresponding to the pixel point in the 1 st row and the data corresponding to the plurality of compressed pixel points form the compressed image data.
Preferably, the pixel points in the first row and the pixel points in the first column are implemented by the following three ways:
-storing initial data of a first row or column of pixel points in the original image data;
-storing R, G, B components of a first row or column of pixels in said original image data in the upper three bits reserved after binary processing;
-outputting a first row or column of pixel points in the original image data to a specified pattern for storage.
Preferably, the specified mode includes:
-bit allocation of RGB-565;
-bit allocation of RGB-666; or
-bit allocation of RGB-888.
According to another aspect of the present invention, there is provided an image compression control apparatus for compressing original image data based on components of different pixel points to obtain compressed image data, wherein the components include R, G and B values, the apparatus comprising:
the first calculation module 11: the pixel comparison module is used for calculating and storing the difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point;
the first processing module 12: the difference value is used for reducing the bit number of the component corresponding to the difference value and then assigning the component as a first compression form of the corresponding pixel point;
the second processing module 13: and the second compression mode is used for reducing the bit number of the component corresponding to the current pixel point and then assigning the component as a corresponding pixel point.
According to another aspect of the present invention, there is provided a control method of image decompression for decompressing compressed image data, comprising the steps of:
i: determining a component corresponding to a current pixel point in original image data based on a component corresponding to the current pixel point in compressed image data and the component corresponding to a contrast pixel point;
ii: acquiring the components corresponding to all pixel points except a first row or a first column in original image data;
iii: and taking each component of the pixel points corresponding to the first row or the first column in the compressed image data and a plurality of the components as original image data.
According to another aspect of the present invention, there is provided an image decompression control apparatus for decompressing compressed image data, comprising:
the first determination module 21: determining a component corresponding to a current pixel point in original image data based on a component corresponding to the current pixel point in compressed image data and the component corresponding to a contrast pixel point;
the first acquisition module 22: acquiring the components corresponding to all pixel points except a first row or a first column in original image data;
the third processing module 23: and taking each component of the pixel points corresponding to the first row or the first column in the compressed image data and a plurality of the components as original image data.
The invention calculates and stores the difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, and selects different processing modes based on the difference value, thereby realizing different processing of image data compression under different mode states, and finally forming a compressed image.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
fig. 1 is a schematic flow chart illustrating a control method of image compression according to an embodiment of the present invention;
FIG. 2 is a block diagram of a control apparatus for image compression according to another embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating a control method for image decompression according to another embodiment of the present invention; and
fig. 4 is a block diagram illustrating a control apparatus for image decompression according to another embodiment of the present invention.
Detailed Description
In order to better and clearly show the technical scheme of the invention, the invention is further described with reference to the attached drawings.
Fig. 1 shows a detailed flowchart of a control method for image compression according to a specific embodiment of the present invention, where original image data is compressed based on components of different pixel points to obtain compressed image data, and it is understood by those skilled in the art that each image is composed of thousands of pixel points, and the pixel points are composed of three primary colors, i.e., when the three colors, i.e., red, green, and blue, are arbitrarily combined according to different proportions, i.e., different color displays of each pixel point are formed, so in binary representation, it is preferable to assign red, green, and blue components in each pixel point, and respectively record the red, green, and blue components as R values, G values, and B values, i.e., the sizes of the three color components in each pixel point are represented by the data sizes of the R values, G values, and B values. The invention discloses a control method of image compression by taking different components of the three colors of red, green and blue as research base points, which specifically comprises the following steps:
firstly, step S101 is entered, a difference value between the component corresponding to the current pixel point and the component corresponding to the contrast pixel point is calculated, if the component corresponding to the difference value is smaller than a first threshold, step S102 is executed, if the component corresponding to the difference value is larger than the first threshold, step S103 is executed, wherein the contrast pixel point is located at an adjacent position in a side direction of the current pixel point, and the component corresponding to the contrast pixel point is assigned as the component corresponding to the difference value when step S101 is executed again. As will be appreciated by those skilled in the art,
further, the present invention is configured to compress an image with 565 bits of input image data into 11 bits of image data, where the input image data may not only be 565 bits, but also be 666 bits, 888 bits, or more bit distributions with different RGB, and the compressed image data may not only be 11 bits, or may be 13 bits, and in such an embodiment, when a difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point is smaller than a first threshold, step S102 is performed, when a difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point is larger than the first threshold, step S103 is performed, and the selection of step S102 and step S103 determines a mode in which the current pixel point should be operated after the current pixel point is compared with the comparison pixel point.
In a preferred embodiment, if the difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point is small, the difference between the component of the current pixel point and each component of the comparison pixel point is considered to be small, the adjacent pixel points are considered to be flat, and the difference represents the difference between the two, further, the present invention only needs to store the difference to obtain the specific value of the current pixel point through the comparison pixel point and the difference, and similarly, if the difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point is large, the difference between the component of the current pixel point and each component of the comparison pixel point is considered to be large, the adjacent pixel points are considered to be not flat, further, the present invention needs to perform a conventional compression operation on the current pixel point, and reducing the bit number of the component corresponding to the current pixel point and then taking the component as compressed data of the current pixel point.
Further, in a preferred embodiment, in the step S101, the component corresponding to the difference is any one of the R value, the G value and the B value, and in such an embodiment, when any one of the R value, the G value and the B value in the component corresponding to the difference is smaller than a first threshold, the step S102 is executed, and when all the R value, the G value and the B value are larger than the first threshold, the step S103 is executed.
As a preferable variation of the foregoing embodiment, in step S101, the components corresponding to the difference are at least two of the R value, the G value and the B value, that is, when at least two of the R value, the G value and the B value in the components corresponding to the difference are smaller than the first threshold, step S102 is executed, otherwise, step S103 is executed.
More specifically, the comparison pixel point is located at an adjacent position in the direction of one side of the current pixel point, and the component corresponding to the comparison pixel point is assigned as the component corresponding to the difference value when the step a is executed again, the specific position of the comparison pixel point is limited, namely the comparison pixel point is located at the adjacent position in the direction of one side of the current pixel point, after the current pixel point is calculated, the next pixel point of the current pixel point is preferably calculated, the current pixel point is taken as the comparison pixel point of the next pixel point at the moment, all the pixel points are calculated in sequence, and the value of each current pixel point calculated in the step S102 or the step S103 is taken as the final storage data of the current pixel point.
Those skilled in the art understand that the one-side direction is a left side, a right side, an upper side or a lower side, when the one-side direction is the left side, the present invention performs operation in a left-to-right direction, and more specifically, calculates the difference between each current pixel point in each row and the pixel point on the left side sequentially in a left-to-right manner, as a variation, when the one-side direction is the right side, the present invention performs operation in a right-to-left direction, and more specifically, calculates the difference between each current pixel point in each row and the pixel point on the right side sequentially in a right-to-left manner, as another variation, when the one-side direction is the upper side, the present invention performs operation in a top-to-bottom direction, and more specifically, calculates the difference between each current pixel point in each column and the pixel point on the upper side sequentially in a top-to-bottom manner, as another variation, when the one-side direction is the lower side, that is, the present invention performs calculation according to the direction from bottom to top, and more specifically, calculates the difference between each current pixel point in each column and the pixel point on the lower side thereof in sequence according to the manner from bottom to top.
Further, in the step S101, the first threshold ranges from 16 to 128, and it is understood by those skilled in the art that the first threshold is exemplified by an R component, if 3 bits are used to represent the R component, and if the input R component is 5 bits, the range is 2 × 2 — 8(3 bits represent 8 data), and since the input is 5 bits, the data represented is a multiple of 8, such as 8 data, 0,8,16, and so on, the first threshold is about 8 × 8 — 64, and accordingly, for 4 bits of input data, the first threshold is about 4 × 8 — 32, and there is a difference in compression effect of different threshold images.
Then, step S102 is entered, the bit number of the component corresponding to the difference is reduced and then assigned as the first compression form of the corresponding pixel corresponding to the component, in such an embodiment, in step S102, the highest bit of the first compression form of the component corresponding to the corresponding pixel is determined as a flag bit, as understood by those skilled in the art, the flag bit is preferably an assigned bit, that is, a unique and specific flag bit is assigned to achieve the reduction of the bit number of the difference component by the technical means in step S102, it is the technical means used in step S102 to mark that entering at this time is, when decompressing, an appropriate technical means is selected based on the flag bit to decompress the first compression pixel, so the flag bit does not represent the bit number of any component, and only represents the mode selection that needs to be selected, more specifically, the flag bit is assigned as M, where M is any one character of 0 to 1, in this embodiment, M may be 0, and may be 1, and in other embodiments, M may also be 5, and may also be 9, which do not affect the specific embodiment of the present invention, and are not described herein again.
Still further, in the step S102, compressing the component corresponding to the pixel point is a bit allocation of RGB-343, in such an embodiment, the present invention preferably compresses a bit allocation of RGB-565 to a bit allocation of RGB-343, specifically, the bit allocation of RGB-343 is expressed as: "RRRGGGGBBB", where "RRR" represents the number of coded bits of the difference between the current value of the red component and the reconstruction value of the pixel on one side, "GGGG" represents the number of coded bits of the difference between the current value of the green component and the reconstruction value of the pixel on one side, and "BBB" represents the number of coded bits of the difference between the current value of the blue component and the reconstruction value of the pixel on one side.
Finally, step S103 is entered, the bit number of the component corresponding to the current pixel point is reduced and then assigned as a second compression form corresponding to the component of the corresponding pixel point, in such an embodiment, as a second implementation scheme of the present invention for compressing image data through different modes, when step S101 is executed, the difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point is calculated and stored, if the component corresponding to the difference is greater than a first threshold, step S103 is executed, at this time, the difference between the comparison pixel point and the current pixel point is greater, more specifically, when step S102 is not executed at this time, step S103 is executed, in step S103, as an embodiment, after the bit number of the component corresponding to the current pixel point is preferably reduced, the high three bits obtained after data processing are stored as the second compression form corresponding to the component corresponding to the corresponding pixel point The bit allocation of the component, that is, the bit allocation of each component R, G, B of the current pixel point is RGB-333, but in other embodiments, the bit allocation of RGB-242, the bit allocation of RGB-234, or the bit allocation of RGB-432 may also be set, where the bit allocation of RGB-333 may refer to the above-mentioned semantic explanation of the bit allocation of RGB-343, which is not described herein again.
Further, in the step S103, the highest bit of the second compression format of the component corresponding to the corresponding pixel point is determined as a flag bit, and similarly, the flag bit is preferably an assignment bit, that is, a unique and specific flag bit is assigned to achieve reduction of the bit number of the difference component by the technical means in the step S103, and what is entered at this time is marked as the technical means used in the step S103, and when performing decompression, an appropriate technical means is selected based on the flag bit to decompress the second compression format of the corresponding pixel point corresponding to the component, so that the flag bit does not represent the bit number of any component, and only represents the mode selection that needs to be selected, more specifically, the flag bit is assigned as N, where N is any two characters from 00 to 11, in such an embodiment, N may be 00, may be 10, 01 or 11, and in other embodiments may be 55 or 99, which do not affect the specific implementation of the present invention and are not described herein.
As understood by those skilled in the art, as a specific embodiment of the present invention, before executing step S101, the original image data is sorted into S columns, the contrast pixel is located in the P-1 th column, and the current pixel is located in the P-th column, where P is greater than or equal to 2 and less than or equal to S. In such an embodiment, the current pixel point is located on the right side of the comparison pixel point, and according to the sequence from left to right, the difference value between the current pixel point and the comparison pixel point is sequentially calculated as compressed data, further, the remaining pixel points except for the 1 st column are determined as the current pixel point, and step S101 to step S103 are repeatedly executed according to the arrangement sequence to obtain a plurality of compression pixel points, so that the data corresponding to the 1 st column of pixel points and the data corresponding to the plurality of compression pixel points form the compressed image data.
As understood by those skilled in the art, as another embodiment of the present invention, before step S101 is executed, the original image data is preferably sorted into W rows, the contrast pixel point is located on the Q-1 th row, and the current pixel point is located on the Q-th row, wherein Q is greater than or equal to 2 and less than or equal to W. In such an embodiment, the current pixel point is located above the comparison pixel point, and the difference between the current pixel point and the comparison pixel point is sequentially calculated as compressed data according to the sequence from top to bottom, further preferably, the remaining pixel points except for the 1 st row are determined as the current pixel point, and the steps a to c are repeatedly executed according to the ranking sequence to obtain a plurality of compression pixel points, so that the data corresponding to the pixel point in the 1 st row and the data corresponding to the plurality of compression pixel points form the compressed image data.
Preferably, the determination of the pixel point in the first row and the pixel point in the first column may store initial data of the pixel point in the first row or the first column in the original image data, in such an embodiment, at this time, a data set input in the first row or the first column is consistent with the data in the first row or the first column in the original image data, the first specific implementation manner is taken as an example in the present invention, the initial data of the pixel point in the first column in the original image data is stored, and then, starting from the second column, each pixel point in the second column is sequentially compared with the pixel point in the first column on the left side of the current pixel point, so that the step S102 or the step S103 is selected to enter, and the difference between the two is stored as compressed data, and at this time, the data in the first column is bit allocation of RGB-565.
In other embodiments, R, G, B components of the first row or column of pixels in the original image data may be stored in the upper three bits reserved after binary processing, and in such embodiments, R, G, B components of the first row or column of pixels are preferably allocated to RGB-333 bits.
In another specific embodiment, the determination of the pixels in the first row and the pixels in the first column may further be performed by storing the output of the pixels in the first row or the first column in the original image data in a specific pattern, where the specific pattern includes RGB-565 bit allocation, RGB-666 bit allocation, or RGB-888 bit allocation.
The invention mainly aims at the fixed compression of images such as RGB-565 bit allocation, RGB-666 bit allocation and the like, and can try to do fixed compression of 11bit or 13bit and the like for the real color image of RGB-888 bit allocation.
Fig. 2 is a schematic block connection diagram of a control apparatus for image compression according to another embodiment of the present invention, and according to another aspect of the present invention, there is provided an image compression control apparatus for compressing original image data based on components of different pixel points to obtain compressed image data, where the components include R values, G values, and B values, including a first calculation module 11: the calculation module is configured to calculate and store a difference between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, and the working principle of the first calculation mode 11 may refer to step S101, which is not described herein again.
Further, the control device for image compression further comprises a first processing module 12: the first processing module 12 is configured to reduce the bit number of the component corresponding to the difference value and then assign the component to a first compression form of a corresponding pixel, and the working principle of the first processing module may refer to step S102, which is not described herein again.
Further, the control device for image compression further includes a second processing module 13, which is configured to assign a value to a second compression form of a corresponding pixel point after reducing the bit number of the component corresponding to the current pixel point, and the working principle of the second processing module 13 may refer to step S103, which is not described herein again.
Fig. 3 shows a detailed flowchart of a control method for image decompression according to another embodiment of the present invention, and it is understood by those skilled in the art that fig. 3 is an auxiliary decompression step of the image compression algorithm shown in fig. 1, and is mainly used to better describe the image compression algorithm shown in fig. 1 and to perfect the technical solution of the present invention, and in particular, fig. 3 provides a control method for image decompression, which is used for decompressing compressed image data in two embodiments shown in step S103, and includes the following steps:
firstly, step S201 is entered, the component corresponding to the current pixel point in the original image data is determined based on the component corresponding to the current pixel point in the compressed image data and the component corresponding to the contrast pixel point, in such an embodiment, the remaining pixel points except for the 1 st column are determined as the current pixel points, and the steps S101 to S103 are repeatedly executed according to the arrangement sequence to obtain a plurality of the compressed pixel points, at this time, different decompression modes are selected according to the flag bit of the current pixel point, if the compression is performed according to the mode in step S102, at this time, the contrast pixel point of the current pixel point and the compressed pixel point of the current pixel point should preferably be taken as the calculation factors to obtain the original pixel point of the current pixel point, that is, the component corresponding to the current pixel point in the original image data is determined based on the component corresponding to the current pixel point in the compressed image data and the component corresponding to the contrast pixel point .
Then, step S202 is performed, the components corresponding to all the pixels except the first row or the first column in the original image data are obtained, after the original pixel of the current pixel is obtained according to step S201, the next column of pixels is preferentially executed, the original pixel of the current pixel is used as a comparison pixel of the new pixel at this time, and step S201 is repeatedly executed until the original pixel data of each pixel in each column is obtained, that is, the components corresponding to all the pixels except the first row or the first column in the original image data are obtained.
Finally, step S203 is entered, each component and a plurality of components of the pixel points corresponding to the first row or the first column in the compressed image data are used as original image data, in such an embodiment, based on the preferred embodiments shown in step S201 and step S202, original pixel point data of all pixel point data except the first column is calculated at this time, and further, each component and a plurality of components of the pixel points corresponding to the first row or the first column in the compressed image data are used as original image data, that is, the image data before compression of the present invention is obtained.
Fig. 4 is a block connection diagram of a control apparatus for image decompression according to another embodiment of the present invention, and the present invention provides a control apparatus for image decompression based on the control method for image decompression shown in fig. 3, including a first determining module 21: the component corresponding to the current pixel point in the original image data is determined based on the component corresponding to the current pixel point in the compressed image data and the component corresponding to the contrast pixel point, and the working principle of the first determining module 21 may refer to step S201, which is not described herein again.
Further, the control device for image decompression further includes a first obtaining module 22, which obtains the components corresponding to all the pixels in the original image data except for the first row or the first column, and the working principle of the first obtaining module 22 may refer to step S202, which is not described herein again.
Further, the control device for image decompression further includes a third processing module 23, and each component of the pixel point corresponding to the first row or the first column in the compressed image data and the plurality of components are used as original image data, and the working principle of the third processing module 23 may refer to step S203, which is not described herein again.
Those skilled in the art understand that the image data stored in the RAM are decoded according to the encoding principle in the first column and the non-first column, wherein the non-first column is further divided into flat-mode and steep-mode decoding according to the identifier read by the non-first column, wherein the flat-mode corresponds to step S102, the steep-mode corresponds to step S103, and the corresponding bit allocation is read according to the identifier, so as to realize decoding.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.
Claims (23)
1. A control method for image compression is disclosed, which is based on components of different pixel points to compress original image data to obtain compressed image data, wherein the components include R value, G value and B value, and is characterized by comprising the following steps:
a. calculating a difference value between the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, executing the step b if the component corresponding to the difference value is smaller than a first threshold value, and executing the step c if the component corresponding to the difference value is larger than the first threshold value, wherein the comparison pixel point is positioned at an adjacent position in one side direction of the current pixel point, and the component corresponding to the comparison pixel point is replaced by the component corresponding to the difference value when the step a is executed again;
b. reducing the bit number of the component corresponding to the difference value and setting the component as a first compression form of the component corresponding to the corresponding pixel point;
c. and reducing the bit number of the component corresponding to the current pixel point, and setting the component to be a second compression form of the component corresponding to the corresponding pixel point.
2. The control method according to claim 1, wherein the one-side direction is a left side, a right side, an upper side, or a lower side.
3. The control method according to claim 1 or 2, wherein in the step a, the component corresponding to the difference value is any one of the R value, the G value, and the B value.
4. The control method according to claim 1 or 2, wherein in the step a, the components corresponding to the difference value are at least two of the R value, G value and B value.
5. The control method according to claim 1, characterized by further comprising, after the step a, a step a': and storing the difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point.
6. The control method according to claim 1, wherein in the step b, the highest bit of the first compressed form is determined as a flag bit.
7. The control method according to claim 6, wherein the flag bit is assigned as M, and M is any one character from 0 to 1.
8. The control method according to claim 6 or 7, wherein in the step a, the first threshold value is in a range of 16 to 128.
9. The control method according to claim 8, wherein in step b, the component corresponding to the compressed pixel point is a bit allocation of RGB-343.
10. The control method of claim 9, wherein the RGB-343 bit allocation is expressed as: "RRRGGGGBBB", where "RRR" represents the number of coded bits of the difference between the current value of the red component and the reconstruction value of the pixel on one side, "GGGG" represents the number of coded bits of the difference between the current value of the green component and the reconstruction value of the pixel on one side, and "BBB" represents the number of coded bits of the difference between the current value of the blue component and the reconstruction value of the pixel on one side.
11. Control method according to claim 1, characterized in that in step c the highest two bits of the second compressed form are determined as flag bits.
12. The control method according to claim 11, wherein the flag bit is assigned as N, and N is any two characters from 00 to 11.
13. The control method of claim 12, wherein the number of bits of the component comprises:
-bit allocation of RGB-242;
-bit allocation of RGB-234; or
-bit allocation of RGB-432.
14. The control method according to any one of claims 1, 2, 5-7, or 9-13, wherein the original image data is sorted into S columns, the contrast pixel is located in the P-1 th column, and the current pixel is located in the P-th column, where P is greater than or equal to 2 and less than or equal to S.
15. The control method according to claim 14, wherein the remaining pixels except for the 1 st column are determined as the current pixel, and the steps a to c are repeatedly performed in the order of arrangement to obtain a plurality of the compressed pixels, so that the data corresponding to the 1 st column of pixels and the data corresponding to the plurality of the compressed pixels constitute the compressed image data.
16. The control method according to any one of claims 1 or 2 or 5-7 or 9-13, wherein the original image data is sorted into W rows, the contrast pixel is located in the Q-1 th row, and the current pixel is located in the Q-th row, wherein Q is greater than or equal to 2 and less than or equal to W.
17. The control method according to claim 16, wherein the remaining pixels except for the 1 st row are determined as the current pixel, and the steps a to c are repeatedly performed in the ranking order to obtain the plurality of compressed pixels, so that the data corresponding to the 1 st row pixel and the data corresponding to the plurality of compressed pixels constitute the compressed image data.
18. The control method according to claim 14, wherein the pixel points in the first row and the pixel points in the first column are implemented by three ways:
-storing initial data of a first row or column of pixel points in the original image data;
-storing R, G, B components of a first row or column of pixels in said original image data in the upper three bits reserved after binary processing;
-outputting a first row or column of pixel points in the original image data to a specified pattern for storage.
19. The control method according to claim 16, wherein the pixel points in the first row and the pixel points in the first column are implemented by three ways:
-storing initial data of a first row or column of pixel points in the original image data;
-storing R, G, B components of a first row or column of pixels in said original image data in the upper three bits reserved after binary processing;
-outputting a first row or column of pixel points in the original image data to a specified pattern for storage.
20. The control method according to claim 18 or 19, wherein the specified mode includes:
-bit allocation of RGB-565;
-bit allocation of RGB-666; or
-bit allocation of RGB-888.
21. An image compression control apparatus, configured to perform compression processing on original image data based on components of different pixel points to obtain compressed image data, where the components include an R value, a G value, and a B value, the apparatus comprising:
first calculation module (11): the device is used for calculating and storing the difference value of the component corresponding to the current pixel point and the component corresponding to the comparison pixel point, if the component corresponding to the difference value is smaller than a first threshold value, a first processing module (12) is adopted, and if the component corresponding to the difference value is larger than the first threshold value, a second processing module (13) is adopted;
first processing module (12): the difference value is used for reducing the bit number of the component corresponding to the difference value and then assigning the component as a first compression form of the corresponding pixel point;
second processing module (13): and the second compression mode is used for reducing the bit number of the component corresponding to the current pixel point and then assigning the component as a corresponding pixel point.
22. A control method of image decompression for decompressing the compressed image data of claim 15 or 17, characterized by comprising the steps of:
i: determining a component corresponding to a current pixel point in original image data based on a component corresponding to the current pixel point in compressed image data and the component corresponding to a contrast pixel point;
ii: acquiring the components corresponding to all pixel points except a first row or a first column in original image data;
iii: using each component of pixel point corresponding to the first row or the first column in the compressed image data and a plurality of the components as original image data,
and c, selecting different decompression modes according to the zone bit of the current pixel point, and repeatedly executing the step i to obtain the components corresponding to all the pixel points except the first row or the first column in the original image data.
23. A control apparatus for image decompression, which decompresses the compressed image data according to claim 15 or 17, comprising:
first determination module (21): determining a component corresponding to a current pixel point in original image data based on a component corresponding to the current pixel point in compressed image data and the component corresponding to a contrast pixel point;
a first acquisition module (22): acquiring the components corresponding to all pixel points except the first row or the first column in the original image data, wherein different decompression modes are selected according to the zone bits of the current pixel points, and the step i is repeatedly executed to acquire the components corresponding to all the pixel points except the first row or the first column in the original image data;
third processing module (23): and taking each component of the pixel points corresponding to the first row or the first column in the compressed image data and a plurality of the components as original image data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811193544.9A CN110971904B (en) | 2018-10-15 | 2018-10-15 | Control method for image compression |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811193544.9A CN110971904B (en) | 2018-10-15 | 2018-10-15 | Control method for image compression |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110971904A CN110971904A (en) | 2020-04-07 |
CN110971904B true CN110971904B (en) | 2020-12-04 |
Family
ID=70029522
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811193544.9A Active CN110971904B (en) | 2018-10-15 | 2018-10-15 | Control method for image compression |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110971904B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111654704A (en) * | 2020-05-26 | 2020-09-11 | 新相微电子(上海)有限公司 | Automatic multi-mode image compression control method and device |
CN112184843B (en) * | 2020-11-09 | 2021-06-29 | 新相微电子(上海)有限公司 | Redundant data removing system and method for image data compression |
CN116711307A (en) * | 2021-03-04 | 2023-09-05 | Oppo广东移动通信有限公司 | Method for generating embedded image data, image sensor, electronic device and non-transitory computer readable medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1825978A (en) * | 2002-04-19 | 2006-08-30 | 精工爱普生株式会社 | Frame compression using cardinal approximation or differential code and escape code |
CN101816182A (en) * | 2007-10-01 | 2010-08-25 | 夏普株式会社 | Image encoding device, image encoding method, and image encoding system |
JP2012054882A (en) * | 2010-09-03 | 2012-03-15 | Panasonic Corp | Image encoding method, image decoding method, image encoding apparatus and image decoding apparatus |
CN105791819A (en) * | 2014-12-26 | 2016-07-20 | 炬芯(珠海)科技有限公司 | Frame compression method for image and decompression method and device for image |
CN107452039A (en) * | 2016-06-01 | 2017-12-08 | 上海东方传媒技术有限公司 | Compress the method and device of RGB color |
EP3291554A1 (en) * | 2016-08-30 | 2018-03-07 | Thomson Licensing | Method and apparatus for video coding with sample adaptive offset |
-
2018
- 2018-10-15 CN CN201811193544.9A patent/CN110971904B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1825978A (en) * | 2002-04-19 | 2006-08-30 | 精工爱普生株式会社 | Frame compression using cardinal approximation or differential code and escape code |
CN101816182A (en) * | 2007-10-01 | 2010-08-25 | 夏普株式会社 | Image encoding device, image encoding method, and image encoding system |
JP2012054882A (en) * | 2010-09-03 | 2012-03-15 | Panasonic Corp | Image encoding method, image decoding method, image encoding apparatus and image decoding apparatus |
CN105791819A (en) * | 2014-12-26 | 2016-07-20 | 炬芯(珠海)科技有限公司 | Frame compression method for image and decompression method and device for image |
CN107452039A (en) * | 2016-06-01 | 2017-12-08 | 上海东方传媒技术有限公司 | Compress the method and device of RGB color |
EP3291554A1 (en) * | 2016-08-30 | 2018-03-07 | Thomson Licensing | Method and apparatus for video coding with sample adaptive offset |
Also Published As
Publication number | Publication date |
---|---|
CN110971904A (en) | 2020-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2143280B1 (en) | Frame buffer compression and decompression method for graphics rendering | |
US7693337B2 (en) | Multi-mode alpha image processing | |
CN110971904B (en) | Control method for image compression | |
CN106170922B (en) | The source code of data and decoded device and method | |
US20070172120A1 (en) | Compression of images for computer graphics | |
US9286698B2 (en) | Method and device for storing a compression ratio indication in a pixel value buffer in tile encoding | |
US20130251261A1 (en) | Method And Apparatus For Image Data Compression | |
CN101653004A (en) | Decoder for selectively decoding predetermined data units from a coded bit stream | |
CN112118449B (en) | Method and device for compressing and decompressing image | |
CN114222129A (en) | Image compression encoding method, image compression encoding device, computer equipment and storage medium | |
CN102271251B (en) | Lossless image compression method | |
CN112887722B (en) | Lossless image compression method | |
CN104093027B (en) | Joint scalar embedded graphics coding for coloured image | |
CN101945274A (en) | Compressing and coding apparatus and decoding device | |
US20070211937A1 (en) | Hybrid Image Compression Method | |
JP5894605B2 (en) | Method and apparatus | |
CN115250351A (en) | Compression method, decompression method and related products for image data | |
CN111654704A (en) | Automatic multi-mode image compression control method and device | |
CN106127824B (en) | Image encoding/decoding device and method | |
US10002586B1 (en) | Compression of display data stored locally on a GPU | |
JP5432690B2 (en) | Image coding apparatus and control method thereof | |
CN110198446B (en) | Image processing method and image processing apparatus | |
CN110689590B (en) | Compression coding method and device for map and mobile terminal equipment | |
WO2010018494A1 (en) | Image compression | |
JP3711104B2 (en) | Image compression apparatus and image compression method |
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 | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: 200233 floor 7, building 31, No. 680, Guiping Road, Xuhui District, Shanghai Patentee after: Shanghai Xinxiang Microelectronics Co.,Ltd. Address before: Room 517, 5 / F, Venture Center building, 680 Guiping Road, Caohejing New Technology Development Zone, Xuhui District, Shanghai, 200233 Patentee before: NEW VISION MICRO. Inc. |