Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From: Lamont Alston <[email protected]>
- Date: Mon, 28 Jun 2010 19:40:44 -0400
- Subject: [PATCH] ensure that in open-gop bluray mode both coded and display distance is obeyed
- encoder/encoder.c | 2 +-
- encoder/slicetype.c | 18 ++++++------------
- x264.c | 2 +-
- x264.h | 8 ++++----
- 4 files changed, 12 insertions(+), 18 deletions(-)
- Index: encoder/encoder.c
- ===================================================================
- --- encoder/encoder_orig.c
- +++ encoder/encoder.c
- @@ -575,7 +575,7 @@ static int x264_validate_parameters( x264_t *h )
- h->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
- }
- h->param.i_bframe = x264_clip3( h->param.i_bframe, 0, X264_MIN( X264_BFRAME_MAX, h->param.i_keyint_max-1 ) );
- - h->param.i_open_gop = x264_clip3( h->param.i_open_gop, X264_OPEN_GOP_NONE, X264_OPEN_GOP_CODED_ORDER );
- + h->param.i_open_gop = x264_clip3( h->param.i_open_gop, X264_OPEN_GOP_NONE, X264_OPEN_GOP_BLURAY_ORDER );
- if( h->param.i_keyint_max == 1 )
- h->param.b_intra_refresh = 0;
- h->param.i_bframe_bias = x264_clip3( h->param.i_bframe_bias, -90, 100 );
- Index: encoder/slicetype.c
- ===================================================================
- --- encoder/slicetype_orig.c
- +++ encoder/slicetype.c
- @@ -1233,17 +1233,11 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
- if( !h->param.b_intra_refresh )
- for( int i = keyint_limit+1; i <= num_frames; i += h->param.i_keyint_max )
- {
- - int j = i;
- - if( h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
- - {
- - while( IS_X264_TYPE_B( frames[i]->i_type ) )
- - i++;
- - while( IS_X264_TYPE_B( frames[j-1]->i_type ) )
- - j--;
- - }
- frames[i]->i_type = X264_TYPE_I;
- reset_start = X264_MIN( reset_start, i+1 );
- - i = j;
- + if( h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
- + while( IS_X264_TYPE_B( frames[i-1]->i_type ) )
- + i--;
- }
- if( vbv_lookahead )
- @@ -1339,7 +1333,7 @@ void x264_slicetype_decide( x264_t *h )
- int warn = frm->i_type != X264_TYPE_IDR;
- if( warn && h->param.i_open_gop == X264_OPEN_GOP_DISPLAY_ORDER )
- warn &= frm->i_type != X264_TYPE_I && frm->i_type != X264_TYPE_KEYFRAME;
- - if( warn && h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
- + if( warn && h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
- {
- /* if this minigop ends with i, it's not a violation */
- int j = bframes;
- @@ -1355,8 +1349,8 @@ void x264_slicetype_decide( x264_t *h )
- if( h->param.i_open_gop )
- {
- h->lookahead->i_last_keyframe = frm->i_frame; // Use display order
- - if( h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
- - h->lookahead->i_last_keyframe -= bframes; // Use coded order
- + if( h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
- + h->lookahead->i_last_keyframe -= bframes; // Use bluray order
- frm->b_keyframe = 1;
- }
- else
- Index: x264.c
- ===================================================================
- --- x264_orig.c
- +++ x264.c
- @@ -385,7 +385,7 @@ static void Help( x264_param_t *defaults, int longhelp )
- " - none: Use standard closed GOPs\n"
- " - display: Base GOP length on display order\n"
- " (not Blu-ray compatible)\n"
- - " - coded: Base GOP length on coded order\n"
- + " - bluray: Base GOP length on bluray order\n"
- " Only available with b-frames\n" );
- H1( " --no-cabac Disable CABAC\n" );
- H1( " -r, --ref <integer> Number of reference frames [%d]\n", defaults->i_frame_reference );
- Index: x264.h
- ===================================================================
- --- x264_orig.h
- +++ x264.h
- @@ -35,7 +35,7 @@
- #include <stdarg.h>
- -#define X264_BUILD 100
- +#define X264_BUILD 101
- /* x264_t:
- * opaque handler for encoder */
- @@ -106,7 +106,7 @@ typedef struct x264_t x264_t;
- #define X264_KEYINT_MIN_AUTO 0
- #define X264_OPEN_GOP_NONE 0
- #define X264_OPEN_GOP_DISPLAY_ORDER 1
- -#define X264_OPEN_GOP_CODED_ORDER 2
- +#define X264_OPEN_GOP_BLURAY_ORDER 2
- static const char * const x264_direct_pred_names[] = { "none", "spatial", "temporal", "auto", 0 };
- static const char * const x264_motion_est_names[] = { "dia", "hex", "umh", "esa", "tesa", 0 };
- @@ -118,7 +118,7 @@ static const char * const x264_colorprim_names[] = { "", "bt709", "undef", "", "
- static const char * const x264_transfer_names[] = { "", "bt709", "undef", "", "bt470m", "bt470bg", "smpte170m", "smpte240m", "linear", "log100", "log316", 0 };
- static const char * const x264_colmatrix_names[] = { "GBR", "bt709", "undef", "", "fcc", "bt470bg", "smpte170m", "smpte240m", "YCgCo", 0 };
- static const char * const x264_nal_hrd_names[] = { "none", "vbr", "cbr", 0 };
- -static const char * const x264_open_gop_names[] = { "none", "display", "coded", 0 };
- +static const char * const x264_open_gop_names[] = { "none", "display", "bluray", 0 };
- /* Colorspace type
- * legacy only; nothing other than I420 is really supported. */
- @@ -228,7 +228,7 @@ typedef struct x264_param_t
- int i_bframe_adaptive;
- int i_bframe_bias;
- int i_bframe_pyramid; /* Keep some B-frames as references: 0=off, 1=strict hierarchical, 2=normal */
- - int i_open_gop; /* Open gop: 1=display order, 2=coded order to determine gop size */
- + int i_open_gop; /* Open gop: 1=display order, 2=bluray order to determine gop size */
- int b_deblocking_filter;
- int i_deblocking_filter_alphac0; /* [-6, 6] -6 light filter, 6 strong */
Advertisement
Add Comment
Please, Sign In to add comment