Guest User

Untitled

a guest
Jun 30th, 2010
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. From: Lamont Alston <[email protected]>
  2. Date: Mon, 28 Jun 2010 19:40:44 -0400
  3. Subject: [PATCH] ensure that in open-gop bluray mode both coded and display distance is obeyed
  4.  
  5. encoder/encoder.c | 2 +-
  6. encoder/slicetype.c | 18 ++++++------------
  7. x264.c | 2 +-
  8. x264.h | 8 ++++----
  9. 4 files changed, 12 insertions(+), 18 deletions(-)
  10.  
  11. Index: encoder/encoder.c
  12. ===================================================================
  13. --- encoder/encoder_orig.c
  14. +++ encoder/encoder.c
  15. @@ -575,7 +575,7 @@ static int x264_validate_parameters( x264_t *h )
  16. h->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
  17. }
  18. h->param.i_bframe = x264_clip3( h->param.i_bframe, 0, X264_MIN( X264_BFRAME_MAX, h->param.i_keyint_max-1 ) );
  19. - h->param.i_open_gop = x264_clip3( h->param.i_open_gop, X264_OPEN_GOP_NONE, X264_OPEN_GOP_CODED_ORDER );
  20. + h->param.i_open_gop = x264_clip3( h->param.i_open_gop, X264_OPEN_GOP_NONE, X264_OPEN_GOP_BLURAY_ORDER );
  21. if( h->param.i_keyint_max == 1 )
  22. h->param.b_intra_refresh = 0;
  23. h->param.i_bframe_bias = x264_clip3( h->param.i_bframe_bias, -90, 100 );
  24. Index: encoder/slicetype.c
  25. ===================================================================
  26. --- encoder/slicetype_orig.c
  27. +++ encoder/slicetype.c
  28. @@ -1233,17 +1233,11 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
  29. if( !h->param.b_intra_refresh )
  30. for( int i = keyint_limit+1; i <= num_frames; i += h->param.i_keyint_max )
  31. {
  32. - int j = i;
  33. - if( h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
  34. - {
  35. - while( IS_X264_TYPE_B( frames[i]->i_type ) )
  36. - i++;
  37. - while( IS_X264_TYPE_B( frames[j-1]->i_type ) )
  38. - j--;
  39. - }
  40. frames[i]->i_type = X264_TYPE_I;
  41. reset_start = X264_MIN( reset_start, i+1 );
  42. - i = j;
  43. + if( h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
  44. + while( IS_X264_TYPE_B( frames[i-1]->i_type ) )
  45. + i--;
  46. }
  47.  
  48. if( vbv_lookahead )
  49. @@ -1339,7 +1333,7 @@ void x264_slicetype_decide( x264_t *h )
  50. int warn = frm->i_type != X264_TYPE_IDR;
  51. if( warn && h->param.i_open_gop == X264_OPEN_GOP_DISPLAY_ORDER )
  52. warn &= frm->i_type != X264_TYPE_I && frm->i_type != X264_TYPE_KEYFRAME;
  53. - if( warn && h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
  54. + if( warn && h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
  55. {
  56. /* if this minigop ends with i, it's not a violation */
  57. int j = bframes;
  58. @@ -1355,8 +1349,8 @@ void x264_slicetype_decide( x264_t *h )
  59. if( h->param.i_open_gop )
  60. {
  61. h->lookahead->i_last_keyframe = frm->i_frame; // Use display order
  62. - if( h->param.i_open_gop == X264_OPEN_GOP_CODED_ORDER )
  63. - h->lookahead->i_last_keyframe -= bframes; // Use coded order
  64. + if( h->param.i_open_gop == X264_OPEN_GOP_BLURAY_ORDER )
  65. + h->lookahead->i_last_keyframe -= bframes; // Use bluray order
  66. frm->b_keyframe = 1;
  67. }
  68. else
  69. Index: x264.c
  70. ===================================================================
  71. --- x264_orig.c
  72. +++ x264.c
  73. @@ -385,7 +385,7 @@ static void Help( x264_param_t *defaults, int longhelp )
  74. " - none: Use standard closed GOPs\n"
  75. " - display: Base GOP length on display order\n"
  76. " (not Blu-ray compatible)\n"
  77. - " - coded: Base GOP length on coded order\n"
  78. + " - bluray: Base GOP length on bluray order\n"
  79. " Only available with b-frames\n" );
  80. H1( " --no-cabac Disable CABAC\n" );
  81. H1( " -r, --ref <integer> Number of reference frames [%d]\n", defaults->i_frame_reference );
  82. Index: x264.h
  83. ===================================================================
  84. --- x264_orig.h
  85. +++ x264.h
  86. @@ -35,7 +35,7 @@
  87.  
  88. #include <stdarg.h>
  89.  
  90. -#define X264_BUILD 100
  91. +#define X264_BUILD 101
  92.  
  93. /* x264_t:
  94. * opaque handler for encoder */
  95. @@ -106,7 +106,7 @@ typedef struct x264_t x264_t;
  96. #define X264_KEYINT_MIN_AUTO 0
  97. #define X264_OPEN_GOP_NONE 0
  98. #define X264_OPEN_GOP_DISPLAY_ORDER 1
  99. -#define X264_OPEN_GOP_CODED_ORDER 2
  100. +#define X264_OPEN_GOP_BLURAY_ORDER 2
  101.  
  102. static const char * const x264_direct_pred_names[] = { "none", "spatial", "temporal", "auto", 0 };
  103. static const char * const x264_motion_est_names[] = { "dia", "hex", "umh", "esa", "tesa", 0 };
  104. @@ -118,7 +118,7 @@ static const char * const x264_colorprim_names[] = { "", "bt709", "undef", "", "
  105. static const char * const x264_transfer_names[] = { "", "bt709", "undef", "", "bt470m", "bt470bg", "smpte170m", "smpte240m", "linear", "log100", "log316", 0 };
  106. static const char * const x264_colmatrix_names[] = { "GBR", "bt709", "undef", "", "fcc", "bt470bg", "smpte170m", "smpte240m", "YCgCo", 0 };
  107. static const char * const x264_nal_hrd_names[] = { "none", "vbr", "cbr", 0 };
  108. -static const char * const x264_open_gop_names[] = { "none", "display", "coded", 0 };
  109. +static const char * const x264_open_gop_names[] = { "none", "display", "bluray", 0 };
  110.  
  111. /* Colorspace type
  112. * legacy only; nothing other than I420 is really supported. */
  113. @@ -228,7 +228,7 @@ typedef struct x264_param_t
  114. int i_bframe_adaptive;
  115. int i_bframe_bias;
  116. int i_bframe_pyramid; /* Keep some B-frames as references: 0=off, 1=strict hierarchical, 2=normal */
  117. - int i_open_gop; /* Open gop: 1=display order, 2=coded order to determine gop size */
  118. + int i_open_gop; /* Open gop: 1=display order, 2=bluray order to determine gop size */
  119.  
  120. int b_deblocking_filter;
  121. int i_deblocking_filter_alphac0; /* [-6, 6] -6 light filter, 6 strong */
Advertisement
Add Comment
Please, Sign In to add comment