JPEG decoder: delay conversion to YUV to WebPEncode() call

We store the raw RGB samples decoded from JPEG, and avoid precision loss.

Note that this may increase the encoding time reported by
cwebp -v, since RGB->YUV now occur during WebPEncode call
(in case of lossy), instead of ReadJPEG().
This also increases the memory use, since we're carying the
source ARGB samples around.

Change-Id: Ic2180206cfc9f5574f391e91c3b89b9d81695d01
This commit is contained in:
skal 2014-07-21 22:26:22 +02:00
parent 6f3202be98
commit fbda2f499c

View File

@ -272,6 +272,7 @@ int ReadJPEG(FILE* in_file, WebPPicture* const pic, Metadata* const metadata) {
// WebP conversion. // WebP conversion.
pic->width = width; pic->width = width;
pic->height = height; pic->height = height;
pic->use_argb = 1; // store raw RGB samples
ok = WebPPictureImportRGB(pic, rgb, stride); ok = WebPPictureImportRGB(pic, rgb, stride);
if (!ok) goto Error; if (!ok) goto Error;