]> git.sesse.net Git - ffmpeg/commitdiff
mpegvideo_enc: add quantizer_noise_shaping private option.
authorAnton Khirnov <anton@khirnov.net>
Mon, 27 Feb 2012 19:06:23 +0000 (20:06 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 29 Feb 2012 06:26:24 +0000 (07:26 +0100)
Deprecate corresponding AVCodecContext field.

libavcodec/avcodec.h
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c
libavcodec/options.c

index a9fc31e90068106b38dabc231a91f4fe4a64395f..f4db08335a49fe88a24975019216cb481abad035 100644 (file)
@@ -1757,12 +1757,12 @@ typedef struct AVCodecContext {
     attribute_deprecated int inter_threshold;
 #endif
 
+#if FF_API_MPV_GLOBAL_OPTS
     /**
-     * quantizer noise shaping
-     * - encoding: Set by user.
-     * - decoding: unused
+     * @deprecated use mpegvideo private options instead
      */
-    int quantizer_noise_shaping;
+    attribute_deprecated int quantizer_noise_shaping;
+#endif
 
     /**
      * Motion estimation threshold below which no motion estimation is
index 084f4be7693297bf27afec2c6b570033f1203a8d..ad0bd3a164dd076d77223bd0c1ad4ba2dbb93a92 100644 (file)
@@ -691,6 +691,7 @@ typedef struct MpegEncContext {
     void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block);
 
     int mpv_flags;      ///< flags set by private options
+    int quantizer_noise_shaping;
 } MpegEncContext;
 
 #define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
@@ -715,7 +716,8 @@ typedef struct MpegEncContext {
 { "luma_elim_threshold",   "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
                                                                       FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
 { "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
-                                                                      FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },
+                                                                      FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
+{ "quantizer_noise_shaping", NULL,                                  FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { 0 },       0, INT_MAX, FF_MPV_OPT_FLAGS },
 
 extern const AVOption ff_mpv_generic_options[];
 
index 8a516b3016f677e60512ebd3e62f22381a28a57f..0940eeda2fd82412d18778ef65b0257f2d72c256 100644 (file)
@@ -630,6 +630,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
         s->mpv_flags |= FF_MPV_FLAG_SKIP_RD;
     if (avctx->flags2 & CODEC_FLAG2_STRICT_GOP)
         s->mpv_flags |= FF_MPV_FLAG_STRICT_GOP;
+    if (avctx->quantizer_noise_shaping)
+        s->quantizer_noise_shaping = avctx->quantizer_noise_shaping;
 #endif
 
     switch (avctx->codec->id) {
@@ -1949,7 +1951,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
         }
     }
 
-    if (s->avctx->quantizer_noise_shaping) {
+    if (s->quantizer_noise_shaping) {
         if (!skip_dct[0])
             get_visual_weight(weight[0], ptr_y                 , wrap_y);
         if (!skip_dct[1])
@@ -1990,7 +1992,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
             } else
                 s->block_last_index[i] = -1;
         }
-        if (s->avctx->quantizer_noise_shaping) {
+        if (s->quantizer_noise_shaping) {
             for (i = 0; i < mb_block_count; i++) {
                 if (!skip_dct[i]) {
                     s->block_last_index[i] =
@@ -3738,7 +3740,7 @@ STOP_TIMER("init rem[]")
 #ifdef REFINE_STATS
 {START_TIMER
 #endif
-        analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
+        analyze_gradient = last_non_zero > 2 || s->quantizer_noise_shaping >= 3;
 
         if(analyze_gradient){
 #ifdef REFINE_STATS
@@ -3796,7 +3798,7 @@ STOP_TIMER("dct")}
             const int level= block[j];
             int change, old_coeff;
 
-            if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
+            if(s->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
                 break;
 
             if(level){
@@ -3814,7 +3816,7 @@ STOP_TIMER("dct")}
                 int score, new_coeff, unquant_change;
 
                 score=0;
-                if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
+                if(s->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
                    continue;
 
                 if(new_level){
index dbf3427d912a81eef766f5172895afd9e9e65d34..288c75437a9ebd0aa9e408c95b99b0e454fe6df2 100644 (file)
@@ -325,7 +325,9 @@ static const AVOption options[]={
 #endif
 {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"},
 {"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#if FF_API_MPV_GLOBAL_OPTS
+{"qns", "deprecated, use mpegvideo private options instead", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
 {"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E|D, "threads"},
 {"auto", "detect a good number of threads", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
 {"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},