libx264: add 'b-pyramid' private option.
Deprecate CODEC_FLAG2_BPYRAMID.
This commit is contained in:
		
							parent
							
								
									5d4a1048ee
								
							
						
					
					
						commit
						34dda1251d
					
				@ -607,7 +607,9 @@ typedef struct RcOverride{
 | 
				
			|||||||
#define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
 | 
					#define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
 | 
				
			||||||
#define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
 | 
					#define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
 | 
				
			||||||
#define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
 | 
					#define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
 | 
				
			||||||
 | 
					#if FF_API_X264_GLOBAL_OPTS
 | 
				
			||||||
#define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
 | 
					#define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
 | 
					#define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
 | 
				
			||||||
#define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
 | 
					#define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
 | 
				
			||||||
#define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
 | 
					#define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
 | 
				
			||||||
 | 
				
			|||||||
@ -51,6 +51,7 @@ typedef struct X264Context {
 | 
				
			|||||||
    int weightp;
 | 
					    int weightp;
 | 
				
			||||||
    int ssim;
 | 
					    int ssim;
 | 
				
			||||||
    int intra_refresh;
 | 
					    int intra_refresh;
 | 
				
			||||||
 | 
					    int b_pyramid;
 | 
				
			||||||
} X264Context;
 | 
					} X264Context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void X264_log(void *p, int level, const char *fmt, va_list args)
 | 
					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.b_cabac           = avctx->coder_type == FF_CODER_TYPE_AC;
 | 
				
			||||||
    x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
 | 
					    x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
 | 
				
			||||||
    x4->params.i_bframe_bias     = avctx->bframebias;
 | 
					    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;
 | 
					    x4->params.i_keyint_min = avctx->keyint_min;
 | 
				
			||||||
    if (x4->params.i_keyint_min > x4->params.i_keyint_max)
 | 
					    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.i_weighted_pred    = avctx->weighted_p_pred;
 | 
				
			||||||
    x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
 | 
					    x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
 | 
				
			||||||
    x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
 | 
					    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
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (x4->aq_mode >= 0)
 | 
					    if (x4->aq_mode >= 0)
 | 
				
			||||||
@ -345,6 +345,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
 | 
				
			|||||||
        x4->params.analyse.b_ssim = x4->ssim;
 | 
					        x4->params.analyse.b_ssim = x4->ssim;
 | 
				
			||||||
    if (x4->intra_refresh >= 0)
 | 
					    if (x4->intra_refresh >= 0)
 | 
				
			||||||
        x4->params.b_intra_refresh = x4->intra_refresh;
 | 
					        x4->params.b_intra_refresh = x4->intra_refresh;
 | 
				
			||||||
 | 
					    if (x4->b_pyramid >= 0)
 | 
				
			||||||
 | 
					        x4->params.i_bframe_pyramid = x4->b_pyramid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (x4->fastfirstpass)
 | 
					    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" },
 | 
					    { "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 },
 | 
					    { "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 },
 | 
					    { "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 },
 | 
					    { NULL },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -387,7 +387,9 @@ static const AVOption options[]={
 | 
				
			|||||||
{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 | 
					{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 | 
				
			||||||
{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 | 
					{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 | 
				
			||||||
{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = 2 }, INT_MIN, INT_MAX, V|E},
 | 
					{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = 2 }, INT_MIN, INT_MAX, V|E},
 | 
				
			||||||
 | 
					#if FF_API_X264_GLOBAL_OPTS
 | 
				
			||||||
{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
					{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
					{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
				
			||||||
{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
					{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
				
			||||||
{"dct8x8", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_8X8DCT }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
					{"dct8x8", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_8X8DCT }, INT_MIN, INT_MAX, V|E, "flags2"},
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user