50 #define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
51 #define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
52 #define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
53 #define W4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
54 #define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
55 #define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
56 #define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
62 #define MUL(a, b) MUL16(a, b)
63 #define MAC(a, b, c) MAC16(a, b, c)
79 #define MUL(a, b) ((a) * (b))
80 #define MAC(a, b, c) ((a) += (b) * (c))
84 #error "Unsupported bitdepth"
93 #define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
94 if (((((uint64_t *)row)[0] & ~ROW0_MASK) | ((uint64_t *)row)[1]) == 0) {
97 temp = (row[0] << (
DC_SHIFT - extra_shift)) & 0xffff;
99 temp = (row[0] >> (extra_shift -
DC_SHIFT)) & 0xffff;
103 ((uint64_t *)row)[0] =
temp;
104 ((uint64_t *)row)[1] =
temp;
108 if (!(((uint32_t*)row)[1] |
109 ((uint32_t*)row)[2] |
110 ((uint32_t*)row)[3] |
114 temp = (row[0] << (
DC_SHIFT - extra_shift)) & 0xffff;
116 temp = (row[0] >> (extra_shift -
DC_SHIFT)) & 0xffff;
119 ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
120 ((uint32_t*)row)[2]=((uint32_t*)row)[3] =
temp;
135 b0 =
MUL(
W1, row[1]);
137 b1 =
MUL(
W3, row[1]);
138 MAC(b1, -
W7, row[3]);
139 b2 =
MUL(
W5, row[1]);
140 MAC(b2, -
W1, row[3]);
141 b3 =
MUL(
W7, row[1]);
142 MAC(b3, -
W5, row[3]);
145 a0 +=
W4*row[4] +
W6*row[6];
146 a1 += -
W4*row[4] -
W2*row[6];
147 a2 += -
W4*row[4] +
W2*row[6];
148 a3 +=
W4*row[4] -
W6*row[6];
153 MAC(b1, -
W1, row[5]);
154 MAC(b1, -
W5, row[7]);
160 MAC(b3, -
W1, row[7]);
163 row[0] = (a0 + b0) >> (
ROW_SHIFT + extra_shift);
164 row[7] = (a0 - b0) >> (
ROW_SHIFT + extra_shift);
165 row[1] = (a1 + b1) >> (
ROW_SHIFT + extra_shift);
166 row[6] = (a1 - b1) >> (
ROW_SHIFT + extra_shift);
167 row[2] = (a2 + b2) >> (
ROW_SHIFT + extra_shift);
168 row[5] = (a2 - b2) >> (
ROW_SHIFT + extra_shift);
169 row[3] = (a3 + b3) >> (
ROW_SHIFT + extra_shift);
170 row[4] = (a3 - b3) >> (
ROW_SHIFT + extra_shift);
173 #define IDCT_COLS do { \
174 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); \
181 a2 += -W6*col[8*2]; \
182 a3 += -W2*col[8*2]; \
184 b0 = MUL(W1, col[8*1]); \
185 b1 = MUL(W3, col[8*1]); \
186 b2 = MUL(W5, col[8*1]); \
187 b3 = MUL(W7, col[8*1]); \
189 MAC(b0, W3, col[8*3]); \
190 MAC(b1, -W7, col[8*3]); \
191 MAC(b2, -W1, col[8*3]); \
192 MAC(b3, -W5, col[8*3]); \
196 a1 += -W4*col[8*4]; \
197 a2 += -W4*col[8*4]; \
202 MAC(b0, W5, col[8*5]); \
203 MAC(b1, -W1, col[8*5]); \
204 MAC(b2, W7, col[8*5]); \
205 MAC(b3, W3, col[8*5]); \
210 a1 += -W2*col[8*6]; \
212 a3 += -W6*col[8*6]; \
216 MAC(b0, W7, col[8*7]); \
217 MAC(b1, -W5, col[8*7]); \
218 MAC(b2, W3, col[8*7]); \
219 MAC(b3, -W1, col[8*7]); \
292 line_size /=
sizeof(
pixel);
294 for (i = 0; i < 8; i++)
297 for (i = 0; i < 8; i++)
306 line_size /=
sizeof(
pixel);
308 for (i = 0; i < 8; i++)
311 for (i = 0; i < 8; i++)
319 for (i = 0; i < 8; i++)
322 for (i = 0; i < 8; i++)