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)
65 #elif BIT_DEPTH == 10 || BIT_DEPTH == 12
68 #define W1 22725 // 90901
69 #define W2 21407 // 85627
70 #define W3 19265 // 77062
71 #define W4 16384 // 65535
72 #define W5 12873 // 51491
73 #define W6 8867 // 35468
74 #define W7 4520 // 18081
100 #define MUL(a, b) ((a) * (b))
101 #define MAC(a, b, c) ((a) += (b) * (c))
105 #error "Unsupported bitdepth"
110 static inline void FUNC(idctRowCondDC_extrashift)(int16_t *row,
int extra_shift)
118 #define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
121 if (DC_SHIFT - extra_shift >= 0) {
122 temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
124 temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff;
126 temp += temp * (1 << 16);
127 temp += temp * ((uint64_t) 1 << 32);
138 if (DC_SHIFT - extra_shift >= 0) {
139 temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
141 temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff;
143 temp += temp * (1 << 16);
152 a0 = (
W4 * row[0]) + (1 << (
ROW_SHIFT + extra_shift - 1));
162 b0 =
MUL(
W1, row[1]);
164 b1 =
MUL(
W3, row[1]);
165 MAC(b1, -
W7, row[3]);
166 b2 =
MUL(
W5, row[1]);
167 MAC(b2, -
W1, row[3]);
168 b3 =
MUL(
W7, row[1]);
169 MAC(b3, -
W5, row[3]);
172 a0 +=
W4*row[4] +
W6*row[6];
173 a1 += -
W4*row[4] -
W2*row[6];
174 a2 += -
W4*row[4] +
W2*row[6];
175 a3 +=
W4*row[4] -
W6*row[6];
180 MAC(b1, -
W1, row[5]);
181 MAC(b1, -
W5, row[7]);
187 MAC(b3, -
W1, row[7]);
190 row[0] = (a0 + b0) >> (
ROW_SHIFT + extra_shift);
191 row[7] = (a0 - b0) >> (
ROW_SHIFT + extra_shift);
192 row[1] = (a1 + b1) >> (
ROW_SHIFT + extra_shift);
193 row[6] = (a1 - b1) >> (
ROW_SHIFT + extra_shift);
194 row[2] = (a2 + b2) >> (
ROW_SHIFT + extra_shift);
195 row[5] = (a2 - b2) >> (
ROW_SHIFT + extra_shift);
196 row[3] = (a3 + b3) >> (
ROW_SHIFT + extra_shift);
197 row[4] = (a3 - b3) >> (
ROW_SHIFT + extra_shift);
200 #define IDCT_COLS do { \
201 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); \
208 a2 += -W6*col[8*2]; \
209 a3 += -W2*col[8*2]; \
211 b0 = MUL(W1, col[8*1]); \
212 b1 = MUL(W3, col[8*1]); \
213 b2 = MUL(W5, col[8*1]); \
214 b3 = MUL(W7, col[8*1]); \
216 MAC(b0, W3, col[8*3]); \
217 MAC(b1, -W7, col[8*3]); \
218 MAC(b2, -W1, col[8*3]); \
219 MAC(b3, -W5, col[8*3]); \
223 a1 += -W4*col[8*4]; \
224 a2 += -W4*col[8*4]; \
229 MAC(b0, W5, col[8*5]); \
230 MAC(b1, -W1, col[8*5]); \
231 MAC(b2, W7, col[8*5]); \
232 MAC(b3, W3, col[8*5]); \
237 a1 += -W2*col[8*6]; \
239 a3 += -W6*col[8*6]; \
243 MAC(b0, W7, col[8*7]); \
244 MAC(b1, -W5, col[8*7]); \
245 MAC(b2, W3, col[8*7]); \
246 MAC(b3, -W1, col[8*7]); \
251 static inline void FUNC(idctSparseCol_extrashift)(int16_t *col)
324 line_size /=
sizeof(
pixel);
326 for (i = 0; i < 8; i++)
329 for (i = 0; i < 8; i++)
338 line_size /=
sizeof(
pixel);
340 for (i = 0; i < 8; i++)
343 for (i = 0; i < 8; i++)
351 for (i = 0; i < 8; i++)
354 for (i = 0; i < 8; i++)
void FUNC() ff_simple_idct(int16_t *block)
static void FUNC() idctSparseColPut(pixel *dest, int line_size, int16_t *col)
static void FUNC() idctRowCondDC(int16_t *row, int extra_shift)
static void FUNC() idctSparseColAdd(pixel *dest, int line_size, int16_t *col)
static void FUNC() idctSparseCol(int16_t *col)
void FUNC() ff_simple_idct_put(uint8_t *dest_, int line_size, int16_t *block)
void FUNC() ff_simple_idct_add(uint8_t *dest_, int line_size, int16_t *block)