[FFmpeg-devel] [PATCH] remove redundant libvpx AVOptions

James Zern jzern at google.com
Fri Jan 6 01:07:24 CET 2012


On Thu, Jan 5, 2012 at 11:47, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Wed, Jan 04, 2012 at 11:34:50PM +0530, j at v2v.cc wrote:
>> On 01/04/2012 05:26 PM, Carl Eugen Hoyos wrote:
>>
>> >> currently ffmpeg provides 2 ways of setting many libvpx flags.
>> >> this is confusing. there should be just one way to set those flags.
>> >> this makes ffmpeg -h much cleaner and documentation and use
>> >> easier.
>> >
>> > Given that is must break (some) scripts, I am slightly against such changes.
>> >
>>
>> as a minimum the double declaration of best, good and realtime should be
>> removed.
>
> fixed, thanks
>
>
>>
>> doc/encoders.texi also still references vp8flags=+altref but its gone;
>> so (some) scripts are broken already.
>
> yes, sadly.
> do you volunteer to update the docs or add the option back for
> compatibility ?
>
Both options attached, your preference.

> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
From 922e4a17b72cc979717bbde72cc75b64bcc379b6 Mon Sep 17 00:00:00 2001
From: James Zern <jzern at google.com>
Date: Thu, 5 Jan 2012 14:24:26 -0800
Subject: [PATCH] libvpxenc: restore vp8flags for compatibility

removed in 98df93c, this makes the documentation correct again.

Found-by:  j at v2v.cc
---
 libavcodec/libvpxenc.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 4a91f3d..044ea32 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -58,6 +58,13 @@ typedef struct VP8EncoderContext {
     struct FrameListData *coded_frame_list;
 
     int cpu_used;
+    /**
+     * VP8 specific flags, see VP8F_* below.
+     */
+    int flags;
+#define VP8F_ERROR_RESILIENT 0x00000001 ///< Enable measures appropriate for streaming over lossy links
+#define VP8F_AUTO_ALT_REF    0x00000002 ///< Enable automatic alternate reference frame generation
+
     int auto_alt_ref;
 
     int arnr_max_frames;
@@ -329,7 +336,7 @@ static av_cold int vp8_init(AVCodecContext *avctx)
    if (avctx->profile != FF_PROFILE_UNKNOWN)
        enccfg.g_profile = avctx->profile;
 
-    enccfg.g_error_resilient = ctx->error_resilient;
+    enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
 
     dump_enc_cfg(avctx, &enccfg);
     /* Construct Encoder Context */
@@ -343,6 +350,8 @@ static av_cold int vp8_init(AVCodecContext *avctx)
     av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
     if (ctx->cpu_used != INT_MIN)
         codecctl_int(avctx, VP8E_SET_CPUUSED,          ctx->cpu_used);
+    if (ctx->flags & VP8F_AUTO_ALT_REF)
+        ctx->auto_alt_ref = 1;
     if (ctx->auto_alt_ref >= 0)
         codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
     if (ctx->arnr_max_frames >= 0)
@@ -574,6 +583,9 @@ static const AVOption options[] = {
 #endif
 {"speed", "", offsetof(VP8Context, cpu_used), AV_OPT_TYPE_INT, {.dbl = 3}, -16, 16, VE},
 {"quality", "", offsetof(VP8Context, deadline), AV_OPT_TYPE_INT, {.dbl = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"},
+{"vp8flags", "", offsetof(VP8Context, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, 0, UINT_MAX, VE, "flags"},
+{"error_resilient", "enable error resilience", 0, FF_OPT_TYPE_CONST, {.dbl = VP8F_ERROR_RESILIENT}, INT_MIN, INT_MAX, VE, "flags"},
+{"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, FF_OPT_TYPE_CONST, {.dbl = VP8F_AUTO_ALT_REF}, INT_MIN, INT_MAX, VE, "flags"},
 {"arnr_max_frames", "altref noise reduction max frame count", offsetof(VP8Context, arnr_max_frames), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 15, VE},
 {"arnr_strength", "altref noise reduction filter strength", offsetof(VP8Context, arnr_strength), AV_OPT_TYPE_INT, {.dbl = 3}, 0, 6, VE},
 {"arnr_type", "altref noise reduction filter type", offsetof(VP8Context, arnr_type), AV_OPT_TYPE_INT, {.dbl = 3}, 1, 3, VE},
-- 
1.7.3.1
-------------- next part --------------
From 28d4edec9f5bfd8a5da6de187153a8869000ed59 Mon Sep 17 00:00:00 2001
From: James Zern <jzern at google.com>
Date: Thu, 5 Jan 2012 15:55:50 -0800
Subject: [PATCH] doc/encoders: update libvpx parameter mapping

vp8flags was removed in 98df93c

Found-by:  j at v2v.cc
---
 doc/encoders.texi |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 65841ed..47e7527 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -513,7 +513,7 @@ rc_2pass_vbr_minsection_pct
 
 @item Alternate reference frame related
 @table @option
- at item vp8flags altref
+ at item auto-alt-ref
 @code{VP8E_SET_ENABLEAUTOALTREF}
 @item @var{arnr_max_frames}
 @code{VP8E_SET_ARNR_MAXFRAMES}
@@ -525,7 +525,7 @@ rc_2pass_vbr_minsection_pct
 g_lag_in_frames
 @end table
 
- at item vp8flags error_resilient
+ at item error-resilient
 g_error_resilient
 
 @end table
-- 
1.7.3.1


More information about the ffmpeg-devel mailing list