[FFmpeg-cvslog] libx264: add 'psy' private option.

Anton Khirnov git at videolan.org
Thu Sep 1 00:03:06 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 27 10:16:14 2011 +0200| [38934f19fe624270fabf32a411d84f1fee3e0aae] | committer: Anton Khirnov

libx264: add 'psy' private option.

Deprecate CODEC_FLAG2_PSY

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38934f19fe624270fabf32a411d84f1fee3e0aae
---

 libavcodec/avcodec.h |    2 +-
 libavcodec/libx264.c |    7 +++++--
 libavcodec/options.c |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6422683..b0317d5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -632,8 +632,8 @@ typedef struct RcOverride{
 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
 #endif
 #define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
-#define CODEC_FLAG2_PSY           0x00080000 ///< Use psycho visual optimizations.
 #if FF_API_X264_GLOBAL_OPTS
+#define CODEC_FLAG2_PSY           0x00080000 ///< Use psycho visual optimizations.
 #define CODEC_FLAG2_SSIM          0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes.
 #endif
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index e653de4..2ea6614 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -47,6 +47,7 @@ typedef struct X264Context {
     int aq_mode;
     float aq_strength;
     char *psy_rd;
+    int psy;
     int rc_lookahead;
     int weightp;
     int weightb;
@@ -243,8 +244,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
         x4->params.analyse.i_me_method = X264_ME_TESA;
     else x4->params.analyse.i_me_method = X264_ME_HEX;
 
-    x4->params.analyse.b_psy              = avctx->flags2 & CODEC_FLAG2_PSY;
-
     x4->params.analyse.i_me_range         = avctx->me_range;
     x4->params.analyse.i_subpel_refine    = avctx->me_subpel_quality;
 
@@ -331,6 +330,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->params.analyse.b_transform_8x8    = avctx->flags2 & CODEC_FLAG2_8X8DCT;
     x4->params.analyse.b_fast_pskip       = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
     x4->params.b_aud                      = avctx->flags2 & CODEC_FLAG2_AUD;
+    x4->params.analyse.b_psy              = avctx->flags2 & CODEC_FLAG2_PSY;
 #endif
 
     if (x4->aq_mode >= 0)
@@ -341,6 +341,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Error parsing option 'psy-rd' with value '%s'.\n", x4->psy_rd);
         return AVERROR(EINVAL);
     }
+    if (x4->psy >= 0)
+        x4->params.analyse.b_psy  = x4->psy;
     if (x4->rc_lookahead >= 0)
         x4->params.rc.i_lookahead = x4->rc_lookahead;
     if (x4->weightp >= 0)
@@ -440,6 +442,7 @@ static const AVOption options[] = {
     { "variance",      "Variance AQ (complexity mask)",   0, FF_OPT_TYPE_CONST, {X264_AQ_VARIANCE},     INT_MIN, INT_MAX, VE, "aq_mode" },
     { "autovariance",  "Auto-variance AQ (experimental)", 0, FF_OPT_TYPE_CONST, {X264_AQ_AUTOVARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" },
     { "aq-strength",   "AQ strength. Reduces blocking and blurring in flat and textured areas.", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {-1}, -1, FLT_MAX, VE},
+    { "psy",           "Use psychovisual optimizations.",                 OFFSET(psy),           FF_OPT_TYPE_INT,    {-1 }, -1, 1, VE },
     { "psy-rd",        "Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.", OFFSET(psy_rd), FF_OPT_TYPE_STRING,  {0 }, 0, 0, VE},
     { "rc-lookahead",  "Number of frames to look ahead for frametype and ratecontrol", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE },
     { "weightb",       "Weighted prediction for B-frames.",               OFFSET(weightb),       FF_OPT_TYPE_INT,    {-1 }, -1, 1, VE },
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 1344a89..e7e7983 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -446,8 +446,8 @@ static const AVOption options[]={
 {"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, {.dbl = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D},
 {"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, {.dbl = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D},
 {"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, {.dbl = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D},
-{"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_PSY }, INT_MIN, INT_MAX, V|E, "flags2"},
 #if FF_API_X264_GLOBAL_OPTS
+{"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_PSY }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E},
 {"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E},
 {"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, V|E},



More information about the ffmpeg-cvslog mailing list