Commit 71b5f442 authored by Anton Khirnov's avatar Anton Khirnov

libx264: add 'deblock' private option

Deprecate AVCodecContext.deblockalpha/deblockbeta
parent f83c4518
......@@ -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
......
......@@ -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 },
};
......
......@@ -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"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment