1 #include <VLIB/Utils/video_bin_dct.h>
3 static void bin_fdct(const uint16_t* data_in, int16_t* data_out)
7 static void bin_idct(const int16_t* data_in, uint16_t* data_out)
10 int16_t x0, x1, x2, x3, x4, x5, x6, x7;
11 int16_t tx0, tx3, tx4, tx5;
12 const int16_t* in = data_in;
13 int16_t* out = (int16_t*) data_out;
16 for( i = 8; i > 0; i-- )
18 x0 = in[0]; x1 = in[1]; x2 = in[2]; x3 = in[3];
19 x4 = in[4]; x5 = in[5]; x6 = in[6]; x7 = in[7];
49 out[0] = (x0 + x1) >> 1;
50 out[1] = (x4 + x3) >> 1;
51 out[2] = (x6 + x5) >> 1;
52 out[3] = (x2 + x7) >> 1;
53 out[4] = (x2 - x7) >> 1;
54 out[5] = (x6 - x5) >> 1;
55 out[6] = (x4 - x3) >> 1;
56 out[7] = (x0 - x1) >> 1;
62 in = (const int16_t*) data_out;
63 out = (int16_t*) data_out;
66 for( i = 8; i > 0; i-- )
68 tx0 = in[0]; x1 = in[8]; x2 = in[16]; tx3 = in[24];
69 tx4 = in[32]; tx5 = in[40]; x6 = in[48]; x7 = in[56];
97 // Final step - TODO Check if we can replace out by data_out
112 int16_t* video_fdct_compute(int16_t* in, int16_t* out, int32_t num_macro_blocks)
114 while( num_macro_blocks > 0 )
116 bin_fdct((uint16_t*)in, out);
118 in += MCU_BLOCK_SIZE;
119 out += MCU_BLOCK_SIZE;
121 bin_fdct((uint16_t*)in, out);
123 in += MCU_BLOCK_SIZE;
124 out += MCU_BLOCK_SIZE;
126 bin_fdct((uint16_t*)in, out);
128 in += MCU_BLOCK_SIZE;
129 out += MCU_BLOCK_SIZE;
131 bin_fdct((uint16_t*)in, out);
133 in += MCU_BLOCK_SIZE;
134 out += MCU_BLOCK_SIZE;
136 bin_fdct((uint16_t*)in, out);
138 in += MCU_BLOCK_SIZE;
139 out += MCU_BLOCK_SIZE;
141 bin_fdct((uint16_t*)in, out);
143 in += MCU_BLOCK_SIZE;
144 out += MCU_BLOCK_SIZE;
152 int16_t* video_idct_compute(int16_t* in, int16_t* out, int32_t num_macro_blocks)
154 while( num_macro_blocks > 0 )
156 bin_idct(in, (uint16_t*)out);
158 in += MCU_BLOCK_SIZE;
159 out += MCU_BLOCK_SIZE;
161 bin_idct(in, (uint16_t*)out);
163 in += MCU_BLOCK_SIZE;
164 out += MCU_BLOCK_SIZE;
166 bin_idct(in, (uint16_t*)out);
168 in += MCU_BLOCK_SIZE;
169 out += MCU_BLOCK_SIZE;
171 bin_idct(in, (uint16_t*)out);
173 in += MCU_BLOCK_SIZE;
174 out += MCU_BLOCK_SIZE;
176 bin_idct(in, (uint16_t*)out);
178 in += MCU_BLOCK_SIZE;
179 out += MCU_BLOCK_SIZE;
181 bin_idct(in, (uint16_t*)out);
183 in += MCU_BLOCK_SIZE;
184 out += MCU_BLOCK_SIZE;