diff mbox

[FFmpeg-devel] lavc/libvpxenc: Avaoid vp8 transparency encoding with auto-alt-ref

Message ID 201609161423.14133.cehoyos@ag.or.at
State Accepted
Commit 44bcb636c1a7052059330c3edbd900246e15ae60
Headers show

Commit Message

Carl Eugen Hoyos Sept. 16, 2016, 12:23 p.m. UTC
Hi!

Attached patch fixes ticket #5815.

Please comment, Carl Eugen
From 3cf356b38a8ea6f9c98c36ad5cc7413dfa780e28 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Fri, 16 Sep 2016 14:21:09 +0200
Subject: [PATCH] lavc/libvpxenc: Avoid vp8 transparency encoding with
 auto-alt-ref.

Fixes ticket #5815.
---
 libavcodec/libvpxenc.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

James Zern Sept. 16, 2016, 11:48 p.m. UTC | #1
On Fri, Sep 16, 2016 at 5:23 AM, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
> Hi!
>
> Attached patch fixes ticket #5815.
>

> +    if (ctx->auto_alt_ref && ctx->is_alpha && avctx->codec_id == AV_CODEC_ID_VP8) {
> +        av_log(avctx, AV_LOG_ERROR, "Transparency encoding with auto_alt_ref does not work\n");
> +        return AVERROR(EINVAL);
> +    }
> +
>

This is a bit drastic, but might be necessary if the bug is reliably
occurring. This sounds like a libvpx bug, I'll try to reproduce
locally when I get a chance.
Carl Eugen Hoyos Sept. 16, 2016, 11:50 p.m. UTC | #2
2016-09-17 1:48 GMT+02:00 James Zern:
> On Fri, Sep 16, 2016 at 5:23 AM, Carl Eugen Hoyos wrote:

>> Attached patch fixes ticket #5815.
>
>> +    if (ctx->auto_alt_ref && ctx->is_alpha && avctx->codec_id == AV_CODEC_ID_VP8) {
>> +        av_log(avctx, AV_LOG_ERROR, "Transparency encoding with auto_alt_ref does not work\n");
>> +        return AVERROR(EINVAL);
>> +    }
>> +
>>
>
> This is a bit drastic, but might be necessary if the bug is reliably

It only occurs if you try to encode with transparency and
auto_alt_ref.

> occurring. This sounds like a libvpx bug, I'll try to reproduce
> locally when I get a chance.

Please do!

Carl Eugen
James Zern Sept. 17, 2016, 2:44 a.m. UTC | #3
On Fri, Sep 16, 2016 at 4:50 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2016-09-17 1:48 GMT+02:00 James Zern:
>> On Fri, Sep 16, 2016 at 5:23 AM, Carl Eugen Hoyos wrote:
>
>>> Attached patch fixes ticket #5815.
>>
>>> +    if (ctx->auto_alt_ref && ctx->is_alpha && avctx->codec_id == AV_CODEC_ID_VP8) {
>>> +        av_log(avctx, AV_LOG_ERROR, "Transparency encoding with auto_alt_ref does not work\n");
>>> +        return AVERROR(EINVAL);
>>> +    }
>>> +
>>>
>>
>> This is a bit drastic, but might be necessary if the bug is reliably
>
> It only occurs if you try to encode with transparency and
> auto_alt_ref.
>

Thanks for the easy repro. It may have something to do with the fact
that in vp8 the alt-ref is a separate frame, this needs a closer look.
Feel free to apply the change in the meantime.

>> occurring. This sounds like a libvpx bug, I'll try to reproduce
>> locally when I get a chance.
>
> Please do!
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Carl Eugen Hoyos Sept. 17, 2016, 9:43 a.m. UTC | #4
2016-09-17 4:44 GMT+02:00 James Zern <jzern-at-google.com@ffmpeg.org>:

> Thanks for the easy repro. It may have something to do with the fact
> that in vp8 the alt-ref is a separate frame, this needs a closer look.

Please keep us informed.

> Feel free to apply the change in the meantime.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index f3cff81..2db87f7 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -631,6 +631,11 @@  FF_ENABLE_DEPRECATION_WARNINGS
     if (ctx->tune >= 0)
         codecctl_int(avctx, VP8E_SET_TUNING,           ctx->tune);
 
+    if (ctx->auto_alt_ref && ctx->is_alpha && avctx->codec_id == AV_CODEC_ID_VP8) {
+        av_log(avctx, AV_LOG_ERROR, "Transparency encoding with auto_alt_ref does not work\n");
+        return AVERROR(EINVAL);
+    }
+
     if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) {
 #if FF_API_PRIVATE_OPT
 FF_DISABLE_DEPRECATION_WARNINGS