mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
WebPEncode: clear stats at the start of encode
also relocate user_data from WebPAuxStats to the WebPPicture struct to make clearing easier while placing it closer to the progress hook with which it's used. prior to this change some spurious lossless data could be reported in the lossy (sans alpha) encoding case. additionally user_data could be lost during lossless encoding. Change-Id: I929fae3dfde4d445ff81bbaad51445ea586dd80b
This commit is contained in:
@ -344,6 +344,8 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
|
||||
if (pic->width > WEBP_MAX_DIMENSION || pic->height > WEBP_MAX_DIMENSION)
|
||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
|
||||
if (pic->stats != NULL) memset(pic->stats, 0, sizeof(*pic->stats));
|
||||
|
||||
if (!config->lossless) {
|
||||
VP8Encoder* enc = NULL;
|
||||
if (pic->y == NULL || pic->u == NULL || pic->v == NULL) {
|
||||
|
Reference in New Issue
Block a user