33 int16_t *
block,
int n,
int qscale)
46 qadd = (qscale - 1) | 1;
54 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ];
58 "packssdw %%mm6, %%mm6 \n\t"
59 "packssdw %%mm6, %%mm6 \n\t"
61 "pxor %%mm7, %%mm7 \n\t"
62 "packssdw %%mm5, %%mm5 \n\t"
63 "packssdw %%mm5, %%mm5 \n\t"
64 "psubw %%mm5, %%mm7 \n\t"
65 "pxor %%mm4, %%mm4 \n\t"
68 "movq (%0, %3), %%mm0 \n\t"
69 "movq 8(%0, %3), %%mm1 \n\t"
71 "pmullw %%mm6, %%mm0 \n\t"
72 "pmullw %%mm6, %%mm1 \n\t"
74 "movq (%0, %3), %%mm2 \n\t"
75 "movq 8(%0, %3), %%mm3 \n\t"
77 "pcmpgtw %%mm4, %%mm2 \n\t"
78 "pcmpgtw %%mm4, %%mm3 \n\t"
80 "pxor %%mm2, %%mm0 \n\t"
81 "pxor %%mm3, %%mm1 \n\t"
83 "paddw %%mm7, %%mm0 \n\t"
84 "paddw %%mm7, %%mm1 \n\t"
86 "pxor %%mm0, %%mm2 \n\t"
87 "pxor %%mm1, %%mm3 \n\t"
89 "pcmpeqw %%mm7, %%mm0 \n\t"
90 "pcmpeqw %%mm7, %%mm1 \n\t"
92 "pandn %%mm2, %%mm0 \n\t"
93 "pandn %%mm3, %%mm1 \n\t"
95 "movq %%mm0, (%0, %3) \n\t"
96 "movq %%mm1, 8(%0, %3) \n\t"
100 ::
"r" (
block+nCoeffs),
"rm"(qmul),
"rm" (qadd),
"r" (2*(-nCoeffs))
108 int16_t *
block,
int n,
int qscale)
113 qadd = (qscale - 1) | 1;
117 nCoeffs=
s->inter_scantable.raster_end[
s->block_last_index[n] ];
120 "movd %1, %%mm6 \n\t"
121 "packssdw %%mm6, %%mm6 \n\t"
122 "packssdw %%mm6, %%mm6 \n\t"
123 "movd %2, %%mm5 \n\t"
124 "pxor %%mm7, %%mm7 \n\t"
125 "packssdw %%mm5, %%mm5 \n\t"
126 "packssdw %%mm5, %%mm5 \n\t"
127 "psubw %%mm5, %%mm7 \n\t"
128 "pxor %%mm4, %%mm4 \n\t"
131 "movq (%0, %3), %%mm0 \n\t"
132 "movq 8(%0, %3), %%mm1 \n\t"
134 "pmullw %%mm6, %%mm0 \n\t"
135 "pmullw %%mm6, %%mm1 \n\t"
137 "movq (%0, %3), %%mm2 \n\t"
138 "movq 8(%0, %3), %%mm3 \n\t"
140 "pcmpgtw %%mm4, %%mm2 \n\t"
141 "pcmpgtw %%mm4, %%mm3 \n\t"
143 "pxor %%mm2, %%mm0 \n\t"
144 "pxor %%mm3, %%mm1 \n\t"
146 "paddw %%mm7, %%mm0 \n\t"
147 "paddw %%mm7, %%mm1 \n\t"
149 "pxor %%mm0, %%mm2 \n\t"
150 "pxor %%mm1, %%mm3 \n\t"
152 "pcmpeqw %%mm7, %%mm0 \n\t"
153 "pcmpeqw %%mm7, %%mm1 \n\t"
155 "pandn %%mm2, %%mm0 \n\t"
156 "pandn %%mm3, %%mm1 \n\t"
158 "movq %%mm0, (%0, %3) \n\t"
159 "movq %%mm1, 8(%0, %3) \n\t"
163 ::
"r" (
block+nCoeffs),
"rm"(qmul),
"rm" (qadd),
"r" (2*(-nCoeffs))
169 int16_t *
block,
int n,
int qscale)
172 const uint16_t *quant_matrix;
177 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ]+1;
180 block0 =
block[0] *
s->y_dc_scale;
182 block0 =
block[0] *
s->c_dc_scale;
184 quant_matrix =
s->intra_matrix;
186 "pcmpeqw %%mm7, %%mm7 \n\t"
187 "psrlw $15, %%mm7 \n\t"
188 "movd %2, %%mm6 \n\t"
189 "packssdw %%mm6, %%mm6 \n\t"
190 "packssdw %%mm6, %%mm6 \n\t"
191 "mov %3, %%"FF_REG_a
" \n\t"
194 "movq (%0, %%"FF_REG_a
"), %%mm0 \n\t"
195 "movq 8(%0, %%"FF_REG_a
"), %%mm1\n\t"
196 "movq (%1, %%"FF_REG_a
"), %%mm4 \n\t"
197 "movq 8(%1, %%"FF_REG_a
"), %%mm5\n\t"
198 "pmullw %%mm6, %%mm4 \n\t"
199 "pmullw %%mm6, %%mm5 \n\t"
200 "pxor %%mm2, %%mm2 \n\t"
201 "pxor %%mm3, %%mm3 \n\t"
202 "pcmpgtw %%mm0, %%mm2 \n\t"
203 "pcmpgtw %%mm1, %%mm3 \n\t"
204 "pxor %%mm2, %%mm0 \n\t"
205 "pxor %%mm3, %%mm1 \n\t"
206 "psubw %%mm2, %%mm0 \n\t"
207 "psubw %%mm3, %%mm1 \n\t"
208 "pmullw %%mm4, %%mm0 \n\t"
209 "pmullw %%mm5, %%mm1 \n\t"
210 "pxor %%mm4, %%mm4 \n\t"
211 "pxor %%mm5, %%mm5 \n\t"
212 "pcmpeqw (%0, %%"FF_REG_a
"), %%mm4 \n\t"
213 "pcmpeqw 8(%0, %%"FF_REG_a
"), %%mm5\n\t"
214 "psraw $3, %%mm0 \n\t"
215 "psraw $3, %%mm1 \n\t"
216 "psubw %%mm7, %%mm0 \n\t"
217 "psubw %%mm7, %%mm1 \n\t"
218 "por %%mm7, %%mm0 \n\t"
219 "por %%mm7, %%mm1 \n\t"
220 "pxor %%mm2, %%mm0 \n\t"
221 "pxor %%mm3, %%mm1 \n\t"
222 "psubw %%mm2, %%mm0 \n\t"
223 "psubw %%mm3, %%mm1 \n\t"
224 "pandn %%mm0, %%mm4 \n\t"
225 "pandn %%mm1, %%mm5 \n\t"
226 "movq %%mm4, (%0, %%"FF_REG_a
") \n\t"
227 "movq %%mm5, 8(%0, %%"FF_REG_a
")\n\t"
229 "add $16, %%"FF_REG_a
" \n\t"
231 ::
"r" (
block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
232 :
"%"FF_REG_a,
"memory"
238 int16_t *
block,
int n,
int qscale)
241 const uint16_t *quant_matrix;
245 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ]+1;
247 quant_matrix =
s->inter_matrix;
249 "pcmpeqw %%mm7, %%mm7 \n\t"
250 "psrlw $15, %%mm7 \n\t"
251 "movd %2, %%mm6 \n\t"
252 "packssdw %%mm6, %%mm6 \n\t"
253 "packssdw %%mm6, %%mm6 \n\t"
254 "mov %3, %%"FF_REG_a
" \n\t"
257 "movq (%0, %%"FF_REG_a
"), %%mm0 \n\t"
258 "movq 8(%0, %%"FF_REG_a
"), %%mm1\n\t"
259 "movq (%1, %%"FF_REG_a
"), %%mm4 \n\t"
260 "movq 8(%1, %%"FF_REG_a
"), %%mm5\n\t"
261 "pmullw %%mm6, %%mm4 \n\t"
262 "pmullw %%mm6, %%mm5 \n\t"
263 "pxor %%mm2, %%mm2 \n\t"
264 "pxor %%mm3, %%mm3 \n\t"
265 "pcmpgtw %%mm0, %%mm2 \n\t"
266 "pcmpgtw %%mm1, %%mm3 \n\t"
267 "pxor %%mm2, %%mm0 \n\t"
268 "pxor %%mm3, %%mm1 \n\t"
269 "psubw %%mm2, %%mm0 \n\t"
270 "psubw %%mm3, %%mm1 \n\t"
271 "paddw %%mm0, %%mm0 \n\t"
272 "paddw %%mm1, %%mm1 \n\t"
273 "paddw %%mm7, %%mm0 \n\t"
274 "paddw %%mm7, %%mm1 \n\t"
275 "pmullw %%mm4, %%mm0 \n\t"
276 "pmullw %%mm5, %%mm1 \n\t"
277 "pxor %%mm4, %%mm4 \n\t"
278 "pxor %%mm5, %%mm5 \n\t"
279 "pcmpeqw (%0, %%"FF_REG_a
"), %%mm4 \n\t"
280 "pcmpeqw 8(%0, %%"FF_REG_a
"), %%mm5\n\t"
281 "psraw $4, %%mm0 \n\t"
282 "psraw $4, %%mm1 \n\t"
283 "psubw %%mm7, %%mm0 \n\t"
284 "psubw %%mm7, %%mm1 \n\t"
285 "por %%mm7, %%mm0 \n\t"
286 "por %%mm7, %%mm1 \n\t"
287 "pxor %%mm2, %%mm0 \n\t"
288 "pxor %%mm3, %%mm1 \n\t"
289 "psubw %%mm2, %%mm0 \n\t"
290 "psubw %%mm3, %%mm1 \n\t"
291 "pandn %%mm0, %%mm4 \n\t"
292 "pandn %%mm1, %%mm5 \n\t"
293 "movq %%mm4, (%0, %%"FF_REG_a
") \n\t"
294 "movq %%mm5, 8(%0, %%"FF_REG_a
")\n\t"
296 "add $16, %%"FF_REG_a
" \n\t"
298 ::
"r" (
block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
299 :
"%"FF_REG_a,
"memory"
304 int16_t *
block,
int n,
int qscale)
307 const uint16_t *quant_matrix;
315 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ];
318 block0 =
block[0] *
s->y_dc_scale;
320 block0 =
block[0] *
s->c_dc_scale;
321 quant_matrix =
s->intra_matrix;
323 "pcmpeqw %%mm7, %%mm7 \n\t"
324 "psrlw $15, %%mm7 \n\t"
325 "movd %2, %%mm6 \n\t"
326 "packssdw %%mm6, %%mm6 \n\t"
327 "packssdw %%mm6, %%mm6 \n\t"
328 "mov %3, %%"FF_REG_a
" \n\t"
331 "movq (%0, %%"FF_REG_a
"), %%mm0 \n\t"
332 "movq 8(%0, %%"FF_REG_a
"), %%mm1\n\t"
333 "movq (%1, %%"FF_REG_a
"), %%mm4 \n\t"
334 "movq 8(%1, %%"FF_REG_a
"), %%mm5\n\t"
335 "pmullw %%mm6, %%mm4 \n\t"
336 "pmullw %%mm6, %%mm5 \n\t"
337 "pxor %%mm2, %%mm2 \n\t"
338 "pxor %%mm3, %%mm3 \n\t"
339 "pcmpgtw %%mm0, %%mm2 \n\t"
340 "pcmpgtw %%mm1, %%mm3 \n\t"
341 "pxor %%mm2, %%mm0 \n\t"
342 "pxor %%mm3, %%mm1 \n\t"
343 "psubw %%mm2, %%mm0 \n\t"
344 "psubw %%mm3, %%mm1 \n\t"
345 "pmullw %%mm4, %%mm0 \n\t"
346 "pmullw %%mm5, %%mm1 \n\t"
347 "pxor %%mm4, %%mm4 \n\t"
348 "pxor %%mm5, %%mm5 \n\t"
349 "pcmpeqw (%0, %%"FF_REG_a
"), %%mm4 \n\t"
350 "pcmpeqw 8(%0, %%"FF_REG_a
"), %%mm5\n\t"
351 "psraw $4, %%mm0 \n\t"
352 "psraw $4, %%mm1 \n\t"
353 "pxor %%mm2, %%mm0 \n\t"
354 "pxor %%mm3, %%mm1 \n\t"
355 "psubw %%mm2, %%mm0 \n\t"
356 "psubw %%mm3, %%mm1 \n\t"
357 "pandn %%mm0, %%mm4 \n\t"
358 "pandn %%mm1, %%mm5 \n\t"
359 "movq %%mm4, (%0, %%"FF_REG_a
") \n\t"
360 "movq %%mm5, 8(%0, %%"FF_REG_a
")\n\t"
362 "add $16, %%"FF_REG_a
" \n\t"
364 ::
"r" (
block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"g" (-2*nCoeffs)
365 :
"%"FF_REG_a,
"memory"
372 int16_t *
block,
int n,
int qscale)
375 const uint16_t *quant_matrix;
382 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ];
384 quant_matrix =
s->inter_matrix;
386 "pcmpeqw %%mm7, %%mm7 \n\t"
387 "psrlq $48, %%mm7 \n\t"
388 "movd %2, %%mm6 \n\t"
389 "packssdw %%mm6, %%mm6 \n\t"
390 "packssdw %%mm6, %%mm6 \n\t"
391 "mov %3, %%"FF_REG_a
" \n\t"
394 "movq (%0, %%"FF_REG_a
"), %%mm0 \n\t"
395 "movq 8(%0, %%"FF_REG_a
"), %%mm1\n\t"
396 "movq (%1, %%"FF_REG_a
"), %%mm4 \n\t"
397 "movq 8(%1, %%"FF_REG_a
"), %%mm5\n\t"
398 "pmullw %%mm6, %%mm4 \n\t"
399 "pmullw %%mm6, %%mm5 \n\t"
400 "pxor %%mm2, %%mm2 \n\t"
401 "pxor %%mm3, %%mm3 \n\t"
402 "pcmpgtw %%mm0, %%mm2 \n\t"
403 "pcmpgtw %%mm1, %%mm3 \n\t"
404 "pxor %%mm2, %%mm0 \n\t"
405 "pxor %%mm3, %%mm1 \n\t"
406 "psubw %%mm2, %%mm0 \n\t"
407 "psubw %%mm3, %%mm1 \n\t"
408 "paddw %%mm0, %%mm0 \n\t"
409 "paddw %%mm1, %%mm1 \n\t"
410 "pmullw %%mm4, %%mm0 \n\t"
411 "pmullw %%mm5, %%mm1 \n\t"
412 "paddw %%mm4, %%mm0 \n\t"
413 "paddw %%mm5, %%mm1 \n\t"
414 "pxor %%mm4, %%mm4 \n\t"
415 "pxor %%mm5, %%mm5 \n\t"
416 "pcmpeqw (%0, %%"FF_REG_a
"), %%mm4 \n\t"
417 "pcmpeqw 8(%0, %%"FF_REG_a
"), %%mm5\n\t"
418 "psrlw $5, %%mm0 \n\t"
419 "psrlw $5, %%mm1 \n\t"
420 "pxor %%mm2, %%mm0 \n\t"
421 "pxor %%mm3, %%mm1 \n\t"
422 "psubw %%mm2, %%mm0 \n\t"
423 "psubw %%mm3, %%mm1 \n\t"
424 "pandn %%mm0, %%mm4 \n\t"
425 "pandn %%mm1, %%mm5 \n\t"
426 "pxor %%mm4, %%mm7 \n\t"
427 "pxor %%mm5, %%mm7 \n\t"
428 "movq %%mm4, (%0, %%"FF_REG_a
") \n\t"
429 "movq %%mm5, 8(%0, %%"FF_REG_a
")\n\t"
431 "add $16, %%"FF_REG_a
" \n\t"
433 "movd 124(%0, %3), %%mm0 \n\t"
434 "movq %%mm7, %%mm6 \n\t"
435 "psrlq $32, %%mm7 \n\t"
436 "pxor %%mm6, %%mm7 \n\t"
437 "movq %%mm7, %%mm6 \n\t"
438 "psrlq $16, %%mm7 \n\t"
439 "pxor %%mm6, %%mm7 \n\t"
440 "pslld $31, %%mm7 \n\t"
441 "psrlq $15, %%mm7 \n\t"
442 "pxor %%mm7, %%mm0 \n\t"
443 "movd %%mm0, 124(%0, %3) \n\t"
445 ::
"r" (
block+nCoeffs),
"r"(quant_matrix+nCoeffs),
"rm" (qscale),
"r" (-2*nCoeffs)
446 :
"%"FF_REG_a,
"memory"
458 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
459 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
460 s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
461 s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx;
463 s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
464 s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;