Message ID | AS8P250MB0744E8FEA8769EA7B913A4188F7D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Commit | 4b8b1415ae7709351eeab4037d0ef2e20bf9f7bd |
Headers | show |
Series | [FFmpeg-devel,1/3] avcodec/vp8: Enforce key-frame only for WebP | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Andreas Rheinhardt: > VP8-in-WebP only uses key frame encoding (see [1]), yet this > is currently not enforced. This commit does so in order to > make output reproducible with frame-threading as the VP8 decoder's > update_thread_context is not called at all when using decoding > VP8-in-WebP (as this is unnecessary for key frame-only streams). > > [1]: https://developers.google.com/speed/webp/docs/riff_container > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/vp8.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > index 83c60adeb0..7972775a1c 100644 > --- a/libavcodec/vp8.c > +++ b/libavcodec/vp8.c > @@ -2665,7 +2665,11 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, > if (ret < 0) > goto err; > > - if (s->actually_webp) { > + if (!is_vp7 && s->actually_webp) { > + // VP8 in WebP is supposed to be intra-only. Enforce this here > + // to ensure that output is reproducible with frame-threading. > + if (!s->keyframe) > + return AVERROR_INVALIDDATA; > // avctx->pix_fmt already set in caller. > } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { > s->pix_fmt = get_pixel_format(s); Will apply this patchset tomorrow unless there are objections. - Andreas
On 03.02.24 14:57, Andreas Rheinhardt wrote: > Andreas Rheinhardt: >> VP8-in-WebP only uses key frame encoding (see [1]), yet this >> is currently not enforced. This commit does so in order to >> make output reproducible with frame-threading as the VP8 decoder's >> update_thread_context is not called at all when using decoding >> VP8-in-WebP (as this is unnecessary for key frame-only streams). >> >> [1]: https://developers.google.com/speed/webp/docs/riff_container >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> >> --- >> libavcodec/vp8.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c >> index 83c60adeb0..7972775a1c 100644 >> --- a/libavcodec/vp8.c >> +++ b/libavcodec/vp8.c >> @@ -2665,7 +2665,11 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, >> if (ret < 0) >> goto err; >> >> - if (s->actually_webp) { >> + if (!is_vp7 && s->actually_webp) { >> + // VP8 in WebP is supposed to be intra-only. Enforce this here >> + // to ensure that output is reproducible with frame-threading. >> + if (!s->keyframe) >> + return AVERROR_INVALIDDATA; >> // avctx->pix_fmt already set in caller. >> } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { >> s->pix_fmt = get_pixel_format(s); > > Will apply this patchset tomorrow unless there are objections. Works as expected for me for a coupled version of the animated webp decoder which can follow-up. Thanks, Thilo
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 83c60adeb0..7972775a1c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2665,7 +2665,11 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, if (ret < 0) goto err; - if (s->actually_webp) { + if (!is_vp7 && s->actually_webp) { + // VP8 in WebP is supposed to be intra-only. Enforce this here + // to ensure that output is reproducible with frame-threading. + if (!s->keyframe) + return AVERROR_INVALIDDATA; // avctx->pix_fmt already set in caller. } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { s->pix_fmt = get_pixel_format(s);
VP8-in-WebP only uses key frame encoding (see [1]), yet this is currently not enforced. This commit does so in order to make output reproducible with frame-threading as the VP8 decoder's update_thread_context is not called at all when using decoding VP8-in-WebP (as this is unnecessary for key frame-only streams). [1]: https://developers.google.com/speed/webp/docs/riff_container Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vp8.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)