Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 34.42 KB | None | 0 0
  1. From a297b5b7822411e79caec98cfc7ea34de6c4162b Mon Sep 17 00:00:00 2001
  2. From: Daniel Kang <daniel.d.kang@gmail.com>
  3. Date: Tue, 24 May 2011 15:14:38 -0400
  4. Subject: [PATCH 1/2] Add IDCT functions for 10-bit H.264.
  5.  
  6. Ports the majority of IDCT functions for 10-bit H.264.
  7.  
  8. Some code was ported from x264.
  9. ---
  10. libavcodec/x86/Makefile            |    3 +-
  11.  libavcodec/x86/h264_idct_10bit.asm |  484 ++++++++++++++++++++++++++++++++++++
  12.  libavcodec/x86/h264dsp_mmx.c       |   59 +++++
  13.  3 files changed, 545 insertions(+), 1 deletions(-)
  14.  create mode 100644 libavcodec/x86/h264_idct_10bit.asm
  15.  
  16. diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
  17. index ba664ab..38b736e 100644
  18. --- a/libavcodec/x86/Makefile
  19. +++ b/libavcodec/x86/Makefile
  20. @@ -12,8 +12,9 @@ YASM-OBJS-$(CONFIG_FFT)                += x86/fft_mmx.o                 \
  21.  MMX-OBJS-$(CONFIG_H264DSP)             += x86/h264dsp_mmx.o
  22.  YASM-OBJS-$(CONFIG_H264DSP)            += x86/h264_deblock.o            \
  23.                                            x86/h264_deblock_10bit.o      \
  24. -                                          x86/h264_weight.o             \
  25.                                            x86/h264_idct.o               \
  26. +                                          x86/h264_idct_10bit.o         \
  27. +                                          x86/h264_weight.o             \
  28.  
  29.  YASM-OBJS-$(CONFIG_H264PRED)           += x86/h264_intrapred.o
  30.  MMX-OBJS-$(CONFIG_H264PRED)            += x86/h264_intrapred_init.o
  31. diff --git a/libavcodec/x86/h264_idct_10bit.asm b/libavcodec/x86/h264_idct_10bit.asm
  32. new file mode 100644
  33. index 0000000..c526869
  34. --- /dev/null
  35. +++ b/libavcodec/x86/h264_idct_10bit.asm
  36. @@ -0,0 +1,484 @@
  37. +;*****************************************************************************
  38. +;* MMX/SSE2/AVX-optimized 10-bit H.264 iDCT code
  39. +;*****************************************************************************
  40. +;* Copyright (C) 2005-2011 x264 project
  41. +;*
  42. +;* Authors: Daniel Kang <daniel.d.kang@gmail.com>
  43. +;*
  44. +;* This file is part of Libav.
  45. +;*
  46. +;* Libav is free software; you can redistribute it and/or
  47. +;* modify it under the terms of the GNU Lesser General Public
  48. +;* License as published by the Free Software Foundation; either
  49. +;* version 2.1 of the License, or (at your option) any later version.
  50. +;*
  51. +;* Libav is distributed in the hope that it will be useful,
  52. +;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  53. +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  54. +;* Lesser General Public License for more details.
  55. +;*
  56. +;* You should have received a copy of the GNU Lesser General Public
  57. +;* License along with Libav; if not, write to the Free Software
  58. +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  59. +;******************************************************************************
  60. +
  61. +%include "x86inc.asm"
  62. +%include "x86util.asm"
  63. +
  64. +SECTION_RODATA
  65. +
  66. +pw_pixel_max: times 8 dw ((1 << 10)-1)
  67. +pd_32:        times 4 dd 32
  68. +scan8_mem: db 4+1*8, 5+1*8, 4+2*8, 5+2*8
  69. +           db 6+1*8, 7+1*8, 6+2*8, 7+2*8
  70. +           db 4+3*8, 5+3*8, 4+4*8, 5+4*8
  71. +           db 6+3*8, 7+3*8, 6+4*8, 7+4*8
  72. +           db 1+1*8, 2+1*8
  73. +           db 1+2*8, 2+2*8
  74. +           db 1+4*8, 2+4*8
  75. +           db 1+5*8, 2+5*8
  76. +
  77. +%ifdef PIC
  78. +%define scan8 r11
  79. +%else
  80. +%define scan8 scan8_mem
  81. +%endif
  82. +
  83. +SECTION .text
  84. +
  85. +;-----------------------------------------------------------------------------
  86. +; void h264_idct_add(pixel *dst, dctcoef *block, int stride)
  87. +;-----------------------------------------------------------------------------
  88. +%macro STORE_DIFFx2 6
  89. +    psrad       %1, 6
  90. +    psrad       %2, 6
  91. +    packssdw    %1, %2
  92. +    movq        %3, [%5]
  93. +    movhps      %3, [%5+%6]
  94. +    paddsw      %1, %3
  95. +    CLIPW       %1, %4, [pw_pixel_max]
  96. +    movq      [%5], %1
  97. +    movhps [%5+%6], %1
  98. +%endmacro
  99. +
  100. +;dst, in, stride
  101. +%macro IDCT4_ADD_10 3
  102. +    mova  m0, [%2+ 0]
  103. +    mova  m1, [%2+16]
  104. +    mova  m2, [%2+32]
  105. +    mova  m3, [%2+48]
  106. +    IDCT4_1D d,0,1,2,3,4,5
  107. +    TRANSPOSE4x4D 0,1,2,3,4
  108. +    paddd m0, [pd_32]
  109. +    IDCT4_1D d,0,1,2,3,4,5
  110. +    pxor  m5, m5
  111. +    STORE_DIFFx2 m0, m1, m4, m5, %1, %3
  112. +    lea   %1, [%1+%3*2]
  113. +    STORE_DIFFx2 m2, m3, m4, m5, %1, %3
  114. +%endmacro
  115. +
  116. +%macro IDCT_ADD_10 1
  117. +cglobal h264_idct_add_10_%1, 3,3
  118. +    IDCT4_ADD_10 r0, r1, r2
  119. +    RET
  120. +%endmacro
  121. +
  122. +INIT_XMM
  123. +IDCT_ADD_10 sse2
  124. +%ifdef HAVE_AVX
  125. +INIT_AVX
  126. +IDCT_ADD_10 avx
  127. +%endif
  128. +
  129. +;-----------------------------------------------------------------------------
  130. +; h264_idct_add16(pixel *dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
  131. +;-----------------------------------------------------------------------------
  132. +;;;;;;; NO FATE SAMPLES TRIGGER THIS
  133. +%macro ADD4x4IDCT 1
  134. +add4x4_idct_%1:
  135. +    mova  m0, [r2+ 0]
  136. +    mova  m1, [r2+16]
  137. +    mova  m2, [r2+32]
  138. +    mova  m3, [r2+48]
  139. +    IDCT4_1D d,0,1,2,3,4,5
  140. +    TRANSPOSE4x4D 0,1,2,3,4
  141. +    paddd m0, [pd_32]
  142. +    IDCT4_1D d,0,1,2,3,4,5
  143. +    pxor  m5, m5
  144. +    STORE_DIFFx2 m0, m1, m4, m5, r5, r3
  145. +    lea   r5, [r5+r3*2]
  146. +    STORE_DIFFx2 m2, m3, m4, m5, r5, r3
  147. +    ret
  148. +%endmacro
  149. +
  150. +INIT_XMM
  151. +ALIGN 16
  152. +ADD4x4IDCT sse2
  153. +%ifdef HAVE_AVX
  154. +INIT_AVX
  155. +ALIGN 16
  156. +ADD4x4IDCT avx
  157. +%endif
  158. +
  159. +%macro ADD16_OP 3
  160. +    cmp          byte [r4+%3], 0
  161. +    jz .skipblock%2
  162. +    mov         r5d, dword [r1+%2*4]
  163. +    add          r5, r0
  164. +    call add4x4_idct_%1
  165. +.skipblock%2:
  166. +%if %2<15
  167. +    add          r2, 64
  168. +%endif
  169. +%endmacro
  170. +
  171. +%macro IDCT_ADD16_10 1
  172. +cglobal h264_idct_add16_10_%1, 5,6
  173. +    ADD16_OP %1, 0, 4+1*8
  174. +    ADD16_OP %1, 1, 5+1*8
  175. +    ADD16_OP %1, 2, 4+2*8
  176. +    ADD16_OP %1, 3, 5+2*8
  177. +    ADD16_OP %1, 4, 6+1*8
  178. +    ADD16_OP %1, 5, 7+1*8
  179. +    ADD16_OP %1, 6, 6+2*8
  180. +    ADD16_OP %1, 7, 7+2*8
  181. +    ADD16_OP %1, 8, 4+3*8
  182. +    ADD16_OP %1, 9, 5+3*8
  183. +    ADD16_OP %1, 10, 4+4*8
  184. +    ADD16_OP %1, 11, 5+4*8
  185. +    ADD16_OP %1, 12, 6+3*8
  186. +    ADD16_OP %1, 13, 7+3*8
  187. +    ADD16_OP %1, 14, 6+4*8
  188. +    ADD16_OP %1, 15, 7+4*8
  189. +    RET
  190. +%endmacro
  191. +
  192. +INIT_XMM
  193. +IDCT_ADD16_10 sse2
  194. +%ifdef HAVE_AVX
  195. +INIT_AVX
  196. +IDCT_ADD16_10 avx
  197. +%endif
  198. +
  199. +;-----------------------------------------------------------------------------
  200. +; h264_idct_add16intra(pixel *dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
  201. +;-----------------------------------------------------------------------------
  202. +%macro ADD16_OP_INTRA 3
  203. +    movzx        r5, byte [r4+%3]
  204. +    or          r5d, dword [r2]
  205. +    test         r5, r5
  206. +    jz .skipblock%2
  207. +    mov         r5d, dword [r1+%2*4]
  208. +    add          r5, r0
  209. +    call add4x4_idct_%1
  210. +.skipblock%2:
  211. +%if %2<15
  212. +    add          r2, 64
  213. +%endif
  214. +%endmacro
  215. +
  216. +%macro IDCT_ADD16INTRA_10 1
  217. +cglobal h264_idct_add16intra_10_%1,5,6
  218. +    ADD16_OP_INTRA %1, 0, 4+1*8
  219. +    ADD16_OP_INTRA %1, 1, 5+1*8
  220. +    ADD16_OP_INTRA %1, 2, 4+2*8
  221. +    ADD16_OP_INTRA %1, 3, 5+2*8
  222. +    ADD16_OP_INTRA %1, 4, 6+1*8
  223. +    ADD16_OP_INTRA %1, 5, 7+1*8
  224. +    ADD16_OP_INTRA %1, 6, 6+2*8
  225. +    ADD16_OP_INTRA %1, 7, 7+2*8
  226. +    ADD16_OP_INTRA %1, 8, 4+3*8
  227. +    ADD16_OP_INTRA %1, 9, 5+3*8
  228. +    ADD16_OP_INTRA %1, 10, 4+4*8
  229. +    ADD16_OP_INTRA %1, 11, 5+4*8
  230. +    ADD16_OP_INTRA %1, 12, 6+3*8
  231. +    ADD16_OP_INTRA %1, 13, 7+3*8
  232. +    ADD16_OP_INTRA %1, 14, 6+4*8
  233. +    ADD16_OP_INTRA %1, 15, 7+4*8
  234. +    RET
  235. +%endmacro
  236. +
  237. +INIT_XMM
  238. +IDCT_ADD16INTRA_10 sse2
  239. +%ifdef HAVE_AVX
  240. +INIT_AVX
  241. +IDCT_ADD16INTRA_10 avx
  242. +%endif
  243. +
  244. +;-----------------------------------------------------------------------------
  245. +; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
  246. +;-----------------------------------------------------------------------------
  247. +%macro IDCT_ADD8 1
  248. +cglobal h264_idct_add8_10_%1,5,7
  249. +    mov          r5, 16
  250. +    add          r2, 1024
  251. +%ifdef PIC
  252. +    lea         r11, [scan8_mem]
  253. +%endif
  254. +%ifdef ARCH_X86_64
  255. +    mov         r10, r0
  256. +%endif
  257. +    call         h264_idct_add8_10_plane_%1
  258. +%ifdef ARCH_X86_64
  259. +    add         r10, gprsize
  260. +%else
  261. +    add        r0mp, gprsize
  262. +%endif
  263. +%ifndef UNIX64
  264. +    call         h264_idct_add8_10_plane_%1
  265. +    RET
  266. +%endif
  267. +
  268. +h264_idct_add8_10_plane_%1:
  269. +.nextblock:
  270. +    movzx        r6, byte [scan8+r5]
  271. +    movzx        r6, byte [r4+r6]
  272. +    or          r6d, dword [r2]
  273. +    test         r6, r6
  274. +    jz .skipblock
  275. +%ifdef ARCH_X86_64
  276. +    mov         r0d, dword [r1+r5*4]
  277. +    add          r0, [r10]
  278. +%else
  279. +    mov          r0, r1m ; XXX r1m here is actually r0m of the calling func
  280. +    mov          r0, [r0]
  281. +    add          r0, dword [r1+r5*4]
  282. +%endif
  283. +    IDCT4_ADD_10 r0, r2, r3
  284. +.skipblock:
  285. +    inc          r5
  286. +    add          r2, 64
  287. +    test         r5, 3
  288. +    jnz .nextblock
  289. +    rep ret
  290. +%endmacro ; IDCT_ADD8
  291. +
  292. +INIT_XMM
  293. +IDCT_ADD8 sse2
  294. +%ifdef HAVE_AVX
  295. +INIT_AVX
  296. +IDCT_ADD8 avx
  297. +%endif
  298. +
  299. +;-----------------------------------------------------------------------------
  300. +; void h264_idct_dc_add(pixel *dst, dctcoef *block, int stride)
  301. +;-----------------------------------------------------------------------------
  302. +%macro IDCT_DC_ADD_OP_10 0
  303. +    mova      m1, [r0+ 0]
  304. +    mova      m2, [r0+r2]
  305. +    mova      m3, [r1+ 0]
  306. +    mova      m4, [r1+r2]
  307. +    pxor      m5, m5
  308. +    paddw     m1, m0
  309. +    paddw     m2, m0
  310. +    paddw     m3, m0
  311. +    paddw     m4, m0
  312. +    CLIPW     m1, m5, m6
  313. +    CLIPW     m2, m5, m6
  314. +    CLIPW     m3, m5, m6
  315. +    CLIPW     m4, m5, m6
  316. +    mova [r0+ 0], m1
  317. +    mova [r0+r2], m2
  318. +    mova [r1+ 0], m3
  319. +    mova [r1+r2], m4
  320. +%endmacro
  321. +
  322. +INIT_MMX
  323. +cglobal h264_idct_dc_add_10_mmx2,3,3
  324. +    movd      m0, dword [r1]
  325. +    paddd     m0, [pd_32]
  326. +    psrad     m0, 6
  327. +    lea       r1, [r0+r2*2]
  328. +    pshufw    m0, m0, 0
  329. +    mova      m6, [pw_pixel_max]
  330. +    IDCT_DC_ADD_OP_10
  331. +    RET
  332. +
  333. +;-----------------------------------------------------------------------------
  334. +; void h264_idct8_dc_add(pixel *dst, dctcoef *block, int stride)
  335. +;-----------------------------------------------------------------------------
  336. +%macro IDCT8_DC_ADD 1
  337. +cglobal h264_idct8_dc_add_10_%1,3,3,7
  338. +    mov      r1d, dword [r1]
  339. +    add       r1, 32
  340. +    sar       r1, 6
  341. +    movd      m0, r1d
  342. +    lea       r1, [r0+r2*2]
  343. +    SPLATW    m0, m0, 0
  344. +    mova      m6, [pw_pixel_max]
  345. +    IDCT_DC_ADD_OP_10
  346. +    lea       r0, [r0+r2*4]
  347. +    lea       r1, [r0+r2*2]
  348. +    IDCT_DC_ADD_OP_10
  349. +    RET
  350. +%endmacro
  351. +
  352. +INIT_XMM
  353. +IDCT8_DC_ADD sse2
  354. +%ifdef HAVE_AVX
  355. +INIT_AVX
  356. +IDCT8_DC_ADD avx
  357. +%endif
  358. +
  359. +;-----------------------------------------------------------------------------
  360. +; void h264_idct8_add(pixel *dst, dctcoef *block, int stride)
  361. +;-----------------------------------------------------------------------------
  362. +%macro IDCT8_1D 2
  363. +    SWAP         0, 1
  364. +    psrad        m4, m5, 1
  365. +    psrad        m1, m0, 1
  366. +    paddd        m4, m5
  367. +    paddd        m1, m0
  368. +    paddd        m4, m7
  369. +    paddd        m1, m5
  370. +    psubd        m4, m0
  371. +    paddd        m1, m3
  372. +
  373. +    psubd        m0, m3
  374. +    psubd        m5, m3
  375. +    paddd        m0, m7
  376. +    psubd        m5, m7
  377. +    psrad        m3, 1
  378. +    psrad        m7, 1
  379. +    psubd        m0, m3
  380. +    psubd        m5, m7
  381. +
  382. +    SWAP         1, 7
  383. +    psrad        m1, m7, 2
  384. +    psrad        m3, m4, 2
  385. +    paddd        m3, m0
  386. +    psrad        m0, 2
  387. +    paddd        m1, m5
  388. +    psrad        m5, 2
  389. +    psubd        m0, m4
  390. +    psubd        m7, m5
  391. +
  392. +    SWAP         5, 6
  393. +    psrad        m4, m2, 1
  394. +    psrad        m6, m5, 1
  395. +    psubd        m4, m5
  396. +    paddd        m6, m2
  397. +
  398. +    mova         m2, %1
  399. +    mova         m5, %2
  400. +    SUMSUB_BA    d, 5, 2
  401. +    SUMSUB_BA    d, 6, 5
  402. +    SUMSUB_BA    d, 4, 2
  403. +    SUMSUB_BA    d, 7, 6
  404. +    SUMSUB_BA    d, 0, 4
  405. +    SUMSUB_BA    d, 3, 2
  406. +    SUMSUB_BA    d, 1, 5
  407. +    SWAP         7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567
  408. +%endmacro
  409. +
  410. +%macro IDCT8_1D_FULL 1
  411. +    mova         m7, [%1+112*2]
  412. +    mova         m6, [%1+ 96*2]
  413. +    mova         m5, [%1+ 80*2]
  414. +    mova         m3, [%1+ 48*2]
  415. +    mova         m2, [%1+ 32*2]
  416. +    mova         m1, [%1+ 16*2]
  417. +    IDCT8_1D   [%1], [%1+ 64*2]
  418. +%endmacro
  419. +
  420. +; %1=int16_t *block, %2=int16_t *dstblock
  421. +%macro IDCT8_ADD_SSE_START 2
  422. +    IDCT8_1D_FULL %1
  423. +    mova         [%1], m7
  424. +    TRANSPOSE4x4D   0,1,2,3,7
  425. +    mova           m7, [%1]
  426. +    mova    [%2     ], m0
  427. +    mova    [%2+16*2], m1
  428. +    mova    [%2+32*2], m2
  429. +    mova    [%2+48*2], m3
  430. +    TRANSPOSE4x4D   4,5,6,7,3
  431. +    mova    [%2+ 8*2], m4
  432. +    mova    [%2+24*2], m5
  433. +    mova    [%2+40*2], m6
  434. +    mova    [%2+56*2], m7
  435. +%endmacro
  436. +
  437. +; %1=uint8_t *dst, %2=int16_t *block, %3=int stride
  438. +%macro IDCT8_ADD_SSE_END 3
  439. +    IDCT8_1D_FULL %2
  440. +    mova    [%2     ], m5
  441. +    mova    [%2+16*2], m6
  442. +    mova    [%2+32*2], m7
  443. +
  444. +    pxor         m7, m7
  445. +    STORE_DIFFx2 m0, m1, m5, m7, %1, %3
  446. +    lea          %1, [%1+%3*2]
  447. +    STORE_DIFFx2 m2, m3, m5, m7, %1, %3
  448. +    mova         m0, [%2     ]
  449. +    mova         m1, [%2+16*2]
  450. +    mova         m2, [%2+32*2]
  451. +    lea          %1, [%1+%3*2]
  452. +    STORE_DIFFx2 m4, m0, m5, m7, %1, %3
  453. +    lea          %1, [%1+%3*2]
  454. +    STORE_DIFFx2 m1, m2, m5, m7, %1, %3
  455. +%endmacro
  456. +
  457. +%macro IDCT8_ADD 1
  458. +cglobal h264_idct8_add_10_%1, 3,4,8
  459. +    %assign pad 256+16-gprsize-(stack_offset&15)
  460. +    SUB         rsp, pad
  461. +
  462. +    add   dword [r1], 32
  463. +    IDCT8_ADD_SSE_START r1   , rsp
  464. +    IDCT8_ADD_SSE_START r1+16, rsp+128
  465. +    lea          r3, [r0+8]
  466. +    IDCT8_ADD_SSE_END   r0  , rsp,    r2
  467. +    IDCT8_ADD_SSE_END   r3  , rsp+16, r2
  468. +
  469. +    ADD         rsp, pad
  470. +    RET
  471. +%endmacro
  472. +
  473. +INIT_XMM
  474. +IDCT8_ADD sse2
  475. +%ifdef HAVE_AVX
  476. +INIT_AVX
  477. +IDCT8_ADD avx
  478. +%endif
  479. +
  480. +;-----------------------------------------------------------------------------
  481. +; h264_idct8_add4(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
  482. +;-----------------------------------------------------------------------------
  483. +;;;;;;; NO FATE SAMPLES TRIGGER THIS
  484. +%macro IDCT8_ADD4 1
  485. +cglobal h264_idct8_add4_10_%1, 5,7,8
  486. +    %assign pad 256+16-gprsize-(stack_offset&15)
  487. +    SUB         rsp, pad
  488. +    xor          r5, r5
  489. +%ifdef PIC
  490. +    lea         r11, [scan8_mem]
  491. +%endif
  492. +.nextblock:
  493. +    movzx        r6, byte [scan8+r5]
  494. +    movzx        r6, byte [r4+r6]
  495. +    test         r6, r6
  496. +    jz .skipblock
  497. +    mov         r6d, dword [r1+r5*4]
  498. +    lea          r6, [r0+r6]
  499. +    add  dword [r2], 32
  500. +    IDCT8_ADD_SSE_START r2   , rsp
  501. +    IDCT8_ADD_SSE_START r2+16, rsp+128
  502. +    IDCT8_ADD_SSE_END   r6   , rsp,    r3
  503. +    mov         r6d, dword [r1+r5*4]
  504. +    lea          r6, [r0+r6+8]
  505. +    IDCT8_ADD_SSE_END   r6  , rsp+16,  r3
  506. +.skipblock:
  507. +    add          r5, 4
  508. +    add          r2, 256
  509. +    cmp          r5, 16
  510. +    jl .nextblock
  511. +    ADD         rsp, pad
  512. +    RET
  513. +%endmacro ; IDCT8_ADD4
  514. +
  515. +INIT_XMM
  516. +IDCT8_ADD4 sse2
  517. +%ifdef HAVE_AVX
  518. +INIT_AVX
  519. +IDCT8_ADD4 avx
  520. +%endif
  521. diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c
  522. index 1c07d14..d60fbd5 100644
  523. --- a/libavcodec/x86/h264dsp_mmx.c
  524. +++ b/libavcodec/x86/h264dsp_mmx.c
  525. @@ -27,6 +27,43 @@ DECLARE_ALIGNED(8, static const uint64_t, ff_pb_3_1  ) = 0x0103010301030103ULL;
  526.  
  527.  /***********************************/
  528.  /* IDCT */
  529. +#define IDCT_ADD_FUNC(NUM, DEPTH, OPT) \
  530. +void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT (uint8_t *dst, int16_t *block, int stride);
  531. +
  532. +IDCT_ADD_FUNC(, 10, sse2)
  533. +IDCT_ADD_FUNC(_dc, 10, mmx2)
  534. +IDCT_ADD_FUNC(8_dc, 10, sse2)
  535. +IDCT_ADD_FUNC(8, 10, sse2)
  536. +#if HAVE_AVX
  537. +IDCT_ADD_FUNC(, 10, avx)
  538. +IDCT_ADD_FUNC(8_dc, 10, avx)
  539. +IDCT_ADD_FUNC(8, 10, avx)
  540. +#endif
  541. +
  542. +
  543. +#define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT) \
  544. +void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  545. +                              (uint8_t *dst, const int *block_offset, \
  546. +                              DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  547. +
  548. +IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
  549. +IDCT_ADD_REP_FUNC(8, 4, 10, avx)
  550. +IDCT_ADD_REP_FUNC(, 16, 10, sse2)
  551. +IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
  552. +#if HAVE_AVX
  553. +IDCT_ADD_REP_FUNC(, 16, 10, avx)
  554. +IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
  555. +#endif
  556. +
  557. +
  558. +#define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT) \
  559. +void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  560. +                              (uint8_t **dst, const int *block_offset, \
  561. +                              DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  562. +IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
  563. +#if HAVE_AVX
  564. +IDCT_ADD_REP_FUNC2(, 8, 10, avx)
  565. +#endif
  566.  
  567.  void ff_h264_idct_add_mmx     (uint8_t *dst, int16_t *block, int stride);
  568.  void ff_h264_idct8_add_mmx    (uint8_t *dst, int16_t *block, int stride);
  569. @@ -418,7 +455,17 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  570.              c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_mmxext;
  571.              c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_mmxext;
  572.  #endif
  573. +            c->h264_idct_dc_add= ff_h264_idct_dc_add_10_mmx2;
  574.              if (mm_flags&AV_CPU_FLAG_SSE2) {
  575. +                c->h264_idct_add       = ff_h264_idct_add_10_sse2;
  576. +                c->h264_idct8_dc_add   = ff_h264_idct8_dc_add_10_sse2;
  577. +                c->h264_idct8_add      = ff_h264_idct8_add_10_sse2;
  578. +
  579. +                c->h264_idct_add16     = ff_h264_idct_add16_10_sse2;
  580. +                c->h264_idct8_add4     = ff_h264_idct8_add4_10_sse2;
  581. +                c->h264_idct_add8      = ff_h264_idct_add8_10_sse2;
  582. +                c->h264_idct_add16intra= ff_h264_idct_add16intra_10_sse2;
  583. +
  584.                  c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_sse2;
  585.                  c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_sse2;
  586.  #if HAVE_ALIGNED_STACK
  587. @@ -428,7 +475,18 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  588.                  c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
  589.  #endif
  590.              }
  591. +#if HAVE_AVX
  592.              if (mm_flags&AV_CPU_FLAG_AVX) {
  593. +                c->h264_idct_dc_add    =
  594. +                c->h264_idct_add       = ff_h264_idct_add_10_avx;
  595. +                c->h264_idct8_add      = ff_h264_idct8_add_10_avx;
  596. +                c->h264_idct8_dc_add   = ff_h264_idct8_dc_add_10_avx;
  597. +
  598. +                c->h264_idct_add16     = ff_h264_idct_add16_10_avx;
  599. +                c->h264_idct8_add4     = ff_h264_idct8_add4_10_avx;
  600. +                c->h264_idct_add8      = ff_h264_idct_add8_10_avx;
  601. +                c->h264_idct_add16intra= ff_h264_idct_add16intra_10_avx;
  602. +
  603.                  c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_avx;
  604.                  c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_avx;
  605.  #if HAVE_ALIGNED_STACK
  606. @@ -438,6 +496,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  607.                  c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
  608.  #endif
  609.              }
  610. +#endif /* HAVE_AVX */
  611.          }
  612.      }
  613.  #endif
  614. --
  615. 1.7.5.1
  616.  
  617.  
  618. From d7b2789d235902c8cf11961d06a5e26d74f71bf3 Mon Sep 17 00:00:00 2001
  619. From: Daniel Kang <daniel.d.kang@gmail.com>
  620. Date: Tue, 24 May 2011 15:15:08 -0400
  621. Subject: [PATCH 2/2] Update 8-bit H.264 IDCT function names to reflect
  622.  bit-depth.
  623.  
  624. ---
  625. libavcodec/h264dsp.h         |    1 -
  626.  libavcodec/x86/h264_idct.asm |   38 +++++++++---------
  627.  libavcodec/x86/h264dsp_mmx.c |   90 ++++++++++++++++++------------------------
  628.  3 files changed, 57 insertions(+), 72 deletions(-)
  629.  
  630. diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
  631. index 87a1dd9..864c118 100644
  632. --- a/libavcodec/h264dsp.h
  633. +++ b/libavcodec/h264dsp.h
  634. @@ -66,7 +66,6 @@ typedef struct H264DSPContext{
  635.      void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
  636.      void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
  637.  
  638. -    void (*h264_dct)(DCTELEM block[4][4]);
  639.      void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
  640.      void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
  641.      void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
  642. diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
  643. index ae70a30..f90f41c 100644
  644. --- a/libavcodec/x86/h264_idct.asm
  645. +++ b/libavcodec/x86/h264_idct.asm
  646. @@ -73,7 +73,7 @@ SECTION .text
  647.  
  648.  INIT_MMX
  649.  ; ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride)
  650. -cglobal h264_idct_add_mmx, 3, 3, 0
  651. +cglobal h264_idct_add_8_mmx, 3, 3, 0
  652.      IDCT4_ADD    r0, r1, r2
  653.      RET
  654.  
  655. @@ -125,7 +125,7 @@ cglobal h264_idct_add_mmx, 3, 3, 0
  656.      SUMSUB_BA    w, 0, 4
  657.      SUMSUB_BA    w, 3, 2
  658.      SUMSUB_BA    w, 1, 5
  659. -    SWAP          7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567
  660. +    SWAP         7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567
  661.  %endmacro
  662.  
  663.  %macro IDCT8_1D_FULL 1
  664. @@ -177,7 +177,7 @@ cglobal h264_idct_add_mmx, 3, 3, 0
  665.  
  666.  INIT_MMX
  667.  ; ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
  668. -cglobal h264_idct8_add_mmx, 3, 4, 0
  669. +cglobal h264_idct8_add_8_mmx, 3, 4, 0
  670.      %assign pad 128+4-(stack_offset&7)
  671.      SUB         rsp, pad
  672.  
  673. @@ -237,7 +237,7 @@ cglobal h264_idct8_add_mmx, 3, 4, 0
  674.  
  675.  INIT_XMM
  676.  ; ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride)
  677. -cglobal h264_idct8_add_sse2, 3, 4, 10
  678. +cglobal h264_idct8_add_8_sse2, 3, 4, 10
  679.      IDCT8_ADD_SSE r0, r1, r2, r3
  680.      RET
  681.  
  682. @@ -261,7 +261,7 @@ cglobal h264_idct8_add_sse2, 3, 4, 10
  683.      packuswb     m1, m1
  684.  %endmacro
  685.  
  686. -%macro DC_ADD_MMX2_OP 3-4
  687. +%macro DC_ADD_MMX2_OP 4
  688.      %1           m2, [%2     ]
  689.      %1           m3, [%2+%3  ]
  690.      %1           m4, [%2+%3*2]
  691. @@ -282,13 +282,13 @@ cglobal h264_idct8_add_sse2, 3, 4, 10
  692.  
  693.  INIT_MMX
  694.  ; ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
  695. -cglobal h264_idct_dc_add_mmx2, 3, 3, 0
  696. +cglobal h264_idct_dc_add_8_mmx2, 3, 3, 0
  697.      DC_ADD_MMX2_INIT r1, r2
  698.      DC_ADD_MMX2_OP movh, r0, r2, r1
  699.      RET
  700.  
  701.  ; ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
  702. -cglobal h264_idct8_dc_add_mmx2, 3, 3, 0
  703. +cglobal h264_idct8_dc_add_8_mmx2, 3, 3, 0
  704.      DC_ADD_MMX2_INIT r1, r2
  705.      DC_ADD_MMX2_OP mova, r0, r2, r1
  706.      lea          r0, [r0+r2*4]
  707. @@ -297,7 +297,7 @@ cglobal h264_idct8_dc_add_mmx2, 3, 3, 0
  708.  
  709.  ; ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset,
  710.  ;             DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  711. -cglobal h264_idct_add16_mmx, 5, 7, 0
  712. +cglobal h264_idct_add16_8_mmx, 5, 7, 0
  713.      xor          r5, r5
  714.  %ifdef PIC
  715.      lea         r11, [scan8_mem]
  716. @@ -319,7 +319,7 @@ cglobal h264_idct_add16_mmx, 5, 7, 0
  717.  
  718.  ; ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset,
  719.  ;                        DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  720. -cglobal h264_idct8_add4_mmx, 5, 7, 0
  721. +cglobal h264_idct8_add4_8_mmx, 5, 7, 0
  722.      %assign pad 128+4-(stack_offset&7)
  723.      SUB         rsp, pad
  724.  
  725. @@ -351,7 +351,7 @@ cglobal h264_idct8_add4_mmx, 5, 7, 0
  726.  
  727.  ; ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset,
  728.  ;                         DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  729. -cglobal h264_idct_add16_mmx2, 5, 7, 0
  730. +cglobal h264_idct_add16_8_mmx2, 5, 7, 0
  731.      xor          r5, r5
  732.  %ifdef PIC
  733.      lea         r11, [scan8_mem]
  734. @@ -398,7 +398,7 @@ cglobal h264_idct_add16_mmx2, 5, 7, 0
  735.  
  736.  ; ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset,
  737.  ;                             DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  738. -cglobal h264_idct_add16intra_mmx, 5, 7, 0
  739. +cglobal h264_idct_add16intra_8_mmx, 5, 7, 0
  740.      xor          r5, r5
  741.  %ifdef PIC
  742.      lea         r11, [scan8_mem]
  743. @@ -421,7 +421,7 @@ cglobal h264_idct_add16intra_mmx, 5, 7, 0
  744.  
  745.  ; ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset,
  746.  ;                              DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  747. -cglobal h264_idct_add16intra_mmx2, 5, 7, 0
  748. +cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
  749.      xor          r5, r5
  750.  %ifdef PIC
  751.      lea         r11, [scan8_mem]
  752. @@ -466,7 +466,7 @@ cglobal h264_idct_add16intra_mmx2, 5, 7, 0
  753.  
  754.  ; ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset,
  755.  ;                         DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  756. -cglobal h264_idct8_add4_mmx2, 5, 7, 0
  757. +cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
  758.      %assign pad 128+4-(stack_offset&7)
  759.      SUB         rsp, pad
  760.  
  761. @@ -529,7 +529,7 @@ cglobal h264_idct8_add4_mmx2, 5, 7, 0
  762.  INIT_XMM
  763.  ; ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset,
  764.  ;                         DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  765. -cglobal h264_idct8_add4_sse2, 5, 7, 10
  766. +cglobal h264_idct8_add4_8_sse2, 5, 7, 10
  767.      xor          r5, r5
  768.  %ifdef PIC
  769.      lea         r11, [scan8_mem]
  770. @@ -607,7 +607,7 @@ h264_idct_add8_mmx_plane:
  771.  
  772.  ; ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset,
  773.  ;                       DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  774. -cglobal h264_idct_add8_mmx, 5, 7, 0
  775. +cglobal h264_idct_add8_8_mmx, 5, 7, 0
  776.      mov          r5, 16
  777.      add          r2, 512
  778.  %ifdef PIC
  779. @@ -668,7 +668,7 @@ h264_idct_add8_mmx2_plane
  780.  
  781.  ; ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset,
  782.  ;                        DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  783. -cglobal h264_idct_add8_mmx2, 5, 7, 0
  784. +cglobal h264_idct_add8_8_mmx2, 5, 7, 0
  785.      mov          r5, 16
  786.      add          r2, 512
  787.  %ifdef ARCH_X86_64
  788. @@ -744,7 +744,7 @@ x264_add8x4_idct_sse2:
  789.  
  790.  ; ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset,
  791.  ;                         DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  792. -cglobal h264_idct_add16_sse2, 5, 5, 8
  793. +cglobal h264_idct_add16_8_sse2, 5, 5, 8
  794.  %ifdef ARCH_X86_64
  795.      mov        r10, r0
  796.  %endif
  797. @@ -791,7 +791,7 @@ cglobal h264_idct_add16_sse2, 5, 5, 8
  798.  
  799.  ; ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset,
  800.  ;                              DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  801. -cglobal h264_idct_add16intra_sse2, 5, 7, 8
  802. +cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
  803.  %ifdef ARCH_X86_64
  804.      mov        r10, r0
  805.  %endif
  806. @@ -840,7 +840,7 @@ cglobal h264_idct_add16intra_sse2, 5, 7, 8
  807.  
  808.  ; ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset,
  809.  ;                        DCTELEM *block, int stride, const uint8_t nnzc[6*8])
  810. -cglobal h264_idct_add8_sse2, 5, 7, 8
  811. +cglobal h264_idct_add8_8_sse2, 5, 7, 8
  812.      add          r2, 512
  813.  %ifdef ARCH_X86_64
  814.      mov         r10, r0
  815. diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c
  816. index d60fbd5..1a31e41 100644
  817. --- a/libavcodec/x86/h264dsp_mmx.c
  818. +++ b/libavcodec/x86/h264dsp_mmx.c
  819. @@ -30,9 +30,14 @@ DECLARE_ALIGNED(8, static const uint64_t, ff_pb_3_1  ) = 0x0103010301030103ULL;
  820.  #define IDCT_ADD_FUNC(NUM, DEPTH, OPT) \
  821.  void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT (uint8_t *dst, int16_t *block, int stride);
  822.  
  823. +IDCT_ADD_FUNC(, 8, mmx)
  824.  IDCT_ADD_FUNC(, 10, sse2)
  825. +IDCT_ADD_FUNC(_dc, 8, mmx2)
  826.  IDCT_ADD_FUNC(_dc, 10, mmx2)
  827. +IDCT_ADD_FUNC(8_dc, 8, mmx2)
  828.  IDCT_ADD_FUNC(8_dc, 10, sse2)
  829. +IDCT_ADD_FUNC(8, 8, mmx)
  830. +IDCT_ADD_FUNC(8, 8, sse2)
  831.  IDCT_ADD_FUNC(8, 10, sse2)
  832.  #if HAVE_AVX
  833.  IDCT_ADD_FUNC(, 10, avx)
  834. @@ -46,9 +51,18 @@ void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  835.                                (uint8_t *dst, const int *block_offset, \
  836.                                DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  837.  
  838. +IDCT_ADD_REP_FUNC(8, 4, 8, mmx)
  839. +IDCT_ADD_REP_FUNC(8, 4, 8, mmx2)
  840. +IDCT_ADD_REP_FUNC(8, 4, 8, sse2)
  841.  IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
  842.  IDCT_ADD_REP_FUNC(8, 4, 10, avx)
  843. +IDCT_ADD_REP_FUNC(, 16, 8, mmx)
  844. +IDCT_ADD_REP_FUNC(, 16, 8, mmx2)
  845. +IDCT_ADD_REP_FUNC(, 16, 8, sse2)
  846.  IDCT_ADD_REP_FUNC(, 16, 10, sse2)
  847. +IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
  848. +IDCT_ADD_REP_FUNC(, 16intra, 8, mmx2)
  849. +IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
  850.  IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
  851.  #if HAVE_AVX
  852.  IDCT_ADD_REP_FUNC(, 16, 10, avx)
  853. @@ -60,42 +74,14 @@ IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
  854.  void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  855.                                (uint8_t **dst, const int *block_offset, \
  856.                                DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  857. +IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
  858. +IDCT_ADD_REP_FUNC2(, 8, 8, mmx2)
  859. +IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
  860.  IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
  861.  #if HAVE_AVX
  862.  IDCT_ADD_REP_FUNC2(, 8, 10, avx)
  863.  #endif
  864.  
  865. -void ff_h264_idct_add_mmx     (uint8_t *dst, int16_t *block, int stride);
  866. -void ff_h264_idct8_add_mmx    (uint8_t *dst, int16_t *block, int stride);
  867. -void ff_h264_idct8_add_sse2   (uint8_t *dst, int16_t *block, int stride);
  868. -void ff_h264_idct_dc_add_mmx2 (uint8_t *dst, int16_t *block, int stride);
  869. -void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride);
  870. -
  871. -void ff_h264_idct_add16_mmx      (uint8_t *dst, const int *block_offset,
  872. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  873. -void ff_h264_idct8_add4_mmx      (uint8_t *dst, const int *block_offset,
  874. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  875. -void ff_h264_idct_add16_mmx2     (uint8_t *dst, const int *block_offset,
  876. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  877. -void ff_h264_idct_add16intra_mmx (uint8_t *dst, const int *block_offset,
  878. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  879. -void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset,
  880. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  881. -void ff_h264_idct8_add4_mmx2     (uint8_t *dst, const int *block_offset,
  882. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  883. -void ff_h264_idct8_add4_sse2     (uint8_t *dst, const int *block_offset,
  884. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  885. -void ff_h264_idct_add8_mmx       (uint8_t **dest, const int *block_offset,
  886. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  887. -void ff_h264_idct_add8_mmx2      (uint8_t **dest, const int *block_offset,
  888. -                                  DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
  889. -
  890. -void ff_h264_idct_add16_sse2     (uint8_t *dst, const int *block_offset, DCTELEM *block,
  891. -                                  int stride, const uint8_t nnzc[6*8]);
  892. -void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block,
  893. -                                  int stride, const uint8_t nnzc[6*8]);
  894. -void ff_h264_idct_add8_sse2      (uint8_t **dest, const int *block_offset, DCTELEM *block,
  895. -                                  int stride, const uint8_t nnzc[6*8]);
  896.  void ff_h264_luma_dc_dequant_idct_mmx (DCTELEM *output, DCTELEM *input, int qmul);
  897.  void ff_h264_luma_dc_dequant_idct_sse2(DCTELEM *output, DCTELEM *input, int qmul);
  898.  
  899. @@ -350,24 +336,24 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  900.      }
  901.  #if HAVE_YASM
  902.      if (mm_flags & AV_CPU_FLAG_MMX) {
  903. -        c->h264_idct_dc_add=
  904. -        c->h264_idct_add= ff_h264_idct_add_mmx;
  905. -        c->h264_idct8_dc_add=
  906. -        c->h264_idct8_add= ff_h264_idct8_add_mmx;
  907. -
  908. -        c->h264_idct_add16     = ff_h264_idct_add16_mmx;
  909. -        c->h264_idct8_add4     = ff_h264_idct8_add4_mmx;
  910. -        c->h264_idct_add8      = ff_h264_idct_add8_mmx;
  911. -        c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx;
  912. +        c->h264_idct_dc_add         =
  913. +        c->h264_idct_add            = ff_h264_idct_add_8_mmx;
  914. +        c->h264_idct8_dc_add        =
  915. +        c->h264_idct8_add           = ff_h264_idct8_add_8_mmx;
  916. +
  917. +        c->h264_idct_add16          = ff_h264_idct_add16_8_mmx;
  918. +        c->h264_idct8_add4          = ff_h264_idct8_add4_8_mmx;
  919. +        c->h264_idct_add8           = ff_h264_idct_add8_8_mmx;
  920. +        c->h264_idct_add16intra     = ff_h264_idct_add16intra_8_mmx;
  921.          c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_mmx;
  922.  
  923.          if (mm_flags & AV_CPU_FLAG_MMX2) {
  924. -            c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2;
  925. -            c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2;
  926. -            c->h264_idct_add16     = ff_h264_idct_add16_mmx2;
  927. -            c->h264_idct8_add4     = ff_h264_idct8_add4_mmx2;
  928. -            c->h264_idct_add8      = ff_h264_idct_add8_mmx2;
  929. -            c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2;
  930. +            c->h264_idct_dc_add    = ff_h264_idct_dc_add_8_mmx2;
  931. +            c->h264_idct8_dc_add   = ff_h264_idct8_dc_add_8_mmx2;
  932. +            c->h264_idct_add16     = ff_h264_idct_add16_8_mmx2;
  933. +            c->h264_idct8_add4     = ff_h264_idct8_add4_8_mmx2;
  934. +            c->h264_idct_add8      = ff_h264_idct_add8_8_mmx2;
  935. +            c->h264_idct_add16intra= ff_h264_idct_add16intra_8_mmx2;
  936.  
  937.              c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_8_mmxext;
  938.              c->h264_h_loop_filter_chroma= ff_deblock_h_chroma_8_mmxext;
  939. @@ -398,8 +384,12 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  940.              c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2;
  941.  
  942.              if (mm_flags&AV_CPU_FLAG_SSE2) {
  943. -                c->h264_idct8_add = ff_h264_idct8_add_sse2;
  944. -                c->h264_idct8_add4= ff_h264_idct8_add4_sse2;
  945. +                c->h264_idct8_add           = ff_h264_idct8_add_8_sse2;
  946. +
  947. +                c->h264_idct_add16          = ff_h264_idct_add16_8_sse2;
  948. +                c->h264_idct8_add4          = ff_h264_idct8_add4_8_sse2;
  949. +                c->h264_idct_add8           = ff_h264_idct_add8_8_sse2;
  950. +                c->h264_idct_add16intra     = ff_h264_idct_add16intra_8_sse2;
  951.                  c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_sse2;
  952.  
  953.                  c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_sse2;
  954. @@ -420,10 +410,6 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
  955.                  c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_sse2;
  956.                  c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
  957.  #endif
  958. -
  959. -                c->h264_idct_add16 = ff_h264_idct_add16_sse2;
  960. -                c->h264_idct_add8  = ff_h264_idct_add8_sse2;
  961. -                c->h264_idct_add16intra = ff_h264_idct_add16intra_sse2;
  962.              }
  963.              if (mm_flags&AV_CPU_FLAG_SSSE3) {
  964.                  c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_ssse3;
  965. --
  966. 1.7.5.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement