Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 28.12 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 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement