mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-14 21:09:55 +02:00
AnimEncoder API: Support input frames in YUV(A) format.
We automatically convert them to ARGB format. Change-Id: Ia21f07e08c746e16a318cb035af375c81d9af0de
This commit is contained in:
@ -1058,14 +1058,25 @@ int WebPAnimEncoderAdd(WebPAnimEncoder* enc, WebPPicture* frame, int duration,
|
||||
return 0;
|
||||
}
|
||||
if (frame->width != enc->canvas_width_ ||
|
||||
frame->height != enc->canvas_height_ || !frame->use_argb ||
|
||||
duration < 0) {
|
||||
frame->height != enc->canvas_height_ || duration < 0) {
|
||||
frame->error_code = VP8_ENC_ERROR_INVALID_CONFIGURATION;
|
||||
if (enc->options_.verbose) {
|
||||
fprintf(stderr, "ERROR adding frame: Invalid input.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!frame->use_argb) { // Convert frame from YUV(A) to ARGB.
|
||||
if (enc->options_.verbose) {
|
||||
fprintf(stderr, "WARNING: Converting frame from YUV(A) to ARGB format; "
|
||||
"this incurs a small loss.\n");
|
||||
}
|
||||
if (!WebPPictureYUVAToARGB(frame)) {
|
||||
fprintf(stderr, "ERROR converting frame from YUV(A) to ARGB\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (encoder_config != NULL) {
|
||||
config = *encoder_config;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user