0013-x264-drop-148-build-support-and-fix-10bit-support.patch 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. From 5d003fa5df276b62efe82329ef9ce2fd30a34f46 Mon Sep 17 00:00:00 2001
  2. From: Ilkka Ollakka <ileoo@videolan.org>
  3. Date: Sat, 24 Mar 2018 11:23:33 +0200
  4. Subject: [PATCH] x264: drop <148 build support and fix 10bit support
  5. x264: drop <148 build support and fix 10bit support
  6. Drop old #if as 148 is not that recent anymore.
  7. fixes #19581
  8. Rebased upstream commit
  9. http://git.videolan.org/?p=vlc.git;a=commitdiff;h=a8953ba707cca1f2de372ca24513296bcfcdaaa8
  10. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  11. ---
  12. modules/codec/x264.c | 65 ++++++++--------------------------------------------
  13. 1 file changed, 10 insertions(+), 55 deletions(-)
  14. diff --git a/modules/codec/x264.c b/modules/codec/x264.c
  15. index be5d0006de..96a4b08524 100644
  16. --- a/modules/codec/x264.c
  17. +++ b/modules/codec/x264.c
  18. @@ -83,13 +83,7 @@ static void x264_log( void *, int i_level, const char *psz, va_list );
  19. "I-frames, but do not start a new GOP." )
  20. #define OPENGOP_TEXT N_("Use recovery points to close GOPs")
  21. -#if X264_BUILD < 115
  22. -#define OPENGOP_LONGTEXT N_("none: use closed GOPs only\n"\
  23. - "normal: use standard open GOPs\n" \
  24. - "bluray: use Blu-ray compatible open GOPs" )
  25. -#else
  26. #define OPENGOP_LONGTEXT N_("use open GOP, for bluray compatibility use also bluray-compat option")
  27. -#endif
  28. #define BLURAY_TEXT N_("Enable compatibility hacks for Blu-ray support")
  29. #define BLURAY_LONGTEXT N_("Enable hacks for Blu-ray support, this doesn't enforce every aspect of Blu-ray compatibility\n" \
  30. @@ -471,16 +465,10 @@ vlc_module_begin ()
  31. add_integer( SOUT_CFG_PREFIX "min-keyint", 25, MIN_KEYINT_TEXT,
  32. MIN_KEYINT_LONGTEXT, true )
  33. -#if X264_BUILD >= 102 && X264_BUILD <= 114
  34. - add_string( SOUT_CFG_PREFIX "opengop", "none", OPENGOP_TEXT,
  35. - OPENGOP_LONGTEXT, true )
  36. - change_string_list( x264_open_gop_names, x264_open_gop_names )
  37. -#elif X264_BUILD > 114
  38. add_bool( SOUT_CFG_PREFIX "opengop", false, OPENGOP_TEXT,
  39. OPENGOP_LONGTEXT, true )
  40. add_bool( SOUT_CFG_PREFIX "bluray-compat", false, BLURAY_TEXT,
  41. BLURAY_LONGTEXT, true )
  42. -#endif
  43. add_integer( SOUT_CFG_PREFIX "scenecut", 40, SCENE_TEXT,
  44. SCENE_LONGTEXT, true )
  45. @@ -500,13 +488,8 @@ vlc_module_begin ()
  46. B_BIAS_LONGTEXT, true )
  47. change_integer_range( -100, 100 )
  48. -#if X264_BUILD >= 87
  49. add_string( SOUT_CFG_PREFIX "bpyramid", "normal", BPYRAMID_TEXT,
  50. BPYRAMID_LONGTEXT, true )
  51. -#else
  52. - add_string( SOUT_CFG_PREFIX "bpyramid", "none", BPYRAMID_TEXT,
  53. - BPYRAMID_LONGTEXT, true )
  54. -#endif
  55. change_string_list( bpyramid_list, bpyramid_list )
  56. add_bool( SOUT_CFG_PREFIX "cabac", true, CABAC_TEXT, CABAC_LONGTEXT,
  57. @@ -543,22 +526,18 @@ vlc_module_begin ()
  58. add_bool( SOUT_CFG_PREFIX "interlaced", false, INTERLACED_TEXT, INTERLACED_LONGTEXT,
  59. true )
  60. -#if X264_BUILD >= 111
  61. add_integer( SOUT_CFG_PREFIX "frame-packing", -1, FRAMEPACKING_TEXT, FRAMEPACKING_LONGTEXT, true )
  62. change_integer_list( framepacking_list, framepacking_list_text )
  63. change_integer_range( -1, 5)
  64. -#endif
  65. add_integer( SOUT_CFG_PREFIX "slices", 0, SLICE_COUNT, SLICE_COUNT_LONGTEXT, true )
  66. add_integer( SOUT_CFG_PREFIX "slice-max-size", 0, SLICE_MAX_SIZE, SLICE_MAX_SIZE_LONGTEXT, true )
  67. add_integer( SOUT_CFG_PREFIX "slice-max-mbs", 0, SLICE_MAX_MBS, SLICE_MAX_MBS_LONGTEXT, true )
  68. -#if X264_BUILD >= 89
  69. add_string( SOUT_CFG_PREFIX "hrd", "none", HRD_TEXT, HRD_TEXT, true )
  70. vlc_config_set (VLC_CONFIG_LIST,
  71. (sizeof(x264_nal_hrd_names) / sizeof (char*)) - 1,
  72. x264_nal_hrd_names, x264_nal_hrd_names);
  73. -#endif
  74. /* Ratecontrol */
  75. @@ -843,20 +822,14 @@ static int Open ( vlc_object_t *p_this )
  76. fullrange = var_GetBool( p_enc, SOUT_CFG_PREFIX "fullrange" );
  77. p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
  78. p_sys->i_colorspace = X264_CSP_I420;
  79. -#if X264_BUILD >= 118
  80. char *psz_profile = var_GetString( p_enc, SOUT_CFG_PREFIX "profile" );
  81. - if( psz_profile )
  82. - {
  83. - const int mask = x264_bit_depth > 8 ? X264_CSP_HIGH_DEPTH : 0;
  84. -
  85. -
  86. # ifdef MODULE_NAME_IS_x26410b
  87. - if( mask == 0)
  88. - {
  89. - msg_Err( p_enc, "Only high bith depth encoding supported, bit depth:%d", x264_bit_depth);
  90. - return VLC_EGENERIC;
  91. - }
  92. + const int mask = X264_CSP_HIGH_DEPTH;
  93. +# else
  94. + const int mask = 0;
  95. # endif
  96. + if( psz_profile )
  97. + {
  98. if( !strcmp( psz_profile, "high10" ) )
  99. {
  100. @@ -879,7 +852,6 @@ static int Open ( vlc_object_t *p_this )
  101. msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
  102. return VLC_EGENERIC;
  103. }
  104. -
  105. # endif
  106. }
  107. # ifdef MODULE_NAME_IS_x26410b
  108. @@ -890,7 +862,6 @@ static int Open ( vlc_object_t *p_this )
  109. }
  110. # endif
  111. free( psz_profile );
  112. -#endif //X264_BUILD
  113. p_enc->pf_encode_video = Encode;
  114. p_enc->pf_encode_audio = NULL;
  115. @@ -913,6 +884,10 @@ static int Open ( vlc_object_t *p_this )
  116. #else
  117. x264_param_default( &p_sys->param );
  118. x264_param_default_preset( &p_sys->param, psz_preset, psz_tune );
  119. +# if X264_BUILD > 152
  120. + if( mask )
  121. + p_sys->param.i_bitdepth = 10;
  122. +# endif
  123. #endif
  124. free( psz_preset );
  125. free( psz_tune );
  126. @@ -1045,10 +1020,8 @@ static int Open ( vlc_object_t *p_this )
  127. if( fabs( var_GetFloat( p_enc, SOUT_CFG_PREFIX "aq-strength" ) - 1.0) > 0.005 )
  128. p_sys->param.rc.f_aq_strength = var_GetFloat( p_enc, SOUT_CFG_PREFIX "aq-strength" );
  129. -#if X264_BUILD >= 111
  130. if( var_GetInteger( p_enc, SOUT_CFG_PREFIX "frame-packing" ) > -1 )
  131. p_sys->param.i_frame_packing = var_GetInteger( p_enc, SOUT_CFG_PREFIX "frame-packing" );
  132. -#endif
  133. if( var_GetBool( p_enc, SOUT_CFG_PREFIX "verbose" ) )
  134. p_sys->param.i_log_level = X264_LOG_DEBUG;
  135. @@ -1064,26 +1037,14 @@ static int Open ( vlc_object_t *p_this )
  136. i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "keyint" );
  137. if( i_val > 0 && i_val != 250 ) p_sys->param.i_keyint_max = i_val;
  138. -#if X264_BUILD >= 102
  139. if( i_val == -1 ) p_sys->param.i_keyint_max = X264_KEYINT_MAX_INFINITE;
  140. -#endif
  141. i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "min-keyint" );
  142. if( i_val > 0 && i_val != 25 ) p_sys->param.i_keyint_min = i_val;
  143. -#if X264_BUILD >= 102 && X264_BUILD <= 114
  144. - psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "opengop" );
  145. - if( !strcmp( psz_val, "none" ) )
  146. - p_sys->param.i_open_gop = X264_OPEN_GOP_NONE;
  147. - else if( !strcmp( psz_val, "normal" ) )
  148. - p_sys->param.i_open_gop = X264_OPEN_GOP_NORMAL;
  149. - else if( !strcmp( psz_val, "bluray" ) )
  150. - p_sys->param.i_open_gop = X264_OPEN_GOP_BLURAY;
  151. - free( psz_val );
  152. -#elif X264_BUILD >= 115
  153. p_sys->param.b_open_gop = var_GetBool( p_enc, SOUT_CFG_PREFIX "opengop" );
  154. p_sys->param.b_bluray_compat = var_GetBool( p_enc, SOUT_CFG_PREFIX "bluray-compat" );
  155. -#endif
  156. +
  157. i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "bframes" );
  158. if( i_val >= 0 && i_val <= 16 && i_val != 3 )
  159. p_sys->param.i_bframe = i_val;
  160. @@ -1121,14 +1082,12 @@ static int Open ( vlc_object_t *p_this )
  161. if( i_val >= 1 && i_val != 7 )
  162. p_sys->param.analyse.i_subpel_refine = i_val;
  163. -#if X264_BUILD >= 89
  164. psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "hrd");
  165. if( !strcmp( psz_val, "vbr" ) )
  166. p_sys->param.i_nal_hrd = X264_NAL_HRD_VBR;
  167. else if( !strcmp( psz_val, "cbr" ) )
  168. p_sys->param.i_nal_hrd = X264_NAL_HRD_CBR;
  169. free( psz_val );
  170. -#endif
  171. //TODO: psz_val == NULL ?
  172. psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "me" );
  173. @@ -1486,11 +1445,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
  174. int i_nal=0, i_out=0, i=0;
  175. /* init pic */
  176. -#if X264_BUILD >= 98
  177. x264_picture_init( &pic );
  178. -#else
  179. - memset( &pic, 0, sizeof( x264_picture_t ) );
  180. -#endif
  181. if( likely(p_pict) ) {
  182. pic.i_pts = p_pict->date;
  183. pic.img.i_csp = p_sys->i_colorspace;
  184. --
  185. 2.14.3