Commit f9cc9411 authored by Loren Merritt's avatar Loren Merritt

add an option to control direct_8x8_inference_flag, default to enabled.

slightly faster encoding and decoding of p4x4 + B-frames,
and is needed for strict Levels compliance.


git-svn-id: svn://svn.videolan.org/x264/trunk@573 df754926-b1dd-0310-bc7b-ec298dee348c
parent 8f0864a9
...@@ -119,6 +119,7 @@ void x264_param_default( x264_param_t *param ) ...@@ -119,6 +119,7 @@ void x264_param_default( x264_param_t *param )
param->analyse.i_subpel_refine = 5; param->analyse.i_subpel_refine = 5;
param->analyse.b_chroma_me = 1; param->analyse.b_chroma_me = 1;
param->analyse.i_mv_range = -1; // set from level_idc param->analyse.i_mv_range = -1; // set from level_idc
param->analyse.i_direct_8x8_inference = -1; // set from level_idc
param->analyse.i_chroma_qp_offset = 0; param->analyse.i_chroma_qp_offset = 0;
param->analyse.b_fast_pskip = 1; param->analyse.b_fast_pskip = 1;
param->analyse.b_dct_decimate = 1; param->analyse.b_dct_decimate = 1;
...@@ -383,6 +384,8 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) ...@@ -383,6 +384,8 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
p->analyse.b_weighted_bipred = atobool(value); p->analyse.b_weighted_bipred = atobool(value);
OPT("direct") OPT("direct")
b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred ); b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred );
OPT("direct-8x8")
p->analyse.i_direct_8x8_inference = atoi(value);
OPT("chroma-qp-offset") OPT("chroma-qp-offset")
p->analyse.i_chroma_qp_offset = atoi(value); p->analyse.i_chroma_qp_offset = atoi(value);
OPT("me") OPT("me")
......
...@@ -472,6 +472,8 @@ static int x264_validate_parameters( x264_t *h ) ...@@ -472,6 +472,8 @@ static int x264_validate_parameters( x264_t *h )
h->param.analyse.i_mv_range = l->mv_range; h->param.analyse.i_mv_range = l->mv_range;
else else
h->param.analyse.i_mv_range = x264_clip3(h->param.analyse.i_mv_range, 32, 2048); h->param.analyse.i_mv_range = x264_clip3(h->param.analyse.i_mv_range, 32, 2048);
if( h->param.analyse.i_direct_8x8_inference < 0 )
h->param.analyse.i_direct_8x8_inference = l->direct8x8;
} }
if( h->param.rc.f_qblur < 0 ) if( h->param.rc.f_qblur < 0 )
...@@ -493,6 +495,7 @@ static int x264_validate_parameters( x264_t *h ) ...@@ -493,6 +495,7 @@ static int x264_validate_parameters( x264_t *h )
BOOLIFY( b_deblocking_filter ); BOOLIFY( b_deblocking_filter );
BOOLIFY( b_interlaced ); BOOLIFY( b_interlaced );
BOOLIFY( analyse.b_transform_8x8 ); BOOLIFY( analyse.b_transform_8x8 );
BOOLIFY( analyse.i_direct_8x8_inference );
BOOLIFY( analyse.b_bidir_me ); BOOLIFY( analyse.b_bidir_me );
BOOLIFY( analyse.b_chroma_me ); BOOLIFY( analyse.b_chroma_me );
BOOLIFY( analyse.b_fast_pskip ); BOOLIFY( analyse.b_fast_pskip );
......
...@@ -132,12 +132,9 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) ...@@ -132,12 +132,9 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1; sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
sps->b_frame_mbs_only = ! param->b_interlaced; sps->b_frame_mbs_only = ! param->b_interlaced;
sps->b_mb_adaptive_frame_field = param->b_interlaced; sps->b_mb_adaptive_frame_field = param->b_interlaced;
sps->b_direct8x8_inference = 0; sps->b_direct8x8_inference = param->analyse.i_direct_8x8_inference
if( ! sps->b_frame_mbs_only || || ! sps->b_frame_mbs_only
!(param->analyse.inter & X264_ANALYSE_PSUB8x8) ) || !(param->analyse.inter & X264_ANALYSE_PSUB8x8);
{
sps->b_direct8x8_inference = 1;
}
sps->crop.i_left = 0; sps->crop.i_left = 0;
sps->crop.i_top = 0; sps->crop.i_top = 0;
...@@ -553,6 +550,8 @@ void x264_validate_levels( x264_t *h ) ...@@ -553,6 +550,8 @@ void x264_validate_levels( x264_t *h )
if( h->param.i_fps_den > 0 ) if( h->param.i_fps_den > 0 )
CHECK( "MB rate", l->mbps, (int64_t)mbs * h->param.i_fps_num / h->param.i_fps_den ); CHECK( "MB rate", l->mbps, (int64_t)mbs * h->param.i_fps_num / h->param.i_fps_den );
if( h->sps->b_direct8x8_inference < l->direct8x8 )
x264_log( h, X264_LOG_WARNING, "direct 8x8 inference (0) < level requirement (1)\n" );
/* TODO check the rest of the limits */ /* TODO check the rest of the limits */
} }
...@@ -209,6 +209,11 @@ static void Help( x264_param_t *defaults, int b_longhelp ) ...@@ -209,6 +209,11 @@ static void Help( x264_param_t *defaults, int b_longhelp )
H0( " --direct <string> Direct MV prediction mode [\"%s\"]\n" H0( " --direct <string> Direct MV prediction mode [\"%s\"]\n"
" - none, spatial, temporal, auto\n", " - none, spatial, temporal, auto\n",
strtable_lookup( x264_direct_pred_names, defaults->analyse.i_direct_mv_pred ) ); strtable_lookup( x264_direct_pred_names, defaults->analyse.i_direct_mv_pred ) );
H1( " --direct-8x8 <-1|0|1> Direct prediction size [%d]\n"
" - 0: 4x4\n"
" - 1: 8x8\n"
" - -1: smallest possible according to level\n",
defaults->analyse.i_direct_8x8_inference );
H0( " -w, --weightb Weighted prediction for B-frames\n" ); H0( " -w, --weightb Weighted prediction for B-frames\n" );
H0( " --me <string> Integer pixel motion estimation method [\"%s\"]\n", H0( " --me <string> Integer pixel motion estimation method [\"%s\"]\n",
strtable_lookup( x264_motion_est_names, defaults->analyse.i_me_method ) ); strtable_lookup( x264_motion_est_names, defaults->analyse.i_me_method ) );
...@@ -374,6 +379,7 @@ static int Parse( int argc, char **argv, ...@@ -374,6 +379,7 @@ static int Parse( int argc, char **argv,
{ "output", required_argument, NULL, 'o' }, { "output", required_argument, NULL, 'o' },
{ "analyse", required_argument, NULL, 'A' }, { "analyse", required_argument, NULL, 'A' },
{ "direct", required_argument, NULL, 0 }, { "direct", required_argument, NULL, 0 },
{ "direct-8x8", required_argument, NULL, 0 },
{ "weightb", no_argument, NULL, 'w' }, { "weightb", no_argument, NULL, 'w' },
{ "me", required_argument, NULL, 0 }, { "me", required_argument, NULL, 0 },
{ "merange", required_argument, NULL, 0 }, { "merange", required_argument, NULL, 0 },
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <stdarg.h> #include <stdarg.h>
#define X264_BUILD 51 #define X264_BUILD 52
/* x264_t: /* x264_t:
* opaque handler for decoder and encoder */ * opaque handler for decoder and encoder */
...@@ -203,11 +203,12 @@ typedef struct ...@@ -203,11 +203,12 @@ typedef struct
int b_transform_8x8; int b_transform_8x8;
int b_weighted_bipred; /* implicit weighting for B-frames */ int b_weighted_bipred; /* implicit weighting for B-frames */
int i_direct_mv_pred; /* spatial vs temporal mv prediction */ int i_direct_mv_pred; /* spatial vs temporal mv prediction */
int i_direct_8x8_inference; /* forbid 4x4 direct partitions. -1 = auto, based on level */
int i_chroma_qp_offset; int i_chroma_qp_offset;
int i_me_method; /* motion estimation algorithm to use (X264_ME_*) */ int i_me_method; /* motion estimation algorithm to use (X264_ME_*) */
int i_me_range; /* integer pixel motion estimation search range (from predicted mv) */ int i_me_range; /* integer pixel motion estimation search range (from predicted mv) */
int i_mv_range; /* maximum length of a mv (in pixels) */ int i_mv_range; /* maximum length of a mv (in pixels). -1 = auto, based on level */
int i_subpel_refine; /* subpixel motion estimation quality */ int i_subpel_refine; /* subpixel motion estimation quality */
int b_bidir_me; /* jointly optimize both MVs in B-frames */ int b_bidir_me; /* jointly optimize both MVs in B-frames */
int b_chroma_me; /* chroma ME for subpel and mode decision in P-frames */ int b_chroma_me; /* chroma ME for subpel and mode decision in P-frames */
......
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