Brief introduction
Compressed pixel data can be used in the compression scheme is to directly compress the BGR24 or convert the Bgr24 image to Yv12, and then the sub-plane using libjpeg compression; turn yv12 then compress the reason is yv12 data volume is less than bgr24 half; then the data volume should be smaller after compression; But specifically is not really going to be better, if good, how much better, and not a quantitative test than the data; Here we use experimental data to conduct specific analysis to assist in decision-making if we process our data.
Experimental Solutions
Select 25 1600x1200 size images; Random sampling calculates the compressed data size and time-consuming of compression and decompression; The final performance curve is composed of two lines: one is the ratio of the size of the compressed data, the second is the compression and decompression time-consuming comparison results; The horizontal axis represented by y=0 in red; The blue is the contrast curve of the compressed data quantity, the green compress and decompress the time-consuming contrast curve, the horizontal axis represents the data size, the total 118 sampling points, each sample point corresponds to the size (n*10 + 20) ^2, that is, each sample point is larger than the previous sample point of the image size of the width of 10 pixels; The meaning of the curve is (BGR–YV12)/bgr*100; That is to calculate the percentage difference of the statistical results of two compression methods; time-consuming statistics each sample point contains one compression and one decompression process, taking into account the time statistics required to BGR24,YV12 using pixel data also includes the processing of a yv12 turn BGR;
Results Analysis:
According to the experimental scheme described in the front, the red line indicates that the direct compression BGR is lower than the YV12 and then the compression performance is inferior, the lower axis indicates that the compression BGR performance is better than the compression yv12. From the compressed data volume analysis, the data from Bgr24 to YV12 no obvious advantage; At all sampling points, the maximum percentage difference of direct compression bgr24 than compression yv12 is not more than 4%, and from time-consuming, the size is greater than 200x200, and it takes about 25% more time. But the size of the image within 200x200, direct compression bgr24 more advantageous; [The first point of the time-consuming curve should be an anomaly]
Note
Turbojpeg is another project related to Libjpeg, some of the work done on the libjpeg, including some of the more upper-level interfaces, I was in the search libjpeg can directly compress YV12 data when found this thing, found his website has introduced YV12 content, But it's blurry. Compress and decompress YV12 find data error, and then carefully search the relevant information to find his interface just provides the ability to decode the JPEG image into YV12, There is no interface for directly encoding YV12 format images. However, it is also mentioned that there is an interface for direct encoding and decoding of YV12 in the version being developed.
http://sourceforge.net/p/libjpeg-turbo/mailman/message/32239709/
This time, we'll have to test it carefully.
Ref
http://www.ijg.org/
http://libjpeg.sourceforge.net/
http://www.libjpeg-turbo.org/
Libjpeg compression and decompression of images