| OLD | NEW |
| 1 /* | 1 /* |
| 2 * MMX optimized DSP utils | 2 * MMX optimized DSP utils |
| 3 * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org> | 3 * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org> |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 extern const uint64_t ff_pw_96; | 50 extern const uint64_t ff_pw_96; |
| 51 extern const uint64_t ff_pw_128; | 51 extern const uint64_t ff_pw_128; |
| 52 extern const uint64_t ff_pw_255; | 52 extern const uint64_t ff_pw_255; |
| 53 | 53 |
| 54 extern const xmm_reg ff_pb_1; | 54 extern const xmm_reg ff_pb_1; |
| 55 extern const xmm_reg ff_pb_3; | 55 extern const xmm_reg ff_pb_3; |
| 56 extern const uint64_t ff_pb_7; | 56 extern const uint64_t ff_pb_7; |
| 57 extern const uint64_t ff_pb_1F; | 57 extern const uint64_t ff_pb_1F; |
| 58 extern const uint64_t ff_pb_3F; | 58 extern const uint64_t ff_pb_3F; |
| 59 extern const uint64_t ff_pb_81; | 59 extern const uint64_t ff_pb_81; |
| 60 extern const uint64_t ff_pb_A1; | 60 extern const xmm_reg ff_pb_A1; |
| 61 extern const xmm_reg ff_pb_F8; | 61 extern const xmm_reg ff_pb_F8; |
| 62 extern const uint64_t ff_pb_FC; | 62 extern const uint64_t ff_pb_FC; |
| 63 extern const xmm_reg ff_pb_FE; | 63 extern const xmm_reg ff_pb_FE; |
| 64 | 64 |
| 65 extern const double ff_pd_1[2]; | 65 extern const double ff_pd_1[2]; |
| 66 extern const double ff_pd_2[2]; | 66 extern const double ff_pd_2[2]; |
| 67 | 67 |
| 68 #define LOAD4(stride,in,a,b,c,d)\ | 68 #define LOAD4(stride,in,a,b,c,d)\ |
| 69 "movq 0*"#stride"+"#in", "#a"\n\t"\ | 69 "movq 0*"#stride"+"#in", "#a"\n\t"\ |
| 70 "movq 1*"#stride"+"#in", "#b"\n\t"\ | 70 "movq 1*"#stride"+"#in", "#b"\n\t"\ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 87 "mov" #m " " #a ", " #t " \n\t" /* abcd */\ | 87 "mov" #m " " #a ", " #t " \n\t" /* abcd */\ |
| 88 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ | 88 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ |
| 89 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ | 89 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ |
| 90 | 90 |
| 91 #define TRANSPOSE4(a,b,c,d,t)\ | 91 #define TRANSPOSE4(a,b,c,d,t)\ |
| 92 SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\ | 92 SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\ |
| 93 SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\ | 93 SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\ |
| 94 SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\ | 94 SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\ |
| 95 SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */ | 95 SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */ |
| 96 | 96 |
| 97 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int
src_stride){ |
| 98 __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ... |
| 99 "movd %4, %%mm0 \n\t" |
| 100 "movd %5, %%mm1 \n\t" |
| 101 "movd %6, %%mm2 \n\t" |
| 102 "movd %7, %%mm3 \n\t" |
| 103 "punpcklbw %%mm1, %%mm0 \n\t" |
| 104 "punpcklbw %%mm3, %%mm2 \n\t" |
| 105 "movq %%mm0, %%mm1 \n\t" |
| 106 "punpcklwd %%mm2, %%mm0 \n\t" |
| 107 "punpckhwd %%mm2, %%mm1 \n\t" |
| 108 "movd %%mm0, %0 \n\t" |
| 109 "punpckhdq %%mm0, %%mm0 \n\t" |
| 110 "movd %%mm0, %1 \n\t" |
| 111 "movd %%mm1, %2 \n\t" |
| 112 "punpckhdq %%mm1, %%mm1 \n\t" |
| 113 "movd %%mm1, %3 \n\t" |
| 114 |
| 115 : "=m" (*(uint32_t*)(dst + 0*dst_stride)), |
| 116 "=m" (*(uint32_t*)(dst + 1*dst_stride)), |
| 117 "=m" (*(uint32_t*)(dst + 2*dst_stride)), |
| 118 "=m" (*(uint32_t*)(dst + 3*dst_stride)) |
| 119 : "m" (*(uint32_t*)(src + 0*src_stride)), |
| 120 "m" (*(uint32_t*)(src + 1*src_stride)), |
| 121 "m" (*(uint32_t*)(src + 2*src_stride)), |
| 122 "m" (*(uint32_t*)(src + 3*src_stride)) |
| 123 ); |
| 124 } |
| 125 |
| 97 // e,f,g,h can be memory | 126 // e,f,g,h can be memory |
| 98 // out: a,d,t,c | 127 // out: a,d,t,c |
| 99 #define TRANSPOSE8x4(a,b,c,d,e,f,g,h,t)\ | 128 #define TRANSPOSE8x4(a,b,c,d,e,f,g,h,t)\ |
| 100 "punpcklbw " #e ", " #a " \n\t" /* a0 e0 a1 e1 a2 e2 a3 e3 */\ | 129 "punpcklbw " #e ", " #a " \n\t" /* a0 e0 a1 e1 a2 e2 a3 e3 */\ |
| 101 "punpcklbw " #f ", " #b " \n\t" /* b0 f0 b1 f1 b2 f2 b3 f3 */\ | 130 "punpcklbw " #f ", " #b " \n\t" /* b0 f0 b1 f1 b2 f2 b3 f3 */\ |
| 102 "punpcklbw " #g ", " #c " \n\t" /* c0 g0 c1 g1 c2 g2 d3 g3 */\ | 131 "punpcklbw " #g ", " #c " \n\t" /* c0 g0 c1 g1 c2 g2 d3 g3 */\ |
| 103 "punpcklbw " #h ", " #d " \n\t" /* d0 h0 d1 h1 d2 h2 d3 h3 */\ | 132 "punpcklbw " #h ", " #d " \n\t" /* d0 h0 d1 h1 d2 h2 d3 h3 */\ |
| 104 SBUTTERFLY(a, b, t, bw, q) /* a= a0 b0 e0 f0 a1 b1 e1 f1 */\ | 133 SBUTTERFLY(a, b, t, bw, q) /* a= a0 b0 e0 f0 a1 b1 e1 f1 */\ |
| 105 /* t= a2 b2 e2 f2 a3 b3 e3 f3 */\ | 134 /* t= a2 b2 e2 f2 a3 b3 e3 f3 */\ |
| 106 SBUTTERFLY(c, d, b, bw, q) /* c= c0 d0 g0 h0 c1 d1 g1 h1 */\ | 135 SBUTTERFLY(c, d, b, bw, q) /* c= c0 d0 g0 h0 c1 d1 g1 h1 */\ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #endif | 180 #endif |
| 152 | 181 |
| 153 #define MOVQ_WONE(regd) \ | 182 #define MOVQ_WONE(regd) \ |
| 154 __asm__ volatile ( \ | 183 __asm__ volatile ( \ |
| 155 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ | 184 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
| 156 "psrlw $15, %%" #regd ::) | 185 "psrlw $15, %%" #regd ::) |
| 157 | 186 |
| 158 void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx); | 187 void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx); |
| 159 void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx); | 188 void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx); |
| 160 | 189 |
| 161 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size
); | 190 void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_s
ize); |
| 162 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size
); | 191 void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_s
ize); |
| 163 void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int li
ne_size); | 192 void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int
line_size); |
| 164 | 193 |
| 165 void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | 194 void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); |
| 166 void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | 195 void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); |
| 167 void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | 196 void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); |
| 168 void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | 197 void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); |
| 169 | 198 |
| 170 void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); | 199 void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); |
| 171 void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int
rnd); | 200 void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int
rnd); |
| 172 void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, in
t rnd); | 201 void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, in
t rnd); |
| 173 | 202 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 184 const uint8_t *lum, | 213 const uint8_t *lum, |
| 185 int size); | 214 int size); |
| 186 | 215 |
| 187 void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4, | 216 void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4, |
| 188 const uint8_t *lum_m3, | 217 const uint8_t *lum_m3, |
| 189 const uint8_t *lum_m2, | 218 const uint8_t *lum_m2, |
| 190 const uint8_t *lum_m1, | 219 const uint8_t *lum_m1, |
| 191 const uint8_t *lum, int size); | 220 const uint8_t *lum, int size); |
| 192 | 221 |
| 193 #endif /* AVCODEC_X86_DSPUTIL_MMX_H */ | 222 #endif /* AVCODEC_X86_DSPUTIL_MMX_H */ |
| OLD | NEW |