From fbda2f499ccc27bccdd543343e99f420f4b001f6 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 21 Jul 2014 22:26:22 +0200 Subject: [PATCH] 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 --- examples/jpegdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/jpegdec.c b/examples/jpegdec.c index c06da8dc..5411e6e0 100644 --- a/examples/jpegdec.c +++ b/examples/jpegdec.c @@ -272,6 +272,7 @@ int ReadJPEG(FILE* in_file, WebPPicture* const pic, Metadata* const metadata) { // WebP conversion. pic->width = width; pic->height = height; + pic->use_argb = 1; // store raw RGB samples ok = WebPPictureImportRGB(pic, rgb, stride); if (!ok) goto Error;