deblock.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. /*****************************************************************************
  2. * deblock.c: deblocking
  3. *****************************************************************************
  4. * Copyright (C) 2003-2018 x264 project
  5. *
  6. * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  7. * Loren Merritt <lorenm@u.washington.edu>
  8. * Fiona Glaser <fiona@x264.com>
  9. * Henrik Gramner <henrik@gramner.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  24. *
  25. * This program is also available under a commercial proprietary license.
  26. * For more information, contact us at licensing@x264.com.
  27. *****************************************************************************/
  28. #include "common.h"
  29. /* Deblocking filter */
  30. static const uint8_t i_alpha_table[52+12*3] =
  31. {
  32. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  33. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  34. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  35. 0, 0, 0, 0, 0, 0, 4, 4, 5, 6,
  36. 7, 8, 9, 10, 12, 13, 15, 17, 20, 22,
  37. 25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
  38. 80, 90,101,113,127,144,162,182,203,226,
  39. 255,255,
  40. 255,255,255,255,255,255,255,255,255,255,255,255,
  41. };
  42. static const uint8_t i_beta_table[52+12*3] =
  43. {
  44. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  45. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  46. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  47. 0, 0, 0, 0, 0, 0, 2, 2, 2, 3,
  48. 3, 3, 3, 4, 4, 4, 6, 6, 7, 7,
  49. 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
  50. 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
  51. 18, 18,
  52. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
  53. };
  54. static const int8_t i_tc0_table[52+12*3][4] =
  55. {
  56. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  57. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  58. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  59. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  60. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  61. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
  62. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 },
  63. {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 },
  64. {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 },
  65. {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 },
  66. {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 },
  67. {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 },
  68. {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 },
  69. {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
  70. {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
  71. };
  72. #define alpha_table(x) i_alpha_table[(x)+24]
  73. #define beta_table(x) i_beta_table[(x)+24]
  74. #define tc0_table(x) i_tc0_table[(x)+24]
  75. /* From ffmpeg */
  76. static ALWAYS_INLINE void deblock_edge_luma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc0 )
  77. {
  78. int p2 = pix[-3*xstride];
  79. int p1 = pix[-2*xstride];
  80. int p0 = pix[-1*xstride];
  81. int q0 = pix[ 0*xstride];
  82. int q1 = pix[ 1*xstride];
  83. int q2 = pix[ 2*xstride];
  84. if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
  85. {
  86. int tc = tc0;
  87. int delta;
  88. if( abs( p2 - p0 ) < beta )
  89. {
  90. if( tc0 )
  91. pix[-2*xstride] = p1 + x264_clip3( (( p2 + ((p0 + q0 + 1) >> 1)) >> 1) - p1, -tc0, tc0 );
  92. tc++;
  93. }
  94. if( abs( q2 - q0 ) < beta )
  95. {
  96. if( tc0 )
  97. pix[ 1*xstride] = q1 + x264_clip3( (( q2 + ((p0 + q0 + 1) >> 1)) >> 1) - q1, -tc0, tc0 );
  98. tc++;
  99. }
  100. delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
  101. pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */
  102. pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */
  103. }
  104. }
  105. static inline void deblock_luma_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 )
  106. {
  107. for( int i = 0; i < 4; i++ )
  108. {
  109. if( tc0[i] < 0 )
  110. {
  111. pix += 4*ystride;
  112. continue;
  113. }
  114. for( int d = 0; d < 4; d++, pix += ystride )
  115. deblock_edge_luma_c( pix, xstride, alpha, beta, tc0[i] );
  116. }
  117. }
  118. static void deblock_h_luma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  119. {
  120. for( int d = 0; d < 8; d++, pix += stride )
  121. deblock_edge_luma_c( pix, 1, alpha, beta, tc0[d>>1] );
  122. }
  123. static void deblock_v_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  124. {
  125. deblock_luma_c( pix, stride, 1, alpha, beta, tc0 );
  126. }
  127. static void deblock_h_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  128. {
  129. deblock_luma_c( pix, 1, stride, alpha, beta, tc0 );
  130. }
  131. static ALWAYS_INLINE void deblock_edge_chroma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc )
  132. {
  133. int p1 = pix[-2*xstride];
  134. int p0 = pix[-1*xstride];
  135. int q0 = pix[ 0*xstride];
  136. int q1 = pix[ 1*xstride];
  137. if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
  138. {
  139. int delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
  140. pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */
  141. pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */
  142. }
  143. }
  144. static ALWAYS_INLINE void deblock_chroma_c( pixel *pix, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 )
  145. {
  146. for( int i = 0; i < 4; i++ )
  147. {
  148. int tc = tc0[i];
  149. if( tc <= 0 )
  150. {
  151. pix += height*ystride;
  152. continue;
  153. }
  154. for( int d = 0; d < height; d++, pix += ystride-2 )
  155. for( int e = 0; e < 2; e++, pix++ )
  156. deblock_edge_chroma_c( pix, xstride, alpha, beta, tc0[i] );
  157. }
  158. }
  159. static void deblock_h_chroma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  160. {
  161. deblock_chroma_c( pix, 1, 2, stride, alpha, beta, tc0 );
  162. }
  163. static void deblock_v_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  164. {
  165. deblock_chroma_c( pix, 2, stride, 2, alpha, beta, tc0 );
  166. }
  167. static void deblock_h_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  168. {
  169. deblock_chroma_c( pix, 2, 2, stride, alpha, beta, tc0 );
  170. }
  171. static void deblock_h_chroma_422_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
  172. {
  173. deblock_chroma_c( pix, 4, 2, stride, alpha, beta, tc0 );
  174. }
  175. static ALWAYS_INLINE void deblock_edge_luma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta )
  176. {
  177. int p2 = pix[-3*xstride];
  178. int p1 = pix[-2*xstride];
  179. int p0 = pix[-1*xstride];
  180. int q0 = pix[ 0*xstride];
  181. int q1 = pix[ 1*xstride];
  182. int q2 = pix[ 2*xstride];
  183. if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
  184. {
  185. if( abs( p0 - q0 ) < ((alpha >> 2) + 2) )
  186. {
  187. if( abs( p2 - p0 ) < beta ) /* p0', p1', p2' */
  188. {
  189. const int p3 = pix[-4*xstride];
  190. pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
  191. pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
  192. pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
  193. }
  194. else /* p0' */
  195. pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
  196. if( abs( q2 - q0 ) < beta ) /* q0', q1', q2' */
  197. {
  198. const int q3 = pix[3*xstride];
  199. pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
  200. pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
  201. pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
  202. }
  203. else /* q0' */
  204. pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
  205. }
  206. else /* p0', q0' */
  207. {
  208. pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
  209. pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
  210. }
  211. }
  212. }
  213. static inline void deblock_luma_intra_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta )
  214. {
  215. for( int d = 0; d < 16; d++, pix += ystride )
  216. deblock_edge_luma_intra_c( pix, xstride, alpha, beta );
  217. }
  218. static void deblock_h_luma_intra_mbaff_c( pixel *pix, intptr_t ystride, int alpha, int beta )
  219. {
  220. for( int d = 0; d < 8; d++, pix += ystride )
  221. deblock_edge_luma_intra_c( pix, 1, alpha, beta );
  222. }
  223. static void deblock_v_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
  224. {
  225. deblock_luma_intra_c( pix, stride, 1, alpha, beta );
  226. }
  227. static void deblock_h_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
  228. {
  229. deblock_luma_intra_c( pix, 1, stride, alpha, beta );
  230. }
  231. static ALWAYS_INLINE void deblock_edge_chroma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta )
  232. {
  233. int p1 = pix[-2*xstride];
  234. int p0 = pix[-1*xstride];
  235. int q0 = pix[ 0*xstride];
  236. int q1 = pix[ 1*xstride];
  237. if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
  238. {
  239. pix[-1*xstride] = (2*p1 + p0 + q1 + 2) >> 2; /* p0' */
  240. pix[ 0*xstride] = (2*q1 + q0 + p1 + 2) >> 2; /* q0' */
  241. }
  242. }
  243. static ALWAYS_INLINE void deblock_chroma_intra_c( pixel *pix, int width, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta )
  244. {
  245. for( int d = 0; d < height; d++, pix += ystride-2 )
  246. for( int e = 0; e < width; e++, pix++ )
  247. deblock_edge_chroma_intra_c( pix, xstride, alpha, beta );
  248. }
  249. static void deblock_h_chroma_intra_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta )
  250. {
  251. deblock_chroma_intra_c( pix, 2, 4, 2, stride, alpha, beta );
  252. }
  253. static void deblock_v_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
  254. {
  255. deblock_chroma_intra_c( pix, 1, 16, stride, 2, alpha, beta );
  256. }
  257. static void deblock_h_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
  258. {
  259. deblock_chroma_intra_c( pix, 2, 8, 2, stride, alpha, beta );
  260. }
  261. static void deblock_h_chroma_422_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
  262. {
  263. deblock_chroma_intra_c( pix, 2, 16, 2, stride, alpha, beta );
  264. }
  265. static void deblock_strength_c( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
  266. int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit,
  267. int bframe )
  268. {
  269. for( int dir = 0; dir < 2; dir++ )
  270. {
  271. int s1 = dir ? 1 : 8;
  272. int s2 = dir ? 8 : 1;
  273. for( int edge = 0; edge < 4; edge++ )
  274. for( int i = 0, loc = X264_SCAN8_0+edge*s2; i < 4; i++, loc += s1 )
  275. {
  276. int locn = loc - s2;
  277. if( nnz[loc] || nnz[locn] )
  278. bs[dir][edge][i] = 2;
  279. else if( ref[0][loc] != ref[0][locn] ||
  280. abs( mv[0][loc][0] - mv[0][locn][0] ) >= 4 ||
  281. abs( mv[0][loc][1] - mv[0][locn][1] ) >= mvy_limit ||
  282. (bframe && (ref[1][loc] != ref[1][locn] ||
  283. abs( mv[1][loc][0] - mv[1][locn][0] ) >= 4 ||
  284. abs( mv[1][loc][1] - mv[1][locn][1] ) >= mvy_limit )))
  285. {
  286. bs[dir][edge][i] = 1;
  287. }
  288. else
  289. bs[dir][edge][i] = 0;
  290. }
  291. }
  292. }
  293. static ALWAYS_INLINE void deblock_edge( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp,
  294. int a, int b, int b_chroma, x264_deblock_inter_t pf_inter )
  295. {
  296. int index_a = i_qp + a;
  297. int index_b = i_qp + b;
  298. int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
  299. int beta = beta_table(index_b) << (BIT_DEPTH-8);
  300. int8_t tc[4];
  301. if( !M32(bS) || !alpha || !beta )
  302. return;
  303. tc[0] = (tc0_table(index_a)[bS[0]] << (BIT_DEPTH-8)) + b_chroma;
  304. tc[1] = (tc0_table(index_a)[bS[1]] << (BIT_DEPTH-8)) + b_chroma;
  305. tc[2] = (tc0_table(index_a)[bS[2]] << (BIT_DEPTH-8)) + b_chroma;
  306. tc[3] = (tc0_table(index_a)[bS[3]] << (BIT_DEPTH-8)) + b_chroma;
  307. pf_inter( pix, i_stride, alpha, beta, tc );
  308. }
  309. static ALWAYS_INLINE void deblock_edge_intra( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp,
  310. int a, int b, int b_chroma, x264_deblock_intra_t pf_intra )
  311. {
  312. int index_a = i_qp + a;
  313. int index_b = i_qp + b;
  314. int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
  315. int beta = beta_table(index_b) << (BIT_DEPTH-8);
  316. if( !alpha || !beta )
  317. return;
  318. pf_intra( pix, i_stride, alpha, beta );
  319. }
  320. static ALWAYS_INLINE void macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
  321. {
  322. int deblock_on_slice_edges = h->sh.i_disable_deblocking_filter_idc != 2;
  323. h->mb.i_neighbour = 0;
  324. h->mb.i_mb_xy = mb_y * h->mb.i_mb_stride + mb_x;
  325. h->mb.b_interlaced = PARAM_INTERLACED && h->mb.field[h->mb.i_mb_xy];
  326. h->mb.i_mb_top_y = mb_y - (1 << MB_INTERLACED);
  327. h->mb.i_mb_top_xy = mb_x + h->mb.i_mb_stride*h->mb.i_mb_top_y;
  328. h->mb.i_mb_left_xy[1] =
  329. h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1;
  330. if( SLICE_MBAFF )
  331. {
  332. if( mb_y&1 )
  333. {
  334. if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED )
  335. h->mb.i_mb_left_xy[0] -= h->mb.i_mb_stride;
  336. }
  337. else
  338. {
  339. if( h->mb.i_mb_top_xy >= 0 && MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy] )
  340. {
  341. h->mb.i_mb_top_xy += h->mb.i_mb_stride;
  342. h->mb.i_mb_top_y++;
  343. }
  344. if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED )
  345. h->mb.i_mb_left_xy[1] += h->mb.i_mb_stride;
  346. }
  347. }
  348. if( mb_x > 0 && (deblock_on_slice_edges ||
  349. h->mb.slice_table[h->mb.i_mb_left_xy[0]] == h->mb.slice_table[h->mb.i_mb_xy]) )
  350. h->mb.i_neighbour |= MB_LEFT;
  351. if( mb_y > MB_INTERLACED && (deblock_on_slice_edges
  352. || h->mb.slice_table[h->mb.i_mb_top_xy] == h->mb.slice_table[h->mb.i_mb_xy]) )
  353. h->mb.i_neighbour |= MB_TOP;
  354. }
  355. void x264_frame_deblock_row( x264_t *h, int mb_y )
  356. {
  357. int b_interlaced = SLICE_MBAFF;
  358. int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET;
  359. int b = h->sh.i_beta_offset - QP_BD_OFFSET;
  360. int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset );
  361. int stridey = h->fdec->i_stride[0];
  362. int strideuv = h->fdec->i_stride[1];
  363. int chroma_format = CHROMA_FORMAT;
  364. int chroma444 = CHROMA444;
  365. int chroma_height = 16 >> CHROMA_V_SHIFT;
  366. intptr_t uvdiff = chroma444 ? h->fdec->plane[2] - h->fdec->plane[1] : 1;
  367. for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
  368. {
  369. x264_prefetch_fenc( h, h->fdec, mb_x, mb_y );
  370. macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
  371. int mb_xy = h->mb.i_mb_xy;
  372. int transform_8x8 = h->mb.mb_transform_size[mb_xy];
  373. int intra_cur = IS_INTRA( h->mb.type[mb_xy] );
  374. uint8_t (*bs)[8][4] = h->deblock_strength[mb_y&1][h->param.b_sliced_threads?mb_xy:mb_x];
  375. pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey + 16*mb_x;
  376. pixel *pixuv = h->fdec->plane[1] + chroma_height*mb_y*strideuv + 16*mb_x;
  377. if( mb_y & MB_INTERLACED )
  378. {
  379. pixy -= 15*stridey;
  380. pixuv -= (chroma_height-1)*strideuv;
  381. }
  382. int stride2y = stridey << MB_INTERLACED;
  383. int stride2uv = strideuv << MB_INTERLACED;
  384. int qp = h->mb.qp[mb_xy];
  385. int qpc = h->chroma_qp_table[qp];
  386. int first_edge_only = (h->mb.partition[mb_xy] == D_16x16 && !h->mb.cbp[mb_xy] && !intra_cur) || qp <= qp_thresh;
  387. #define FILTER( intra, dir, edge, qp, chroma_qp )\
  388. do\
  389. {\
  390. if( !(edge & 1) || !transform_8x8 )\
  391. {\
  392. deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1),\
  393. stride2y, bs[dir][edge], qp, a, b, 0,\
  394. h->loopf.deblock_luma##intra[dir] );\
  395. if( chroma_format == CHROMA_444 )\
  396. {\
  397. deblock_edge##intra( h, pixuv + 4*edge*(dir?stride2uv:1),\
  398. stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
  399. h->loopf.deblock_luma##intra[dir] );\
  400. deblock_edge##intra( h, pixuv + uvdiff + 4*edge*(dir?stride2uv:1),\
  401. stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
  402. h->loopf.deblock_luma##intra[dir] );\
  403. }\
  404. else if( chroma_format == CHROMA_420 && !(edge & 1) )\
  405. {\
  406. deblock_edge##intra( h, pixuv + edge*(dir?2*stride2uv:4),\
  407. stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
  408. h->loopf.deblock_chroma##intra[dir] );\
  409. }\
  410. }\
  411. if( chroma_format == CHROMA_422 && (dir || !(edge & 1)) )\
  412. {\
  413. deblock_edge##intra( h, pixuv + edge*(dir?4*stride2uv:4),\
  414. stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
  415. h->loopf.deblock_chroma##intra[dir] );\
  416. }\
  417. } while( 0 )
  418. if( h->mb.i_neighbour & MB_LEFT )
  419. {
  420. if( b_interlaced && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED )
  421. {
  422. int luma_qp[2];
  423. int chroma_qp[2];
  424. int left_qp[2];
  425. x264_deblock_inter_t luma_deblock = h->loopf.deblock_luma_mbaff;
  426. x264_deblock_inter_t chroma_deblock = h->loopf.deblock_chroma_mbaff;
  427. x264_deblock_intra_t luma_intra_deblock = h->loopf.deblock_luma_intra_mbaff;
  428. x264_deblock_intra_t chroma_intra_deblock = h->loopf.deblock_chroma_intra_mbaff;
  429. int c = chroma444 ? 0 : 1;
  430. left_qp[0] = h->mb.qp[h->mb.i_mb_left_xy[0]];
  431. luma_qp[0] = (qp + left_qp[0] + 1) >> 1;
  432. chroma_qp[0] = (qpc + h->chroma_qp_table[left_qp[0]] + 1) >> 1;
  433. if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[0]] ) )
  434. {
  435. deblock_edge_intra( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_intra_deblock );
  436. if( chroma_format )
  437. {
  438. deblock_edge_intra( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
  439. if( chroma444 )
  440. deblock_edge_intra( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
  441. }
  442. }
  443. else
  444. {
  445. deblock_edge( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_deblock );
  446. if( chroma_format )
  447. {
  448. deblock_edge( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
  449. if( chroma444 )
  450. deblock_edge( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
  451. }
  452. }
  453. int offy = MB_INTERLACED ? 4 : 0;
  454. int offuv = MB_INTERLACED ? 4-CHROMA_V_SHIFT : 0;
  455. left_qp[1] = h->mb.qp[h->mb.i_mb_left_xy[1]];
  456. luma_qp[1] = (qp + left_qp[1] + 1) >> 1;
  457. chroma_qp[1] = (qpc + h->chroma_qp_table[left_qp[1]] + 1) >> 1;
  458. if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[1]] ) )
  459. {
  460. deblock_edge_intra( h, pixy + (stridey<<offy), 2*stridey, bs[0][4], luma_qp[1], a, b, 0, luma_intra_deblock );
  461. if( chroma_format )
  462. {
  463. deblock_edge_intra( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
  464. if( chroma444 )
  465. deblock_edge_intra( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
  466. }
  467. }
  468. else
  469. {
  470. deblock_edge( h, pixy + (stridey<<offy), 2*stridey, bs[0][4], luma_qp[1], a, b, 0, luma_deblock );
  471. if( chroma_format )
  472. {
  473. deblock_edge( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
  474. if( chroma444 )
  475. deblock_edge( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
  476. }
  477. }
  478. }
  479. else
  480. {
  481. int qpl = h->mb.qp[h->mb.i_mb_xy-1];
  482. int qp_left = (qp + qpl + 1) >> 1;
  483. int qpc_left = (qpc + h->chroma_qp_table[qpl] + 1) >> 1;
  484. int intra_left = IS_INTRA( h->mb.type[h->mb.i_mb_xy-1] );
  485. int intra_deblock = intra_cur || intra_left;
  486. /* Any MB that was coded, or that analysis decided to skip, has quality commensurate with its QP.
  487. * But if deblocking affects neighboring MBs that were force-skipped, blur might accumulate there.
  488. * So reset their effective QP to max, to indicate that lack of guarantee. */
  489. if( h->fdec->mb_info && M32( bs[0][0] ) )
  490. {
  491. #define RESET_EFFECTIVE_QP(xy) h->fdec->effective_qp[xy] |= 0xff * !!(h->fdec->mb_info[xy] & X264_MBINFO_CONSTANT);
  492. RESET_EFFECTIVE_QP(mb_xy);
  493. RESET_EFFECTIVE_QP(h->mb.i_mb_left_xy[0]);
  494. }
  495. if( intra_deblock )
  496. FILTER( _intra, 0, 0, qp_left, qpc_left );
  497. else
  498. FILTER( , 0, 0, qp_left, qpc_left );
  499. }
  500. }
  501. if( !first_edge_only )
  502. {
  503. FILTER( , 0, 1, qp, qpc );
  504. FILTER( , 0, 2, qp, qpc );
  505. FILTER( , 0, 3, qp, qpc );
  506. }
  507. if( h->mb.i_neighbour & MB_TOP )
  508. {
  509. if( b_interlaced && !(mb_y&1) && !MB_INTERLACED && h->mb.field[h->mb.i_mb_top_xy] )
  510. {
  511. int mbn_xy = mb_xy - 2 * h->mb.i_mb_stride;
  512. for( int j = 0; j < 2; j++, mbn_xy += h->mb.i_mb_stride )
  513. {
  514. int qpt = h->mb.qp[mbn_xy];
  515. int qp_top = (qp + qpt + 1) >> 1;
  516. int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1;
  517. int intra_top = IS_INTRA( h->mb.type[mbn_xy] );
  518. if( intra_cur || intra_top )
  519. M32( bs[1][4*j] ) = 0x03030303;
  520. // deblock the first horizontal edge of the even rows, then the first horizontal edge of the odd rows
  521. deblock_edge( h, pixy + j*stridey, 2* stridey, bs[1][4*j], qp_top, a, b, 0, h->loopf.deblock_luma[1] );
  522. if( chroma444 )
  523. {
  524. deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
  525. deblock_edge( h, pixuv + uvdiff + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
  526. }
  527. else if( chroma_format )
  528. deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 1, h->loopf.deblock_chroma[1] );
  529. }
  530. }
  531. else
  532. {
  533. int qpt = h->mb.qp[h->mb.i_mb_top_xy];
  534. int qp_top = (qp + qpt + 1) >> 1;
  535. int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1;
  536. int intra_top = IS_INTRA( h->mb.type[h->mb.i_mb_top_xy] );
  537. int intra_deblock = intra_cur || intra_top;
  538. /* This edge has been modified, reset effective qp to max. */
  539. if( h->fdec->mb_info && M32( bs[1][0] ) )
  540. {
  541. RESET_EFFECTIVE_QP(mb_xy);
  542. RESET_EFFECTIVE_QP(h->mb.i_mb_top_xy);
  543. }
  544. if( (!b_interlaced || (!MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy])) && intra_deblock )
  545. {
  546. FILTER( _intra, 1, 0, qp_top, qpc_top );
  547. }
  548. else
  549. {
  550. if( intra_deblock )
  551. M32( bs[1][0] ) = 0x03030303;
  552. FILTER( , 1, 0, qp_top, qpc_top );
  553. }
  554. }
  555. }
  556. if( !first_edge_only )
  557. {
  558. FILTER( , 1, 1, qp, qpc );
  559. FILTER( , 1, 2, qp, qpc );
  560. FILTER( , 1, 3, qp, qpc );
  561. }
  562. #undef FILTER
  563. }
  564. }
  565. /* For deblock-aware RD.
  566. * TODO:
  567. * deblock macroblock edges
  568. * support analysis partitions smaller than 16x16
  569. * deblock chroma for 4:2:0/4:2:2
  570. * handle duplicate refs correctly
  571. */
  572. void x264_macroblock_deblock( x264_t *h )
  573. {
  574. int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET;
  575. int b = h->sh.i_beta_offset - QP_BD_OFFSET;
  576. int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset );
  577. int intra_cur = IS_INTRA( h->mb.i_type );
  578. int qp = h->mb.i_qp;
  579. int qpc = h->mb.i_chroma_qp;
  580. if( (h->mb.i_partition == D_16x16 && !h->mb.i_cbp_luma && !intra_cur) || qp <= qp_thresh )
  581. return;
  582. uint8_t (*bs)[8][4] = h->mb.cache.deblock_strength;
  583. if( intra_cur )
  584. {
  585. M32( bs[0][1] ) = 0x03030303;
  586. M64( bs[0][2] ) = 0x0303030303030303ULL;
  587. M32( bs[1][1] ) = 0x03030303;
  588. M64( bs[1][2] ) = 0x0303030303030303ULL;
  589. }
  590. else
  591. h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv,
  592. bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B );
  593. int transform_8x8 = h->mb.b_transform_8x8;
  594. #define FILTER( dir, edge )\
  595. do\
  596. {\
  597. deblock_edge( h, h->mb.pic.p_fdec[0] + 4*edge*(dir?FDEC_STRIDE:1),\
  598. FDEC_STRIDE, bs[dir][edge], qp, a, b, 0,\
  599. h->loopf.deblock_luma[dir] );\
  600. if( CHROMA444 )\
  601. {\
  602. deblock_edge( h, h->mb.pic.p_fdec[1] + 4*edge*(dir?FDEC_STRIDE:1),\
  603. FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\
  604. h->loopf.deblock_luma[dir] );\
  605. deblock_edge( h, h->mb.pic.p_fdec[2] + 4*edge*(dir?FDEC_STRIDE:1),\
  606. FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\
  607. h->loopf.deblock_luma[dir] );\
  608. }\
  609. } while( 0 )
  610. if( !transform_8x8 ) FILTER( 0, 1 );
  611. FILTER( 0, 2 );
  612. if( !transform_8x8 ) FILTER( 0, 3 );
  613. if( !transform_8x8 ) FILTER( 1, 1 );
  614. FILTER( 1, 2 );
  615. if( !transform_8x8 ) FILTER( 1, 3 );
  616. #undef FILTER
  617. }
  618. #if HAVE_MMX
  619. #include "x86/deblock.h"
  620. #endif
  621. #if ARCH_PPC
  622. #include "ppc/deblock.h"
  623. #endif
  624. #if HAVE_ARMV6
  625. #include "arm/deblock.h"
  626. #endif
  627. #if ARCH_AARCH64
  628. #include "aarch64/deblock.h"
  629. #endif
  630. #if HAVE_MSA
  631. #include "mips/deblock.h"
  632. #endif
  633. void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff )
  634. {
  635. pf->deblock_luma[1] = deblock_v_luma_c;
  636. pf->deblock_luma[0] = deblock_h_luma_c;
  637. pf->deblock_chroma[1] = deblock_v_chroma_c;
  638. pf->deblock_h_chroma_420 = deblock_h_chroma_c;
  639. pf->deblock_h_chroma_422 = deblock_h_chroma_422_c;
  640. pf->deblock_luma_intra[1] = deblock_v_luma_intra_c;
  641. pf->deblock_luma_intra[0] = deblock_h_luma_intra_c;
  642. pf->deblock_chroma_intra[1] = deblock_v_chroma_intra_c;
  643. pf->deblock_h_chroma_420_intra = deblock_h_chroma_intra_c;
  644. pf->deblock_h_chroma_422_intra = deblock_h_chroma_422_intra_c;
  645. pf->deblock_luma_mbaff = deblock_h_luma_mbaff_c;
  646. pf->deblock_chroma_420_mbaff = deblock_h_chroma_mbaff_c;
  647. pf->deblock_luma_intra_mbaff = deblock_h_luma_intra_mbaff_c;
  648. pf->deblock_chroma_420_intra_mbaff = deblock_h_chroma_intra_mbaff_c;
  649. pf->deblock_strength = deblock_strength_c;
  650. #if HAVE_MMX
  651. if( cpu&X264_CPU_MMX2 )
  652. {
  653. #if ARCH_X86
  654. pf->deblock_luma[1] = x264_deblock_v_luma_mmx2;
  655. pf->deblock_luma[0] = x264_deblock_h_luma_mmx2;
  656. pf->deblock_chroma[1] = x264_deblock_v_chroma_mmx2;
  657. pf->deblock_h_chroma_420 = x264_deblock_h_chroma_mmx2;
  658. pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_mmx2;
  659. pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_mmx2;
  660. pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_mmx2;
  661. pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_mmx2;
  662. pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_mmx2;
  663. pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_mmx2;
  664. pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_mmx2;
  665. pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2;
  666. #endif
  667. #if !HIGH_BIT_DEPTH
  668. pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2;
  669. #endif
  670. if( cpu&X264_CPU_SSE2 )
  671. {
  672. pf->deblock_strength = x264_deblock_strength_sse2;
  673. pf->deblock_h_chroma_420 = x264_deblock_h_chroma_sse2;
  674. pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_sse2;
  675. pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_sse2;
  676. pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_sse2;
  677. pf->deblock_luma[1] = x264_deblock_v_luma_sse2;
  678. pf->deblock_luma[0] = x264_deblock_h_luma_sse2;
  679. pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_sse2;
  680. pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_sse2;
  681. if( !(cpu&X264_CPU_STACK_MOD4) )
  682. {
  683. pf->deblock_chroma[1] = x264_deblock_v_chroma_sse2;
  684. pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_sse2;
  685. pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_sse2;
  686. #if HIGH_BIT_DEPTH
  687. pf->deblock_chroma_420_intra_mbaff= x264_deblock_h_chroma_intra_mbaff_sse2;
  688. #endif
  689. }
  690. }
  691. if( cpu&X264_CPU_SSSE3 )
  692. pf->deblock_strength = x264_deblock_strength_ssse3;
  693. if( cpu&X264_CPU_AVX )
  694. {
  695. pf->deblock_strength = x264_deblock_strength_avx;
  696. pf->deblock_h_chroma_420 = x264_deblock_h_chroma_avx;
  697. pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_avx;
  698. pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_avx;
  699. pf->deblock_luma[1] = x264_deblock_v_luma_avx;
  700. pf->deblock_luma[0] = x264_deblock_h_luma_avx;
  701. pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_avx;
  702. pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_avx;
  703. if( !(cpu&X264_CPU_STACK_MOD4) )
  704. {
  705. pf->deblock_chroma[1] = x264_deblock_v_chroma_avx;
  706. pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_avx;
  707. pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_avx;
  708. #if HIGH_BIT_DEPTH
  709. pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_avx;
  710. pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_avx;
  711. #endif
  712. }
  713. }
  714. if( cpu&X264_CPU_AVX2 )
  715. {
  716. pf->deblock_strength = x264_deblock_strength_avx2;
  717. }
  718. if( cpu&X264_CPU_AVX512 )
  719. {
  720. pf->deblock_strength = x264_deblock_strength_avx512;
  721. }
  722. }
  723. #endif
  724. #if !HIGH_BIT_DEPTH
  725. #if HAVE_ALTIVEC
  726. if( cpu&X264_CPU_ALTIVEC )
  727. {
  728. pf->deblock_luma[1] = x264_deblock_v_luma_altivec;
  729. pf->deblock_luma[0] = x264_deblock_h_luma_altivec;
  730. }
  731. #endif // HAVE_ALTIVEC
  732. #if HAVE_ARMV6 || ARCH_AARCH64
  733. if( cpu&X264_CPU_NEON )
  734. {
  735. pf->deblock_luma[1] = x264_deblock_v_luma_neon;
  736. pf->deblock_luma[0] = x264_deblock_h_luma_neon;
  737. pf->deblock_chroma[1] = x264_deblock_v_chroma_neon;
  738. pf->deblock_h_chroma_420 = x264_deblock_h_chroma_neon;
  739. pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_neon;
  740. pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_neon;
  741. pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_neon;
  742. pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_neon;
  743. pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_neon;
  744. pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_neon;
  745. pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_neon;
  746. pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_neon;
  747. pf->deblock_strength = x264_deblock_strength_neon;
  748. }
  749. #endif
  750. #if HAVE_MSA
  751. if( cpu&X264_CPU_MSA )
  752. {
  753. pf->deblock_luma[1] = x264_deblock_v_luma_msa;
  754. pf->deblock_luma[0] = x264_deblock_h_luma_msa;
  755. pf->deblock_chroma[1] = x264_deblock_v_chroma_msa;
  756. pf->deblock_h_chroma_420 = x264_deblock_h_chroma_msa;
  757. pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_msa;
  758. pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_msa;
  759. pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_msa;
  760. pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_msa;
  761. pf->deblock_strength = x264_deblock_strength_msa;
  762. }
  763. #endif
  764. #endif // !HIGH_BIT_DEPTH
  765. /* These functions are equivalent, so don't duplicate them. */
  766. pf->deblock_chroma_422_mbaff = pf->deblock_h_chroma_420;
  767. pf->deblock_chroma_422_intra_mbaff = pf->deblock_h_chroma_420_intra;
  768. }