summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-22 07:55:34 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-31 10:24:17 +0200
commit34dda1251d590df559f54f67b3a3a80e3f5835d7 (patch)
treecf1d4ffd885d00f8559015dd5509f85d9a1ed578 /libavcodec/libx264.c
parent5d4a1048ee251cf7cb2da7d24f23da6d8a34459a (diff)
libx264: add 'b-pyramid' private option.
Deprecate CODEC_FLAG2_BPYRAMID.
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 2cf3009e4d..7ca82d9cd1 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -51,6 +51,7 @@ typedef struct X264Context {
int weightp;
int ssim;
int intra_refresh;
+ int b_pyramid;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -188,8 +189,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.b_cabac = avctx->coder_type == FF_CODER_TYPE_AC;
x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
x4->params.i_bframe_bias = avctx->bframebias;
- x4->params.i_bframe_pyramid = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
- avctx->has_b_frames = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!avctx->max_b_frames;
x4->params.i_keyint_min = avctx->keyint_min;
if (x4->params.i_keyint_min > x4->params.i_keyint_max)
@@ -326,6 +325,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
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;
#endif
if (x4->aq_mode >= 0)
@@ -345,6 +345,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.analyse.b_ssim = x4->ssim;
if (x4->intra_refresh >= 0)
x4->params.b_intra_refresh = x4->intra_refresh;
+ if (x4->b_pyramid >= 0)
+ x4->params.i_bframe_pyramid = x4->b_pyramid;
if (x4->fastfirstpass)
@@ -434,6 +436,10 @@ static const AVOption options[] = {
{ "smart", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_SMART}, INT_MIN, INT_MAX, VE, "weightp" },
{ "ssim", "Calculate and print SSIM stats.", OFFSET(ssim), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE },
{ "intra-refresh", "Use Periodic Intra Refresh instead of IDR frames.",OFFSET(intra_refresh),FF_OPT_TYPE_INT, {-1 }, -1, 1, VE },
+ { "b-pyramid", "Keep some B-frames as references.", OFFSET(b_pyramid), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "b_pyramid" },
+ { "none", NULL, 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_NONE}, INT_MIN, INT_MAX, VE, "b_pyramid" },
+ { "strict", "Strictly hierarchical pyramid", 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_STRICT}, INT_MIN, INT_MAX, VE, "b_pyramid" },
+ { "normal", "Non-strict (not Blu-ray compatible)", 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_NORMAL}, INT_MIN, INT_MAX, VE, "b_pyramid" },
{ NULL },
};