32 int16_t *
block,
int n,
int qscale)
45 qadd = (qscale - 1) | 1;
57 "packssdw %%mm6, %%mm6 \n\t"
58 "packssdw %%mm6, %%mm6 \n\t"
60 "pxor %%mm7, %%mm7 \n\t"
61 "packssdw %%mm5, %%mm5 \n\t"
62 "packssdw %%mm5, %%mm5 \n\t"
63 "psubw %%mm5, %%mm7 \n\t"
64 "pxor %%mm4, %%mm4 \n\t"
67 "movq (%0, %3), %%mm0 \n\t"
68 "movq 8(%0, %3), %%mm1 \n\t"
70 "pmullw %%mm6, %%mm0 \n\t"
71 "pmullw %%mm6, %%mm1 \n\t"
73 "movq (%0, %3), %%mm2 \n\t"
74 "movq 8(%0, %3), %%mm3 \n\t"
76 "pcmpgtw %%mm4, %%mm2 \n\t"
77 "pcmpgtw %%mm4, %%mm3 \n\t"
79 "pxor %%mm2, %%mm0 \n\t"
80 "pxor %%mm3, %%mm1 \n\t"
82 "paddw %%mm7, %%mm0 \n\t"
83 "paddw %%mm7, %%mm1 \n\t"
85 "pxor %%mm0, %%mm2 \n\t"
86 "pxor %%mm1, %%mm3 \n\t"
88 "pcmpeqw %%mm7, %%mm0 \n\t"
89 "pcmpeqw %%mm7, %%mm1 \n\t"
91 "pandn %%mm2, %%mm0 \n\t"
92 "pandn %%mm3, %%mm1 \n\t"
94 "movq %%mm0, (%0, %3) \n\t"
95 "movq %%mm1, 8(%0, %3) \n\t"
99 ::
"r" (block+nCoeffs),
"rm"(qmul),
"rm" (qadd),
"r" (2*(-nCoeffs))
107 int16_t *block,
int n,
int qscale)
112 qadd = (qscale - 1) | 1;
119 "movd %1, %%mm6 \n\t"
120 "packssdw %%mm6, %%mm6 \n\t"
121 "packssdw %%mm6, %%mm6 \n\t"
122 "movd %2, %%mm5 \n\t"
123 "pxor %%mm7, %%mm7 \n\t"
124 "packssdw %%mm5, %%mm5 \n\t"
125 "packssdw %%mm5, %%mm5 \n\t"
126 "psubw %%mm5, %%mm7 \n\t"
127 "pxor %%mm4, %%mm4 \n\t"
130 "movq (%0, %3), %%mm0 \n\t"
131 "movq 8(%0, %3), %%mm1 \n\t"
133 "pmullw %%mm6, %%mm0 \n\t"
134 "pmullw %%mm6, %%mm1 \n\t"
136 "movq (%0, %3), %%mm2 \n\t"
137 "movq 8(%0, %3), %%mm3 \n\t"
139 "pcmpgtw %%mm4, %%mm2 \n\t"
140 "pcmpgtw %%mm4, %%mm3 \n\t"
142 "pxor %%mm2, %%mm0 \n\t"
143 "pxor %%mm3, %%mm1 \n\t"
145 "paddw %%mm7, %%mm0 \n\t"
146 "paddw %%mm7, %%mm1 \n\t"
148 "pxor %%mm0, %%mm2 \n\t"
149 "pxor %%mm1, %%mm3 \n\t"
151 "pcmpeqw %%mm7, %%mm0 \n\t"
152 "pcmpeqw %%mm7, %%mm1 \n\t"
154 "pandn %%mm2, %%mm0 \n\t"
155 "pandn %%mm3, %%mm1 \n\t"
157 "movq %%mm0, (%0, %3) \n\t"
158 "movq %%mm1, 8(%0, %3) \n\t"
162 ::
"r" (block+nCoeffs),
"rm"(qmul),
"rm" (qadd),
"r" (2*(-nCoeffs))
168 int16_t *block,
int n,
int qscale)
171 const uint16_t *quant_matrix;
185 "pcmpeqw %%mm7, %%mm7 \n\t"
186 "psrlw $15, %%mm7 \n\t"
187 "movd %2, %%mm6 \n\t"
188 "packssdw %%mm6, %%mm6 \n\t"
189 "packssdw %%mm6, %%mm6 \n\t"
190 "mov %3, %%"REG_a
" \n\t"
193 "movq (%0, %%"REG_a
"), %%mm0 \n\t"
194 "movq 8(%0, %%"REG_a
"), %%mm1 \n\t"
195 "movq (%1, %%"REG_a
"), %%mm4 \n\t"
196 "movq 8(%1, %%"REG_a
"), %%mm5 \n\t"
197 "pmullw %%mm6, %%mm4 \n\t"
198 "pmullw %%mm6, %%mm5 \n\t"
199 "pxor %%mm2, %%mm2 \n\t"
200 "pxor %%mm3, %%mm3 \n\t"
201 "pcmpgtw %%mm0, %%mm2 \n\t"
202 "pcmpgtw %%mm1, %%mm3 \n\t"
203 "pxor %%mm2, %%mm0 \n\t"
204 "pxor %%mm3, %%mm1 \n\t"
205 "psubw %%mm2, %%mm0 \n\t"
206 "psubw %%mm3, %%mm1 \n\t"
207 "pmullw %%mm4, %%mm0 \n\t"
208 "pmullw %%mm5, %%mm1 \n\t"
209 "pxor %%mm4, %%mm4 \n\t"
210 "pxor %%mm5, %%mm5 \n\t"
211 "pcmpeqw (%0, %%"REG_a
"), %%mm4 \n\t"
212 "pcmpeqw 8(%0, %%"REG_a
"), %%mm5\n\t"
213 "psraw $3, %%mm0 \n\t"
214 "psraw $3, %%mm1 \n\t"
215 "psubw %%mm7, %%mm0 \n\t"
216 "psubw %%mm7, %%mm1 \n\t"
217 "por %%mm7, %%mm0 \n\t"
218 "por %%mm7, %%mm1 \n\t"
219 "pxor %%mm2, %%mm0 \n\t"
220 "pxor %%mm3, %%mm1 \n\t"
221 "psubw %%mm2, %%mm0 \n\t"
222 "psubw %%mm3, %%mm1 \n\t"
223 "pandn %%mm0, %%mm4 \n\t"
224 "pandn %%mm1, %%mm5 \n\t"
225 "movq %%mm4, (%0, %%"REG_a
") \n\t"
226 "movq %%mm5, 8(%0, %%"REG_a
") \n\t"
228 "add $16, %%"REG_a
" \n\t"
230 ::
"r" (block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
237 int16_t *block,
int n,
int qscale)
240 const uint16_t *quant_matrix;
248 "pcmpeqw %%mm7, %%mm7 \n\t"
249 "psrlw $15, %%mm7 \n\t"
250 "movd %2, %%mm6 \n\t"
251 "packssdw %%mm6, %%mm6 \n\t"
252 "packssdw %%mm6, %%mm6 \n\t"
253 "mov %3, %%"REG_a
" \n\t"
256 "movq (%0, %%"REG_a
"), %%mm0 \n\t"
257 "movq 8(%0, %%"REG_a
"), %%mm1 \n\t"
258 "movq (%1, %%"REG_a
"), %%mm4 \n\t"
259 "movq 8(%1, %%"REG_a
"), %%mm5 \n\t"
260 "pmullw %%mm6, %%mm4 \n\t"
261 "pmullw %%mm6, %%mm5 \n\t"
262 "pxor %%mm2, %%mm2 \n\t"
263 "pxor %%mm3, %%mm3 \n\t"
264 "pcmpgtw %%mm0, %%mm2 \n\t"
265 "pcmpgtw %%mm1, %%mm3 \n\t"
266 "pxor %%mm2, %%mm0 \n\t"
267 "pxor %%mm3, %%mm1 \n\t"
268 "psubw %%mm2, %%mm0 \n\t"
269 "psubw %%mm3, %%mm1 \n\t"
270 "paddw %%mm0, %%mm0 \n\t"
271 "paddw %%mm1, %%mm1 \n\t"
272 "paddw %%mm7, %%mm0 \n\t"
273 "paddw %%mm7, %%mm1 \n\t"
274 "pmullw %%mm4, %%mm0 \n\t"
275 "pmullw %%mm5, %%mm1 \n\t"
276 "pxor %%mm4, %%mm4 \n\t"
277 "pxor %%mm5, %%mm5 \n\t"
278 "pcmpeqw (%0, %%"REG_a
"), %%mm4 \n\t"
279 "pcmpeqw 8(%0, %%"REG_a
"), %%mm5\n\t"
280 "psraw $4, %%mm0 \n\t"
281 "psraw $4, %%mm1 \n\t"
282 "psubw %%mm7, %%mm0 \n\t"
283 "psubw %%mm7, %%mm1 \n\t"
284 "por %%mm7, %%mm0 \n\t"
285 "por %%mm7, %%mm1 \n\t"
286 "pxor %%mm2, %%mm0 \n\t"
287 "pxor %%mm3, %%mm1 \n\t"
288 "psubw %%mm2, %%mm0 \n\t"
289 "psubw %%mm3, %%mm1 \n\t"
290 "pandn %%mm0, %%mm4 \n\t"
291 "pandn %%mm1, %%mm5 \n\t"
292 "movq %%mm4, (%0, %%"REG_a
") \n\t"
293 "movq %%mm5, 8(%0, %%"REG_a
") \n\t"
295 "add $16, %%"REG_a
" \n\t"
297 ::
"r" (block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
303 int16_t *block,
int n,
int qscale)
306 const uint16_t *quant_matrix;
320 "pcmpeqw %%mm7, %%mm7 \n\t"
321 "psrlw $15, %%mm7 \n\t"
322 "movd %2, %%mm6 \n\t"
323 "packssdw %%mm6, %%mm6 \n\t"
324 "packssdw %%mm6, %%mm6 \n\t"
325 "mov %3, %%"REG_a
" \n\t"
328 "movq (%0, %%"REG_a
"), %%mm0 \n\t"
329 "movq 8(%0, %%"REG_a
"), %%mm1 \n\t"
330 "movq (%1, %%"REG_a
"), %%mm4 \n\t"
331 "movq 8(%1, %%"REG_a
"), %%mm5 \n\t"
332 "pmullw %%mm6, %%mm4 \n\t"
333 "pmullw %%mm6, %%mm5 \n\t"
334 "pxor %%mm2, %%mm2 \n\t"
335 "pxor %%mm3, %%mm3 \n\t"
336 "pcmpgtw %%mm0, %%mm2 \n\t"
337 "pcmpgtw %%mm1, %%mm3 \n\t"
338 "pxor %%mm2, %%mm0 \n\t"
339 "pxor %%mm3, %%mm1 \n\t"
340 "psubw %%mm2, %%mm0 \n\t"
341 "psubw %%mm3, %%mm1 \n\t"
342 "pmullw %%mm4, %%mm0 \n\t"
343 "pmullw %%mm5, %%mm1 \n\t"
344 "pxor %%mm4, %%mm4 \n\t"
345 "pxor %%mm5, %%mm5 \n\t"
346 "pcmpeqw (%0, %%"REG_a
"), %%mm4 \n\t"
347 "pcmpeqw 8(%0, %%"REG_a
"), %%mm5\n\t"
348 "psraw $3, %%mm0 \n\t"
349 "psraw $3, %%mm1 \n\t"
350 "pxor %%mm2, %%mm0 \n\t"
351 "pxor %%mm3, %%mm1 \n\t"
352 "psubw %%mm2, %%mm0 \n\t"
353 "psubw %%mm3, %%mm1 \n\t"
354 "pandn %%mm0, %%mm4 \n\t"
355 "pandn %%mm1, %%mm5 \n\t"
356 "movq %%mm4, (%0, %%"REG_a
") \n\t"
357 "movq %%mm5, 8(%0, %%"REG_a
") \n\t"
359 "add $16, %%"REG_a
" \n\t"
361 ::
"r" (block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
369 int16_t *block,
int n,
int qscale)
372 const uint16_t *quant_matrix;
381 "pcmpeqw %%mm7, %%mm7 \n\t"
382 "psrlq $48, %%mm7 \n\t"
383 "movd %2, %%mm6 \n\t"
384 "packssdw %%mm6, %%mm6 \n\t"
385 "packssdw %%mm6, %%mm6 \n\t"
386 "mov %3, %%"REG_a
" \n\t"
389 "movq (%0, %%"REG_a
"), %%mm0 \n\t"
390 "movq 8(%0, %%"REG_a
"), %%mm1 \n\t"
391 "movq (%1, %%"REG_a
"), %%mm4 \n\t"
392 "movq 8(%1, %%"REG_a
"), %%mm5 \n\t"
393 "pmullw %%mm6, %%mm4 \n\t"
394 "pmullw %%mm6, %%mm5 \n\t"
395 "pxor %%mm2, %%mm2 \n\t"
396 "pxor %%mm3, %%mm3 \n\t"
397 "pcmpgtw %%mm0, %%mm2 \n\t"
398 "pcmpgtw %%mm1, %%mm3 \n\t"
399 "pxor %%mm2, %%mm0 \n\t"
400 "pxor %%mm3, %%mm1 \n\t"
401 "psubw %%mm2, %%mm0 \n\t"
402 "psubw %%mm3, %%mm1 \n\t"
403 "paddw %%mm0, %%mm0 \n\t"
404 "paddw %%mm1, %%mm1 \n\t"
405 "pmullw %%mm4, %%mm0 \n\t"
406 "pmullw %%mm5, %%mm1 \n\t"
407 "paddw %%mm4, %%mm0 \n\t"
408 "paddw %%mm5, %%mm1 \n\t"
409 "pxor %%mm4, %%mm4 \n\t"
410 "pxor %%mm5, %%mm5 \n\t"
411 "pcmpeqw (%0, %%"REG_a
"), %%mm4 \n\t"
412 "pcmpeqw 8(%0, %%"REG_a
"), %%mm5\n\t"
413 "psrlw $4, %%mm0 \n\t"
414 "psrlw $4, %%mm1 \n\t"
415 "pxor %%mm2, %%mm0 \n\t"
416 "pxor %%mm3, %%mm1 \n\t"
417 "psubw %%mm2, %%mm0 \n\t"
418 "psubw %%mm3, %%mm1 \n\t"
419 "pandn %%mm0, %%mm4 \n\t"
420 "pandn %%mm1, %%mm5 \n\t"
421 "pxor %%mm4, %%mm7 \n\t"
422 "pxor %%mm5, %%mm7 \n\t"
423 "movq %%mm4, (%0, %%"REG_a
") \n\t"
424 "movq %%mm5, 8(%0, %%"REG_a
") \n\t"
426 "add $16, %%"REG_a
" \n\t"
428 "movd 124(%0, %3), %%mm0 \n\t"
429 "movq %%mm7, %%mm6 \n\t"
430 "psrlq $32, %%mm7 \n\t"
431 "pxor %%mm6, %%mm7 \n\t"
432 "movq %%mm7, %%mm6 \n\t"
433 "psrlq $16, %%mm7 \n\t"
434 "pxor %%mm6, %%mm7 \n\t"
435 "pslld $31, %%mm7 \n\t"
436 "psrlq $15, %%mm7 \n\t"
437 "pxor %%mm7, %%mm0 \n\t"
438 "movd %%mm0, 124(%0, %3) \n\t"
440 ::
"r" (block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"r" (-2*nCoeffs)
int h263_aic
Advanded INTRA Coding (AIC)
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Macro definitions for various function/variable attributes.
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define INLINE_MMX(flags)
void(* dct_unquantize_mpeg2_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void(* dct_unquantize_mpeg1_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Libavcodec external API header.
av_cold void ff_mpv_common_init_x86(MpegEncContext *s)
int block_last_index[12]
last non zero coefficient in block
uint16_t inter_matrix[64]
ScanTable intra_scantable
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
struct AVCodecContext * avctx
void(* dct_unquantize_mpeg1_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void(* dct_unquantize_mpeg2_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
ScanTable inter_scantable
if inter == intra then intra should be used to reduce tha cache usage