Mercurial > libavcodec.hg
comparison ra288.c @ 7169:f12513065d85 libavcodec
Move function to avoid forward declaration
author | vitor |
---|---|
date | Mon, 30 Jun 2008 16:57:27 +0000 |
parents | c2691f22708b |
children | 9176fe6f17c9 |
comparison
equal
deleted
inserted
replaced
7168:c2691f22708b | 7169:f12513065d85 |
---|---|
33 float st2a[38], st2b[11], st2[11]; | 33 float st2a[38], st2b[11], st2[11]; |
34 float sb[41]; | 34 float sb[41]; |
35 float lhist[10]; | 35 float lhist[10]; |
36 } Real288_internal; | 36 } Real288_internal; |
37 | 37 |
38 static void prodsum(float *tgt, float *src, int len, int n); | |
39 static void co(int n, int i, int j, float *in, float *out, float *st1, float *st2, const float *table); | |
40 static int pred(float *in, float *tgt, int n); | |
41 static void colmult(float *tgt, float *m1, const float *m2, int n); | |
42 | |
43 | |
44 /* initial decode */ | 38 /* initial decode */ |
45 static void unpack(unsigned short *tgt, const unsigned char *src, | 39 static void unpack(unsigned short *tgt, const unsigned char *src, |
46 unsigned int len) | 40 unsigned int len) |
47 { | 41 { |
48 int x, y, z; | 42 int x, y, z; |
65 tgt[++y] += src[x] >> n; | 59 tgt[++y] += src[x] >> n; |
66 z = 8 - n; | 60 z = 8 - n; |
67 } else | 61 } else |
68 z += 8; | 62 z += 8; |
69 } | 63 } |
70 } | |
71 | |
72 static void update(Real288_internal *glob) | |
73 { | |
74 int x,y; | |
75 float buffer1[40], temp1[37]; | |
76 float buffer2[8], temp2[11]; | |
77 | |
78 for (x=0, y=glob->phasep+5; x < 40; buffer1[x++] = glob->output[(y++)%40]); | |
79 | |
80 co(36, 40, 35, buffer1, temp1, glob->st1a, glob->st1b, table1); | |
81 | |
82 if (pred(temp1, glob->st1, 36)) | |
83 colmult(glob->pr1, glob->st1, table1a, 36); | |
84 | |
85 for (x=0, y=glob->phase + 1; x < 8; buffer2[x++] = glob->history[(y++) % 8]); | |
86 | |
87 co(10, 8, 20, buffer2, temp2, glob->st2a, glob->st2b, table2); | |
88 | |
89 if (pred(temp2, glob->st2, 10)) | |
90 colmult(glob->pr2, glob->st2, table2a, 10); | |
91 } | 64 } |
92 | 65 |
93 /* Decode and produce output */ | 66 /* Decode and produce output */ |
94 static void decode(Real288_internal *glob, unsigned int input) | 67 static void decode(Real288_internal *glob, unsigned int input) |
95 { | 68 { |
192 if ((f0 += f1*f2) < 0) | 165 if ((f0 += f1*f2) < 0) |
193 return 0; | 166 return 0; |
194 } | 167 } |
195 } | 168 } |
196 | 169 |
170 /* product sum (lsf) */ | |
171 static void prodsum(float *tgt, float *src, int len, int n) | |
172 { | |
173 unsigned int x; | |
174 float *p1, *p2; | |
175 double sum; | |
176 | |
177 while (n >= 0) { | |
178 p1 = (p2 = src) - n; | |
179 for (sum=0, x=len; x--; sum += (*p1++) * (*p2++)); | |
180 tgt[n--] = sum; | |
181 } | |
182 } | |
183 | |
197 static void co(int n, int i, int j, float *in, float *out, float *st1, | 184 static void co(int n, int i, int j, float *in, float *out, float *st1, |
198 float *st2, const float *table) | 185 float *st2, const float *table) |
199 { | 186 { |
200 int a, b, c; | 187 int a, b, c; |
201 unsigned int x; | 188 unsigned int x; |
221 out[x] = *(st2++) + buffer2[x]; | 208 out[x] = *(st2++) + buffer2[x]; |
222 } | 209 } |
223 *out *= 1.00390625; /* to prevent clipping */ | 210 *out *= 1.00390625; /* to prevent clipping */ |
224 } | 211 } |
225 | 212 |
226 /* product sum (lsf) */ | 213 static void update(Real288_internal *glob) |
227 static void prodsum(float *tgt, float *src, int len, int n) | 214 { |
228 { | 215 int x,y; |
229 unsigned int x; | 216 float buffer1[40], temp1[37]; |
230 float *p1, *p2; | 217 float buffer2[8], temp2[11]; |
231 double sum; | 218 |
232 | 219 for (x=0, y=glob->phasep+5; x < 40; buffer1[x++] = glob->output[(y++)%40]); |
233 while (n >= 0) { | 220 |
234 p1 = (p2 = src) - n; | 221 co(36, 40, 35, buffer1, temp1, glob->st1a, glob->st1b, table1); |
235 for (sum=0, x=len; x--; sum += (*p1++) * (*p2++)); | 222 |
236 tgt[n--] = sum; | 223 if (pred(temp1, glob->st1, 36)) |
237 } | 224 colmult(glob->pr1, glob->st1, table1a, 36); |
225 | |
226 for (x=0, y=glob->phase + 1; x < 8; buffer2[x++] = glob->history[(y++) % 8]); | |
227 | |
228 co(10, 8, 20, buffer2, temp2, glob->st2a, glob->st2b, table2); | |
229 | |
230 if (pred(temp2, glob->st2, 10)) | |
231 colmult(glob->pr2, glob->st2, table2a, 10); | |
238 } | 232 } |
239 | 233 |
240 static void * decode_block(AVCodecContext * avctx, const unsigned char *in, | 234 static void * decode_block(AVCodecContext * avctx, const unsigned char *in, |
241 signed short int *out, unsigned len) | 235 signed short int *out, unsigned len) |
242 { | 236 { |