diff options
author | Nils Wallménius <nils@rockbox.org> | 2010-08-22 20:14:25 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2010-08-22 20:14:25 +0000 |
commit | d660e9655c3654dc80e4db4d29108e7ae5c11f7f (patch) | |
tree | 6bd3e45688b55b45581fc9e9eac22a8631c39b36 /apps/codecs/libtremor/floor1.c | |
parent | 8b5f3cabcc122e7b97799a9358c3ad3481405151 (diff) | |
download | rockbox-d660e9655c3654dc80e4db4d29108e7ae5c11f7f.tar.gz rockbox-d660e9655c3654dc80e4db4d29108e7ae5c11f7f.zip |
Move ffmpeg functions to their own file to avoid mixing code under different liceses in the same file. Licensing is fun!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27859 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libtremor/floor1.c')
-rw-r--r-- | apps/codecs/libtremor/floor1.c | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/apps/codecs/libtremor/floor1.c b/apps/codecs/libtremor/floor1.c index 1ea7ee99b5..0d3828c816 100644 --- a/apps/codecs/libtremor/floor1.c +++ b/apps/codecs/libtremor/floor1.c | |||
@@ -274,57 +274,7 @@ static const ogg_int32_t FLOOR_fromdB_LOOKUP[256] ICONST_ATTR = { | |||
274 | XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff), | 274 | XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff), |
275 | }; | 275 | }; |
276 | 276 | ||
277 | /* render_line and friend taken from ffmpeg (libavcodec/vorbis.c) */ | 277 | #include "ffmpeg_render_line.h" |
278 | static inline void render_line_unrolled(int x, int y, int x1, | ||
279 | int sy, int ady, int adx, | ||
280 | ogg_int32_t *buf) | ||
281 | { | ||
282 | int err = -adx; | ||
283 | x -= x1 - 1; | ||
284 | buf += x1 - 1; | ||
285 | while (++x < 0) { | ||
286 | err += ady; | ||
287 | if (err >= 0) { | ||
288 | err += ady - adx; | ||
289 | y += sy; | ||
290 | buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]); | ||
291 | x++; | ||
292 | } | ||
293 | buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]); | ||
294 | } | ||
295 | if (x <= 0) { | ||
296 | if (err + ady >= 0) | ||
297 | y += sy; | ||
298 | buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]); | ||
299 | } | ||
300 | } | ||
301 | |||
302 | static void render_line(int x0, int y0, int x1, int y1, ogg_int32_t *buf) | ||
303 | { | ||
304 | int dy = y1 - y0; | ||
305 | int adx = x1 - x0; | ||
306 | int ady = abs(dy); | ||
307 | int sy = dy < 0 ? -1 : 1; | ||
308 | buf[x0] = MULT31_SHIFT15(buf[x0],FLOOR_fromdB_LOOKUP[y0]); | ||
309 | if (ady*2 <= adx) { // optimized common case | ||
310 | render_line_unrolled(x0, y0, x1, sy, ady, adx, buf); | ||
311 | } else { | ||
312 | int base = dy / adx; | ||
313 | int x = x0; | ||
314 | int y = y0; | ||
315 | int err = -adx; | ||
316 | ady -= abs(base) * adx; | ||
317 | while (++x < x1) { | ||
318 | y += base; | ||
319 | err += ady; | ||
320 | if (err >= 0) { | ||
321 | err -= adx; | ||
322 | y += sy; | ||
323 | } | ||
324 | buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]); | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | 278 | ||
329 | static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in) | 279 | static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in) |
330 | ICODE_ATTR_TREMOR_NOT_MDCT; | 280 | ICODE_ATTR_TREMOR_NOT_MDCT; |