]> git.sesse.net Git - ffmpeg/commitdiff
lavc: Move chromaoffset to codec private options
authorVittorio Giovara <vittorio.giovara@gmail.com>
Sat, 12 Sep 2015 12:40:29 +0000 (14:40 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Thu, 21 Jan 2016 20:33:19 +0000 (15:33 -0500)
This option is only used by x264 and xavs.
It is a very codec-specific option, so deprecate the global variant.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/avcodec.h
libavcodec/libx264.c
libavcodec/libxavs.c
libavcodec/options_table.h

index 160ab60de248798b0999eaae86734ce1a22e0a0b..355e6f6729706e114112e570025b126c4572a4ae 100644 (file)
@@ -1978,12 +1978,11 @@ typedef struct AVCodecContext {
      */
     int refs;
 
-    /**
-     * chroma qp offset from luma
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
+#if FF_API_PRIVATE_OPT
+    /** @deprecated use encoder private options instead */
+    attribute_deprecated
     int chromaoffset;
+#endif
 
 #if FF_API_UNUSED_MEMBERS
     /**
index 5db00ff54015cf0fe9c118f0fd61d66846d2035c..1caf0414d6ee0fccdd633f7d0f4215e2d7351d89 100644 (file)
@@ -80,6 +80,7 @@ typedef struct X264Context {
     int forced_idr;
     int coder;
     int b_frame_strategy;
+    int chroma_offset;
 
     char *x264_params;
 } X264Context;
@@ -412,7 +413,15 @@ static av_cold int X264_init(AVCodecContext *avctx)
     if (avctx->i_quant_factor > 0)
         x4->params.rc.f_ip_factor         = 1 / fabs(avctx->i_quant_factor);
     x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
-    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
+
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+    if (avctx->chromaoffset)
+        x4->chroma_offset = avctx->chromaoffset;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+    x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset;
 
     if (avctx->gop_size >= 0)
         x4->params.i_keyint_max         = avctx->gop_size;
@@ -739,6 +748,7 @@ static const AVOption options[] = {
     { "cavlc",            NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  INT_MIN, INT_MAX, VE, "coder" },
     { "cabac",            NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 },  INT_MIN, INT_MAX, VE, "coder" },
     { "b_strategy",   "Strategy to choose between I/P/B-frames",          OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, VE },
+    { "chromaoffset", "QP difference between chroma and luma",           OFFSET(chroma_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, VE },
 
     { "x264-params",  "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
     { NULL },
index 910d6c965e0f11cc6c61f2c14b89db0b75ccb32d..21833766cf17bf8ad75762808340629aec77b816 100644 (file)
@@ -57,6 +57,7 @@ typedef struct XavsContext {
     int mbtree;
     int mixed_refs;
     int b_frame_strategy;
+    int chroma_offset;
 
     int64_t *pts_buffer;
     int out_frame_count;
@@ -379,7 +380,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
     /* what is the RC method we are now using? Default NO */
     x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);
     x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
-    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
+
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+    if (avctx->chromaoffset)
+        x4->chroma_offset = avctx->chromaoffset;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+    x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset;
 
     x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;
     x4->params.i_log_level    = XAVS_LOG_DEBUG;
@@ -448,6 +457,7 @@ static const AVOption options[] = {
     { "esa",           NULL,      0,    AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_ESA },               INT_MIN, INT_MAX, VE, "motion-est" },
     { "tesa",          NULL,      0,    AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_TESA },              INT_MIN, INT_MAX, VE, "motion-est" },
     { "b_strategy",    "Strategy to choose between I/P/B-frames",         OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, VE},
+    { "chromaoffset", "QP difference between chroma and luma",           OFFSET(chroma_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE},
 
     { NULL },
 };
index 9efaf2cad8f54bfe0163a590f8483e8b95b32de3..7a5766ff8474325891eaa8958569939f34f4ea45 100644 (file)
@@ -390,7 +390,9 @@ static const AVOption avcodec_options[] = {
 #endif
 {"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E},
 {"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E},
+#if FF_API_PRIVATE_OPT
 {"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
 {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 #if FF_API_UNUSED_MEMBERS
 {"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E},