Guard the lossless encoder (in flux) under a flag

Change-Id: I6dd8fd17089c199001c06b1afde14233dc3e3234
This commit is contained in:
Urvang Joshi
2012-04-11 09:52:13 +00:00
committed by James Zern
parent 09f7532cce
commit 6b38378acb
16 changed files with 82 additions and 4 deletions

View File

@ -105,6 +105,7 @@ int WebPPictureAlloc(WebPPicture* const picture) {
mem += uv0_size;
}
} else {
#ifdef USE_LOSSLESS_ENCODER
const uint64_t argb_size = (uint64_t)width * height;
const uint64_t total_size = argb_size * sizeof(*picture->argb);
if (width <= 0 || height <= 0 ||
@ -116,6 +117,9 @@ int WebPPictureAlloc(WebPPicture* const picture) {
picture->argb = (uint32_t*)malloc(total_size);
if (picture->argb == NULL) return 0;
picture->argb_stride = width;
#else
return 0;
#endif
}
}
return 1;
@ -129,14 +133,18 @@ static void WebPPictureGrabSpecs(const WebPPicture* const src,
dst->y = dst->u = dst->v = NULL;
dst->u0 = dst->v0 = NULL;
dst->a = NULL;
#ifdef USE_LOSSLESS_ENCODER
dst->argb = NULL;
#endif
}
// Release memory owned by 'picture'.
void WebPPictureFree(WebPPicture* const picture) {
if (picture != NULL) {
free(picture->y);
#ifdef USE_LOSSLESS_ENCODER
free(picture->argb);
#endif
WebPPictureGrabSpecs(NULL, picture);
}
}
@ -185,9 +193,13 @@ int WebPPictureCopy(const WebPPicture* const src, WebPPicture* const dst) {
}
#endif
} else {
#ifdef USE_LOSSLESS_ENCODER
CopyPlane((uint8_t*)src->argb, 4 * src->argb_stride,
(uint8_t*)dst->argb, 4 * dst->argb_stride,
4 * dst->width, dst->height);
#else
return 0;
#endif
}
return 1;
}
@ -524,6 +536,7 @@ static int Import(WebPPicture* const picture,
}
}
} else {
#ifdef USE_LOSSLESS_ENCODER
if (!import_alpha) {
for (y = 0; y < height; ++y) {
for (x = 0; x < width; ++x) {
@ -551,6 +564,9 @@ static int Import(WebPPicture* const picture,
}
}
}
#else
return 0;
#endif
}
return 1;
}