40 void ff_cavs_idct8_mmx(int16_t *
out,
const int16_t *
in);
45 ff_cavs_idct8_mmx(b2, block);
49 void ff_cavs_idct8_sse2(int16_t *
out,
const int16_t *
in);
54 ff_cavs_idct8_sse2(b2, block);
60 #if (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE)
69 #define QPEL_CAVSV1(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \
70 "movd (%0), "#F" \n\t"\
71 "movq "#C", %%mm6 \n\t"\
72 "pmullw "MANGLE(MUL1)", %%mm6\n\t"\
73 "movq "#D", %%mm7 \n\t"\
74 "pmullw "MANGLE(MUL2)", %%mm7\n\t"\
75 "psllw $3, "#E" \n\t"\
76 "psubw "#E", %%mm6 \n\t"\
77 "psraw $3, "#E" \n\t"\
78 "paddw %%mm7, %%mm6 \n\t"\
79 "paddw "#E", %%mm6 \n\t"\
80 "paddw "#B", "#B" \n\t"\
81 "pxor %%mm7, %%mm7 \n\t"\
83 "punpcklbw %%mm7, "#F" \n\t"\
84 "psubw "#B", %%mm6 \n\t"\
85 "psraw $1, "#B" \n\t"\
86 "psubw "#A", %%mm6 \n\t"\
87 "paddw "MANGLE(ADD)", %%mm6 \n\t"\
88 "psraw $7, %%mm6 \n\t"\
89 "packuswb %%mm6, %%mm6 \n\t"\
90 OP(%%mm6, (%1), A, d) \
94 #define QPEL_CAVSV2(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \
95 "movd (%0), "#F" \n\t"\
96 "movq "#C", %%mm6 \n\t"\
97 "paddw "#D", %%mm6 \n\t"\
98 "pmullw "MANGLE(MUL1)", %%mm6\n\t"\
100 "punpcklbw %%mm7, "#F" \n\t"\
101 "psubw "#B", %%mm6 \n\t"\
102 "psubw "#E", %%mm6 \n\t"\
103 "paddw "MANGLE(ADD)", %%mm6 \n\t"\
104 "psraw $3, %%mm6 \n\t"\
105 "packuswb %%mm6, %%mm6 \n\t"\
106 OP(%%mm6, (%1), A, d) \
110 #define QPEL_CAVSV3(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \
111 "movd (%0), "#F" \n\t"\
112 "movq "#C", %%mm6 \n\t"\
113 "pmullw "MANGLE(MUL2)", %%mm6\n\t"\
114 "movq "#D", %%mm7 \n\t"\
115 "pmullw "MANGLE(MUL1)", %%mm7\n\t"\
116 "psllw $3, "#B" \n\t"\
117 "psubw "#B", %%mm6 \n\t"\
118 "psraw $3, "#B" \n\t"\
119 "paddw %%mm7, %%mm6 \n\t"\
120 "paddw "#B", %%mm6 \n\t"\
121 "paddw "#E", "#E" \n\t"\
122 "pxor %%mm7, %%mm7 \n\t"\
124 "punpcklbw %%mm7, "#F" \n\t"\
125 "psubw "#E", %%mm6 \n\t"\
126 "psraw $1, "#E" \n\t"\
127 "psubw "#F", %%mm6 \n\t"\
128 "paddw "MANGLE(ADD)", %%mm6 \n\t"\
129 "psraw $7, %%mm6 \n\t"\
130 "packuswb %%mm6, %%mm6 \n\t"\
131 OP(%%mm6, (%1), A, d) \
135 #define QPEL_CAVSVNUM(VOP,OP,ADD,MUL1,MUL2)\
141 "pxor %%mm7, %%mm7 \n\t"\
142 "movd (%0), %%mm0 \n\t"\
144 "movd (%0), %%mm1 \n\t"\
146 "movd (%0), %%mm2 \n\t"\
148 "movd (%0), %%mm3 \n\t"\
150 "movd (%0), %%mm4 \n\t"\
152 "punpcklbw %%mm7, %%mm0 \n\t"\
153 "punpcklbw %%mm7, %%mm1 \n\t"\
154 "punpcklbw %%mm7, %%mm2 \n\t"\
155 "punpcklbw %%mm7, %%mm3 \n\t"\
156 "punpcklbw %%mm7, %%mm4 \n\t"\
157 VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\
158 VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\
159 VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\
160 VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\
161 VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, ADD, MUL1, MUL2)\
162 VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, ADD, MUL1, MUL2)\
163 VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\
164 VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\
166 : "+a"(src), "+c"(dst)\
167 : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\
168 NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\
173 VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\
174 VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\
175 VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, ADD, MUL1, MUL2)\
176 VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, ADD, MUL1, MUL2)\
177 VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\
178 VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\
179 VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\
180 VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\
182 : "+a"(src), "+c"(dst)\
183 : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\
184 NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\
188 src += 4-(h+5)*srcStride;\
189 dst += 4-h*dstStride;\
192 #define QPEL_CAVS(OPNAME, OP, MMX)\
193 static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
197 "pxor %%mm7, %%mm7 \n\t"\
198 "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\
200 "movq (%0), %%mm0 \n\t"\
201 "movq 1(%0), %%mm2 \n\t"\
202 "movq %%mm0, %%mm1 \n\t"\
203 "movq %%mm2, %%mm3 \n\t"\
204 "punpcklbw %%mm7, %%mm0 \n\t"\
205 "punpckhbw %%mm7, %%mm1 \n\t"\
206 "punpcklbw %%mm7, %%mm2 \n\t"\
207 "punpckhbw %%mm7, %%mm3 \n\t"\
208 "paddw %%mm2, %%mm0 \n\t"\
209 "paddw %%mm3, %%mm1 \n\t"\
210 "pmullw %%mm6, %%mm0 \n\t"\
211 "pmullw %%mm6, %%mm1 \n\t"\
212 "movq -1(%0), %%mm2 \n\t"\
213 "movq 2(%0), %%mm4 \n\t"\
214 "movq %%mm2, %%mm3 \n\t"\
215 "movq %%mm4, %%mm5 \n\t"\
216 "punpcklbw %%mm7, %%mm2 \n\t"\
217 "punpckhbw %%mm7, %%mm3 \n\t"\
218 "punpcklbw %%mm7, %%mm4 \n\t"\
219 "punpckhbw %%mm7, %%mm5 \n\t"\
220 "paddw %%mm4, %%mm2 \n\t"\
221 "paddw %%mm3, %%mm5 \n\t"\
222 "psubw %%mm2, %%mm0 \n\t"\
223 "psubw %%mm5, %%mm1 \n\t"\
224 "movq "MANGLE(ff_pw_4)", %%mm5\n\t"\
225 "paddw %%mm5, %%mm0 \n\t"\
226 "paddw %%mm5, %%mm1 \n\t"\
227 "psraw $3, %%mm0 \n\t"\
228 "psraw $3, %%mm1 \n\t"\
229 "packuswb %%mm1, %%mm0 \n\t"\
230 OP(%%mm0, (%1),%%mm5, q) \
235 : "+a"(src), "+c"(dst), "+m"(h)\
236 : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
237 NAMED_CONSTRAINTS_ADD(ff_pw_4,ff_pw_5)\
242 static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
244 QPEL_CAVSVNUM(QPEL_CAVSV1,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
247 static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
249 QPEL_CAVSVNUM(QPEL_CAVSV2,OP,ff_pw_4,ff_pw_5,ff_pw_42) \
252 static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)\
254 QPEL_CAVSVNUM(QPEL_CAVSV3,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
257 static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
259 OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 8);\
261 static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
263 OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 16);\
264 OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
267 static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
269 OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 8);\
271 static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
273 OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 16);\
274 OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
277 static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
279 OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 8);\
281 static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
283 OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 16);\
284 OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
287 static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride)\
289 OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
290 OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
293 OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
294 OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
297 #define CAVS_MC(OPNAME, SIZE, MMX) \
298 static void OPNAME ## cavs_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
300 OPNAME ## cavs_qpel ## SIZE ## _h_ ## MMX(dst, src, stride, stride);\
303 static void OPNAME ## cavs_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
305 OPNAME ## cavs_qpel ## SIZE ## _v1_ ## MMX(dst, src, stride, stride);\
308 static void OPNAME ## cavs_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
310 OPNAME ## cavs_qpel ## SIZE ## _v2_ ## MMX(dst, src, stride, stride);\
313 static void OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
315 OPNAME ## cavs_qpel ## SIZE ## _v3_ ## MMX(dst, src, stride, stride);\
318 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
319 #define AVG_3DNOW_OP(a,b,temp, size) \
320 "mov" #size " " #b ", " #temp " \n\t"\
321 "pavgusb " #temp ", " #a " \n\t"\
322 "mov" #size " " #a ", " #b " \n\t"
323 #define AVG_MMXEXT_OP(a, b, temp, size) \
324 "mov" #size " " #b ", " #temp " \n\t"\
325 "pavgb " #temp ", " #a " \n\t"\
326 "mov" #size " " #a ", " #b " \n\t"
330 #if HAVE_MMX_EXTERNAL
383 #if HAVE_MMX_EXTERNAL
394 #define DSPFUNC(PFX, IDX, NUM, EXT) \
395 c->PFX ## _cavs_qpel_pixels_tab[IDX][ 2] = PFX ## _cavs_qpel ## NUM ## _mc20_ ## EXT; \
396 c->PFX ## _cavs_qpel_pixels_tab[IDX][ 4] = PFX ## _cavs_qpel ## NUM ## _mc01_ ## EXT; \
397 c->PFX ## _cavs_qpel_pixels_tab[IDX][ 8] = PFX ## _cavs_qpel ## NUM ## _mc02_ ## EXT; \
398 c->PFX ## _cavs_qpel_pixels_tab[IDX][12] = PFX ## _cavs_qpel ## NUM ## _mc03_ ## EXT; \
400 #if HAVE_MMXEXT_INLINE
401 QPEL_CAVS(put_, PUT_OP, mmxext)
402 QPEL_CAVS(avg_, AVG_MMXEXT_OP, mmxext)
410 #if HAVE_AMD3DNOW_INLINE
411 QPEL_CAVS(put_, PUT_OP, 3dnow)
412 QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
436 #if HAVE_AMD3DNOW_INLINE
438 cavsdsp_init_3dnow(c, avctx);
440 #if HAVE_MMXEXT_INLINE
448 #if HAVE_MMX_EXTERNAL
454 #if HAVE_SSE2_EXTERNAL
void ff_put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, ptrdiff_t line_size)
static atomic_int cpu_flags
Macro definitions for various function/variable attributes.
#define DSPFUNC(PFX, IDX, NUM, EXT)
void ff_add_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, ptrdiff_t line_size)
void ff_avg_pixels16_mmxext(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
#define EXTERNAL_SSE2(flags)
qpel_mc_func put_cavs_qpel_pixels_tab[2][16]
#define CAVS_MC(OPNAME, SIZE)
#define INLINE_AMD3DNOW(flags)
main external API structure.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
void(* cavs_idct8_add)(uint8_t *dst, int16_t *block, ptrdiff_t stride)
static av_cold void cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx)
qpel_mc_func avg_cavs_qpel_pixels_tab[2][16]
av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
#define EXTERNAL_MMXEXT(flags)
#define INLINE_MMXEXT(flags)
GLint GLenum GLboolean GLsizei stride
void ff_avg_pixels8_mmx(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
common internal and external API header
void ff_avg_pixels16_mmx(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
#define LOCAL_ALIGNED(a, t, v,...)
void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
void ff_put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)