31 #ifndef AVCODEC_H264IDCT_INTERNAL_H
32 #define AVCODEC_H264IDCT_INTERNAL_H
35 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8,
36 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8,
37 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8,
38 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8,
39 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8,
40 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8,
41 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8,
42 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8,
43 4+11*8, 5+11*8, 4+12*8, 5+12*8,
44 6+11*8, 7+11*8, 6+12*8, 7+12*8,
45 4+13*8, 5+13*8, 4+14*8, 5+14*8,
46 6+13*8, 7+13*8, 6+14*8, 7+14*8
60 const int z0= block[i + 4*0] + block[i + 4*2];
61 const int z1= block[i + 4*0] - block[i + 4*2];
62 const int z2= (block[i + 4*1]>>1) - block[i + 4*3];
63 const int z3= block[i + 4*1] + (block[i + 4*3]>>1);
65 block[i + 4*0]= z0 + z3;
66 block[i + 4*1]= z1 + z2;
67 block[i + 4*2]= z1 - z2;
68 block[i + 4*3]= z0 - z3;
72 const int z0= block[0 + 4*i] + block[2 + 4*i];
73 const int z1= block[0 + 4*i] - block[2 + 4*i];
74 const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i];
75 const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1);
92 for( i = 0; i < 8; i++ )
94 const int a0 = block[i+0*8] + block[i+4*8];
95 const int a2 = block[i+0*8] - block[i+4*8];
96 const int a4 = (block[i+2*8]>>1) - block[i+6*8];
97 const int a6 = (block[i+6*8]>>1) + block[i+2*8];
99 const int b0 = a0 + a6;
100 const int b2 = a2 +
a4;
101 const int b4 = a2 -
a4;
102 const int b6 = a0 - a6;
104 const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
105 const int a3 = block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
106 const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
107 const int a7 = block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
109 const int b1 = (a7>>2) + a1;
110 const int b3 = a3 + (a5>>2);
111 const int b5 = (a3>>2) - a5;
112 const int b7 = a7 - (a1>>2);
114 block[i+0*8] = b0 + b7;
115 block[i+7*8] = b0 - b7;
116 block[i+1*8] = b2 + b5;
117 block[i+6*8] = b2 - b5;
118 block[i+2*8] = b4 + b3;
119 block[i+5*8] = b4 - b3;
120 block[i+3*8] = b6 + b1;
121 block[i+4*8] = b6 - b1;
123 for( i = 0; i < 8; i++ )
125 const int a0 = block[0+i*8] + block[4+i*8];
126 const int a2 = block[0+i*8] - block[4+i*8];
127 const int a4 = (block[2+i*8]>>1) - block[6+i*8];
128 const int a6 = (block[6+i*8]>>1) + block[2+i*8];
130 const int b0 = a0 + a6;
131 const int b2 = a2 +
a4;
132 const int b4 = a2 -
a4;
133 const int b6 = a0 - a6;
135 const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
136 const int a3 = block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
137 const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
138 const int a7 = block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
140 const int b1 = (a7>>2) + a1;
141 const int b3 = a3 + (a5>>2);
142 const int b5 = (a3>>2) - a5;
143 const int b7 = a7 - (a1>>2);
162 for( j = 0; j < 4; j++ )
164 for( i = 0; i < 4; i++ )
175 for( j = 0; j < 8; j++ )
177 for( i = 0; i < 8; i++ )
186 int nnz = nnzc[
scan8[i] ];
204 for(i=0; i<16; i+=4){
205 int nnz = nnzc[
scan8[i] ];
216 for(i=j*16; i<j*16+4; i++){
229 for(i=j*16; i<j*16+4; i++){
238 for(i=j*16+4; i<j*16+8; i++){
239 if(nnzc[
scan8[i+4] ])
260 const int z0= input[4*i+0] + input[4*i+1];
261 const int z1= input[4*i+0] - input[4*i+1];
262 const int z2= input[4*i+2] - input[4*i+3];
263 const int z3= input[4*i+2] + input[4*i+3];
272 const int offset= x_offset[i];
273 const int z0= temp[4*0+i] + temp[4*2+i];
274 const int z1= temp[4*0+i] - temp[4*2+i];
275 const int z2= temp[4*1+i] - temp[4*3+i];
276 const int z3= temp[4*1+i] + temp[4*3+i];
278 output[
stride* 0+
offset]= ((((z0 + z3)*qmul + 128 ) >> 8));
279 output[
stride* 1+
offset]= ((((z1 + z2)*qmul + 128 ) >> 8));
280 output[
stride* 4+
offset]= ((((z1 - z2)*qmul + 128 ) >> 8));
281 output[
stride* 5+
offset]= ((((z0 - z3)*qmul + 128 ) >> 8));
288 const int xStride= 16;
291 static const uint8_t x_offset[2]={0, 16};
295 temp[2*i+0] = block[stride*i + xStride*0] + block[stride*i + xStride*1];
296 temp[2*i+1] = block[stride*i + xStride*0] - block[stride*i + xStride*1];
300 const int offset= x_offset[i];
301 const int z0= temp[2*0+i] + temp[2*2+i];
302 const int z1= temp[2*0+i] - temp[2*2+i];
303 const int z2= temp[2*1+i] - temp[2*3+i];
304 const int z3= temp[2*1+i] + temp[2*3+i];
306 block[stride*0+
offset]= ((z0 + z3)*qmul + 128) >> 8;
307 block[stride*1+
offset]= ((z1 + z2)*qmul + 128) >> 8;
308 block[stride*2+
offset]= ((z1 - z2)*qmul + 128) >> 8;
309 block[stride*3+
offset]= ((z0 - z3)*qmul + 128) >> 8;
315 const int xStride= 16;
319 a= block[stride*0 + xStride*0];
320 b= block[stride*0 + xStride*1];
321 c= block[stride*1 + xStride*0];
322 d= block[stride*1 + xStride*1];
329 block[stride*0 + xStride*0]= ((a+
c)*qmul) >> 7;
330 block[stride*0 + xStride*1]= ((e+
b)*qmul) >> 7;
331 block[stride*1 + xStride*0]= ((a-
c)*qmul) >> 7;
332 block[stride*1 + xStride*1]= ((e-
b)*qmul) >> 7;