Mercurial > libavcodec.hg
comparison faandct.c @ 1562:bf452704100f libavcodec
optionally merge postscale into quantization table for the float aan dct
author | michael |
---|---|
date | Thu, 23 Oct 2003 09:11:56 +0000 |
parents | aa71c7981523 |
children | 820e06c6ca9b |
comparison
equal
deleted
inserted
replaced
1561:aa71c7981523 | 1562:bf452704100f |
---|---|
30 | 30 |
31 #include "dsputil.h" | 31 #include "dsputil.h" |
32 #include "faandct.h" | 32 #include "faandct.h" |
33 | 33 |
34 #define FLOAT float | 34 #define FLOAT float |
35 #ifdef FAAN_POSTSCALE | |
36 # define SCALE(x) postscale[x] | |
37 #else | |
38 # define SCALE(x) 1 | |
39 #endif | |
35 | 40 |
36 //numbers generated by simple c code (not as accurate as they could be) | 41 //numbers generated by simple c code (not as accurate as they could be) |
37 /* | 42 /* |
38 for(i=0; i<8; i++){ | 43 for(i=0; i<8; i++){ |
39 printf("#define B%d %1.20llf\n", i, (long double)1.0/(cosl(i*acosl(-1.0)/(long double)16.0)*sqrtl(2))); | 44 printf("#define B%d %1.20llf\n", i, (long double)1.0/(cosl(i*acosl(-1.0)/(long double)16.0)*sqrtl(2))); |
128 tmp10= tmp0 + tmp3; | 133 tmp10= tmp0 + tmp3; |
129 tmp13= tmp0 - tmp3; | 134 tmp13= tmp0 - tmp3; |
130 tmp11= tmp1 + tmp2; | 135 tmp11= tmp1 + tmp2; |
131 tmp12= tmp1 - tmp2; | 136 tmp12= tmp1 - tmp2; |
132 | 137 |
133 data[8*0 + i]= lrint(postscale[8*0 + i] * (tmp10 + tmp11)); | 138 data[8*0 + i]= lrint(SCALE(8*0 + i) * (tmp10 + tmp11)); |
134 data[8*4 + i]= lrint(postscale[8*4 + i] * (tmp10 - tmp11)); | 139 data[8*4 + i]= lrint(SCALE(8*4 + i) * (tmp10 - tmp11)); |
135 | 140 |
136 z1= (tmp12 + tmp13)* A1; | 141 z1= (tmp12 + tmp13)* A1; |
137 data[8*2 + i]= lrint(postscale[8*2 + i] * (tmp13 + z1)); | 142 data[8*2 + i]= lrint(SCALE(8*2 + i) * (tmp13 + z1)); |
138 data[8*6 + i]= lrint(postscale[8*6 + i] * (tmp13 - z1)); | 143 data[8*6 + i]= lrint(SCALE(8*6 + i) * (tmp13 - z1)); |
139 | 144 |
140 tmp10= tmp4 + tmp5; | 145 tmp10= tmp4 + tmp5; |
141 tmp11= tmp5 + tmp6; | 146 tmp11= tmp5 + tmp6; |
142 tmp12= tmp6 + tmp7; | 147 tmp12= tmp6 + tmp7; |
143 | 148 |
147 z3= tmp11*A1; | 152 z3= tmp11*A1; |
148 | 153 |
149 z11= tmp7 + z3; | 154 z11= tmp7 + z3; |
150 z13= tmp7 - z3; | 155 z13= tmp7 - z3; |
151 | 156 |
152 data[8*5 + i]= lrint(postscale[8*5 + i] * (z13 + z2)); | 157 data[8*5 + i]= lrint(SCALE(8*5 + i) * (z13 + z2)); |
153 data[8*3 + i]= lrint(postscale[8*3 + i] * (z13 - z2)); | 158 data[8*3 + i]= lrint(SCALE(8*3 + i) * (z13 - z2)); |
154 data[8*1 + i]= lrint(postscale[8*1 + i] * (z11 + z4)); | 159 data[8*1 + i]= lrint(SCALE(8*1 + i) * (z11 + z4)); |
155 data[8*7 + i]= lrint(postscale[8*7 + i] * (z11 - z4)); | 160 data[8*7 + i]= lrint(SCALE(8*7 + i) * (z11 - z4)); |
156 } | 161 } |
157 } | 162 } |