Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 86.87 KB | None | 0 0
  1. From 7d462192dfb66c6b2b3bdbaa841a6a69e5b7848e Mon Sep 17 00:00:00 2001
  2. From: Daniel Kang <daniel.d.kang@gmail.com>
  3. Date: Sat, 25 Dec 2010 14:32:11 -0500
  4. Subject: [PATCH 01/15] pred8x8l_top_dc_mmxext
  5.  
  6. ---
  7. libavcodec/x86/h264_intrapred.asm    |   78 ++++++++++++++++++++++++++++-----
  8.  libavcodec/x86/h264_intrapred_init.c |    2 +
  9.  2 files changed, 68 insertions(+), 12 deletions(-)
  10.  
  11. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  12. index 14a6038..b21516b 100644
  13. --- a/libavcodec/x86/h264_intrapred.asm
  14. +++ b/libavcodec/x86/h264_intrapred.asm
  15. @@ -20,6 +20,7 @@
  16.  ;******************************************************************************
  17.  
  18.  %include "x86inc.asm"
  19. +%include "x86util.asm"
  20.  
  21.  SECTION_RODATA
  22.  
  23. @@ -37,6 +38,7 @@ SECTION .text
  24.  
  25.  cextern pb_1
  26.  cextern pb_3
  27. +cextern pw_4
  28.  cextern pw_5
  29.  cextern pw_16
  30.  cextern pw_17
  31. @@ -827,6 +829,70 @@ PRED8x8_H mmx
  32.  PRED8x8_H mmxext
  33.  PRED8x8_H ssse3
  34.  
  35. +; dest, left, right, src, tmp
  36. +; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
  37. +%macro PRED4x4_LOWPASS 5
  38. +    mova    %5, %2
  39. +    pavgb   %2, %3
  40. +    pxor    %3, %5
  41. +    mova    %1, %4
  42. +    pand    %3, [pb_1]
  43. +    psubusb %2, %3
  44. +    pavgb   %1, %2
  45. +%endmacro
  46. +
  47. +;-----------------------------------------------------------------------------
  48. +; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
  49. +;-----------------------------------------------------------------------------
  50. +INIT_MMX
  51. +%define PALIGNR PALIGNR_MMX
  52. +cglobal pred8x8l_top_dc_mmxext, 4,4
  53. +    sub          r0, r3
  54. +    movq        mm0, [r0-8]
  55. +    movq        mm3, [r0]
  56. +    movq        mm1, [r0+8]
  57. +    movq        mm2, mm3
  58. +    movq        mm4, mm3
  59. +    PALIGNR     mm2, mm0, 7, mm0
  60. +    PALIGNR     mm1, mm4, 1, mm4
  61. +    test         r1, r1 ; top_left
  62. +    jz .fix_lt_2
  63. +    test         r2, r2 ; top_right
  64. +    jz .fix_tr_1
  65. +.do_top:
  66. +    PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
  67. +    jmp .body
  68. +.fix_lt_2:
  69. +    movq        mm5, mm3
  70. +    pxor        mm5, mm2
  71. +    psllq       mm5, 56
  72. +    psrlq       mm5, 56
  73. +    pxor        mm2, mm5
  74. +    test         r2, r2 ; top_right
  75. +    jnz .do_top
  76. +.fix_tr_1:
  77. +    movq        mm5, mm3
  78. +    pxor        mm5, mm1
  79. +    psrlq       mm5, 56
  80. +    psllq       mm5, 56
  81. +    pxor        mm1, mm5
  82. +    jmp .do_top
  83. +.body
  84. +    pxor     mm1, mm1
  85. +    psadbw   mm1, mm0
  86. +    paddw    mm1, [pw_4]
  87. +    psrlw    mm1, 3
  88. +    pshufw   mm1, mm1, 0
  89. +    packuswb mm1, mm1
  90. +%rep 3
  91. +    movq [r0+r3*1], mm1
  92. +    movq [r0+r3*2], mm1
  93. +    lea    r0, [r0+r3*2]
  94. +%endrep
  95. +    movq [r0+r3*1], mm1
  96. +    movq [r0+r3*2], mm1
  97. +    RET
  98. +
  99.  ;-----------------------------------------------------------------------------
  100.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  101.  ;-----------------------------------------------------------------------------
  102. @@ -1073,18 +1139,6 @@ cglobal pred4x4_tm_vp8_ssse3, 3,3
  103.      movd [r1+r2*2], mm5
  104.      RET
  105.  
  106. -; dest, left, right, src, tmp
  107. -; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
  108. -%macro PRED4x4_LOWPASS 5
  109. -    mova    %5, %2
  110. -    pavgb   %2, %3
  111. -    pxor    %3, %5
  112. -    mova    %1, %4
  113. -    pand    %3, [pb_1]
  114. -    psubusb %2, %3
  115. -    pavgb   %1, %2
  116. -%endmacro
  117. -
  118.  ;-----------------------------------------------------------------------------
  119.  ; void pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
  120.  ;-----------------------------------------------------------------------------
  121. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  122. index 10a6dd6..aba02ce 100644
  123. --- a/libavcodec/x86/h264_intrapred_init.c
  124. +++ b/libavcodec/x86/h264_intrapred_init.c
  125. @@ -57,6 +57,7 @@ void ff_pred8x8_tm_vp8_mmx         (uint8_t *src, int stride);
  126.  void ff_pred8x8_tm_vp8_mmxext      (uint8_t *src, int stride);
  127.  void ff_pred8x8_tm_vp8_sse2        (uint8_t *src, int stride);
  128.  void ff_pred8x8_tm_vp8_ssse3       (uint8_t *src, int stride);
  129. +void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topright, int stride);
  130.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  131.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  132.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  133. @@ -94,6 +95,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  134.          h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
  135.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_mmxext;
  136.          h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
  137. +        h->pred8x8l[TOP_DC_PRED  ] = ff_pred8x8l_top_dc_mmxext;
  138.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  139.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  140.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  141. --
  142. 1.7.2.2
  143.  
  144.  
  145. From 30e18a52fb0409fd02de4f25e26285084fbb304f Mon Sep 17 00:00:00 2001
  146. From: Daniel Kang <daniel.d.kang@gmail.com>
  147. Date: Sat, 25 Dec 2010 14:49:27 -0500
  148. Subject: [PATCH 02/15] pred8x8l_vertical_mmxext
  149.  
  150. ---
  151. libavcodec/x86/h264_intrapred.asm    |   46 ++++++++++++++++++++++++++++++++++
  152.  libavcodec/x86/h264_intrapred_init.c |    2 +
  153.  2 files changed, 48 insertions(+), 0 deletions(-)
  154.  
  155. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  156. index b21516b..62a16ff 100644
  157. --- a/libavcodec/x86/h264_intrapred.asm
  158. +++ b/libavcodec/x86/h264_intrapred.asm
  159. @@ -842,6 +842,52 @@ PRED8x8_H ssse3
  160.  %endmacro
  161.  
  162.  ;-----------------------------------------------------------------------------
  163. +; void pred8x8l_vertical_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  164. +;-----------------------------------------------------------------------------
  165. +INIT_MMX
  166. +%define PALIGNR PALIGNR_MMX
  167. +cglobal pred8x8l_vertical_mmxext, 4,4
  168. +    sub          r0, r3
  169. +    movq        mm0, [r0-8]
  170. +    movq        mm3, [r0]
  171. +    movq        mm1, [r0+8]
  172. +    movq        mm2, mm3
  173. +    movq        mm4, mm3
  174. +    PALIGNR     mm2, mm0, 7, mm0
  175. +    PALIGNR     mm1, mm4, 1, mm4
  176. +    test         r1, r1 ; top_left
  177. +    jz .fix_lt_2
  178. +    test         r2, r2 ; top_right
  179. +    jz .fix_tr_1
  180. +.do_top:
  181. +    PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
  182. +    jmp .body
  183. +.fix_lt_2:
  184. +    movq        mm5, mm3
  185. +    pxor        mm5, mm2
  186. +    psllq       mm5, 56
  187. +    psrlq       mm5, 56
  188. +    pxor        mm2, mm5
  189. +    test         r2, r2 ; top_right
  190. +    jnz .do_top
  191. +.fix_tr_1:
  192. +    movq        mm5, mm3
  193. +    pxor        mm5, mm1
  194. +    psrlq       mm5, 56
  195. +    psllq       mm5, 56
  196. +    pxor        mm1, mm5
  197. +    jmp .do_top
  198. +.body
  199. +%rep 3
  200. +    movq [r0+r3*1], mm0
  201. +    movq [r0+r3*2], mm0
  202. +    lea    r0, [r0+r3*2]
  203. +%endrep
  204. +    movq [r0+r3*1], mm0
  205. +    movq [r0+r3*2], mm0
  206. +    RET
  207. +
  208. +;-----------------------------------------------------------------------------
  209.  ; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
  210.  ;-----------------------------------------------------------------------------
  211.  INIT_MMX
  212. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  213. index aba02ce..79bdaec 100644
  214. --- a/libavcodec/x86/h264_intrapred_init.c
  215. +++ b/libavcodec/x86/h264_intrapred_init.c
  216. @@ -58,6 +58,7 @@ void ff_pred8x8_tm_vp8_mmxext      (uint8_t *src, int stride);
  217.  void ff_pred8x8_tm_vp8_sse2        (uint8_t *src, int stride);
  218.  void ff_pred8x8_tm_vp8_ssse3       (uint8_t *src, int stride);
  219.  void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topright, int stride);
  220. +void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topright, int stride);
  221.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  222.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  223.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  224. @@ -96,6 +97,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  225.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_mmxext;
  226.          h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
  227.          h->pred8x8l[TOP_DC_PRED  ] = ff_pred8x8l_top_dc_mmxext;
  228. +        h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  229.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  230.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  231.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  232. --
  233. 1.7.2.2
  234.  
  235.  
  236. From 5fda00845e1c491ea8706782885737cc0ad15d7e Mon Sep 17 00:00:00 2001
  237. From: Daniel Kang <daniel.d.kang@gmail.com>
  238. Date: Sat, 25 Dec 2010 16:21:59 -0500
  239. Subject: [PATCH 03/15] pred8x8_top_dc_mmxext
  240.  
  241. ---
  242. libavcodec/x86/h264_intrapred.asm    |   28 ++++++++++++++++++++++++++++
  243.  libavcodec/x86/h264_intrapred_init.c |    3 +++
  244.  2 files changed, 31 insertions(+), 0 deletions(-)
  245.  
  246. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  247. index 62a16ff..3c39b71 100644
  248. --- a/libavcodec/x86/h264_intrapred.asm
  249. +++ b/libavcodec/x86/h264_intrapred.asm
  250. @@ -940,6 +940,34 @@ cglobal pred8x8l_top_dc_mmxext, 4,4
  251.      RET
  252.  
  253.  ;-----------------------------------------------------------------------------
  254. +; void pred8x8_top_dc_mmxext(uint8_t *src, int stride)
  255. +;-----------------------------------------------------------------------------
  256. +cglobal pred8x8_top_dc_mmxext, 2,2
  257. +    sub         r0, r1
  258. +    movq       mm0, [r0]
  259. +    pxor       mm1, mm1
  260. +    pxor       mm2, mm2
  261. +    punpckhbw  mm1, mm0
  262. +    punpcklbw  mm0, mm2
  263. +    psadbw     mm1, mm2        ; s1
  264. +    psadbw     mm0, mm2        ; s0
  265. +    psrlw      mm1, 1
  266. +    psrlw      mm0, 1
  267. +    pavgw      mm1, mm2
  268. +    pavgw      mm0, mm2
  269. +    pshufw     mm1, mm1, 0
  270. +    pshufw     mm0, mm0, 0     ; dc0 (w)
  271. +    packuswb   mm0, mm1        ; dc0,dc1 (b)
  272. +%rep 3
  273. +    movq [r0+r1*1], mm0
  274. +    movq [r0+r1*2], mm0
  275. +    lea    r0, [r0+r1*2]
  276. +%endrep
  277. +    movq [r0+r1*1], mm0
  278. +    movq [r0+r1*2], mm0
  279. +    RET
  280. +
  281. +;-----------------------------------------------------------------------------
  282.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  283.  ;-----------------------------------------------------------------------------
  284.  
  285. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  286. index 79bdaec..dfa3b3f 100644
  287. --- a/libavcodec/x86/h264_intrapred_init.c
  288. +++ b/libavcodec/x86/h264_intrapred_init.c
  289. @@ -49,6 +49,7 @@ void ff_pred8x8_vertical_mmx       (uint8_t *src, int stride);
  290.  void ff_pred8x8_horizontal_mmx     (uint8_t *src, int stride);
  291.  void ff_pred8x8_horizontal_mmxext  (uint8_t *src, int stride);
  292.  void ff_pred8x8_horizontal_ssse3   (uint8_t *src, int stride);
  293. +void ff_pred8x8_top_dc_mmxext      (uint8_t *src, int stride);
  294.  void ff_pred8x8_plane_mmx          (uint8_t *src, int stride);
  295.  void ff_pred8x8_plane_mmx2         (uint8_t *src, int stride);
  296.  void ff_pred8x8_plane_sse2         (uint8_t *src, int stride);
  297. @@ -101,6 +102,8 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  298.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  299.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  300.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  301. +        if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264)
  302. +            h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;
  303.          if (codec_id == CODEC_ID_VP8) {
  304.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
  305.              h->pred8x8  [DC_PRED8x8   ] = ff_pred8x8_dc_rv40_mmxext;
  306. --
  307. 1.7.2.2
  308.  
  309.  
  310. From 8d6b2365fa48e6dab2957e81702297d56ee67429 Mon Sep 17 00:00:00 2001
  311. From: Daniel Kang <daniel.d.kang@gmail.com>
  312. Date: Sat, 25 Dec 2010 17:42:43 -0500
  313. Subject: [PATCH 04/15] pred8x8l_horizontal_mmxext
  314.  
  315. ---
  316. libavcodec/x86/h264_intrapred.asm    |   75 ++++++++++++++++++++++++++++++++++
  317.  libavcodec/x86/h264_intrapred_init.c |    2 +
  318.  2 files changed, 77 insertions(+), 0 deletions(-)
  319.  
  320. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  321. index 3c39b71..5c5af03 100644
  322. --- a/libavcodec/x86/h264_intrapred.asm
  323. +++ b/libavcodec/x86/h264_intrapred.asm
  324. @@ -968,6 +968,81 @@ cglobal pred8x8_top_dc_mmxext, 2,2
  325.      RET
  326.  
  327.  ;-----------------------------------------------------------------------------
  328. +; void pred8x8l_horizontal_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  329. +;-----------------------------------------------------------------------------
  330. +
  331. +INIT_MMX
  332. +%define PALIGNR PALIGNR_MMX
  333. +cglobal pred8x8l_horizontal_mmxext, 4,4
  334. +    sub          r0, r3
  335. +    lea          r2, [r0+r3*2]
  336. +    movq        mm0, [r0+r3*1-8]
  337. +    punpckhbw   mm0, [r0+r3*0-8]
  338. +    movq        mm1, [r2+r3*1-8]
  339. +    punpckhbw   mm1, [r0+r3*2-8]
  340. +    mov          r2, r0
  341. +    punpckhwd   mm1, mm0
  342. +    lea          r0, [r0+r3*4]
  343. +    movq        mm2, [r0+r3*1-8]
  344. +    punpckhbw   mm2, [r0+r3*0-8]
  345. +    lea          r0, [r0+r3*2]
  346. +    movq        mm3, [r0+r3*1-8]
  347. +    punpckhbw   mm3, [r0+r3*0-8]
  348. +    punpckhwd   mm3, mm2
  349. +    punpckhdq   mm3, mm1
  350. +    lea          r0, [r0+r3*2]
  351. +    movq        mm0, [r0+r3*0-8]
  352. +    movq        mm1, [r2]
  353. +    mov          r0, r2
  354. +    movq        mm4, mm3
  355. +    movq        mm2, mm3
  356. +    PALIGNR     mm4, mm0, 7, mm0
  357. +    PALIGNR     mm1, mm2, 1, mm2
  358. +    test        r1, r1 ; top_left
  359. +    jz .fix_lt_1
  360. +.do_left:
  361. +    movq        mm0, mm4
  362. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  363. +    movq        mm4, mm0
  364. +    movq        mm7, mm2
  365. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  366. +    psllq       mm1, 56
  367. +    PALIGNR     mm7, mm1, 7, mm3
  368. +    movq        mm3, mm7
  369. +    jmp .body
  370. +.fix_lt_1:
  371. +    movq        mm5, mm3
  372. +    pxor        mm5, mm4
  373. +    psrlq       mm5, 56
  374. +    psllq       mm5, 48
  375. +    pxor        mm1, mm5
  376. +    jmp .do_left
  377. +.body
  378. +    movq       mm7, mm3
  379. +    punpckhbw  mm3, mm3
  380. +    punpcklbw  mm7, mm7
  381. +    pshufw     mm0, mm3, 0xff
  382. +    pshufw     mm1, mm3, 0xaa
  383. +    pshufw     mm2, mm3, 0x55
  384. +    pshufw     mm3, mm3, 0x00
  385. +    pshufw     mm4, mm7, 0xff
  386. +    pshufw     mm5, mm7, 0xaa
  387. +    pshufw     mm6, mm7, 0x55
  388. +    pshufw     mm7, mm7, 0x00
  389. +    lea         r1, [r0+r3*2]
  390. +    lea         r2, [r1+r3*2]
  391. +    movq [r0+r3*1], mm0
  392. +    movq [r0+r3*2], mm1
  393. +    movq [r1+r3*1], mm2
  394. +    movq [r1+r3*2], mm3
  395. +    movq [r2+r3*1], mm4
  396. +    movq [r2+r3*2], mm5
  397. +    lea         r0, [r2+r3*2]
  398. +    movq [r0+r3*1], mm6
  399. +    movq [r0+r3*2], mm7
  400. +    RET
  401. +
  402. +;-----------------------------------------------------------------------------
  403.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  404.  ;-----------------------------------------------------------------------------
  405.  
  406. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  407. index dfa3b3f..98a906f 100644
  408. --- a/libavcodec/x86/h264_intrapred_init.c
  409. +++ b/libavcodec/x86/h264_intrapred_init.c
  410. @@ -60,6 +60,7 @@ void ff_pred8x8_tm_vp8_sse2        (uint8_t *src, int stride);
  411.  void ff_pred8x8_tm_vp8_ssse3       (uint8_t *src, int stride);
  412.  void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topright, int stride);
  413.  void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topright, int stride);
  414. +void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  415.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  416.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  417.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  418. @@ -99,6 +100,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  419.          h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
  420.          h->pred8x8l[TOP_DC_PRED  ] = ff_pred8x8l_top_dc_mmxext;
  421.          h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  422. +        h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  423.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  424.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  425.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  426. --
  427. 1.7.2.2
  428.  
  429.  
  430. From 1713c97a216d9127e6e29d1edddc62dacde6608b Mon Sep 17 00:00:00 2001
  431. From: Daniel Kang <daniel.d.kang@gmail.com>
  432. Date: Sat, 25 Dec 2010 19:45:23 -0500
  433. Subject: [PATCH 05/15] pred8x8l_dc_mmxext
  434.  
  435. ---
  436. libavcodec/x86/h264_intrapred.asm    |   98 ++++++++++++++++++++++++++++++++++
  437.  libavcodec/x86/h264_intrapred_init.c |    2 +
  438.  2 files changed, 100 insertions(+), 0 deletions(-)
  439.  
  440. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  441. index 5c5af03..dfe381c 100644
  442. --- a/libavcodec/x86/h264_intrapred.asm
  443. +++ b/libavcodec/x86/h264_intrapred.asm
  444. @@ -40,6 +40,7 @@ cextern pb_1
  445.  cextern pb_3
  446.  cextern pw_4
  447.  cextern pw_5
  448. +cextern pw_8
  449.  cextern pw_16
  450.  cextern pw_17
  451.  cextern pw_32
  452. @@ -888,6 +889,103 @@ cglobal pred8x8l_vertical_mmxext, 4,4
  453.      RET
  454.  
  455.  ;-----------------------------------------------------------------------------
  456. +;void pred8x8l_dc_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  457. +;-----------------------------------------------------------------------------
  458. +
  459. +INIT_MMX
  460. +%define PALIGNR PALIGNR_MMX
  461. +cglobal pred8x8l_dc_mmxext, 4,5
  462. +    sub          r0, r3
  463. +    lea          r4, [r0+r3*2]
  464. +    movq        mm0, [r0+r3*1-8]
  465. +    punpckhbw   mm0, [r0+r3*0-8]
  466. +    movq        mm1, [r4+r3*1-8]
  467. +    punpckhbw   mm1, [r0+r3*2-8]
  468. +    mov          r4, r0
  469. +    punpckhwd   mm1, mm0
  470. +    lea          r0, [r0+r3*4]
  471. +    movq        mm2, [r0+r3*1-8]
  472. +    punpckhbw   mm2, [r0+r3*0-8]
  473. +    lea          r0, [r0+r3*2]
  474. +    movq        mm3, [r0+r3*1-8]
  475. +    punpckhbw   mm3, [r0+r3*0-8]
  476. +    punpckhwd   mm3, mm2
  477. +    punpckhdq   mm3, mm1
  478. +    lea          r0, [r0+r3*2]
  479. +    movq        mm0, [r0+r3*0-8]
  480. +    movq        mm1, [r4]
  481. +    mov          r0, r4
  482. +    movq        mm4, mm3
  483. +    movq        mm2, mm3
  484. +    PALIGNR     mm4, mm0, 7, mm0
  485. +    PALIGNR     mm1, mm2, 1, mm2
  486. +    test        r1, r1 ; top_left
  487. +    jz .fix_lt_1
  488. +.do_left:
  489. +    movq        mm0, mm4
  490. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  491. +    movq        mm4, mm0
  492. +    movq        mm7, mm2
  493. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  494. +    psllq       mm1, 56
  495. +    PALIGNR     mm7, mm1, 7, mm3
  496. +.check_top:
  497. +    movq        mm0, [r0-8]
  498. +    movq        mm3, [r0]
  499. +    movq        mm1, [r0+8]
  500. +    movq        mm2, mm3
  501. +    movq        mm4, mm3
  502. +    PALIGNR     mm2, mm0, 7, mm0
  503. +    PALIGNR     mm1, mm4, 1, mm4
  504. +    test         r1, r1 ; top_left
  505. +    jz .fix_lt_2
  506. +    test         r2, r2 ; top_right
  507. +    jz .fix_tr_1
  508. +.do_top:
  509. +    PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
  510. +    jmp .body
  511. +.fix_lt_1:
  512. +    movq        mm5, mm3
  513. +    pxor        mm5, mm4
  514. +    psrlq       mm5, 56
  515. +    psllq       mm5, 48
  516. +    pxor        mm1, mm5
  517. +    jmp .do_left
  518. +.fix_lt_2:
  519. +    movq        mm5, mm3
  520. +    pxor        mm5, mm2
  521. +    psllq       mm5, 56
  522. +    psrlq       mm5, 56
  523. +    pxor        mm2, mm5
  524. +    test         r2, r2 ; top_right
  525. +    jnz .do_top
  526. +.fix_tr_1:
  527. +    movq        mm5, mm3
  528. +    pxor        mm5, mm1
  529. +    psrlq       mm5, 56
  530. +    psllq       mm5, 56
  531. +    pxor        mm1, mm5
  532. +    jmp .do_top
  533. +.body
  534. +    pxor        mm0, mm0
  535. +    pxor        mm1, mm1
  536. +    psadbw      mm0, mm7
  537. +    psadbw      mm1, mm6
  538. +    paddw       mm0, [pw_8]
  539. +    paddw       mm0, mm1
  540. +    psrlw       mm0, 4
  541. +    pshufw      mm0, mm0, 0
  542. +    packuswb    mm0, mm0
  543. +%rep 3
  544. +    movq [r0+r3*1], mm0
  545. +    movq [r0+r3*2], mm0
  546. +    lea    r0, [r0+r3*2]
  547. +%endrep
  548. +    movq [r0+r3*1], mm0
  549. +    movq [r0+r3*2], mm0
  550. +    RET
  551. +
  552. +;-----------------------------------------------------------------------------
  553.  ; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
  554.  ;-----------------------------------------------------------------------------
  555.  INIT_MMX
  556. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  557. index 98a906f..b5e6c02 100644
  558. --- a/libavcodec/x86/h264_intrapred_init.c
  559. +++ b/libavcodec/x86/h264_intrapred_init.c
  560. @@ -58,6 +58,7 @@ void ff_pred8x8_tm_vp8_mmx         (uint8_t *src, int stride);
  561.  void ff_pred8x8_tm_vp8_mmxext      (uint8_t *src, int stride);
  562.  void ff_pred8x8_tm_vp8_sse2        (uint8_t *src, int stride);
  563.  void ff_pred8x8_tm_vp8_ssse3       (uint8_t *src, int stride);
  564. +void ff_pred8x8l_dc_mmxext         (uint8_t *src, int has_topleft, int has_topright, int stride);
  565.  void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topright, int stride);
  566.  void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topright, int stride);
  567.  void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  568. @@ -98,6 +99,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  569.          h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
  570.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_mmxext;
  571.          h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
  572. +        h->pred8x8l[DC_PRED      ] = ff_pred8x8l_dc_mmxext;
  573.          h->pred8x8l[TOP_DC_PRED  ] = ff_pred8x8l_top_dc_mmxext;
  574.          h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  575.          h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  576. --
  577. 1.7.2.2
  578.  
  579.  
  580. From 2334210d134a7e62838f011484738f6548db361d Mon Sep 17 00:00:00 2001
  581. From: Daniel Kang <daniel.d.kang@gmail.com>
  582. Date: Sat, 25 Dec 2010 21:06:06 -0500
  583. Subject: [PATCH 06/15] pred8x8l_horizontal_up_mmxext
  584.  
  585. ---
  586. libavcodec/h264.c                    |    2 +
  587.  libavcodec/x86/h264_intrapred.asm    |   96 +++++++++++++++++++++++++++++++++-
  588.  libavcodec/x86/h264_intrapred_init.c |    2 +
  589.  3 files changed, 98 insertions(+), 2 deletions(-)
  590.  
  591. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  592. index 318c1c8..cbcbc42 100644
  593. --- a/libavcodec/h264.c
  594. +++ b/libavcodec/h264.c
  595. @@ -1190,8 +1190,10 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  596.                                  h->hpc.pred8x8l_add[dir](ptr, h->mb + i*16, linesize);
  597.                              }else{
  598.                                  const int nnz = h->non_zero_count_cache[ scan8[i] ];
  599. +START_TIMER;
  600.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  601.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  602. +if (dir == HOR_UP_PRED) { STOP_TIMER("pred8x8l_horizontal_up"); }
  603.                                  if(nnz){
  604.                                      if(nnz == 1 && h->mb[i*16])
  605.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  606. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  607. index dfe381c..901823c 100644
  608. --- a/libavcodec/x86/h264_intrapred.asm
  609. +++ b/libavcodec/x86/h264_intrapred.asm
  610. @@ -1116,19 +1116,19 @@ cglobal pred8x8l_horizontal_mmxext, 4,4
  611.      pxor        mm1, mm5
  612.      jmp .do_left
  613.  .body
  614. +    lea         r1, [r0+r3*2]
  615.      movq       mm7, mm3
  616.      punpckhbw  mm3, mm3
  617.      punpcklbw  mm7, mm7
  618.      pshufw     mm0, mm3, 0xff
  619.      pshufw     mm1, mm3, 0xaa
  620. +    lea         r2, [r1+r3*2]
  621.      pshufw     mm2, mm3, 0x55
  622.      pshufw     mm3, mm3, 0x00
  623.      pshufw     mm4, mm7, 0xff
  624.      pshufw     mm5, mm7, 0xaa
  625.      pshufw     mm6, mm7, 0x55
  626.      pshufw     mm7, mm7, 0x00
  627. -    lea         r1, [r0+r3*2]
  628. -    lea         r2, [r1+r3*2]
  629.      movq [r0+r3*1], mm0
  630.      movq [r0+r3*2], mm1
  631.      movq [r1+r3*1], mm2
  632. @@ -1141,6 +1141,98 @@ cglobal pred8x8l_horizontal_mmxext, 4,4
  633.      RET
  634.  
  635.  ;-----------------------------------------------------------------------------
  636. +; void pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  637. +;-----------------------------------------------------------------------------
  638. +INIT_MMX
  639. +%define PALIGNR PALIGNR_MMX
  640. +cglobal pred8x8l_horizontal_up_mmxext, 4,4
  641. +    sub          r0, r3
  642. +    lea          r2, [r0+r3*2]
  643. +    movq        mm0, [r0+r3*1-8]
  644. +    punpckhbw   mm0, [r0+r3*0-8]
  645. +    movq        mm1, [r2+r3*1-8]
  646. +    punpckhbw   mm1, [r0+r3*2-8]
  647. +    mov          r2, r0
  648. +    punpckhwd   mm1, mm0
  649. +    lea          r0, [r0+r3*4]
  650. +    movq        mm2, [r0+r3*1-8]
  651. +    punpckhbw   mm2, [r0+r3*0-8]
  652. +    lea          r0, [r0+r3*2]
  653. +    movq        mm3, [r0+r3*1-8]
  654. +    punpckhbw   mm3, [r0+r3*0-8]
  655. +    punpckhwd   mm3, mm2
  656. +    punpckhdq   mm3, mm1
  657. +    lea          r0, [r0+r3*2]
  658. +    movq        mm0, [r0+r3*0-8]
  659. +    movq        mm1, [r2]
  660. +    mov          r0, r2
  661. +    movq        mm4, mm3
  662. +    movq        mm2, mm3
  663. +    PALIGNR     mm4, mm0, 7, mm0
  664. +    PALIGNR     mm1, mm2, 1, mm2
  665. +    test        r1, r1 ; top_left
  666. +    jz .fix_lt_1
  667. +.do_left:
  668. +    movq        mm0, mm4
  669. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  670. +    movq        mm4, mm0
  671. +    movq        mm7, mm2
  672. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  673. +    psllq       mm1, 56
  674. +    PALIGNR     mm7, mm1, 7, mm3
  675. +    movq        mm1, mm7
  676. +    jmp .body
  677. +.fix_lt_1:
  678. +    movq        mm5, mm3
  679. +    pxor        mm5, mm4
  680. +    psrlq       mm5, 56
  681. +    psllq       mm5, 48
  682. +    pxor        mm1, mm5
  683. +    jmp .do_left
  684. +.body
  685. +    lea         r1, [r0+r3*2]
  686. +    movq       mm1, mm7            ; l0 l1 l2 l3 l4 l5 l6 l7
  687. +    pshufw     mm0, mm1, 00011011b ; l6 l7 l4 l5 l2 l3 l0 l1
  688. +    psllq      mm1, 56             ; l7 .. .. .. .. .. .. ..
  689. +    movq       mm2, mm0
  690. +    psllw      mm0, 8
  691. +    psrlw      mm2, 8
  692. +    por        mm2, mm0            ; l7 l6 l5 l4 l3 l2 l1 l0
  693. +    movq       mm3, mm2
  694. +    movq       mm4, mm2
  695. +    movq       mm5, mm2
  696. +    psrlq      mm2, 8
  697. +    psrlq      mm3, 16
  698. +    lea         r2, [r1+r3*2]
  699. +    por        mm2, mm1            ; l7 l7 l6 l5 l4 l3 l2 l1
  700. +    punpckhbw  mm1, mm1
  701. +    por        mm3, mm1            ; l7 l7 l7 l6 l5 l4 l3 l2
  702. +    pavgb      mm4, mm2
  703. +    PRED4x4_LOWPASS mm1, mm3, mm5, mm2, mm6
  704. +    movq       mm5, mm4
  705. +    punpcklbw  mm4, mm1          ; p4 p3 p2 p1
  706. +    punpckhbw  mm5, mm1          ; p8 p7 p6 p5
  707. +    movq       mm6, mm5
  708. +    movq       mm7, mm5
  709. +    movq       mm0, mm5
  710. +    PALIGNR    mm5, mm4, 2, mm1
  711. +    pshufw     mm1, mm6, 11111001b
  712. +    PALIGNR    mm6, mm4, 4, mm2
  713. +    pshufw     mm2, mm7, 11111110b
  714. +    PALIGNR    mm7, mm4, 6, mm3
  715. +    pshufw     mm3, mm0, 11111111b
  716. +    movq [r0+r3*1], mm4
  717. +    movq [r0+r3*2], mm5
  718. +    lea         r0, [r2+r3*2]
  719. +    movq [r1+r3*1], mm6
  720. +    movq [r1+r3*2], mm7
  721. +    movq [r2+r3*1], mm0
  722. +    movq [r2+r3*2], mm1
  723. +    movq [r0+r3*1], mm2
  724. +    movq [r0+r3*2], mm3
  725. +    RET
  726. +
  727. +;-----------------------------------------------------------------------------
  728.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  729.  ;-----------------------------------------------------------------------------
  730.  
  731. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  732. index b5e6c02..4877919 100644
  733. --- a/libavcodec/x86/h264_intrapred_init.c
  734. +++ b/libavcodec/x86/h264_intrapred_init.c
  735. @@ -62,6 +62,7 @@ void ff_pred8x8l_dc_mmxext         (uint8_t *src, int has_topleft, int has_topri
  736.  void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topright, int stride);
  737.  void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topright, int stride);
  738.  void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  739. +void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  740.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  741.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  742.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  743. @@ -103,6 +104,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  744.          h->pred8x8l[TOP_DC_PRED  ] = ff_pred8x8l_top_dc_mmxext;
  745.          h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  746.          h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  747. +        h->pred8x8l[HOR_UP_PRED  ] = ff_pred8x8l_horizontal_up_mmxext;
  748.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  749.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  750.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  751. --
  752. 1.7.2.2
  753.  
  754.  
  755. From 3452703f64c49b467c6b6664b1b8ebe9d7a854cc Mon Sep 17 00:00:00 2001
  756. From: Daniel Kang <daniel.d.kang@gmail.com>
  757. Date: Sat, 25 Dec 2010 23:41:50 -0500
  758. Subject: [PATCH 07/15] pred8x8l_down_left_mmxext
  759.  
  760. ---
  761. libavcodec/h264.c                    |    2 +-
  762.  libavcodec/x86/h264_intrapred.asm    |   91 ++++++++++++++++++++++++++++++++++
  763.  libavcodec/x86/h264_intrapred_init.c |    2 +
  764.  3 files changed, 94 insertions(+), 1 deletions(-)
  765.  
  766. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  767. index cbcbc42..f0d314e 100644
  768. --- a/libavcodec/h264.c
  769. +++ b/libavcodec/h264.c
  770. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  771.  START_TIMER;
  772.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  773.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  774. -if (dir == HOR_UP_PRED) { STOP_TIMER("pred8x8l_horizontal_up"); }
  775. +if (dir == DIAG_DOWN_LEFT_PRED) { STOP_TIMER("pred8x8l_down_left"); }
  776.                                  if(nnz){
  777.                                      if(nnz == 1 && h->mb[i*16])
  778.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  779. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  780. index 901823c..788cbc9 100644
  781. --- a/libavcodec/x86/h264_intrapred.asm
  782. +++ b/libavcodec/x86/h264_intrapred.asm
  783. @@ -1233,6 +1233,97 @@ cglobal pred8x8l_horizontal_up_mmxext, 4,4
  784.      RET
  785.  
  786.  ;-----------------------------------------------------------------------------
  787. +;void pred8x8l_down_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  788. +;-----------------------------------------------------------------------------
  789. +
  790. +INIT_MMX
  791. +%define PALIGNR PALIGNR_MMX
  792. +cglobal pred8x8l_down_left_sse2, 4,4
  793. +    sub          r0, r3
  794. +    movq        mm0, [r0-8]
  795. +    movq        mm3, [r0]
  796. +    movq        mm1, [r0+8]
  797. +    movq        mm2, mm3
  798. +    movq        mm4, mm3
  799. +    PALIGNR     mm2, mm0, 7, mm0
  800. +    PALIGNR     mm1, mm4, 1, mm4
  801. +    test         r1, r1 ; top_left
  802. +    jz .fix_lt_2
  803. +    test         r2, r2 ; top_right
  804. +    jz .fix_tr_1
  805. +.do_top:
  806. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  807. +    movq        mm7, mm4
  808. +    test         r2, r2 ; top_right
  809. +    jz .fix_tr_2
  810. +    movq        mm0, [r0+8]
  811. +    movq        mm5, mm0
  812. +    movq        mm2, mm0
  813. +    movq        mm4, mm0
  814. +    psrlq       mm5, 56
  815. +    PALIGNR     mm2, mm3, 7, mm3
  816. +    PALIGNR     mm5, mm4, 1, mm4
  817. +    PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
  818. +    jmp .do_topright
  819. +.fix_tr_2:
  820. +    punpckhbw   mm3, mm3
  821. +    pshufw      mm1, mm3, 0xFF
  822. +.do_topright:
  823. +    movq        mm6, mm1
  824. +    psrlq       mm1, 56
  825. +    movq        mm5, mm1
  826. +    jmp .body
  827. +.fix_lt_2:
  828. +    movq        mm5, mm3
  829. +    pxor        mm5, mm2
  830. +    psllq       mm5, 56
  831. +    psrlq       mm5, 56
  832. +    pxor        mm2, mm5
  833. +    test         r2, r2 ; top_right
  834. +    jnz .do_top
  835. +.fix_tr_1:
  836. +    movq        mm5, mm3
  837. +    pxor        mm5, mm1
  838. +    psrlq       mm5, 56
  839. +    psllq       mm5, 56
  840. +    pxor        mm1, mm5
  841. +    jmp .do_top
  842. +.body
  843. +    lea         r1, [r0+r3*2]
  844. +    movq2dq   xmm3, mm7
  845. +    movq2dq   xmm4, mm6
  846. +    pslldq    xmm4, 8
  847. +    por       xmm3, xmm4
  848. +    movdqa    xmm2, xmm3
  849. +    psrldq    xmm2, 1
  850. +    movq2dq   xmm5, mm5
  851. +    pslldq    xmm5, 15
  852. +    por       xmm2, xmm5
  853. +    lea         r2, [r1+r3*2]
  854. +    movdqa    xmm1, xmm3
  855. +    pslldq    xmm1, 1
  856. +INIT_XMM
  857. +    PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
  858. +    psrldq    xmm0, 1
  859. +    movq [r0+r3*1], xmm0
  860. +    psrldq    xmm0, 1
  861. +    movq [r0+r3*2], xmm0
  862. +    psrldq    xmm0, 1
  863. +    lea         r0, [r2+r3*2]
  864. +    movq [r1+r3*1], xmm0
  865. +    psrldq    xmm0, 1
  866. +    movq [r1+r3*2], xmm0
  867. +    psrldq    xmm0, 1
  868. +    movq [r2+r3*1], xmm0
  869. +    psrldq    xmm0, 1
  870. +    movq [r2+r3*2], xmm0
  871. +    psrldq    xmm0, 1
  872. +    movq [r0+r3*1], xmm0
  873. +    psrldq    xmm0, 1
  874. +    movq [r0+r3*2], xmm0
  875. +    RET
  876. +
  877. +;-----------------------------------------------------------------------------
  878.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  879.  ;-----------------------------------------------------------------------------
  880.  
  881. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  882. index 4877919..4bf9f78 100644
  883. --- a/libavcodec/x86/h264_intrapred_init.c
  884. +++ b/libavcodec/x86/h264_intrapred_init.c
  885. @@ -63,6 +63,7 @@ void ff_pred8x8l_top_dc_mmxext     (uint8_t *src, int has_topleft, int has_topri
  886.  void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topright, int stride);
  887.  void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  888.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  889. +void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  890.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  891.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  892.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  893. @@ -134,6 +135,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  894.  
  895.      if (mm_flags & AV_CPU_FLAG_SSE2) {
  896.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  897. +        h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  898.          if (codec_id == CODEC_ID_VP8) {
  899.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
  900.              h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
  901. --
  902. 1.7.2.2
  903.  
  904.  
  905. From 66b03d80b08ace9f0d99b12c79cc111a6950c166 Mon Sep 17 00:00:00 2001
  906. From: Daniel Kang <daniel.d.kang@gmail.com>
  907. Date: Sun, 26 Dec 2010 18:07:58 -0500
  908. Subject: [PATCH 08/15] pred8x8l_vertical_right_sse2
  909.  
  910. ---
  911. libavcodec/h264.c                    |    2 +-
  912.  libavcodec/x86/h264_intrapred.asm    |  117 ++++++++++++++++++++++++++++++++++
  913.  libavcodec/x86/h264_intrapred_init.c |    2 +
  914.  3 files changed, 120 insertions(+), 1 deletions(-)
  915.  
  916. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  917. index f0d314e..8353b51 100644
  918. --- a/libavcodec/h264.c
  919. +++ b/libavcodec/h264.c
  920. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  921.  START_TIMER;
  922.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  923.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  924. -if (dir == DIAG_DOWN_LEFT_PRED) { STOP_TIMER("pred8x8l_down_left"); }
  925. +if (dir == VERT_RIGHT_PRED) { STOP_TIMER("pred8x8l_vertical_right"); }
  926.                                  if(nnz){
  927.                                      if(nnz == 1 && h->mb[i*16])
  928.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  929. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  930. index 788cbc9..1327ecb 100644
  931. --- a/libavcodec/x86/h264_intrapred.asm
  932. +++ b/libavcodec/x86/h264_intrapred.asm
  933. @@ -25,6 +25,7 @@
  934.  SECTION_RODATA
  935.  
  936.  tm_shuf: times 8 db 0x03, 0x80
  937. +pw_ff00: times 8 dw 0xff00
  938.  plane_shuf:  db -8, -7, -6, -5, -4, -3, -2, -1
  939.               db  1,  2,  3,  4,  5,  6,  7,  8
  940.  plane8_shuf: db -4, -3, -2, -1,  0,  0,  0,  0
  941. @@ -1233,6 +1234,122 @@ cglobal pred8x8l_horizontal_up_mmxext, 4,4
  942.      RET
  943.  
  944.  ;-----------------------------------------------------------------------------
  945. +; void pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  946. +;-----------------------------------------------------------------------------
  947. +
  948. +INIT_MMX
  949. +%define PALIGNR PALIGNR_MMX
  950. +cglobal pred8x8l_vertical_right_sse2, 4,5,7
  951. +    sub          r0, r3
  952. +    lea          r4, [r0+r3*2]
  953. +    movq        mm0, [r0+r3*1-8]
  954. +    punpckhbw   mm0, [r0+r3*0-8]
  955. +    movq        mm1, [r4+r3*1-8]
  956. +    punpckhbw   mm1, [r0+r3*2-8]
  957. +    mov          r4, r0
  958. +    punpckhwd   mm1, mm0
  959. +    lea          r0, [r0+r3*4]
  960. +    movq        mm2, [r0+r3*1-8]
  961. +    punpckhbw   mm2, [r0+r3*0-8]
  962. +    lea          r0, [r0+r3*2]
  963. +    movq        mm3, [r0+r3*1-8]
  964. +    punpckhbw   mm3, [r0+r3*0-8]
  965. +    punpckhwd   mm3, mm2
  966. +    punpckhdq   mm3, mm1
  967. +    lea          r0, [r0+r3*2]
  968. +    movq        mm0, [r0+r3*0-8]
  969. +    movq        mm1, [r4]
  970. +    mov          r0, r4
  971. +    movq        mm4, mm3
  972. +    movq        mm2, mm3
  973. +    PALIGNR     mm4, mm0, 7, mm0
  974. +    PALIGNR     mm1, mm2, 1, mm2
  975. +    test        r1, r1 ; top_left
  976. +    jz .fix_lt_1
  977. +.do_left:
  978. +    movq        mm0, mm4
  979. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  980. +    movq        mm7, mm2
  981. +    movq        mm0, [r0-8]
  982. +    movq        mm3, [r0]
  983. +    movq        mm1, [r0+8]
  984. +    movq        mm2, mm3
  985. +    movq        mm4, mm3
  986. +    PALIGNR     mm2, mm0, 7, mm0
  987. +    PALIGNR     mm1, mm4, 1, mm4
  988. +    test         r1, r1 ; top_left
  989. +    jz .fix_lt_2
  990. +    test         r2, r2 ; top_right
  991. +    jz .fix_tr_1
  992. +.do_top
  993. +    PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
  994. +    jmp .body
  995. +.fix_lt_2:
  996. +    movq        mm5, mm3
  997. +    pxor        mm5, mm2
  998. +    psllq       mm5, 56
  999. +    psrlq       mm5, 56
  1000. +    pxor        mm2, mm5
  1001. +    test         r2, r2 ; top_right
  1002. +    jnz .do_top
  1003. +.fix_lt_1:
  1004. +    movq        mm5, mm3
  1005. +    pxor        mm5, mm4
  1006. +    psrlq       mm5, 56
  1007. +    psllq       mm5, 48
  1008. +    pxor        mm1, mm5
  1009. +    jmp .do_left
  1010. +.fix_tr_1:
  1011. +    movq        mm5, mm3
  1012. +    pxor        mm5, mm1
  1013. +    psrlq       mm5, 56
  1014. +    psllq       mm5, 56
  1015. +    pxor        mm1, mm5
  1016. +    jmp .do_top
  1017. +.body
  1018. +    lea           r1, [r0+r3*2]
  1019. +    movq2dq     xmm0, mm7
  1020. +    movq2dq     xmm4, mm6
  1021. +    pslldq      xmm4, 8
  1022. +    por         xmm0, xmm4
  1023. +    movdqa      xmm6, [pw_ff00]
  1024. +    movdqa      xmm1, xmm0
  1025. +    lea           r2, [r1+r3*2]
  1026. +    movdqa      xmm2, xmm0
  1027. +    movdqa      xmm3, xmm0
  1028. +    pslldq      xmm0, 1
  1029. +    pslldq      xmm1, 2
  1030. +    pavgb       xmm2, xmm0
  1031. +INIT_XMM
  1032. +    PRED4x4_LOWPASS xmm4, xmm3, xmm1, xmm0, xmm5
  1033. +    pandn       xmm6, xmm4
  1034. +    movdqa      xmm5, xmm4
  1035. +    psrlw       xmm4, 8
  1036. +    packuswb    xmm6, xmm4
  1037. +    movhlps     xmm4, xmm6
  1038. +    movhps [r0+r3*2], xmm5
  1039. +    movhps [r0+r3*1], xmm2
  1040. +    psrldq      xmm5, 4
  1041. +    movss       xmm5, xmm6
  1042. +    psrldq      xmm2, 4
  1043. +    movss       xmm2, xmm4
  1044. +    lea           r0, [r2+r3*2]
  1045. +
  1046. +    psrldq      xmm5, 1
  1047. +    psrldq      xmm2, 1
  1048. +    movq        [r0+r3*2], xmm5
  1049. +    movq        [r0+r3*1], xmm2
  1050. +    psrldq      xmm5, 1
  1051. +    psrldq      xmm2, 1
  1052. +    movq        [r2+r3*2], xmm5
  1053. +    movq        [r2+r3*1], xmm2
  1054. +    psrldq      xmm5, 1
  1055. +    psrldq      xmm2, 1
  1056. +    movq        [r1+r3*2], xmm5
  1057. +    movq        [r1+r3*1], xmm2
  1058. +    RET
  1059. +
  1060. +;-----------------------------------------------------------------------------
  1061.  ;void pred8x8l_down_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1062.  ;-----------------------------------------------------------------------------
  1063.  
  1064. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1065. index 4bf9f78..1c5dcc5 100644
  1066. --- a/libavcodec/x86/h264_intrapred_init.c
  1067. +++ b/libavcodec/x86/h264_intrapred_init.c
  1068. @@ -64,6 +64,7 @@ void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topri
  1069.  void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  1070.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  1071.  void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  1072. +void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1073.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  1074.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  1075.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  1076. @@ -136,6 +137,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1077.      if (mm_flags & AV_CPU_FLAG_SSE2) {
  1078.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  1079.          h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  1080. +        h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1081.          if (codec_id == CODEC_ID_VP8) {
  1082.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
  1083.              h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
  1084. --
  1085. 1.7.2.2
  1086.  
  1087.  
  1088. From 0b2f1deb8b4e660ee5fa0bf47436a2a606ac3795 Mon Sep 17 00:00:00 2001
  1089. From: Daniel Kang <daniel.d.kang@gmail.com>
  1090. Date: Sun, 26 Dec 2010 18:40:47 -0500
  1091. Subject: [PATCH 09/15] pred8x8l_vertical_left_sse2
  1092.  
  1093. ---
  1094. libavcodec/h264.c                    |    2 +-
  1095.  libavcodec/x86/h264_intrapred.asm    |   85 ++++++++++++++++++++++++++++++++++
  1096.  libavcodec/x86/h264_intrapred_init.c |    2 +
  1097.  3 files changed, 88 insertions(+), 1 deletions(-)
  1098.  
  1099. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1100. index 8353b51..5a1fdb9 100644
  1101. --- a/libavcodec/h264.c
  1102. +++ b/libavcodec/h264.c
  1103. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1104.  START_TIMER;
  1105.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1106.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1107. -if (dir == VERT_RIGHT_PRED) { STOP_TIMER("pred8x8l_vertical_right"); }
  1108. +if (dir == VERT_LEFT_PRED) { STOP_TIMER("pred8x8l_vertical_left"); }
  1109.                                  if(nnz){
  1110.                                      if(nnz == 1 && h->mb[i*16])
  1111.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1112. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1113. index 1327ecb..512db1b 100644
  1114. --- a/libavcodec/x86/h264_intrapred.asm
  1115. +++ b/libavcodec/x86/h264_intrapred.asm
  1116. @@ -1350,6 +1350,91 @@ INIT_XMM
  1117.      RET
  1118.  
  1119.  ;-----------------------------------------------------------------------------
  1120. +;void pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1121. +;-----------------------------------------------------------------------------
  1122. +
  1123. +INIT_MMX
  1124. +%define PALIGNR PALIGNR_MMX
  1125. +cglobal pred8x8l_vertical_left_sse2, 4,4
  1126. +    sub          r0, r3
  1127. +    movq        mm0, [r0-8]
  1128. +    movq        mm3, [r0]
  1129. +    movq        mm1, [r0+8]
  1130. +    movq        mm2, mm3
  1131. +    movq        mm4, mm3
  1132. +    PALIGNR     mm2, mm0, 7, mm0
  1133. +    PALIGNR     mm1, mm4, 1, mm4
  1134. +    test         r1, r1 ; top_left
  1135. +    jz .fix_lt_2
  1136. +    test         r2, r2 ; top_right
  1137. +    jz .fix_tr_1
  1138. +.do_top:
  1139. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  1140. +    movq2dq    xmm4, mm4
  1141. +    test         r2, r2 ; top_right
  1142. +    jz .fix_tr_2
  1143. +    movq        mm0, [r0+8]
  1144. +    movq        mm5, mm0
  1145. +    movq        mm2, mm0
  1146. +    movq        mm4, mm0
  1147. +    psrlq       mm5, 56
  1148. +    PALIGNR     mm2, mm3, 7, mm3
  1149. +    PALIGNR     mm5, mm4, 1, mm4
  1150. +    PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
  1151. +    jmp .do_topright
  1152. +.fix_tr_2:
  1153. +    punpckhbw   mm3, mm3
  1154. +    pshufw      mm1, mm3, 0xFF
  1155. +.do_topright:
  1156. +    movq2dq    xmm3, mm1
  1157. +    jmp .body
  1158. +.fix_lt_2:
  1159. +    movq        mm5, mm3
  1160. +    pxor        mm5, mm2
  1161. +    psllq       mm5, 56
  1162. +    psrlq       mm5, 56
  1163. +    pxor        mm2, mm5
  1164. +    test         r2, r2 ; top_right
  1165. +    jnz .do_top
  1166. +.fix_tr_1:
  1167. +    movq        mm5, mm3
  1168. +    pxor        mm5, mm1
  1169. +    psrlq       mm5, 56
  1170. +    psllq       mm5, 56
  1171. +    pxor        mm1, mm5
  1172. +    jmp .do_top
  1173. +.body
  1174. +    lea         r1, [r0+r3*2]
  1175. +    pslldq    xmm3, 8
  1176. +    por       xmm4, xmm3
  1177. +    movdqa    xmm2, xmm4
  1178. +    movdqa    xmm1, xmm4
  1179. +    movdqa    xmm3, xmm4
  1180. +    psrldq    xmm2, 1
  1181. +    pslldq    xmm1, 1
  1182. +    pavgb     xmm3, xmm2
  1183. +    lea         r2, [r1+r3*2]
  1184. +INIT_XMM
  1185. +    PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm4, xmm5
  1186. +    psrldq    xmm0, 1
  1187. +    movq [r0+r3*1], xmm3
  1188. +    movq [r0+r3*2], xmm0
  1189. +    lea         r0, [r2+r3*2]
  1190. +    psrldq    xmm3, 1
  1191. +    psrldq    xmm0, 1
  1192. +    movq [r1+r3*1], xmm3
  1193. +    movq [r1+r3*2], xmm0
  1194. +    psrldq    xmm3, 1
  1195. +    psrldq    xmm0, 1
  1196. +    movq [r2+r3*1], xmm3
  1197. +    movq [r2+r3*2], xmm0
  1198. +    psrldq    xmm3, 1
  1199. +    psrldq    xmm0, 1
  1200. +    movq [r0+r3*1], xmm3
  1201. +    movq [r0+r3*2], xmm0
  1202. +    RET
  1203. +
  1204. +;-----------------------------------------------------------------------------
  1205.  ;void pred8x8l_down_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1206.  ;-----------------------------------------------------------------------------
  1207.  
  1208. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1209. index 1c5dcc5..ebba657 100644
  1210. --- a/libavcodec/x86/h264_intrapred_init.c
  1211. +++ b/libavcodec/x86/h264_intrapred_init.c
  1212. @@ -65,6 +65,7 @@ void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topri
  1213.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  1214.  void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  1215.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1216. +void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1217.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  1218.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  1219.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  1220. @@ -138,6 +139,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1221.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  1222.          h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  1223.          h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1224. +        h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  1225.          if (codec_id == CODEC_ID_VP8) {
  1226.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
  1227.              h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
  1228. --
  1229. 1.7.2.2
  1230.  
  1231.  
  1232. From 5728a3079448b86a9d2778c2b8bdac528f1e3bbe Mon Sep 17 00:00:00 2001
  1233. From: Daniel Kang <daniel.d.kang@gmail.com>
  1234. Date: Sun, 26 Dec 2010 20:32:25 -0500
  1235. Subject: [PATCH 10/15] pred8x8l_down_right_sse2
  1236.  
  1237. ---
  1238. libavcodec/h264.c                    |    2 +-
  1239.  libavcodec/x86/h264_intrapred.asm    |  117 ++++++++++++++++++++++++++++++++++
  1240.  libavcodec/x86/h264_intrapred_init.c |    2 +
  1241.  3 files changed, 120 insertions(+), 1 deletions(-)
  1242.  
  1243. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1244. index 5a1fdb9..086e071 100644
  1245. --- a/libavcodec/h264.c
  1246. +++ b/libavcodec/h264.c
  1247. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1248.  START_TIMER;
  1249.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1250.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1251. -if (dir == VERT_LEFT_PRED) { STOP_TIMER("pred8x8l_vertical_left"); }
  1252. +if (dir == DIAG_DOWN_RIGHT_PRED) { STOP_TIMER("pred8x8l_down_right"); }
  1253.                                  if(nnz){
  1254.                                      if(nnz == 1 && h->mb[i*16])
  1255.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1256. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1257. index 512db1b..9132045 100644
  1258. --- a/libavcodec/x86/h264_intrapred.asm
  1259. +++ b/libavcodec/x86/h264_intrapred.asm
  1260. @@ -1435,6 +1435,123 @@ INIT_XMM
  1261.      RET
  1262.  
  1263.  ;-----------------------------------------------------------------------------
  1264. +; void pred8x8l_down_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1265. +;-----------------------------------------------------------------------------
  1266. +
  1267. +INIT_MMX
  1268. +%define PALIGNR PALIGNR_MMX
  1269. +cglobal pred8x8l_down_right_sse2, 4,5
  1270. +    sub          r0, r3
  1271. +    lea          r4, [r0+r3*2]
  1272. +    movq        mm0, [r0+r3*1-8]
  1273. +    punpckhbw   mm0, [r0+r3*0-8]
  1274. +    movq        mm1, [r4+r3*1-8]
  1275. +    punpckhbw   mm1, [r0+r3*2-8]
  1276. +    mov          r4, r0
  1277. +    punpckhwd   mm1, mm0
  1278. +    lea          r0, [r0+r3*4]
  1279. +    movq        mm2, [r0+r3*1-8]
  1280. +    punpckhbw   mm2, [r0+r3*0-8]
  1281. +    lea          r0, [r0+r3*2]
  1282. +    movq        mm3, [r0+r3*1-8]
  1283. +    punpckhbw   mm3, [r0+r3*0-8]
  1284. +    punpckhwd   mm3, mm2
  1285. +    punpckhdq   mm3, mm1
  1286. +    lea          r0, [r0+r3*2]
  1287. +    movq        mm0, [r0+r3*0-8]
  1288. +    movq        mm1, [r4]
  1289. +    mov          r0, r4
  1290. +    movq        mm4, mm3
  1291. +    movq        mm2, mm3
  1292. +    PALIGNR     mm4, mm0, 7, mm0
  1293. +    PALIGNR     mm1, mm2, 1, mm2
  1294. +    test        r1, r1 ; top_left
  1295. +    jz .fix_lt_1
  1296. +.do_left:
  1297. +    movq        mm0, mm4
  1298. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  1299. +    movq        mm4, mm0
  1300. +    movq        mm7, mm2
  1301. +    movq        mm6, mm2
  1302. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  1303. +    psllq       mm1, 56
  1304. +    PALIGNR     mm7, mm1, 7, mm3
  1305. +    movq        mm0, [r0-8]
  1306. +    movq        mm3, [r0]
  1307. +    movq        mm1, [r0+8]
  1308. +    movq        mm2, mm3
  1309. +    movq        mm4, mm3
  1310. +    PALIGNR     mm2, mm0, 7, mm0
  1311. +    PALIGNR     mm1, mm4, 1, mm4
  1312. +    test         r1, r1 ; top_left
  1313. +    jz .fix_lt_2
  1314. +    test         r2, r2 ; top_right
  1315. +    jz .fix_tr_1
  1316. +.do_top:
  1317. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  1318. +    movq        mm5, mm4
  1319. +    jmp .body
  1320. +.fix_lt_1:
  1321. +    movq        mm5, mm3
  1322. +    pxor        mm5, mm4
  1323. +    psrlq       mm5, 56
  1324. +    psllq       mm5, 48
  1325. +    pxor        mm1, mm5
  1326. +    jmp .do_left
  1327. +.fix_lt_2:
  1328. +    movq        mm5, mm3
  1329. +    pxor        mm5, mm2
  1330. +    psllq       mm5, 56
  1331. +    psrlq       mm5, 56
  1332. +    pxor        mm2, mm5
  1333. +    test         r2, r2 ; top_right
  1334. +    jnz .do_top
  1335. +.fix_tr_1:
  1336. +    movq        mm5, mm3
  1337. +    pxor        mm5, mm1
  1338. +    psrlq       mm5, 56
  1339. +    psllq       mm5, 56
  1340. +    pxor        mm1, mm5
  1341. +    jmp .do_top
  1342. +.body
  1343. +    lea         r1, [r0+r3*2]
  1344. +    movq2dq   xmm1, mm7
  1345. +    movq2dq   xmm3, mm6
  1346. +    movq2dq   xmm4, mm5
  1347. +    movdqa    xmm0, xmm3
  1348. +    pslldq    xmm4, 8
  1349. +    por       xmm3, xmm4
  1350. +    lea         r2, [r1+r3*2]
  1351. +    pslldq    xmm4, 1
  1352. +    psrldq    xmm0, 7
  1353. +    pslldq    xmm0, 15
  1354. +    psrldq    xmm0, 7
  1355. +    por       xmm1, xmm0
  1356. +    por       xmm1, xmm4
  1357. +    lea         r0, [r2+r3*2]
  1358. +    movdqa    xmm2, xmm3
  1359. +    psrldq    xmm2, 1
  1360. +INIT_XMM
  1361. +    PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
  1362. +    movdqa    xmm1, xmm0
  1363. +    psrldq    xmm1, 1
  1364. +    movq [r0+r3*2], xmm0
  1365. +    movq [r0+r3*1], xmm1
  1366. +    psrldq    xmm0, 2
  1367. +    psrldq    xmm1, 2
  1368. +    movq [r2+r3*2], xmm0
  1369. +    movq [r2+r3*1], xmm1
  1370. +    psrldq    xmm0, 2
  1371. +    psrldq    xmm1, 2
  1372. +    movq [r1+r3*2], xmm0
  1373. +    movq [r1+r3*1], xmm1
  1374. +    psrldq    xmm0, 2
  1375. +    psrldq    xmm1, 2
  1376. +    movq [r4+r3*2], xmm0
  1377. +    movq [r4+r3*1], xmm1
  1378. +    RET
  1379. +
  1380. +;-----------------------------------------------------------------------------
  1381.  ;void pred8x8l_down_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1382.  ;-----------------------------------------------------------------------------
  1383.  
  1384. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1385. index ebba657..265735d 100644
  1386. --- a/libavcodec/x86/h264_intrapred_init.c
  1387. +++ b/libavcodec/x86/h264_intrapred_init.c
  1388. @@ -64,6 +64,7 @@ void ff_pred8x8l_vertical_mmxext   (uint8_t *src, int has_topleft, int has_topri
  1389.  void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  1390.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  1391.  void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  1392. +void ff_pred8x8l_down_right_sse2   (uint8_t *src, int has_topleft, int has_topright, int stride);
  1393.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1394.  void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1395.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  1396. @@ -138,6 +139,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1397.      if (mm_flags & AV_CPU_FLAG_SSE2) {
  1398.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  1399.          h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  1400. +        h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  1401.          h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1402.          h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  1403.          if (codec_id == CODEC_ID_VP8) {
  1404. --
  1405. 1.7.2.2
  1406.  
  1407.  
  1408. From 77f1d0de4b7aef01fd2c7697c0b8a312366a4d7d Mon Sep 17 00:00:00 2001
  1409. From: Daniel Kang <daniel.d.kang@gmail.com>
  1410. Date: Sun, 26 Dec 2010 22:46:24 -0500
  1411. Subject: [PATCH 11/15] pred8x8l_horizontal_down_sse2
  1412.  
  1413. ---
  1414. libavcodec/h264.c                    |    2 +-
  1415.  libavcodec/x86/h264_intrapred.asm    |  130 ++++++++++++++++++++++++++++++++++
  1416.  libavcodec/x86/h264_intrapred_init.c |    2 +
  1417.  3 files changed, 133 insertions(+), 1 deletions(-)
  1418.  
  1419. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1420. index 086e071..d80324c 100644
  1421. --- a/libavcodec/h264.c
  1422. +++ b/libavcodec/h264.c
  1423. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1424.  START_TIMER;
  1425.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1426.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1427. -if (dir == DIAG_DOWN_RIGHT_PRED) { STOP_TIMER("pred8x8l_down_right"); }
  1428. +if (dir == HOR_DOWN_PRED) { STOP_TIMER("pred8x8l_horizontal_down"); }
  1429.                                  if(nnz){
  1430.                                      if(nnz == 1 && h->mb[i*16])
  1431.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1432. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1433. index 9132045..3b04ebf 100644
  1434. --- a/libavcodec/x86/h264_intrapred.asm
  1435. +++ b/libavcodec/x86/h264_intrapred.asm
  1436. @@ -1142,6 +1142,136 @@ cglobal pred8x8l_horizontal_mmxext, 4,4
  1437.      RET
  1438.  
  1439.  ;-----------------------------------------------------------------------------
  1440. +;void pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1441. +;-----------------------------------------------------------------------------
  1442. +
  1443. +cglobal pred8x8l_horizontal_down_sse2, 4,5
  1444. +    sub          r0, r3
  1445. +    lea          r4, [r0+r3*2]
  1446. +    movq        mm0, [r0+r3*1-8]
  1447. +    punpckhbw   mm0, [r0+r3*0-8]
  1448. +    movq        mm1, [r4+r3*1-8]
  1449. +    punpckhbw   mm1, [r0+r3*2-8]
  1450. +    mov          r4, r0
  1451. +    punpckhwd   mm1, mm0
  1452. +    lea          r0, [r0+r3*4]
  1453. +    movq        mm2, [r0+r3*1-8]
  1454. +    punpckhbw   mm2, [r0+r3*0-8]
  1455. +    lea          r0, [r0+r3*2]
  1456. +    movq        mm3, [r0+r3*1-8]
  1457. +    punpckhbw   mm3, [r0+r3*0-8]
  1458. +    punpckhwd   mm3, mm2
  1459. +    punpckhdq   mm3, mm1
  1460. +    lea          r0, [r0+r3*2]
  1461. +    movq        mm0, [r0+r3*0-8]
  1462. +    movq        mm1, [r4]
  1463. +    mov          r0, r4
  1464. +    movq        mm4, mm3
  1465. +    movq        mm2, mm3
  1466. +    PALIGNR     mm4, mm0, 7, mm0
  1467. +    PALIGNR     mm1, mm2, 1, mm2
  1468. +    test        r1, r1 ; top_left
  1469. +    jz .fix_lt_1
  1470. +.do_left:
  1471. +    movq        mm0, mm4
  1472. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  1473. +    movq2dq    xmm0, mm2
  1474. +    pslldq     xmm0, 8
  1475. +    movq        mm4, mm0
  1476. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  1477. +    movq2dq    xmm2, mm1
  1478. +    pslldq     xmm2, 15
  1479. +    psrldq     xmm2, 8
  1480. +    por        xmm0, xmm2
  1481. +.check_top:
  1482. +    movq        mm0, [r0-8]
  1483. +    movq        mm3, [r0]
  1484. +    movq        mm1, [r0+8]
  1485. +    movq        mm2, mm3
  1486. +    movq        mm4, mm3
  1487. +    PALIGNR     mm2, mm0, 7, mm0
  1488. +    PALIGNR     mm1, mm4, 1, mm4
  1489. +    test         r1, r1 ; top_left
  1490. +    jz .fix_lt_2
  1491. +    test         r2, r2 ; top_right
  1492. +    jz .fix_tr_1
  1493. +.do_top:
  1494. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  1495. +    movq2dq    xmm1, mm4
  1496. +    test         r2, r2 ; top_right
  1497. +    jz .fix_tr_2
  1498. +    movq        mm0, [r0+8]
  1499. +    movq        mm5, mm0
  1500. +    movq        mm2, mm0
  1501. +    movq        mm4, mm0
  1502. +    psrlq       mm5, 56
  1503. +    PALIGNR     mm2, mm3, 7, mm3
  1504. +    PALIGNR     mm5, mm4, 1, mm4
  1505. +    PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
  1506. +    jmp .do_topright
  1507. +.fix_tr_2:
  1508. +    punpckhbw   mm3, mm3
  1509. +    pshufw      mm1, mm3, 0xFF
  1510. +.do_topright:
  1511. +    movq2dq    xmm5, mm1
  1512. +    pslldq     xmm5, 8
  1513. +    por        xmm1, xmm5
  1514. +    jmp .body
  1515. +.fix_lt_1:
  1516. +    movq        mm5, mm3
  1517. +    pxor        mm5, mm4
  1518. +    psrlq       mm5, 56
  1519. +    psllq       mm5, 48
  1520. +    pxor        mm1, mm5
  1521. +    jmp .do_left
  1522. +.fix_lt_2:
  1523. +    movq        mm5, mm3
  1524. +    pxor        mm5, mm2
  1525. +    psllq       mm5, 56
  1526. +    psrlq       mm5, 56
  1527. +    pxor        mm2, mm5
  1528. +    test         r2, r2 ; top_right
  1529. +    jnz .do_top
  1530. +.fix_tr_1:
  1531. +    movq        mm5, mm3
  1532. +    pxor        mm5, mm1
  1533. +    psrlq       mm5, 56
  1534. +    psllq       mm5, 56
  1535. +    pxor        mm1, mm5
  1536. +    jmp .do_top
  1537. +.body
  1538. +INIT_XMM
  1539. +    lea         r2, [r4+r3*2]
  1540. +    movdqa    xmm2, xmm1
  1541. +    movdqa    xmm3, xmm1
  1542. +    PALIGNR   xmm1, xmm0, 7, xmm4
  1543. +    PALIGNR   xmm2, xmm0, 9, xmm5
  1544. +    lea         r1, [r2+r3*2]
  1545. +    PALIGNR   xmm3, xmm0, 8, xmm0
  1546. +    movdqa    xmm4, xmm1
  1547. +    pavgb     xmm4, xmm3
  1548. +    lea         r0, [r1+r3*2]
  1549. +    PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm5
  1550. +    punpcklbw xmm4, xmm0
  1551. +    movhlps   xmm0, xmm4
  1552. +
  1553. +    movq   [r0+r3*2], xmm4
  1554. +    movq   [r2+r3*2], xmm0
  1555. +    psrldq xmm4, 2
  1556. +    psrldq xmm0, 2
  1557. +    movq   [r0+r3*1], xmm4
  1558. +    movq   [r2+r3*1], xmm0
  1559. +    psrldq xmm4, 2
  1560. +    psrldq xmm0, 2
  1561. +    movq   [r1+r3*2], xmm4
  1562. +    movq   [r4+r3*2], xmm0
  1563. +    psrldq xmm4, 2
  1564. +    psrldq xmm0, 2
  1565. +    movq   [r1+r3*1], xmm4
  1566. +    movq   [r4+r3*1], xmm0
  1567. +    RET
  1568. +
  1569. +;-----------------------------------------------------------------------------
  1570.  ; void pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  1571.  ;-----------------------------------------------------------------------------
  1572.  INIT_MMX
  1573. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1574. index 265735d..b4b3a4e 100644
  1575. --- a/libavcodec/x86/h264_intrapred_init.c
  1576. +++ b/libavcodec/x86/h264_intrapred_init.c
  1577. @@ -67,6 +67,7 @@ void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_toprigh
  1578.  void ff_pred8x8l_down_right_sse2   (uint8_t *src, int has_topleft, int has_topright, int stride);
  1579.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1580.  void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1581. +void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1582.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  1583.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  1584.  void ff_pred4x4_tm_vp8_mmx         (uint8_t *src, const uint8_t *topright, int stride);
  1585. @@ -142,6 +143,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1586.          h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  1587.          h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1588.          h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  1589. +        h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
  1590.          if (codec_id == CODEC_ID_VP8) {
  1591.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
  1592.              h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
  1593. --
  1594. 1.7.2.2
  1595.  
  1596.  
  1597. From 38136e3c0554e1fb20b4b39861597ab3543c3a1b Mon Sep 17 00:00:00 2001
  1598. From: Daniel Kang <daniel.d.kang@gmail.com>
  1599. Date: Mon, 27 Dec 2010 00:26:06 -0500
  1600. Subject: [PATCH 12/15] pred8x8_dc_mmxext
  1601.  
  1602. ---
  1603. libavcodec/h264.c                    |    2 +-
  1604.  libavcodec/x86/h264_intrapred.asm    |   62 ++++++++++++++++++++++++++++++++++
  1605.  libavcodec/x86/h264_intrapred_init.c |    5 ++-
  1606.  3 files changed, 67 insertions(+), 2 deletions(-)
  1607.  
  1608. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1609. index d80324c..ff4dba1 100644
  1610. --- a/libavcodec/h264.c
  1611. +++ b/libavcodec/h264.c
  1612. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1613.  START_TIMER;
  1614.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1615.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1616. -if (dir == HOR_DOWN_PRED) { STOP_TIMER("pred8x8l_horizontal_down"); }
  1617. +if (dir == DC_PRED8x8) { STOP_TIMER("pred8x8_dc"); }
  1618.                                  if(nnz){
  1619.                                      if(nnz == 1 && h->mb[i*16])
  1620.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1621. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1622. index 3b04ebf..5f29b18 100644
  1623. --- a/libavcodec/x86/h264_intrapred.asm
  1624. +++ b/libavcodec/x86/h264_intrapred.asm
  1625. @@ -1773,6 +1773,68 @@ INIT_XMM
  1626.      RET
  1627.  
  1628.  ;-----------------------------------------------------------------------------
  1629. +; void pred8x8_dc_mmxext(uint8_t *src, int stride)
  1630. +;-----------------------------------------------------------------------------
  1631. +
  1632. +INIT_MMX
  1633. +cglobal pred8x8_dc_mmxext, 2,5
  1634. +    sub       r0, r1
  1635. +    pxor      m7, m7
  1636. +    movd      m0, [r0+0]
  1637. +    movd      m1, [r0+4]
  1638. +    psadbw    m0, m7            ; s0
  1639. +    mov       r4, r0
  1640. +    psadbw    m1, m7            ; s1
  1641. +
  1642. +    movzx    r2d, byte [r0+r1*1-1]
  1643. +    movzx    r3d, byte [r0+r1*2-1]
  1644. +    lea       r0, [r0+r1*2]
  1645. +    add      r2d, r3d
  1646. +    movzx    r3d, byte [r0+r1*1-1]
  1647. +    add      r2d, r3d
  1648. +    movzx    r3d, byte [r0+r1*2-1]
  1649. +    add      r2d, r3d
  1650. +    lea       r0, [r0+r1*2]
  1651. +    movd      m2, r2d            ; s2
  1652. +
  1653. +    movzx    r2d, byte [r0+r1*1-1]
  1654. +    movzx    r3d, byte [r0+r1*2-1]
  1655. +    lea       r0, [r0+r1*2]
  1656. +    add      r2d, r3d
  1657. +    movzx    r3d, byte [r0+r1*1-1]
  1658. +    add      r2d, r3d
  1659. +    movzx    r3d, byte [r0+r1*2-1]
  1660. +    add      r2d, r3d
  1661. +    movd      m3, r2d            ; s3
  1662. +
  1663. +    punpcklwd m0, m1
  1664. +    mov       r0, r4
  1665. +    punpcklwd m2, m3
  1666. +    punpckldq m0, m2            ; s0, s1, s2, s3
  1667. +    pshufw    m3, m0, 11110110b ; s2, s1, s3, s3
  1668. +    lea       r2, [r0+r1*2]
  1669. +    pshufw    m0, m0, 01110100b ; s0, s1, s3, s1
  1670. +    paddw     m0, m3
  1671. +    lea       r3, [r2+r1*2]
  1672. +    psrlw     m0, 2
  1673. +    pavgw     m0, m7            ; s0+s2, s1, s3, s1+s3
  1674. +    lea       r4, [r3+r1*2]
  1675. +    packuswb  m0, m0
  1676. +    punpcklbw m0, m0
  1677. +    movq      m1, m0
  1678. +    punpcklbw m0, m0
  1679. +    punpckhbw m1, m1
  1680. +    movq [r0+r1*1], m0
  1681. +    movq [r0+r1*2], m0
  1682. +    movq [r2+r1*1], m0
  1683. +    movq [r2+r1*2], m0
  1684. +    movq [r3+r1*1], m1
  1685. +    movq [r3+r1*2], m1
  1686. +    movq [r4+r1*1], m1
  1687. +    movq [r4+r1*2], m1
  1688. +    RET
  1689. +
  1690. +;-----------------------------------------------------------------------------
  1691.  ; void pred8x8_dc_rv40(uint8_t *src, int stride)
  1692.  ;-----------------------------------------------------------------------------
  1693.  
  1694. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1695. index b4b3a4e..984f719 100644
  1696. --- a/libavcodec/x86/h264_intrapred_init.c
  1697. +++ b/libavcodec/x86/h264_intrapred_init.c
  1698. @@ -45,6 +45,7 @@ void ff_pred16x16_tm_vp8_mmx       (uint8_t *src, int stride);
  1699.  void ff_pred16x16_tm_vp8_mmxext    (uint8_t *src, int stride);
  1700.  void ff_pred16x16_tm_vp8_sse2      (uint8_t *src, int stride);
  1701.  void ff_pred8x8_dc_rv40_mmxext     (uint8_t *src, int stride);
  1702. +void ff_pred8x8_dc_mmxext          (uint8_t *src, int stride);
  1703.  void ff_pred8x8_vertical_mmx       (uint8_t *src, int stride);
  1704.  void ff_pred8x8_horizontal_mmx     (uint8_t *src, int stride);
  1705.  void ff_pred8x8_horizontal_mmxext  (uint8_t *src, int stride);
  1706. @@ -113,8 +114,10 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1707.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  1708.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  1709.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  1710. -        if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264)
  1711. +        if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
  1712. +            h->pred8x8[DC_PRED8x8     ] = ff_pred8x8_dc_mmxext;
  1713.              h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;
  1714. +        }
  1715.          if (codec_id == CODEC_ID_VP8) {
  1716.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
  1717.              h->pred8x8  [DC_PRED8x8   ] = ff_pred8x8_dc_rv40_mmxext;
  1718. --
  1719. 1.7.2.2
  1720.  
  1721.  
  1722. From 49cdad992bd4dbcf91311aeba6c9894fc90c60a9 Mon Sep 17 00:00:00 2001
  1723. From: Daniel Kang <daniel.d.kang@gmail.com>
  1724. Date: Mon, 27 Dec 2010 12:39:22 -0500
  1725. Subject: [PATCH 13/15] pred8x8l_vertical_right_mmxext
  1726.  
  1727. ---
  1728. libavcodec/h264.c                    |    2 +-
  1729.  libavcodec/x86/h264_intrapred.asm    |  118 ++++++++++++++++++++++++++++++++++
  1730.  libavcodec/x86/h264_intrapred_init.c |    4 +-
  1731.  3 files changed, 122 insertions(+), 2 deletions(-)
  1732.  
  1733. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1734. index ff4dba1..60cd944 100644
  1735. --- a/libavcodec/h264.c
  1736. +++ b/libavcodec/h264.c
  1737. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1738.  START_TIMER;
  1739.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1740.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1741. -if (dir == DC_PRED8x8) { STOP_TIMER("pred8x8_dc"); }
  1742. +if (dir == VERT_RIGHT_PRED) { STOP_TIMER("pred8x8l_vertical_right_mmxext"); }
  1743.                                  if(nnz){
  1744.                                      if(nnz == 1 && h->mb[i*16])
  1745.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1746. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1747. index 5f29b18..51b8edf 100644
  1748. --- a/libavcodec/x86/h264_intrapred.asm
  1749. +++ b/libavcodec/x86/h264_intrapred.asm
  1750. @@ -1364,6 +1364,124 @@ cglobal pred8x8l_horizontal_up_mmxext, 4,4
  1751.      RET
  1752.  
  1753.  ;-----------------------------------------------------------------------------
  1754. +; void pred8x8l_vertical_right_mmxext( pixel *src, pixel *edge )
  1755. +;-----------------------------------------------------------------------------
  1756. +
  1757. +INIT_MMX
  1758. +%define PALIGNR PALIGNR_MMX
  1759. +cglobal pred8x8l_vertical_right_mmxext, 4,5
  1760. +    sub          r0, r3
  1761. +    lea          r4, [r0+r3*2]
  1762. +    movq        mm0, [r0+r3*1-8]
  1763. +    punpckhbw   mm0, [r0+r3*0-8]
  1764. +    movq        mm1, [r4+r3*1-8]
  1765. +    punpckhbw   mm1, [r0+r3*2-8]
  1766. +    mov          r4, r0
  1767. +    punpckhwd   mm1, mm0
  1768. +    lea          r0, [r0+r3*4]
  1769. +    movq        mm2, [r0+r3*1-8]
  1770. +    punpckhbw   mm2, [r0+r3*0-8]
  1771. +    lea          r0, [r0+r3*2]
  1772. +    movq        mm3, [r0+r3*1-8]
  1773. +    punpckhbw   mm3, [r0+r3*0-8]
  1774. +    punpckhwd   mm3, mm2
  1775. +    punpckhdq   mm3, mm1
  1776. +    lea          r0, [r0+r3*2]
  1777. +    movq        mm0, [r0+r3*0-8]
  1778. +    movq        mm1, [r4]
  1779. +    mov          r0, r4
  1780. +    movq        mm4, mm3
  1781. +    movq        mm2, mm3
  1782. +    PALIGNR     mm4, mm0, 7, mm0
  1783. +    PALIGNR     mm1, mm2, 1, mm2
  1784. +    test        r1, r1 ; top_left
  1785. +    jz .fix_lt_1
  1786. +.do_left:
  1787. +    movq        mm0, mm4
  1788. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  1789. +    movq        mm7, mm2
  1790. +    movq        mm0, [r0-8]
  1791. +    movq        mm3, [r0]
  1792. +    movq        mm1, [r0+8]
  1793. +    movq        mm2, mm3
  1794. +    movq        mm4, mm3
  1795. +    PALIGNR     mm2, mm0, 7, mm0
  1796. +    PALIGNR     mm1, mm4, 1, mm4
  1797. +    test         r1, r1 ; top_left
  1798. +    jz .fix_lt_2
  1799. +    test         r2, r2 ; top_right
  1800. +    jz .fix_tr_1
  1801. +.do_top
  1802. +    PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
  1803. +    jmp .body
  1804. +.fix_lt_2:
  1805. +    movq        mm5, mm3
  1806. +    pxor        mm5, mm2
  1807. +    psllq       mm5, 56
  1808. +    psrlq       mm5, 56
  1809. +    pxor        mm2, mm5
  1810. +    test         r2, r2 ; top_right
  1811. +    jnz .do_top
  1812. +.fix_lt_1:
  1813. +    movq        mm5, mm3
  1814. +    pxor        mm5, mm4
  1815. +    psrlq       mm5, 56
  1816. +    psllq       mm5, 48
  1817. +    pxor        mm1, mm5
  1818. +    jmp .do_left
  1819. +.fix_tr_1:
  1820. +    movq        mm5, mm3
  1821. +    pxor        mm5, mm1
  1822. +    psrlq       mm5, 56
  1823. +    psllq       mm5, 56
  1824. +    pxor        mm1, mm5
  1825. +    jmp .do_top
  1826. +.body
  1827. +    lea         r1, [r0+r3*2]
  1828. +    movq       mm2, mm6
  1829. +    movq       mm4, mm7
  1830. +    movq       mm3, mm6
  1831. +    PALIGNR    mm3, mm4, 7, mm0
  1832. +    movq       mm1, mm6
  1833. +    PALIGNR    mm1, mm4, 6, mm0
  1834. +    movq       mm4, mm3
  1835. +    pavgb      mm3, mm2
  1836. +    lea         r2, [r1+r3*2]
  1837. +    PRED4x4_LOWPASS mm0, mm1, mm2, mm4, mm5
  1838. +    movq [r0+r3*1], mm3
  1839. +    movq [r0+r3*2], mm0
  1840. +    movq       mm5, mm0
  1841. +    movq       mm6, mm3
  1842. +    movq       mm1, mm7
  1843. +    movq       mm2, mm1
  1844. +    psllq      mm2, 8
  1845. +    movq       mm3, mm1
  1846. +    psllq      mm3, 16
  1847. +    lea         r4, [r2+r3*2]
  1848. +    PRED4x4_LOWPASS mm0, mm1, mm3, mm2, mm4
  1849. +
  1850. +    PALIGNR    mm6, mm0, 7, mm2
  1851. +    movq [r1+r3*1], mm6
  1852. +    psllq      mm0, 8
  1853. +    PALIGNR    mm5, mm0, 7, mm1
  1854. +    movq [r1+r3*2], mm5
  1855. +    psllq      mm0, 8
  1856. +
  1857. +    PALIGNR    mm6, mm0, 7, mm2
  1858. +    movq [r2+r3*1], mm6
  1859. +    psllq      mm0, 8
  1860. +    PALIGNR    mm5, mm0, 7, mm1
  1861. +    movq [r2+r3*2], mm5
  1862. +    psllq      mm0, 8
  1863. +
  1864. +    PALIGNR    mm6, mm0, 7, mm2
  1865. +    movq [r4+r3*1], mm6
  1866. +    psllq      mm0, 8
  1867. +    PALIGNR    mm5, mm0, 7, mm1
  1868. +    movq [r4+r3*2], mm5
  1869. +    RET
  1870. +
  1871. +;-----------------------------------------------------------------------------
  1872.  ; void pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  1873.  ;-----------------------------------------------------------------------------
  1874.  
  1875. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  1876. index 984f719..821cb4b 100644
  1877. --- a/libavcodec/x86/h264_intrapred_init.c
  1878. +++ b/libavcodec/x86/h264_intrapred_init.c
  1879. @@ -66,6 +66,7 @@ void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topri
  1880.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  1881.  void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  1882.  void ff_pred8x8l_down_right_sse2   (uint8_t *src, int has_topleft, int has_topright, int stride);
  1883. +void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  1884.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1885.  void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1886.  void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  1887. @@ -111,6 +112,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1888.          h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  1889.          h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  1890.          h->pred8x8l[HOR_UP_PRED  ] = ff_pred8x8l_horizontal_up_mmxext;
  1891. +        h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_mmxext;
  1892.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  1893.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  1894.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  1895. @@ -144,7 +146,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  1896.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  1897.          h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  1898.          h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  1899. -        h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1900. +        //h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  1901.          h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  1902.          h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
  1903.          if (codec_id == CODEC_ID_VP8) {
  1904. --
  1905. 1.7.2.2
  1906.  
  1907.  
  1908. From b9e9a0bc398f2e1495b37125862b9d70f1c46b08 Mon Sep 17 00:00:00 2001
  1909. From: Daniel Kang <daniel.d.kang@gmail.com>
  1910. Date: Mon, 27 Dec 2010 13:36:04 -0500
  1911. Subject: [PATCH 14/15] pred8x8l_down_right_mmxext
  1912.  
  1913. ---
  1914. libavcodec/h264.c                    |    2 +-
  1915.  libavcodec/x86/h264_intrapred.asm    |  137 ++++++++++++++++++++++++++++++++++
  1916.  libavcodec/x86/h264_intrapred_init.c |    4 +-
  1917.  3 files changed, 141 insertions(+), 2 deletions(-)
  1918.  
  1919. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  1920. index 60cd944..e8e140d 100644
  1921. --- a/libavcodec/h264.c
  1922. +++ b/libavcodec/h264.c
  1923. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  1924.  START_TIMER;
  1925.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  1926.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  1927. -if (dir == VERT_RIGHT_PRED) { STOP_TIMER("pred8x8l_vertical_right_mmxext"); }
  1928. +if (dir == DIAG_DOWN_RIGHT_PRED) { STOP_TIMER("pred8x8l_down_right_mmxext"); }
  1929.                                  if(nnz){
  1930.                                      if(nnz == 1 && h->mb[i*16])
  1931.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  1932. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  1933. index 51b8edf..6273627 100644
  1934. --- a/libavcodec/x86/h264_intrapred.asm
  1935. +++ b/libavcodec/x86/h264_intrapred.asm
  1936. @@ -1683,6 +1683,143 @@ INIT_XMM
  1937.      RET
  1938.  
  1939.  ;-----------------------------------------------------------------------------
  1940. +;void pred8x8l_down_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  1941. +;-----------------------------------------------------------------------------
  1942. +
  1943. +INIT_MMX
  1944. +%define PALIGNR PALIGNR_MMX
  1945. +cglobal pred8x8l_down_right_mmxext, 4,5
  1946. +    sub          r0, r3
  1947. +    lea          r4, [r0+r3*2]
  1948. +    movq        mm0, [r0+r3*1-8]
  1949. +    punpckhbw   mm0, [r0+r3*0-8]
  1950. +    movq        mm1, [r4+r3*1-8]
  1951. +    punpckhbw   mm1, [r0+r3*2-8]
  1952. +    mov          r4, r0
  1953. +    punpckhwd   mm1, mm0
  1954. +    lea          r0, [r0+r3*4]
  1955. +    movq        mm2, [r0+r3*1-8]
  1956. +    punpckhbw   mm2, [r0+r3*0-8]
  1957. +    lea          r0, [r0+r3*2]
  1958. +    movq        mm3, [r0+r3*1-8]
  1959. +    punpckhbw   mm3, [r0+r3*0-8]
  1960. +    punpckhwd   mm3, mm2
  1961. +    punpckhdq   mm3, mm1
  1962. +    lea          r0, [r0+r3*2]
  1963. +    movq        mm0, [r0+r3*0-8]
  1964. +    movq        mm1, [r4]
  1965. +    mov          r0, r4
  1966. +    movq        mm4, mm3
  1967. +    movq        mm2, mm3
  1968. +    PALIGNR     mm4, mm0, 7, mm0
  1969. +    PALIGNR     mm1, mm2, 1, mm2
  1970. +    test        r1, r1 ; top_left
  1971. +    jz .fix_lt_1
  1972. +.do_left:
  1973. +    movq        mm0, mm4
  1974. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  1975. +    movq        mm4, mm0
  1976. +    movq        mm7, mm2
  1977. +    movq        mm6, mm2
  1978. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  1979. +    psllq       mm1, 56
  1980. +    PALIGNR     mm7, mm1, 7, mm3
  1981. +    movq        mm0, [r0-8]
  1982. +    movq        mm3, [r0]
  1983. +    movq        mm1, [r0+8]
  1984. +    movq        mm2, mm3
  1985. +    movq        mm4, mm3
  1986. +    PALIGNR     mm2, mm0, 7, mm0
  1987. +    PALIGNR     mm1, mm4, 1, mm4
  1988. +    test         r1, r1 ; top_left
  1989. +    jz .fix_lt_2
  1990. +    test         r2, r2 ; top_right
  1991. +    jz .fix_tr_1
  1992. +.do_top:
  1993. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  1994. +    movq        mm5, mm4
  1995. +    jmp .body
  1996. +.fix_lt_1:
  1997. +    movq        mm5, mm3
  1998. +    pxor        mm5, mm4
  1999. +    psrlq       mm5, 56
  2000. +    psllq       mm5, 48
  2001. +    pxor        mm1, mm5
  2002. +    jmp .do_left
  2003. +.fix_lt_2:
  2004. +    movq        mm5, mm3
  2005. +    pxor        mm5, mm2
  2006. +    psllq       mm5, 56
  2007. +    psrlq       mm5, 56
  2008. +    pxor        mm2, mm5
  2009. +    test         r2, r2 ; top_right
  2010. +    jnz .do_top
  2011. +.fix_tr_1:
  2012. +    movq        mm5, mm3
  2013. +    pxor        mm5, mm1
  2014. +    psrlq       mm5, 56
  2015. +    psllq       mm5, 56
  2016. +    pxor        mm1, mm5
  2017. +    jmp .do_top
  2018. +.body
  2019. +    lea         r1, [r0+r3*2]
  2020. +    movq       mm1, mm7
  2021. +    movq       mm7, mm5
  2022. +    movq       mm5, mm6
  2023. +    movq       mm2, mm7
  2024. +    lea         r2, [r1+r3*2]
  2025. +    PALIGNR    mm2, mm6, 1, mm0
  2026. +    movq       mm3, mm7
  2027. +    PALIGNR    mm3, mm6, 7, mm0
  2028. +    movq       mm4, mm7
  2029. +    lea         r4, [r2+r3*2]
  2030. +    psrlq      mm4, 8
  2031. +    PRED4x4_LOWPASS mm0, mm1, mm2, mm5, mm6
  2032. +    PRED4x4_LOWPASS mm1, mm3, mm4, mm7, mm6
  2033. +    movq [r4+r3*2], mm0
  2034. +    movq       mm2, mm1
  2035. +    psrlq      mm0, 8
  2036. +    psllq      mm2, 56
  2037. +    psrlq      mm1, 8
  2038. +    por        mm0, mm2
  2039. +    movq [r4+r3*1], mm0
  2040. +    movq       mm2, mm1
  2041. +    psrlq      mm0, 8
  2042. +    psllq      mm2, 56
  2043. +    psrlq      mm1, 8
  2044. +    por        mm0, mm2
  2045. +    movq [r2+r3*2], mm0
  2046. +    movq       mm2, mm1
  2047. +    psrlq      mm0, 8
  2048. +    psllq      mm2, 56
  2049. +    psrlq      mm1, 8
  2050. +    por        mm0, mm2
  2051. +    movq [r2+r3*1], mm0
  2052. +    movq       mm2, mm1
  2053. +    psrlq      mm0, 8
  2054. +    psllq      mm2, 56
  2055. +    psrlq      mm1, 8
  2056. +    por        mm0, mm2
  2057. +    movq [r1+r3*2], mm0
  2058. +    movq       mm2, mm1
  2059. +    psrlq      mm0, 8
  2060. +    psllq      mm2, 56
  2061. +    psrlq      mm1, 8
  2062. +    por        mm0, mm2
  2063. +    movq [r1+r3*1], mm0
  2064. +    movq       mm2, mm1
  2065. +    psrlq      mm0, 8
  2066. +    psllq      mm2, 56
  2067. +    psrlq      mm1, 8
  2068. +    por        mm0, mm2
  2069. +    movq [r0+r3*2], mm0
  2070. +    psrlq      mm0, 8
  2071. +    psllq      mm1, 56
  2072. +    por        mm0, mm1
  2073. +    movq [r0+r3*1], mm0
  2074. +    RET
  2075. +
  2076. +;-----------------------------------------------------------------------------
  2077.  ; void pred8x8l_down_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  2078.  ;-----------------------------------------------------------------------------
  2079.  
  2080. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  2081. index 821cb4b..6c6cf30 100644
  2082. --- a/libavcodec/x86/h264_intrapred_init.c
  2083. +++ b/libavcodec/x86/h264_intrapred_init.c
  2084. @@ -66,6 +66,7 @@ void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topri
  2085.  void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  2086.  void ff_pred8x8l_down_left_sse2  (uint8_t *src, int has_topleft, int has_topright, int stride);
  2087.  void ff_pred8x8l_down_right_sse2   (uint8_t *src, int has_topleft, int has_topright, int stride);
  2088. +void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
  2089.  void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  2090.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  2091.  void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  2092. @@ -113,6 +114,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  2093.          h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  2094.          h->pred8x8l[HOR_UP_PRED  ] = ff_pred8x8l_horizontal_up_mmxext;
  2095.          h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_mmxext;
  2096. +        h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_mmxext;
  2097.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  2098.          if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
  2099.              h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
  2100. @@ -145,7 +147,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  2101.      if (mm_flags & AV_CPU_FLAG_SSE2) {
  2102.          h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
  2103.          h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
  2104. -        h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  2105. +        //h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  2106.          //h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  2107.          h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  2108.          h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
  2109. --
  2110. 1.7.2.2
  2111.  
  2112.  
  2113. From e3cb94f4dbb429a19abb4b581b5a0f48109dff14 Mon Sep 17 00:00:00 2001
  2114. From: Daniel Kang <daniel.d.kang@gmail.com>
  2115. Date: Mon, 27 Dec 2010 15:10:45 -0500
  2116. Subject: [PATCH 15/15] pred8x8l_horizontal_down_mmxext
  2117.  
  2118. ---
  2119. libavcodec/h264.c                    |    2 +-
  2120.  libavcodec/x86/h264_intrapred.asm    |  124 ++++++++++++++++++++++++++++++++++
  2121.  libavcodec/x86/h264_intrapred_init.c |    4 +-
  2122.  3 files changed, 128 insertions(+), 2 deletions(-)
  2123.  
  2124. diff --git a/libavcodec/h264.c b/libavcodec/h264.c
  2125. index e8e140d..94ae2b1 100644
  2126. --- a/libavcodec/h264.c
  2127. +++ b/libavcodec/h264.c
  2128. @@ -1193,7 +1193,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
  2129.  START_TIMER;
  2130.                                  h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
  2131.                                                              (h->topright_samples_available<<i)&0x4000, linesize);
  2132. -if (dir == DIAG_DOWN_RIGHT_PRED) { STOP_TIMER("pred8x8l_down_right_mmxext"); }
  2133. +if (dir == HOR_DOWN_PRED) { STOP_TIMER("pred8x8l_horizontal_down_mmxext"); }
  2134.                                  if(nnz){
  2135.                                      if(nnz == 1 && h->mb[i*16])
  2136.                                          idct_dc_add(ptr, h->mb + i*16, linesize);
  2137. diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
  2138. index 6273627..f638255 100644
  2139. --- a/libavcodec/x86/h264_intrapred.asm
  2140. +++ b/libavcodec/x86/h264_intrapred.asm
  2141. @@ -1142,6 +1142,130 @@ cglobal pred8x8l_horizontal_mmxext, 4,4
  2142.      RET
  2143.  
  2144.  ;-----------------------------------------------------------------------------
  2145. +;void pred8x8l_horizontal_down_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
  2146. +;-----------------------------------------------------------------------------
  2147. +
  2148. +INIT_MMX
  2149. +%define PALIGNR PALIGNR_MMX
  2150. +cglobal pred8x8l_horizontal_down_mmxext, 4,5
  2151. +    sub          r0, r3
  2152. +    lea          r4, [r0+r3*2]
  2153. +    movq        mm0, [r0+r3*1-8]
  2154. +    punpckhbw   mm0, [r0+r3*0-8]
  2155. +    movq        mm1, [r4+r3*1-8]
  2156. +    punpckhbw   mm1, [r0+r3*2-8]
  2157. +    mov          r4, r0
  2158. +    punpckhwd   mm1, mm0
  2159. +    lea          r0, [r0+r3*4]
  2160. +    movq        mm2, [r0+r3*1-8]
  2161. +    punpckhbw   mm2, [r0+r3*0-8]
  2162. +    lea          r0, [r0+r3*2]
  2163. +    movq        mm3, [r0+r3*1-8]
  2164. +    punpckhbw   mm3, [r0+r3*0-8]
  2165. +    punpckhwd   mm3, mm2
  2166. +    punpckhdq   mm3, mm1
  2167. +    lea          r0, [r0+r3*2]
  2168. +    movq        mm0, [r0+r3*0-8]
  2169. +    movq        mm1, [r4]
  2170. +    mov          r0, r4
  2171. +    movq        mm4, mm3
  2172. +    movq        mm2, mm3
  2173. +    PALIGNR     mm4, mm0, 7, mm0
  2174. +    PALIGNR     mm1, mm2, 1, mm2
  2175. +    test        r1, r1 ; top_left
  2176. +    jz .fix_lt_1
  2177. +.do_left:
  2178. +    movq        mm0, mm4
  2179. +    PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
  2180. +    movq        mm4, mm0
  2181. +    movq        mm7, mm2
  2182. +    movq        mm6, mm2
  2183. +    PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
  2184. +    psllq       mm1, 56
  2185. +    PALIGNR     mm7, mm1, 7, mm3
  2186. +    movq        mm0, [r0-8]
  2187. +    movq        mm3, [r0]
  2188. +    movq        mm1, [r0+8]
  2189. +    movq        mm2, mm3
  2190. +    movq        mm4, mm3
  2191. +    PALIGNR     mm2, mm0, 7, mm0
  2192. +    PALIGNR     mm1, mm4, 1, mm4
  2193. +    test         r1, r1 ; top_left
  2194. +    jz .fix_lt_2
  2195. +    test         r2, r2 ; top_right
  2196. +    jz .fix_tr_1
  2197. +.do_top:
  2198. +    PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
  2199. +    movq        mm5, mm4
  2200. +    jmp .body
  2201. +.fix_lt_1:
  2202. +    movq        mm5, mm3
  2203. +    pxor        mm5, mm4
  2204. +    psrlq       mm5, 56
  2205. +    psllq       mm5, 48
  2206. +    pxor        mm1, mm5
  2207. +    jmp .do_left
  2208. +.fix_lt_2:
  2209. +    movq        mm5, mm3
  2210. +    pxor        mm5, mm2
  2211. +    psllq       mm5, 56
  2212. +    psrlq       mm5, 56
  2213. +    pxor        mm2, mm5
  2214. +    test         r2, r2 ; top_right
  2215. +    jnz .do_top
  2216. +.fix_tr_1:
  2217. +    movq        mm5, mm3
  2218. +    pxor        mm5, mm1
  2219. +    psrlq       mm5, 56
  2220. +    psllq       mm5, 56
  2221. +    pxor        mm1, mm5
  2222. +    jmp .do_top
  2223. +.body
  2224. +    lea         r1, [r0+r3*2]
  2225. +    movq       mm0, mm7
  2226. +    psllq      mm0, 56
  2227. +    movq       mm1, mm6
  2228. +    movq       mm2, mm5
  2229. +    movq       mm3, mm1
  2230. +    movq       mm4, mm2
  2231. +    PALIGNR    mm2, mm1, 7, mm5
  2232. +    PALIGNR    mm1, mm0, 7, mm6
  2233. +    lea         r2, [r1+r3*2]
  2234. +    PALIGNR    mm4, mm3, 1, mm7
  2235. +    movq       mm5, mm3
  2236. +    pavgb      mm3, mm1
  2237. +    PRED4x4_LOWPASS mm0, mm4, mm1, mm5, mm7
  2238. +    movq       mm4, mm2
  2239. +    movq       mm1, mm2
  2240. +    lea         r4, [r2+r3*2]
  2241. +    psrlq      mm4, 16
  2242. +    psrlq      mm1, 8
  2243. +    PRED4x4_LOWPASS mm6, mm4, mm2, mm1, mm5
  2244. +    movq       mm7, mm3
  2245. +    punpcklbw  mm3, mm0
  2246. +    punpckhbw  mm7, mm0
  2247. +    movq       mm1, mm7
  2248. +    movq       mm0, mm7
  2249. +    movq       mm4, mm7
  2250. +    movq [r4+r3*2], mm3
  2251. +    PALIGNR    mm7, mm3, 2, mm5
  2252. +    movq [r4+r3*1], mm7
  2253. +    PALIGNR    mm1, mm3, 4, mm5
  2254. +    movq [r2+r3*2], mm1
  2255. +    PALIGNR    mm0, mm3, 6, mm3
  2256. +    movq [r2+r3*1], mm0
  2257. +    movq       mm2, mm6
  2258. +    movq       mm3, mm6
  2259. +    movq [r1+r3*2], mm4
  2260. +    PALIGNR    mm6, mm4, 2, mm5
  2261. +    movq [r1+r3*1], mm6
  2262. +    PALIGNR    mm2, mm4, 4, mm5
  2263. +    movq [r0+r3*2], mm2
  2264. +    PALIGNR    mm3, mm4, 6, mm4
  2265. +    movq [r0+r3*1], mm3
  2266. +    RET
  2267. +
  2268. +;-----------------------------------------------------------------------------
  2269.  ;void pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride)
  2270.  ;-----------------------------------------------------------------------------
  2271.  
  2272. diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
  2273. index 6c6cf30..cafe7a2 100644
  2274. --- a/libavcodec/x86/h264_intrapred_init.c
  2275. +++ b/libavcodec/x86/h264_intrapred_init.c
  2276. @@ -70,6 +70,7 @@ void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topri
  2277.  void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  2278.  void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  2279.  void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  2280. +void ff_pred8x8l_horizontal_down_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
  2281.  void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
  2282.  void ff_pred4x4_dc_mmxext          (uint8_t *src, const uint8_t *topright, int stride);
  2283.  void ff_pred4x4_down_left_mmxext   (uint8_t *src, const uint8_t *topright, int stride);
  2284. @@ -113,6 +114,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  2285.          h->pred8x8l[VERT_PRED    ] = ff_pred8x8l_vertical_mmxext;
  2286.          h->pred8x8l[HOR_PRED     ] = ff_pred8x8l_horizontal_mmxext;
  2287.          h->pred8x8l[HOR_UP_PRED  ] = ff_pred8x8l_horizontal_up_mmxext;
  2288. +        h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_mmxext;
  2289.          h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_mmxext;
  2290.          h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_mmxext;
  2291.          h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
  2292. @@ -150,7 +152,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
  2293.          //h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
  2294.          //h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
  2295.          h->pred8x8l[VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
  2296. -        h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
  2297. +        //h->pred8x8l[HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
  2298.          if (codec_id == CODEC_ID_VP8) {
  2299.              h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
  2300.              h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
  2301. --
  2302. 1.7.2.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement