[FFmpeg-cvslog] libx264: add 'deblock' private option
Anton Khirnov
git at videolan.org
Tue Sep 6 21:57:05 CEST 2011
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Sep 1 13:15:09 2011 +0200| [71b5f4427b3c17eeea9903aa3bd091db81222c6d] | committer: Anton Khirnov
libx264: add 'deblock' private option
Deprecate AVCodecContext.deblockalpha/deblockbeta
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71b5f4427b3c17eeea9903aa3bd091db81222c6d
---
libavcodec/avcodec.h | 6 ++++--
libavcodec/libx264.c | 20 ++++++++++++++------
libavcodec/options.c | 2 ++
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e31190b..8a51c58 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2456,13 +2456,14 @@ typedef struct AVCodecContext {
*/
float complexityblur;
+#if FF_API_X264_GLOBAL_OPTS
/**
* in-loop deblocking filter alphac0 parameter
* alpha is in the range -6...6
* - encoding: Set by user.
* - decoding: unused
*/
- int deblockalpha;
+ attribute_deprecated int deblockalpha;
/**
* in-loop deblocking filter beta parameter
@@ -2470,7 +2471,8 @@ typedef struct AVCodecContext {
* - encoding: Set by user.
* - decoding: unused
*/
- int deblockbeta;
+ attribute_deprecated int deblockbeta;
+#endif
/**
* macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 698f600..331bbb0 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -60,6 +60,7 @@ typedef struct X264Context {
int fast_pskip;
int aud;
int mbtree;
+ char *deblock;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -184,6 +185,12 @@ static av_cold int X264_close(AVCodecContext *avctx)
return 0;
}
+#define PARSE_X264_OPT(name, var)\
+ if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\
+ av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
+ return AVERROR(EINVAL);\
+ }
+
static av_cold int X264_init(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
@@ -198,8 +205,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.i_keyint_min = x4->params.i_keyint_max;
x4->params.b_deblocking_filter = avctx->flags & CODEC_FLAG_LOOP_FILTER;
- x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
- x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
x4->params.rc.f_complexity_blur = avctx->complexityblur;
@@ -310,6 +315,10 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
if (avctx->bframebias)
x4->params.i_bframe_bias = avctx->bframebias;
+ if (avctx->deblockalpha)
+ x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
+ if (avctx->deblockbeta)
+ x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
x4->params.i_bframe_pyramid = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
@@ -345,10 +354,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.i_aq_mode = x4->aq_mode;
if (x4->aq_strength >= 0)
x4->params.rc.f_aq_strength = x4->aq_strength;
- if (x4->psy_rd && x264_param_parse(&x4->params, "psy-rd", x4->psy_rd) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error parsing option 'psy-rd' with value '%s'.\n", x4->psy_rd);
- return AVERROR(EINVAL);
- }
+ PARSE_X264_OPT("psy-rd", psy_rd);
+ PARSE_X264_OPT("deblock", deblock);
if (x4->psy >= 0)
x4->params.analyse.b_psy = x4->psy;
if (x4->rc_lookahead >= 0)
@@ -474,6 +481,7 @@ static const AVOption options[] = {
{ "fast-pskip", NULL, OFFSET(fast_pskip), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE},
{ "aud", "Use access unit delimiters.", OFFSET(aud), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE},
{ "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE},
+ { "deblock", "Loop filter parameters, in <alpha:beta> form.", OFFSET(deblock), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
{ NULL },
};
diff --git a/libavcodec/options.c b/libavcodec/options.c
index f7875de..2861a5c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -413,8 +413,10 @@ static const AVOption options[]={
#endif
{"skiprd", "RD optimal MB level residual skipping", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SKIP_RD }, INT_MIN, INT_MAX, V|E, "flags2"},
{"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, {.dbl = 20.0 }, FLT_MIN, FLT_MAX, V|E},
+#if FF_API_X264_GLOBAL_OPTS
{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E},
{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E},
+#endif
{"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "partitions"},
{"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I4X4 }, INT_MIN, INT_MAX, V|E, "partitions"},
{"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I8X8 }, INT_MIN, INT_MAX, V|E, "partitions"},
More information about the ffmpeg-cvslog
mailing list