68 { 71, 296, 295, 237, 71, 40, 38, 19,
69 245, 193, 185, 121, 102, 73, 53, 27,
70 158, 129, 141, 107, 97, 73, 50, 26,
71 102, 116, 109, 98, 82, 66, 45, 23,
72 71, 94, 95, 81, 70, 56, 38, 20,
73 56, 77, 74, 66, 56, 44, 30, 15,
74 38, 53, 50, 45, 38, 30, 21, 11,
75 20, 27, 26, 23, 20, 15, 11, 5
79 { 0, 48, 12, 60, 3, 51, 15, 63, },
80 { 32, 16, 44, 28, 35, 19, 47, 31, },
81 { 8, 56, 4, 52, 11, 59, 7, 55, },
82 { 40, 24, 36, 20, 43, 27, 39, 23, },
83 { 2, 50, 14, 62, 1, 49, 13, 61, },
84 { 34, 18, 46, 30, 33, 17, 45, 29, },
85 { 10, 58, 6, 54, 9, 57, 5, 53, },
86 { 42, 26, 38, 22, 41, 25, 37, 21, },
111 temp= (src[x + pos] + (d[pos]>>log2_scale))>>(6-log2_scale); \
112 src[x + pos]=src[x + pos - 8*src_stride]=0; \
113 if(temp & 0x100) temp= ~(temp>>31); \
118 for(x=0; x<
width; x+=8){
135 static void store_slice2_c(
uint8_t *dst, int16_t *
src,
int dst_stride,
int src_stride,
int width,
int height,
int log2_scale)
137 #define STORE2(pos) \
138 temp= (src[x + pos] + src[x + pos + 16*src_stride] + (d[pos]>>log2_scale))>>(6-log2_scale); \
139 src[x + pos + 16*src_stride]=0; \
140 if(temp & 0x100) temp= ~(temp>>31); \
145 for(x=0; x<
width; x+=8){
161 static void mul_thrmat_c(
struct vf_priv_s *p,
int q)
168 static void column_fidct_c(int16_t* thr_adr, int16_t *
data, int16_t *output,
int cnt);
169 static void row_idct_c(int16_t* workspace,
170 int16_t* output_adr,
int output_stride,
int cnt);
171 static void row_fdct_c(int16_t *
data,
const uint8_t *pixels,
int line_size,
int cnt);
174 #define store_slice_s store_slice_c
175 #define store_slice2_s store_slice2_c
176 #define mul_thrmat_s mul_thrmat_c
177 #define column_fidct_s column_fidct_c
178 #define row_idct_s row_idct_c
179 #define row_fdct_s row_fdct_c
184 static void store_slice_mmx(
uint8_t *dst, int16_t *src,
long dst_stride,
long src_stride,
long width,
long height,
long log2_scale)
188 width = (width+7)&~7;
192 "mov %5, %%"REG_d
" \n\t"
193 "mov %6, %%"REG_S
" \n\t"
194 "mov %7, %%"REG_D
" \n\t"
195 "mov %1, %%"REG_a
" \n\t"
196 "movd %%"REG_d
", %%mm5 \n\t"
197 "xor $-1, %%"REG_d
" \n\t"
198 "mov %%"REG_a
", %%"REG_c
" \n\t"
199 "add $7, %%"REG_d
" \n\t"
201 "sub %0, %%"REG_c
" \n\t"
202 "add %%"REG_c
", %%"REG_c
" \n\t"
203 "movd %%"REG_d
", %%mm2 \n\t"
204 "mov %%"REG_c
", %1 \n\t"
205 "mov %2, %%"REG_d
" \n\t"
206 "shl $4, %%"REG_a
" \n\t"
209 "movq (%%"REG_d
"), %%mm3 \n\t"
210 "movq %%mm3, %%mm4 \n\t"
211 "pxor %%mm7, %%mm7 \n\t"
212 "punpcklbw %%mm7, %%mm3 \n\t"
213 "punpckhbw %%mm7, %%mm4 \n\t"
214 "mov %0, %%"REG_c
" \n\t"
215 "psraw %%mm5, %%mm3 \n\t"
216 "psraw %%mm5, %%mm4 \n\t"
218 "movq %%mm7, (%%"REG_S
",%%"REG_a
") \n\t"
219 "movq (%%"REG_S
"), %%mm0 \n\t"
220 "movq 8(%%"REG_S
"), %%mm1 \n\t"
222 "movq %%mm7, 8(%%"REG_S
",%%"REG_a
") \n\t"
223 "paddw %%mm3, %%mm0 \n\t"
224 "paddw %%mm4, %%mm1 \n\t"
226 "movq %%mm7, (%%"REG_S
") \n\t"
227 "psraw %%mm2, %%mm0 \n\t"
228 "psraw %%mm2, %%mm1 \n\t"
230 "movq %%mm7, 8(%%"REG_S
") \n\t"
231 "packuswb %%mm1, %%mm0 \n\t"
232 "add $16, %%"REG_S
" \n\t"
234 "movq %%mm0, (%%"REG_D
") \n\t"
235 "add $8, %%"REG_D
" \n\t"
236 "sub $8, %%"REG_c
" \n\t"
238 "add %1, %%"REG_S
" \n\t"
239 "add $8, %%"REG_d
" \n\t"
240 "add %3, %%"REG_D
" \n\t"
241 "cmp %4, %%"REG_d
" \n\t"
245 :
"m" (
width),
"m" (src_stride),
"erm" (od),
"m" (dst_stride),
"erm" (
end),
246 "m" (log2_scale),
"m" (
src),
"m" (dst)
247 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_S,
"%"REG_D
252 static void store_slice2_mmx(
uint8_t *dst, int16_t *src,
long dst_stride,
long src_stride,
long width,
long height,
long log2_scale)
256 width = (width+7)&~7;
260 "mov %5, %%"REG_d
" \n\t"
261 "mov %6, %%"REG_S
" \n\t"
262 "mov %7, %%"REG_D
" \n\t"
263 "mov %1, %%"REG_a
" \n\t"
264 "movd %%"REG_d
", %%mm5 \n\t"
265 "xor $-1, %%"REG_d
" \n\t"
266 "mov %%"REG_a
", %%"REG_c
" \n\t"
267 "add $7, %%"REG_d
" \n\t"
268 "sub %0, %%"REG_c
" \n\t"
269 "add %%"REG_c
", %%"REG_c
" \n\t"
270 "movd %%"REG_d
", %%mm2 \n\t"
271 "mov %%"REG_c
", %1 \n\t"
272 "mov %2, %%"REG_d
" \n\t"
273 "shl $5, %%"REG_a
" \n\t"
276 "movq (%%"REG_d
"), %%mm3 \n\t"
277 "movq %%mm3, %%mm4 \n\t"
278 "pxor %%mm7, %%mm7 \n\t"
279 "punpcklbw %%mm7, %%mm3 \n\t"
280 "punpckhbw %%mm7, %%mm4 \n\t"
281 "mov %0, %%"REG_c
" \n\t"
282 "psraw %%mm5, %%mm3 \n\t"
283 "psraw %%mm5, %%mm4 \n\t"
285 "movq (%%"REG_S
"), %%mm0 \n\t"
286 "movq 8(%%"REG_S
"), %%mm1 \n\t"
287 "paddw %%mm3, %%mm0 \n\t"
289 "paddw (%%"REG_S
",%%"REG_a
"), %%mm0 \n\t"
290 "paddw %%mm4, %%mm1 \n\t"
291 "movq 8(%%"REG_S
",%%"REG_a
"), %%mm6 \n\t"
293 "movq %%mm7, (%%"REG_S
",%%"REG_a
") \n\t"
294 "psraw %%mm2, %%mm0 \n\t"
295 "paddw %%mm6, %%mm1 \n\t"
297 "movq %%mm7, 8(%%"REG_S
",%%"REG_a
") \n\t"
298 "psraw %%mm2, %%mm1 \n\t"
299 "packuswb %%mm1, %%mm0 \n\t"
301 "movq %%mm0, (%%"REG_D
") \n\t"
302 "add $16, %%"REG_S
" \n\t"
303 "add $8, %%"REG_D
" \n\t"
304 "sub $8, %%"REG_c
" \n\t"
306 "add %1, %%"REG_S
" \n\t"
307 "add $8, %%"REG_d
" \n\t"
308 "add %3, %%"REG_D
" \n\t"
309 "cmp %4, %%"REG_d
" \n\t"
313 :
"m" (
width),
"m" (src_stride),
"erm" (od),
"m" (dst_stride),
"erm" (
end),
314 "m" (log2_scale),
"m" (
src),
"m" (dst)
315 :
"%"REG_a,
"%"REG_c,
"%"REG_d,
"%"REG_D,
"%"REG_S
323 "movd %0, %%mm7 \n\t"
324 "add $8*8*2, %%"REG_D
" \n\t"
325 "movq 0*8(%%"REG_S
"), %%mm0 \n\t"
326 "punpcklwd %%mm7, %%mm7 \n\t"
327 "movq 1*8(%%"REG_S
"), %%mm1 \n\t"
328 "punpckldq %%mm7, %%mm7 \n\t"
329 "pmullw %%mm7, %%mm0 \n\t"
331 "movq 2*8(%%"REG_S
"), %%mm2 \n\t"
332 "pmullw %%mm7, %%mm1 \n\t"
334 "movq 3*8(%%"REG_S
"), %%mm3 \n\t"
335 "pmullw %%mm7, %%mm2 \n\t"
337 "movq %%mm0, 0*8(%%"REG_D
") \n\t"
338 "movq 4*8(%%"REG_S
"), %%mm4 \n\t"
339 "pmullw %%mm7, %%mm3 \n\t"
341 "movq %%mm1, 1*8(%%"REG_D
") \n\t"
342 "movq 5*8(%%"REG_S
"), %%mm5 \n\t"
343 "pmullw %%mm7, %%mm4 \n\t"
345 "movq %%mm2, 2*8(%%"REG_D
") \n\t"
346 "movq 6*8(%%"REG_S
"), %%mm6 \n\t"
347 "pmullw %%mm7, %%mm5 \n\t"
349 "movq %%mm3, 3*8(%%"REG_D
") \n\t"
350 "movq 7*8+0*8(%%"REG_S
"), %%mm0 \n\t"
351 "pmullw %%mm7, %%mm6 \n\t"
353 "movq %%mm4, 4*8(%%"REG_D
") \n\t"
354 "movq 7*8+1*8(%%"REG_S
"), %%mm1 \n\t"
355 "pmullw %%mm7, %%mm0 \n\t"
357 "movq %%mm5, 5*8(%%"REG_D
") \n\t"
358 "movq 7*8+2*8(%%"REG_S
"), %%mm2 \n\t"
359 "pmullw %%mm7, %%mm1 \n\t"
361 "movq %%mm6, 6*8(%%"REG_D
") \n\t"
362 "movq 7*8+3*8(%%"REG_S
"), %%mm3 \n\t"
363 "pmullw %%mm7, %%mm2 \n\t"
365 "movq %%mm0, 7*8+0*8(%%"REG_D
") \n\t"
366 "movq 7*8+4*8(%%"REG_S
"), %%mm4 \n\t"
367 "pmullw %%mm7, %%mm3 \n\t"
369 "movq %%mm1, 7*8+1*8(%%"REG_D
") \n\t"
370 "movq 7*8+5*8(%%"REG_S
"), %%mm5 \n\t"
371 "pmullw %%mm7, %%mm4 \n\t"
373 "movq %%mm2, 7*8+2*8(%%"REG_D
") \n\t"
374 "movq 7*8+6*8(%%"REG_S
"), %%mm6 \n\t"
375 "pmullw %%mm7, %%mm5 \n\t"
377 "movq %%mm3, 7*8+3*8(%%"REG_D
") \n\t"
378 "movq 14*8+0*8(%%"REG_S
"), %%mm0 \n\t"
379 "pmullw %%mm7, %%mm6 \n\t"
381 "movq %%mm4, 7*8+4*8(%%"REG_D
") \n\t"
382 "movq 14*8+1*8(%%"REG_S
"), %%mm1 \n\t"
383 "pmullw %%mm7, %%mm0 \n\t"
385 "movq %%mm5, 7*8+5*8(%%"REG_D
") \n\t"
386 "pmullw %%mm7, %%mm1 \n\t"
388 "movq %%mm6, 7*8+6*8(%%"REG_D
") \n\t"
389 "movq %%mm0, 14*8+0*8(%%"REG_D
") \n\t"
390 "movq %%mm1, 14*8+1*8(%%"REG_D
") \n\t"
392 :
"+g" (q),
"+S" (adr),
"+D" (adr)
399 int16_t* output_adr,
int output_stride,
int cnt);
402 #define store_slice_s store_slice_mmx
403 #define store_slice2_s store_slice2_mmx
404 #define mul_thrmat_s mul_thrmat_mmx
405 #define column_fidct_s column_fidct_mmx
406 #define row_idct_s row_idct_mmx
407 #define row_fdct_s row_fdct_mmx
411 int dst_stride,
int src_stride,
412 int width,
int height,
413 uint8_t *qp_store,
int qp_stride,
int is_luma)
415 int x, x0,
y, es, qy, t;
418 const int qps= 3 + is_luma;
420 int16_t *
block= (int16_t *)block_align;
421 int16_t *block3=(int16_t *)(block_align+4*8*
BLOCKSZ);
423 memset(block3, 0, 4*8*
BLOCKSZ);
426 if (!src || !dst)
return;
428 int index= 8 + 8*stride + y*stride;
431 p->
src[index - x - 1]= p->
src[index + x ];
432 p->
src[index + width + x ]= p->
src[index + width - x - 1];
442 memset(p->
temp+ 8 +y*stride, 0,width*
sizeof(int16_t));
444 for(y=step; y<height+8; y+=step){
446 if (qy>height-1) qy=height-1;
448 qy=(qy>>qps)*qp_stride;
455 for (x=0; x<8*(
BLOCKSZ-1); x+=8) {
458 t=qp_store[qy+(t>>qps)];
464 memmove(block, block+(
BLOCKSZ-1)*64, 8*8*
sizeof(int16_t));
465 memmove(block3, block3+(
BLOCKSZ-1)*64, 6*8*
sizeof(int16_t));
470 row_fdct_s(block+8*8, p->
src + y*stride+8+x0 +2-(y&1), stride, (es-4)>>2);
472 row_idct_s(block3+0*8, p->
temp + (y&15)*stride+x0+2-(y&1), stride, es>>2);
473 {
const int y1=y-8+step;
476 dst_stride, stride, width, 8, 5-p->
log2_count);
478 dst_stride, stride, width, 8, 5-p->
log2_count);
484 dst_stride, stride, width, y&7, 5-p->
log2_count);
486 dst_stride, stride, width, y&7, 5-p->
log2_count);
490 static int config(
struct vf_instance *vf,
491 int width,
int height,
int d_width,
int d_height,
492 unsigned int flags,
unsigned int outfmt)
494 int h= (height+16+15)&(~15);
496 vf->priv->temp_stride= (width+16+15)&(~15);
497 vf->priv->temp= (int16_t*)
av_mallocz(vf->priv->temp_stride*3*8*
sizeof(int16_t));
510 mpi->
planes[0]=vf->dmpi->planes[0];
511 mpi->
stride[0]=vf->dmpi->stride[0];
512 mpi->
width=vf->dmpi->width;
514 mpi->
planes[1]=vf->dmpi->planes[1];
515 mpi->
planes[2]=vf->dmpi->planes[2];
516 mpi->
stride[1]=vf->dmpi->stride[1];
517 mpi->
stride[2]=vf->dmpi->stride[2];
539 int h = (mpi->
h + 15) >> 4;
541 w = (mpi->
w + 15) >> 4;
544 if(!vf->priv->non_b_qp)
545 vf->priv->non_b_qp= malloc(w*h);
549 char *qp_tab= vf->priv->non_b_qp;
550 if(vf->priv->bframes || !qp_tab)
553 if(qp_tab || vf->priv->qp){
555 mpi->
w, mpi->
h, qp_tab, mpi->
qstride, 1);
576 static void uninit(
struct vf_instance *vf)
578 if(!vf->priv)
return;
581 vf->priv->temp= NULL;
586 free(vf->priv->non_b_qp);
587 vf->priv->non_b_qp= NULL;
614 static int control(
struct vf_instance *vf,
int request,
void*
data)
620 vf->priv->log2_count= *((
unsigned int*)data);
621 if (vf->priv->log2_count < 4) vf->priv->log2_count=4;
630 int custom_threshold_m[64];
649 if (args) sscanf(args,
"%d:%d:%d:%d", &log2c, &vf->
priv->
qp, &i, &vf->
priv->
bframes);
651 if( log2c >=4 && log2c <=5 )
653 else if( log2c >= 6 )
659 if (i < -15) i = -15;
669 |(((uint64_t)custom_threshold_m[i*8+6])<<16)
670 |(((uint64_t)custom_threshold_m[i*8+0])<<32)
671 |(((uint64_t)custom_threshold_m[i*8+4])<<48);
673 |(((uint64_t)custom_threshold_m[i*8+3])<<16)
674 |(((uint64_t)custom_threshold_m[i*8+1])<<32)
675 |(((uint64_t)custom_threshold_m[i*8+7])<<48);
684 "fast simple postprocess",
686 "Michael Niedermayer, Nikolaj Poroshin",
701 #define DCTSIZE_S "8"
703 #define FIX(x,s) ((int) ((x) * (1<<s) + 0.5)&0xffff)
704 #define C64(x) ((uint64_t)((x)|(x)<<16))<<32 | (uint64_t)(x) | (uint64_t)(x)<<16
705 #define FIX64(x,s) C64(FIX(x,s))
707 #define MULTIPLY16H(x,k) (((x)*(k))>>16)
708 #define THRESHOLD(r,x,t) if(((unsigned)((x)+t))>t*2) r=(x);else r=0;
709 #define DESCALE(x,n) (((x) + (1 << ((n)-1))) >> n)
739 static const int16_t FIX_1_414213562_A=
FIX(1.414213562, 14);
749 static void column_fidct_c(int16_t* thr_adr, int16_t *
data, int16_t *output,
int cnt)
751 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
752 int_simd16_t tmp10, tmp11, tmp12, tmp13;
753 int_simd16_t z1,z2,z3,z4,z5, z10, z11, z12, z13;
754 int_simd16_t d0, d1, d2, d3, d4, d5, d6, d7;
764 for (; cnt > 0; cnt-=2) {
765 threshold=(int16_t*)thr_adr;
766 for (ctr =
DCTSIZE; ctr > 0; ctr--) {
790 z1 =
MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781);
801 tmp10 = (tmp0 + tmp2)>>2;
802 tmp11 = (tmp0 - tmp2)>>2;
804 tmp13 = (tmp1 + tmp3)>>2;
805 tmp12 =
MULTIPLY16H((tmp1 - tmp3), FIX_1_414213562_A) - tmp13;
807 tmp0 = tmp10 + tmp13;
808 tmp3 = tmp10 - tmp13;
809 tmp1 = tmp11 + tmp12;
810 tmp2 = tmp11 - tmp12;
818 z5 =
MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433);
840 z10 = (tmp6 - tmp5)<<1;
842 z12 = (tmp4 - tmp7)<<1;
844 tmp7 = (z11 + z13)>>2;
845 tmp11 =
MULTIPLY16H((z11 - z13)<<1, FIX_1_414213562);
854 wsptr[
DCTSIZE*0]+= (tmp0 + tmp7);
855 wsptr[
DCTSIZE*1]+= (tmp1 + tmp6);
856 wsptr[
DCTSIZE*2]+= (tmp2 + tmp5);
857 wsptr[
DCTSIZE*3]+= (tmp3 - tmp4);
858 wsptr[
DCTSIZE*4]+= (tmp3 + tmp4);
859 wsptr[
DCTSIZE*5]+= (tmp2 - tmp5);
860 wsptr[
DCTSIZE*6]= (tmp1 - tmp6);
861 wsptr[
DCTSIZE*7]= (tmp0 - tmp7);
880 "movq "DCTSIZE_S"*0*2(%%"REG_S
"), %%mm1 \n\t"
882 "movq "DCTSIZE_S"*3*2(%%"REG_S
"), %%mm7 \n\t"
883 "movq %%mm1, %%mm0 \n\t"
885 "paddw "DCTSIZE_S"*7*2(%%"REG_S
"), %%mm1 \n\t"
886 "movq %%mm7, %%mm3 \n\t"
888 "paddw "DCTSIZE_S"*4*2(%%"REG_S
"), %%mm7 \n\t"
889 "movq %%mm1, %%mm5 \n\t"
891 "movq "DCTSIZE_S"*1*2(%%"REG_S
"), %%mm6 \n\t"
892 "psubw %%mm7, %%mm1 \n\t"
894 "movq "DCTSIZE_S"*2*2(%%"REG_S
"), %%mm2 \n\t"
895 "movq %%mm6, %%mm4 \n\t"
897 "paddw "DCTSIZE_S"*6*2(%%"REG_S
"), %%mm6 \n\t"
898 "paddw %%mm7, %%mm5 \n\t"
900 "paddw "DCTSIZE_S"*5*2(%%"REG_S
"), %%mm2 \n\t"
901 "movq %%mm6, %%mm7 \n\t"
903 "paddw %%mm2, %%mm6 \n\t"
904 "psubw %%mm2, %%mm7 \n\t"
906 "movq %%mm5, %%mm2 \n\t"
907 "paddw %%mm6, %%mm5 \n\t"
909 "psubw %%mm6, %%mm2 \n\t"
910 "paddw %%mm1, %%mm7 \n\t"
912 "movq 4*16(%%"REG_d
"), %%mm6 \n\t"
913 "psllw $2, %%mm7 \n\t"
915 "psubw 0*16(%%"REG_d
"), %%mm5 \n\t"
916 "psubw %%mm6, %%mm2 \n\t"
918 "paddusw 0*16(%%"REG_d
"), %%mm5 \n\t"
919 "paddusw %%mm6, %%mm2 \n\t"
923 "paddw 0*16(%%"REG_d
"), %%mm5 \n\t"
924 "paddw %%mm6, %%mm2 \n\t"
926 "psubusw 0*16(%%"REG_d
"), %%mm5 \n\t"
927 "psubusw %%mm6, %%mm2 \n\t"
932 "paddw "MANGLE(MM_2)
", %%mm5 \n\t"
933 "movq %%mm2, %%mm6 \n\t"
935 "paddw %%mm5, %%mm2 \n\t"
936 "psubw %%mm6, %%mm5 \n\t"
938 "movq %%mm1, %%mm6 \n\t"
939 "paddw %%mm7, %%mm1 \n\t"
941 "psubw 2*16(%%"REG_d
"), %%mm1 \n\t"
942 "psubw %%mm7, %%mm6 \n\t"
944 "movq 6*16(%%"REG_d
"), %%mm7 \n\t"
945 "psraw $2, %%mm5 \n\t"
947 "paddusw 2*16(%%"REG_d
"), %%mm1 \n\t"
948 "psubw %%mm7, %%mm6 \n\t"
951 "paddw 2*16(%%"REG_d
"), %%mm1 \n\t"
952 "paddusw %%mm7, %%mm6 \n\t"
954 "psubusw 2*16(%%"REG_d
"), %%mm1 \n\t"
955 "paddw %%mm7, %%mm6 \n\t"
957 "psubw "DCTSIZE_S"*4*2(%%"REG_S
"), %%mm3 \n\t"
958 "psubusw %%mm7, %%mm6 \n\t"
962 "movq %%mm1, %%mm7 \n\t"
963 "psraw $2, %%mm2 \n\t"
965 "psubw "DCTSIZE_S"*6*2(%%"REG_S
"), %%mm4 \n\t"
966 "psubw %%mm6, %%mm1 \n\t"
968 "psubw "DCTSIZE_S"*7*2(%%"REG_S
"), %%mm0 \n\t"
969 "paddw %%mm7, %%mm6 \n\t"
971 "psraw $2, %%mm6 \n\t"
972 "movq %%mm2, %%mm7 \n\t"
974 "pmulhw "MANGLE(MM_FIX_1_414213562_A)
", %%mm1 \n\t"
975 "paddw %%mm6, %%mm2 \n\t"
977 "movq %%mm2, 0*8+%3 \n\t"
978 "psubw %%mm6, %%mm7 \n\t"
980 "movq "DCTSIZE_S"*2*2(%%"REG_S
"), %%mm2 \n\t"
981 "psubw %%mm6, %%mm1 \n\t"
983 "psubw "DCTSIZE_S"*5*2(%%"REG_S
"), %%mm2 \n\t"
984 "movq %%mm5, %%mm6 \n\t"
986 "movq %%mm7, 3*8+%3 \n\t"
987 "paddw %%mm2, %%mm3 \n\t"
989 "paddw %%mm4, %%mm2 \n\t"
990 "paddw %%mm0, %%mm4 \n\t"
992 "movq %%mm3, %%mm7 \n\t"
993 "psubw %%mm4, %%mm3 \n\t"
995 "psllw $2, %%mm3 \n\t"
996 "psllw $2, %%mm7 \n\t"
998 "pmulhw "MANGLE(MM_FIX_0_382683433)
", %%mm3 \n\t"
999 "psllw $2, %%mm4 \n\t"
1002 "psllw $2, %%mm2 \n\t"
1004 "pmulhw "MANGLE(MM_FIX_1_306562965)
", %%mm4 \n\t"
1005 "paddw %%mm1, %%mm5 \n\t"
1008 "psubw %%mm1, %%mm6 \n\t"
1011 "paddw %%mm3, %%mm7 \n\t"
1013 "movq %%mm5, 1*8+%3 \n\t"
1014 "paddw %%mm3, %%mm4 \n\t"
1016 "movq 3*16(%%"REG_d
"), %%mm3 \n\t"
1017 "movq %%mm0, %%mm1 \n\t"
1019 "movq %%mm6, 2*8+%3 \n\t"
1020 "psubw %%mm2, %%mm1 \n\t"
1023 "paddw %%mm2, %%mm0 \n\t"
1024 "movq %%mm1, %%mm5 \n\t"
1026 "movq 5*16(%%"REG_d
"), %%mm2 \n\t"
1027 "psubw %%mm7, %%mm1 \n\t"
1029 "paddw %%mm7, %%mm5 \n\t"
1030 "psubw %%mm3, %%mm1 \n\t"
1032 "movq 1*16(%%"REG_d
"), %%mm7 \n\t"
1033 "psubw %%mm2, %%mm5 \n\t"
1035 "movq %%mm0, %%mm6 \n\t"
1036 "paddw %%mm4, %%mm0 \n\t"
1038 "paddusw %%mm3, %%mm1 \n\t"
1039 "psubw %%mm4, %%mm6 \n\t"
1042 "movq 7*16(%%"REG_d
"), %%mm4 \n\t"
1043 "psubw %%mm7, %%mm0 \n\t"
1045 "psubw %%mm4, %%mm6 \n\t"
1046 "paddusw %%mm2, %%mm5 \n\t"
1048 "paddusw %%mm4, %%mm6 \n\t"
1049 "paddw %%mm3, %%mm1 \n\t"
1051 "paddw %%mm2, %%mm5 \n\t"
1052 "paddw %%mm4, %%mm6 \n\t"
1054 "psubusw %%mm3, %%mm1 \n\t"
1055 "psubusw %%mm2, %%mm5 \n\t"
1057 "psubusw %%mm4, %%mm6 \n\t"
1058 "movq %%mm1, %%mm4 \n\t"
1060 "por %%mm5, %%mm4 \n\t"
1061 "paddusw %%mm7, %%mm0 \n\t"
1063 "por %%mm6, %%mm4 \n\t"
1064 "paddw %%mm7, %%mm0 \n\t"
1066 "packssdw %%mm4, %%mm4 \n\t"
1067 "psubusw %%mm7, %%mm0 \n\t"
1069 "movd %%mm4, %%"REG_a
" \n\t"
1070 "or %%"REG_a
", %%"REG_a
" \n\t"
1079 "movq 0*8+%3, %%mm4 \n\t"
1080 "movq %%mm0, %%mm1 \n\t"
1082 "pmulhw "MANGLE(MM_FIX_0_847759065)
", %%mm0 \n\t"
1083 "movq %%mm1, %%mm2 \n\t"
1085 "movq "DCTSIZE_S"*0*2(%%"REG_D
"), %%mm5 \n\t"
1086 "movq %%mm2, %%mm3 \n\t"
1088 "pmulhw "MANGLE(MM_FIX_0_566454497)
", %%mm1 \n\t"
1089 "paddw %%mm4, %%mm5 \n\t"
1091 "movq 1*8+%3, %%mm6 \n\t"
1093 "psraw $2, %%mm3 \n\t"
1095 "pmulhw "MANGLE(MM_FIX_0_198912367)
", %%mm2 \n\t"
1096 "psubw %%mm3, %%mm4 \n\t"
1098 "movq "DCTSIZE_S"*1*2(%%"REG_D
"), %%mm7 \n\t"
1099 "paddw %%mm3, %%mm5 \n\t"
1101 "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D
") \n\t"
1102 "paddw %%mm6, %%mm7 \n\t"
1104 "movq 2*8+%3, %%mm3 \n\t"
1105 "psubw %%mm0, %%mm6 \n\t"
1107 "movq "DCTSIZE_S"*2*2(%%"REG_D
"), %%mm4 \n\t"
1108 "paddw %%mm0, %%mm7 \n\t"
1110 "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D
") \n\t"
1111 "paddw %%mm3, %%mm4 \n\t"
1113 "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D
") \n\t"
1114 "psubw %%mm1, %%mm3 \n\t"
1116 "movq "DCTSIZE_S"*5*2(%%"REG_D
"), %%mm5 \n\t"
1117 "paddw %%mm1, %%mm4 \n\t"
1119 "movq "DCTSIZE_S"*3*2(%%"REG_D
"), %%mm6 \n\t"
1120 "paddw %%mm3, %%mm5 \n\t"
1122 "movq 3*8+%3, %%mm0 \n\t"
1123 "add $8, %%"REG_S
" \n\t"
1125 "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D
") \n\t"
1126 "paddw %%mm0, %%mm6 \n\t"
1128 "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D
") \n\t"
1129 "psubw %%mm2, %%mm0 \n\t"
1131 "movq "DCTSIZE_S"*4*2(%%"REG_D
"), %%mm7 \n\t"
1132 "paddw %%mm2, %%mm6 \n\t"
1134 "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D
") \n\t"
1135 "paddw %%mm0, %%mm7 \n\t"
1137 "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D
") \n\t"
1139 "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D
") \n\t"
1140 "add $8, %%"REG_D
" \n\t"
1149 "movq %%mm5, %%mm3 \n\t"
1150 "psubw %%mm1, %%mm5 \n\t"
1152 "psllw $1, %%mm5 \n\t"
1153 "paddw %%mm1, %%mm3 \n\t"
1155 "movq %%mm0, %%mm2 \n\t"
1156 "psubw %%mm6, %%mm0 \n\t"
1158 "movq %%mm5, %%mm1 \n\t"
1159 "psllw $1, %%mm0 \n\t"
1161 "pmulhw "MANGLE(MM_FIX_2_613125930)
", %%mm1 \n\t"
1162 "paddw %%mm0, %%mm5 \n\t"
1164 "pmulhw "MANGLE(MM_FIX_1_847759065)
", %%mm5 \n\t"
1165 "paddw %%mm6, %%mm2 \n\t"
1167 "pmulhw "MANGLE(MM_FIX_1_082392200)
", %%mm0 \n\t"
1168 "movq %%mm2, %%mm7 \n\t"
1171 "movq 0*8+%3, %%mm4 \n\t"
1172 "psubw %%mm3, %%mm2 \n\t"
1174 "psllw $1, %%mm2 \n\t"
1175 "paddw %%mm3, %%mm7 \n\t"
1177 "pmulhw "MANGLE(MM_FIX_1_414213562)
", %%mm2 \n\t"
1178 "movq %%mm4, %%mm6 \n\t"
1180 "psraw $2, %%mm7 \n\t"
1182 "paddw "DCTSIZE_S"*0*2(%%"REG_D
"), %%mm4 \n\t"
1183 "psubw %%mm7, %%mm6 \n\t"
1185 "movq 1*8+%3, %%mm3 \n\t"
1186 "paddw %%mm7, %%mm4 \n\t"
1188 "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D
") \n\t"
1189 "paddw %%mm5, %%mm1 \n\t"
1191 "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D
") \n\t"
1192 "psubw %%mm7, %%mm1 \n\t"
1194 "movq 2*8+%3, %%mm7 \n\t"
1195 "psubw %%mm5, %%mm0 \n\t"
1197 "movq 3*8+%3, %%mm6 \n\t"
1198 "movq %%mm3, %%mm5 \n\t"
1200 "paddw "DCTSIZE_S"*1*2(%%"REG_D
"), %%mm3 \n\t"
1201 "psubw %%mm1, %%mm5 \n\t"
1203 "psubw %%mm1, %%mm2 \n\t"
1204 "paddw %%mm1, %%mm3 \n\t"
1206 "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D
") \n\t"
1207 "movq %%mm7, %%mm4 \n\t"
1209 "paddw "DCTSIZE_S"*2*2(%%"REG_D
"), %%mm7 \n\t"
1210 "psubw %%mm2, %%mm4 \n\t"
1212 "paddw "DCTSIZE_S"*5*2(%%"REG_D
"), %%mm4 \n\t"
1213 "paddw %%mm2, %%mm7 \n\t"
1215 "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D
") \n\t"
1216 "paddw %%mm2, %%mm0 \n\t"
1219 "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D
") \n\t"
1220 "movq %%mm6, %%mm1 \n\t"
1222 "paddw "DCTSIZE_S"*4*2(%%"REG_D
"), %%mm6 \n\t"
1223 "psubw %%mm0, %%mm1 \n\t"
1225 "paddw "DCTSIZE_S"*3*2(%%"REG_D
"), %%mm1 \n\t"
1226 "paddw %%mm0, %%mm6 \n\t"
1228 "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D
") \n\t"
1229 "add $8, %%"REG_S
" \n\t"
1231 "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D
") \n\t"
1233 "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D
") \n\t"
1234 "add $8, %%"REG_D
" \n\t"
1238 "movq "DCTSIZE_S"*0*2(%%"REG_S
"), %%mm1 \n\t"
1240 "movq "DCTSIZE_S"*3*2(%%"REG_S
"), %%mm7 \n\t"
1241 "movq %%mm1, %%mm0 \n\t"
1243 "paddw "DCTSIZE_S"*7*2(%%"REG_S
"), %%mm1 \n\t"
1244 "movq %%mm7, %%mm3 \n\t"
1246 "paddw "DCTSIZE_S"*4*2(%%"REG_S
"), %%mm7 \n\t"
1247 "movq %%mm1, %%mm5 \n\t"
1249 "movq "DCTSIZE_S"*1*2(%%"REG_S
"), %%mm6 \n\t"
1250 "psubw %%mm7, %%mm1 \n\t"
1252 "movq "DCTSIZE_S"*2*2(%%"REG_S
"), %%mm2 \n\t"
1253 "movq %%mm6, %%mm4 \n\t"
1255 "paddw "DCTSIZE_S"*6*2(%%"REG_S
"), %%mm6 \n\t"
1256 "paddw %%mm7, %%mm5 \n\t"
1258 "paddw "DCTSIZE_S"*5*2(%%"REG_S
"), %%mm2 \n\t"
1259 "movq %%mm6, %%mm7 \n\t"
1261 "paddw %%mm2, %%mm6 \n\t"
1262 "psubw %%mm2, %%mm7 \n\t"
1264 "movq %%mm5, %%mm2 \n\t"
1265 "paddw %%mm6, %%mm5 \n\t"
1267 "psubw %%mm6, %%mm2 \n\t"
1268 "paddw %%mm1, %%mm7 \n\t"
1270 "movq 1*8+4*16(%%"REG_d
"), %%mm6 \n\t"
1271 "psllw $2, %%mm7 \n\t"
1273 "psubw 1*8+0*16(%%"REG_d
"), %%mm5 \n\t"
1274 "psubw %%mm6, %%mm2 \n\t"
1276 "paddusw 1*8+0*16(%%"REG_d
"), %%mm5 \n\t"
1277 "paddusw %%mm6, %%mm2 \n\t"
1281 "paddw 1*8+0*16(%%"REG_d
"), %%mm5 \n\t"
1282 "paddw %%mm6, %%mm2 \n\t"
1284 "psubusw 1*8+0*16(%%"REG_d
"), %%mm5 \n\t"
1285 "psubusw %%mm6, %%mm2 \n\t"
1290 "paddw "MANGLE(MM_2)
", %%mm5 \n\t"
1291 "movq %%mm2, %%mm6 \n\t"
1293 "paddw %%mm5, %%mm2 \n\t"
1294 "psubw %%mm6, %%mm5 \n\t"
1296 "movq %%mm1, %%mm6 \n\t"
1297 "paddw %%mm7, %%mm1 \n\t"
1299 "psubw 1*8+2*16(%%"REG_d
"), %%mm1 \n\t"
1300 "psubw %%mm7, %%mm6 \n\t"
1302 "movq 1*8+6*16(%%"REG_d
"), %%mm7 \n\t"
1303 "psraw $2, %%mm5 \n\t"
1305 "paddusw 1*8+2*16(%%"REG_d
"), %%mm1 \n\t"
1306 "psubw %%mm7, %%mm6 \n\t"
1309 "paddw 1*8+2*16(%%"REG_d
"), %%mm1 \n\t"
1310 "paddusw %%mm7, %%mm6 \n\t"
1312 "psubusw 1*8+2*16(%%"REG_d
"), %%mm1 \n\t"
1313 "paddw %%mm7, %%mm6 \n\t"
1315 "psubw "DCTSIZE_S"*4*2(%%"REG_S
"), %%mm3 \n\t"
1316 "psubusw %%mm7, %%mm6 \n\t"
1320 "movq %%mm1, %%mm7 \n\t"
1321 "psraw $2, %%mm2 \n\t"
1323 "psubw "DCTSIZE_S"*6*2(%%"REG_S
"), %%mm4 \n\t"
1324 "psubw %%mm6, %%mm1 \n\t"
1326 "psubw "DCTSIZE_S"*7*2(%%"REG_S
"), %%mm0 \n\t"
1327 "paddw %%mm7, %%mm6 \n\t"
1329 "psraw $2, %%mm6 \n\t"
1330 "movq %%mm2, %%mm7 \n\t"
1332 "pmulhw "MANGLE(MM_FIX_1_414213562_A)
", %%mm1 \n\t"
1333 "paddw %%mm6, %%mm2 \n\t"
1335 "movq %%mm2, 0*8+%3 \n\t"
1336 "psubw %%mm6, %%mm7 \n\t"
1338 "movq "DCTSIZE_S"*2*2(%%"REG_S
"), %%mm2 \n\t"
1339 "psubw %%mm6, %%mm1 \n\t"
1341 "psubw "DCTSIZE_S"*5*2(%%"REG_S
"), %%mm2 \n\t"
1342 "movq %%mm5, %%mm6 \n\t"
1344 "movq %%mm7, 3*8+%3 \n\t"
1345 "paddw %%mm2, %%mm3 \n\t"
1347 "paddw %%mm4, %%mm2 \n\t"
1348 "paddw %%mm0, %%mm4 \n\t"
1350 "movq %%mm3, %%mm7 \n\t"
1351 "psubw %%mm4, %%mm3 \n\t"
1353 "psllw $2, %%mm3 \n\t"
1354 "psllw $2, %%mm7 \n\t"
1356 "pmulhw "MANGLE(MM_FIX_0_382683433)
", %%mm3 \n\t"
1357 "psllw $2, %%mm4 \n\t"
1360 "psllw $2, %%mm2 \n\t"
1362 "pmulhw "MANGLE(MM_FIX_1_306562965)
", %%mm4 \n\t"
1363 "paddw %%mm1, %%mm5 \n\t"
1366 "psubw %%mm1, %%mm6 \n\t"
1369 "paddw %%mm3, %%mm7 \n\t"
1371 "movq %%mm5, 1*8+%3 \n\t"
1372 "paddw %%mm3, %%mm4 \n\t"
1374 "movq 1*8+3*16(%%"REG_d
"), %%mm3 \n\t"
1375 "movq %%mm0, %%mm1 \n\t"
1377 "movq %%mm6, 2*8+%3 \n\t"
1378 "psubw %%mm2, %%mm1 \n\t"
1381 "paddw %%mm2, %%mm0 \n\t"
1382 "movq %%mm1, %%mm5 \n\t"
1384 "movq 1*8+5*16(%%"REG_d
"), %%mm2 \n\t"
1385 "psubw %%mm7, %%mm1 \n\t"
1387 "paddw %%mm7, %%mm5 \n\t"
1388 "psubw %%mm3, %%mm1 \n\t"
1390 "movq 1*8+1*16(%%"REG_d
"), %%mm7 \n\t"
1391 "psubw %%mm2, %%mm5 \n\t"
1393 "movq %%mm0, %%mm6 \n\t"
1394 "paddw %%mm4, %%mm0 \n\t"
1396 "paddusw %%mm3, %%mm1 \n\t"
1397 "psubw %%mm4, %%mm6 \n\t"
1400 "movq 1*8+7*16(%%"REG_d
"), %%mm4 \n\t"
1401 "psubw %%mm7, %%mm0 \n\t"
1403 "psubw %%mm4, %%mm6 \n\t"
1404 "paddusw %%mm2, %%mm5 \n\t"
1406 "paddusw %%mm4, %%mm6 \n\t"
1407 "paddw %%mm3, %%mm1 \n\t"
1409 "paddw %%mm2, %%mm5 \n\t"
1410 "paddw %%mm4, %%mm6 \n\t"
1412 "psubusw %%mm3, %%mm1 \n\t"
1413 "psubusw %%mm2, %%mm5 \n\t"
1415 "psubusw %%mm4, %%mm6 \n\t"
1416 "movq %%mm1, %%mm4 \n\t"
1418 "por %%mm5, %%mm4 \n\t"
1419 "paddusw %%mm7, %%mm0 \n\t"
1421 "por %%mm6, %%mm4 \n\t"
1422 "paddw %%mm7, %%mm0 \n\t"
1424 "packssdw %%mm4, %%mm4 \n\t"
1425 "psubusw %%mm7, %%mm0 \n\t"
1427 "movd %%mm4, %%"REG_a
" \n\t"
1428 "or %%"REG_a
", %%"REG_a
" \n\t"
1437 "movq 0*8+%3, %%mm4 \n\t"
1438 "movq %%mm0, %%mm1 \n\t"
1440 "pmulhw "MANGLE(MM_FIX_0_847759065)
", %%mm0 \n\t"
1441 "movq %%mm1, %%mm2 \n\t"
1443 "movq "DCTSIZE_S"*0*2(%%"REG_D
"), %%mm5 \n\t"
1444 "movq %%mm2, %%mm3 \n\t"
1446 "pmulhw "MANGLE(MM_FIX_0_566454497)
", %%mm1 \n\t"
1447 "paddw %%mm4, %%mm5 \n\t"
1449 "movq 1*8+%3, %%mm6 \n\t"
1451 "psraw $2, %%mm3 \n\t"
1453 "pmulhw "MANGLE(MM_FIX_0_198912367)
", %%mm2 \n\t"
1454 "psubw %%mm3, %%mm4 \n\t"
1456 "movq "DCTSIZE_S"*1*2(%%"REG_D
"), %%mm7 \n\t"
1457 "paddw %%mm3, %%mm5 \n\t"
1459 "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D
") \n\t"
1460 "paddw %%mm6, %%mm7 \n\t"
1462 "movq 2*8+%3, %%mm3 \n\t"
1463 "psubw %%mm0, %%mm6 \n\t"
1465 "movq "DCTSIZE_S"*2*2(%%"REG_D
"), %%mm4 \n\t"
1466 "paddw %%mm0, %%mm7 \n\t"
1468 "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D
") \n\t"
1469 "paddw %%mm3, %%mm4 \n\t"
1471 "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D
") \n\t"
1472 "psubw %%mm1, %%mm3 \n\t"
1474 "movq "DCTSIZE_S"*5*2(%%"REG_D
"), %%mm5 \n\t"
1475 "paddw %%mm1, %%mm4 \n\t"
1477 "movq "DCTSIZE_S"*3*2(%%"REG_D
"), %%mm6 \n\t"
1478 "paddw %%mm3, %%mm5 \n\t"
1480 "movq 3*8+%3, %%mm0 \n\t"
1481 "add $24, %%"REG_S
" \n\t"
1483 "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D
") \n\t"
1484 "paddw %%mm0, %%mm6 \n\t"
1486 "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D
") \n\t"
1487 "psubw %%mm2, %%mm0 \n\t"
1489 "movq "DCTSIZE_S"*4*2(%%"REG_D
"), %%mm7 \n\t"
1490 "paddw %%mm2, %%mm6 \n\t"
1492 "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D
") \n\t"
1493 "paddw %%mm0, %%mm7 \n\t"
1495 "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D
") \n\t"
1497 "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D
") \n\t"
1498 "add $24, %%"REG_D
" \n\t"
1499 "sub $2, %%"REG_c
" \n\t"
1509 "movq %%mm5, %%mm3 \n\t"
1510 "psubw %%mm1, %%mm5 \n\t"
1512 "psllw $1, %%mm5 \n\t"
1513 "paddw %%mm1, %%mm3 \n\t"
1515 "movq %%mm0, %%mm2 \n\t"
1516 "psubw %%mm6, %%mm0 \n\t"
1518 "movq %%mm5, %%mm1 \n\t"
1519 "psllw $1, %%mm0 \n\t"
1521 "pmulhw "MANGLE(MM_FIX_2_613125930)
", %%mm1 \n\t"
1522 "paddw %%mm0, %%mm5 \n\t"
1524 "pmulhw "MANGLE(MM_FIX_1_847759065)
", %%mm5 \n\t"
1525 "paddw %%mm6, %%mm2 \n\t"
1527 "pmulhw "MANGLE(MM_FIX_1_082392200)
", %%mm0 \n\t"
1528 "movq %%mm2, %%mm7 \n\t"
1531 "movq 0*8+%3, %%mm4 \n\t"
1532 "psubw %%mm3, %%mm2 \n\t"
1534 "psllw $1, %%mm2 \n\t"
1535 "paddw %%mm3, %%mm7 \n\t"
1537 "pmulhw "MANGLE(MM_FIX_1_414213562)
", %%mm2 \n\t"
1538 "movq %%mm4, %%mm6 \n\t"
1540 "psraw $2, %%mm7 \n\t"
1542 "paddw "DCTSIZE_S"*0*2(%%"REG_D
"), %%mm4 \n\t"
1543 "psubw %%mm7, %%mm6 \n\t"
1545 "movq 1*8+%3, %%mm3 \n\t"
1546 "paddw %%mm7, %%mm4 \n\t"
1548 "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D
") \n\t"
1549 "paddw %%mm5, %%mm1 \n\t"
1551 "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D
") \n\t"
1552 "psubw %%mm7, %%mm1 \n\t"
1554 "movq 2*8+%3, %%mm7 \n\t"
1555 "psubw %%mm5, %%mm0 \n\t"
1557 "movq 3*8+%3, %%mm6 \n\t"
1558 "movq %%mm3, %%mm5 \n\t"
1560 "paddw "DCTSIZE_S"*1*2(%%"REG_D
"), %%mm3 \n\t"
1561 "psubw %%mm1, %%mm5 \n\t"
1563 "psubw %%mm1, %%mm2 \n\t"
1564 "paddw %%mm1, %%mm3 \n\t"
1566 "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D
") \n\t"
1567 "movq %%mm7, %%mm4 \n\t"
1569 "paddw "DCTSIZE_S"*2*2(%%"REG_D
"), %%mm7 \n\t"
1570 "psubw %%mm2, %%mm4 \n\t"
1572 "paddw "DCTSIZE_S"*5*2(%%"REG_D
"), %%mm4 \n\t"
1573 "paddw %%mm2, %%mm7 \n\t"
1575 "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D
") \n\t"
1576 "paddw %%mm2, %%mm0 \n\t"
1579 "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D
") \n\t"
1580 "movq %%mm6, %%mm1 \n\t"
1582 "paddw "DCTSIZE_S"*4*2(%%"REG_D
"), %%mm6 \n\t"
1583 "psubw %%mm0, %%mm1 \n\t"
1585 "paddw "DCTSIZE_S"*3*2(%%"REG_D
"), %%mm1 \n\t"
1586 "paddw %%mm0, %%mm6 \n\t"
1588 "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D
") \n\t"
1589 "add $24, %%"REG_S
" \n\t"
1591 "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D
") \n\t"
1593 "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D
") \n\t"
1594 "add $24, %%"REG_D
" \n\t"
1595 "sub $2, %%"REG_c
" \n\t"
1599 :
"+S"(
data),
"+D"(output),
"+c"(cnt),
"=o"(temps)
1613 static void row_idct_c(int16_t* workspace,
1614 int16_t* output_adr,
int output_stride,
int cnt)
1616 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
1617 int_simd16_t tmp10, tmp11, tmp12, tmp13;
1618 int_simd16_t z5, z10, z11, z12, z13;
1624 outptr = output_adr;
1625 for (; cnt > 0; cnt--) {
1628 tmp10 = ( wsptr[2] + wsptr[3]);
1629 tmp11 = ( wsptr[2] - wsptr[3]);
1631 tmp13 = ( wsptr[0] + wsptr[1]);
1632 tmp12 = (
MULTIPLY16H( wsptr[0] - wsptr[1], FIX_1_414213562_A)<<2) - tmp13;
1634 tmp0 = tmp10 + tmp13;
1635 tmp3 = tmp10 - tmp13;
1636 tmp1 = tmp11 + tmp12;
1637 tmp2 = tmp11 - tmp12;
1645 z13 = wsptr[4] + wsptr[5];
1646 z10 = wsptr[4] - wsptr[5];
1647 z11 = wsptr[6] + wsptr[7];
1648 z12 = wsptr[6] - wsptr[7];
1657 tmp6 = (tmp12<<3) - tmp7;
1658 tmp5 = (tmp11<<3) - tmp6;
1659 tmp4 = (tmp10<<3) + tmp5;
1662 outptr[0*output_stride]+=
DESCALE(tmp0 + tmp7, 3);
1663 outptr[1*output_stride]+=
DESCALE(tmp1 + tmp6, 3);
1664 outptr[2*output_stride]+=
DESCALE(tmp2 + tmp5, 3);
1665 outptr[3*output_stride]+=
DESCALE(tmp3 - tmp4, 3);
1666 outptr[4*output_stride]+=
DESCALE(tmp3 + tmp4, 3);
1667 outptr[5*output_stride]+=
DESCALE(tmp2 - tmp5, 3);
1668 outptr[6*output_stride]+=
DESCALE(tmp1 - tmp6, 3);
1669 outptr[7*output_stride]+=
DESCALE(tmp0 - tmp7, 3);
1679 int16_t* output_adr,
int output_stride,
int cnt)
1683 "lea (%%"REG_a
",%%"REG_a
",2), %%"REG_d
" \n\t"
1685 "movq "DCTSIZE_S"*0*2(%%"REG_S
"), %%mm0 \n\t"
1688 "movq "DCTSIZE_S"*1*2(%%"REG_S
"), %%mm1 \n\t"
1689 "movq %%mm0, %%mm4 \n\t"
1691 "movq "DCTSIZE_S"*2*2(%%"REG_S
"), %%mm2 \n\t"
1692 "punpcklwd %%mm1, %%mm0 \n\t"
1694 "movq "DCTSIZE_S"*3*2(%%"REG_S
"), %%mm3 \n\t"
1695 "punpckhwd %%mm1, %%mm4 \n\t"
1698 "movq %%mm2, %%mm7 \n\t"
1699 "punpcklwd %%mm3, %%mm2 \n\t"
1701 "movq %%mm0, %%mm6 \n\t"
1702 "punpckldq %%mm2, %%mm0 \n\t"
1704 "punpckhdq %%mm2, %%mm6 \n\t"
1705 "movq %%mm0, %%mm5 \n\t"
1707 "punpckhwd %%mm3, %%mm7 \n\t"
1708 "psubw %%mm6, %%mm0 \n\t"
1710 "pmulhw "MANGLE(MM_FIX_1_414213562_A)
", %%mm0 \n\t"
1711 "movq %%mm4, %%mm2 \n\t"
1713 "punpckldq %%mm7, %%mm4 \n\t"
1714 "paddw %%mm6, %%mm5 \n\t"
1716 "punpckhdq %%mm7, %%mm2 \n\t"
1717 "movq %%mm4, %%mm1 \n\t"
1719 "psllw $2, %%mm0 \n\t"
1720 "paddw %%mm2, %%mm4 \n\t"
1723 "psubw %%mm2, %%mm1 \n\t"
1726 "psubw %%mm5, %%mm0 \n\t"
1728 "movq %%mm4, %%mm6 \n\t"
1729 "paddw %%mm5, %%mm4 \n\t"
1731 "psubw %%mm5, %%mm6 \n\t"
1732 "movq %%mm1, %%mm7 \n\t"
1735 "paddw %%mm0, %%mm1 \n\t"
1737 "movq %%mm4, 0*8+%3 \n\t"
1738 "movq %%mm3, %%mm4 \n\t"
1740 "movq %%mm6, 1*8+%3 \n\t"
1741 "punpcklwd %%mm2, %%mm3 \n\t"
1745 "punpckhwd %%mm2, %%mm4 \n\t"
1747 "movq %%mm5, %%mm2 \n\t"
1748 "punpcklwd %%mm6, %%mm5 \n\t"
1750 "psubw %%mm0, %%mm7 \n\t"
1751 "punpckhwd %%mm6, %%mm2 \n\t"
1753 "movq %%mm3, %%mm0 \n\t"
1754 "punpckldq %%mm5, %%mm3 \n\t"
1756 "punpckhdq %%mm5, %%mm0 \n\t"
1757 "movq %%mm4, %%mm5 \n\t"
1760 "movq %%mm3, %%mm6 \n\t"
1761 "punpckldq %%mm2, %%mm4 \n\t"
1763 "psubw %%mm0, %%mm3 \n\t"
1764 "punpckhdq %%mm2, %%mm5 \n\t"
1766 "paddw %%mm0, %%mm6 \n\t"
1767 "movq %%mm4, %%mm2 \n\t"
1769 "movq %%mm3, %%mm0 \n\t"
1770 "psubw %%mm5, %%mm4 \n\t"
1772 "pmulhw "MANGLE(MM_FIX_2_613125930)
", %%mm0 \n\t"
1773 "paddw %%mm4, %%mm3 \n\t"
1775 "pmulhw "MANGLE(MM_FIX_1_847759065)
", %%mm3 \n\t"
1776 "paddw %%mm5, %%mm2 \n\t"
1778 "pmulhw "MANGLE(MM_FIX_1_082392200)
", %%mm4 \n\t"
1779 "movq %%mm2, %%mm5 \n\t"
1781 "psubw %%mm6, %%mm2 \n\t"
1782 "paddw %%mm6, %%mm5 \n\t"
1784 "pmulhw "MANGLE(MM_FIX_1_414213562)
", %%mm2 \n\t"
1785 "paddw %%mm3, %%mm0 \n\t"
1787 "psllw $3, %%mm0 \n\t"
1788 "psubw %%mm3, %%mm4 \n\t"
1790 "movq 0*8+%3, %%mm6 \n\t"
1791 "movq %%mm1, %%mm3 \n\t"
1793 "psllw $3, %%mm4 \n\t"
1794 "psubw %%mm5, %%mm0 \n\t"
1796 "psllw $3, %%mm2 \n\t"
1797 "paddw %%mm0, %%mm1 \n\t"
1799 "psubw %%mm0, %%mm2 \n\t"
1800 "psubw %%mm0, %%mm3 \n\t"
1802 "paddw %%mm2, %%mm4 \n\t"
1803 "movq %%mm7, %%mm0 \n\t"
1805 "paddw %%mm2, %%mm7 \n\t"
1806 "psubw %%mm2, %%mm0 \n\t"
1808 "movq "MANGLE(MM_DESCALE_RND)
", %%mm2 \n\t"
1809 "psubw %%mm5, %%mm6 \n\t"
1811 "paddw 0*8+%3, %%mm5 \n\t"
1812 "paddw %%mm2, %%mm1 \n\t"
1814 "paddw %%mm2, %%mm5 \n\t"
1815 "psraw $3, %%mm1 \n\t"
1817 "paddw %%mm2, %%mm7 \n\t"
1818 "psraw $3, %%mm5 \n\t"
1820 "paddw (%%"REG_D
"), %%mm5 \n\t"
1821 "psraw $3, %%mm7 \n\t"
1823 "paddw (%%"REG_D
",%%"REG_a
"), %%mm1 \n\t"
1824 "paddw %%mm2, %%mm0 \n\t"
1826 "paddw (%%"REG_D
",%%"REG_a
",2), %%mm7 \n\t"
1827 "paddw %%mm2, %%mm3 \n\t"
1829 "movq %%mm5, (%%"REG_D
") \n\t"
1830 "paddw %%mm2, %%mm6 \n\t"
1832 "movq %%mm1, (%%"REG_D
",%%"REG_a
") \n\t"
1833 "psraw $3, %%mm0 \n\t"
1835 "movq %%mm7, (%%"REG_D
",%%"REG_a
",2) \n\t"
1836 "add %%"REG_d
", %%"REG_D
" \n\t"
1838 "movq 1*8+%3, %%mm5 \n\t"
1839 "psraw $3, %%mm3 \n\t"
1841 "paddw (%%"REG_D
",%%"REG_a
",2), %%mm0 \n\t"
1842 "psubw %%mm4, %%mm5 \n\t"
1844 "paddw (%%"REG_D
",%%"REG_d
"), %%mm3 \n\t"
1845 "psraw $3, %%mm6 \n\t"
1847 "paddw 1*8+%3, %%mm4 \n\t"
1848 "paddw %%mm2, %%mm5 \n\t"
1850 "paddw (%%"REG_D
",%%"REG_a
",4), %%mm6 \n\t"
1851 "paddw %%mm2, %%mm4 \n\t"
1853 "movq %%mm0, (%%"REG_D
",%%"REG_a
",2) \n\t"
1854 "psraw $3, %%mm5 \n\t"
1856 "paddw (%%"REG_D
"), %%mm5 \n\t"
1857 "psraw $3, %%mm4 \n\t"
1859 "paddw (%%"REG_D
",%%"REG_a
"), %%mm4 \n\t"
1862 "movq %%mm3, (%%"REG_D
",%%"REG_d
") \n\t"
1863 "movq %%mm6, (%%"REG_D
",%%"REG_a
",4) \n\t"
1864 "movq %%mm5, (%%"REG_D
") \n\t"
1865 "movq %%mm4, (%%"REG_D
",%%"REG_a
") \n\t"
1867 "sub %%"REG_d
", %%"REG_D
" \n\t"
1868 "add $8, %%"REG_D
" \n\t"
1869 "dec %%"REG_c
" \n\t"
1872 :
"+S"(workspace),
"+D"(output_adr),
"+c"(cnt),
"=o"(temps)
1873 :
"a"(output_stride*
sizeof(short))
1874 NAMED_CONSTRAINTS_ADD(MM_FIX_1_414213562_A,MM_FIX_2_613125930,MM_FIX_1_847759065,MM_FIX_1_082392200,
1875 MM_FIX_1_414213562,MM_DESCALE_RND)
1884 static void row_fdct_c(int16_t *data,
const uint8_t *pixels,
int line_size,
int cnt)
1886 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
1887 int_simd16_t tmp10, tmp11, tmp12, tmp13;
1888 int_simd16_t z1, z2, z3, z4, z5, z11, z13;
1895 for (; cnt > 0; cnt--) {
1896 tmp0 = pixels[line_size*0] + pixels[line_size*7];
1897 tmp7 = pixels[line_size*0] - pixels[line_size*7];
1898 tmp1 = pixels[line_size*1] + pixels[line_size*6];
1899 tmp6 = pixels[line_size*1] - pixels[line_size*6];
1900 tmp2 = pixels[line_size*2] + pixels[line_size*5];
1901 tmp5 = pixels[line_size*2] - pixels[line_size*5];
1902 tmp3 = pixels[line_size*3] + pixels[line_size*4];
1903 tmp4 = pixels[line_size*3] - pixels[line_size*4];
1907 tmp10 = tmp0 + tmp3;
1908 tmp13 = tmp0 - tmp3;
1909 tmp11 = tmp1 + tmp2;
1910 tmp12 = tmp1 - tmp2;
1914 dataptr[2] = tmp10 + tmp11;
1915 dataptr[3] = tmp10 - tmp11;
1917 z1 =
MULTIPLY16H((tmp12 + tmp13)<<2, FIX_0_707106781);
1918 dataptr[0] = tmp13 + z1;
1919 dataptr[1] = tmp13 - z1;
1923 tmp10 = (tmp4 + tmp5) <<2;
1924 tmp11 = (tmp5 + tmp6) <<2;
1925 tmp12 = (tmp6 + tmp7) <<2;
1935 dataptr[4] = z13 + z2;
1936 dataptr[5] = z13 - z2;
1937 dataptr[6] = z11 + z4;
1938 dataptr[7] = z11 - z4;
1951 "lea (%%"REG_a
",%%"REG_a
",2), %%"REG_d
" \n\t"
1953 "movd (%%"REG_S
"), %%mm0 \n\t"
1954 "pxor %%mm7, %%mm7 \n\t"
1956 "movd (%%"REG_S
",%%"REG_a
"), %%mm1 \n\t"
1957 "punpcklbw %%mm7, %%mm0 \n\t"
1959 "movd (%%"REG_S
",%%"REG_a
",2), %%mm2 \n\t"
1960 "punpcklbw %%mm7, %%mm1 \n\t"
1962 "punpcklbw %%mm7, %%mm2 \n\t"
1963 "add %%"REG_d
", %%"REG_S
" \n\t"
1965 "movq %%mm0, %%mm5 \n\t"
1968 "movd (%%"REG_S
",%%"REG_a
",4), %%mm3 \n\t"
1969 "movq %%mm1, %%mm6 \n\t"
1971 "movd (%%"REG_S
",%%"REG_d
"), %%mm4 \n\t"
1972 "punpcklbw %%mm7, %%mm3 \n\t"
1974 "psubw %%mm3, %%mm5 \n\t"
1975 "punpcklbw %%mm7, %%mm4 \n\t"
1977 "paddw %%mm3, %%mm0 \n\t"
1978 "psubw %%mm4, %%mm6 \n\t"
1980 "movd (%%"REG_S
",%%"REG_a
",2), %%mm3 \n\t"
1981 "paddw %%mm4, %%mm1 \n\t"
1983 "movq %%mm5, %3 \n\t"
1984 "punpcklbw %%mm7, %%mm3 \n\t"
1986 "movq %%mm6, %4 \n\t"
1987 "movq %%mm2, %%mm4 \n\t"
1989 "movd (%%"REG_S
"), %%mm5 \n\t"
1990 "paddw %%mm3, %%mm2 \n\t"
1992 "movd (%%"REG_S
",%%"REG_a
"), %%mm6 \n\t"
1993 "punpcklbw %%mm7, %%mm5 \n\t"
1995 "psubw %%mm3, %%mm4 \n\t"
1996 "punpcklbw %%mm7, %%mm6 \n\t"
1998 "movq %%mm5, %%mm3 \n\t"
1999 "paddw %%mm6, %%mm5 \n\t"
2001 "psubw %%mm6, %%mm3 \n\t"
2002 "movq %%mm0, %%mm6 \n\t"
2004 "movq %%mm1, %%mm7 \n\t"
2005 "psubw %%mm5, %%mm0 \n\t"
2007 "psubw %%mm2, %%mm1 \n\t"
2008 "paddw %%mm2, %%mm7 \n\t"
2010 "paddw %%mm0, %%mm1 \n\t"
2011 "movq %%mm7, %%mm2 \n\t"
2013 "psllw $2, %%mm1 \n\t"
2014 "paddw %%mm5, %%mm6 \n\t"
2017 "paddw %%mm6, %%mm7 \n\t"
2019 "psubw %%mm2, %%mm6 \n\t"
2020 "movq %%mm0, %%mm5 \n\t"
2023 "movq %%mm7, %%mm2 \n\t"
2024 "punpcklwd %%mm6, %%mm7 \n\t"
2026 "paddw %%mm1, %%mm0 \n\t"
2027 "punpckhwd %%mm6, %%mm2 \n\t"
2029 "psubw %%mm1, %%mm5 \n\t"
2030 "movq %%mm0, %%mm6 \n\t"
2032 "movq %4, %%mm1 \n\t"
2033 "punpcklwd %%mm5, %%mm0 \n\t"
2035 "punpckhwd %%mm5, %%mm6 \n\t"
2036 "movq %%mm0, %%mm5 \n\t"
2038 "punpckldq %%mm7, %%mm0 \n\t"
2039 "paddw %%mm4, %%mm3 \n\t"
2041 "punpckhdq %%mm7, %%mm5 \n\t"
2042 "movq %%mm6, %%mm7 \n\t"
2044 "movq %%mm0, "DCTSIZE_S"*0*2(%%"REG_D
") \n\t"
2045 "punpckldq %%mm2, %%mm6 \n\t"
2047 "movq %%mm5, "DCTSIZE_S"*1*2(%%"REG_D
") \n\t"
2048 "punpckhdq %%mm2, %%mm7 \n\t"
2050 "movq %%mm6, "DCTSIZE_S"*2*2(%%"REG_D
") \n\t"
2051 "paddw %%mm1, %%mm4 \n\t"
2053 "movq %%mm7, "DCTSIZE_S"*3*2(%%"REG_D
") \n\t"
2054 "psllw $2, %%mm3 \n\t"
2056 "movq %3, %%mm2 \n\t"
2057 "psllw $2, %%mm4 \n\t"
2060 "paddw %%mm2, %%mm1 \n\t"
2062 "psllw $2, %%mm1 \n\t"
2063 "movq %%mm3, %%mm0 \n\t"
2066 "psubw %%mm1, %%mm3 \n\t"
2068 "pmulhw "MANGLE(MM_FIX_0_382683433)
", %%mm3 \n\t"
2069 "movq %%mm2, %%mm5 \n\t"
2071 "pmulhw "MANGLE(MM_FIX_1_306562965)
", %%mm1 \n\t"
2072 "psubw %%mm4, %%mm2 \n\t"
2074 "paddw %%mm4, %%mm5 \n\t"
2075 "movq %%mm2, %%mm6 \n\t"
2077 "paddw %%mm3, %%mm0 \n\t"
2078 "movq %%mm5, %%mm7 \n\t"
2080 "paddw %%mm0, %%mm2 \n\t"
2081 "psubw %%mm0, %%mm6 \n\t"
2083 "movq %%mm2, %%mm4 \n\t"
2084 "paddw %%mm3, %%mm1 \n\t"
2087 "punpcklwd %%mm6, %%mm2 \n\t"
2088 "paddw %%mm1, %%mm5 \n\t"
2090 "punpckhwd %%mm6, %%mm4 \n\t"
2091 "psubw %%mm1, %%mm7 \n\t"
2093 "movq %%mm5, %%mm6 \n\t"
2094 "punpcklwd %%mm7, %%mm5 \n\t"
2096 "punpckhwd %%mm7, %%mm6 \n\t"
2097 "movq %%mm2, %%mm7 \n\t"
2099 "punpckldq %%mm5, %%mm2 \n\t"
2100 "sub %%"REG_d
", %%"REG_S
" \n\t"
2102 "punpckhdq %%mm5, %%mm7 \n\t"
2103 "movq %%mm4, %%mm5 \n\t"
2106 "punpckldq %%mm6, %%mm4 \n\t"
2109 "punpckhdq %%mm6, %%mm5 \n\t"
2112 "add $4, %%"REG_S
" \n\t"
2116 "dec %%"REG_c
" \n\t"
2119 :
"+S"(pixels),
"+D"(data),
"+c"(cnt),
"=o"(temps),
"=o"(temps[1])