summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libtremor/ffmpeg_render_line.h17
-rw-r--r--apps/codecs/libtremor/floor1.c5
2 files changed, 11 insertions, 11 deletions
diff --git a/apps/codecs/libtremor/ffmpeg_render_line.h b/apps/codecs/libtremor/ffmpeg_render_line.h
index c429c27..1b760ae 100644
--- a/apps/codecs/libtremor/ffmpeg_render_line.h
+++ b/apps/codecs/libtremor/ffmpeg_render_line.h
@@ -23,7 +23,7 @@
/* render_line and friend taken from ffmpeg (libavcodec/vorbis.c) */
static inline void render_line_unrolled(int x, int y, int x1,
int sy, int ady, int adx,
- ogg_int32_t *buf)
+ const ogg_int32_t *lookup, ogg_int32_t *buf)
{
int err = -adx;
x -= x1 - 1;
@@ -33,27 +33,28 @@ static inline void render_line_unrolled(int x, int y, int x1,
if (err >= 0) {
err += ady - adx;
y += sy;
- buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]);
+ buf[x] = MULT31_SHIFT15(buf[x],lookup[y]);
x++;
}
- buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]);
+ buf[x] = MULT31_SHIFT15(buf[x],lookup[y]);
}
if (x <= 0) {
if (err + ady >= 0)
y += sy;
- buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]);
+ buf[x] = MULT31_SHIFT15(buf[x],lookup[y]);
}
}
-static void render_line(int x0, int y0, int x1, int y1, ogg_int32_t *buf)
+static void render_line(int x0, int y0, int x1, int y1,
+ const ogg_int32_t *lookup, ogg_int32_t *buf)
{
int dy = y1 - y0;
int adx = x1 - x0;
int ady = abs(dy);
int sy = dy < 0 ? -1 : 1;
- buf[x0] = MULT31_SHIFT15(buf[x0],FLOOR_fromdB_LOOKUP[y0]);
+ buf[x0] = MULT31_SHIFT15(buf[x0],lookup[y0]);
if (ady*2 <= adx) { // optimized common case
- render_line_unrolled(x0, y0, x1, sy, ady, adx, buf);
+ render_line_unrolled(x0, y0, x1, sy, ady, adx, lookup, buf);
} else {
int base = dy / adx;
int x = x0;
@@ -67,7 +68,7 @@ static void render_line(int x0, int y0, int x1, int y1, ogg_int32_t *buf)
err -= adx;
y += sy;
}
- buf[x] = MULT31_SHIFT15(buf[x],FLOOR_fromdB_LOOKUP[y]);
+ buf[x] = MULT31_SHIFT15(buf[x],lookup[y]);
}
}
}
diff --git a/apps/codecs/libtremor/floor1.c b/apps/codecs/libtremor/floor1.c
index 6528639..94d00da 100644
--- a/apps/codecs/libtremor/floor1.c
+++ b/apps/codecs/libtremor/floor1.c
@@ -24,6 +24,7 @@
#include "registry.h"
#include "codebook.h"
#include "misc.h"
+#include "ffmpeg_render_line.h"
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
@@ -287,8 +288,6 @@ static const ogg_int32_t FLOOR_fromdB_LOOKUP[256] ICONST_ATTR = {
XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
};
-#include "ffmpeg_render_line.h"
-
static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in)
ICODE_ATTR_TREMOR_NOT_MDCT;
static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
@@ -406,7 +405,7 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
/* guard lookup against out-of-range values */
hy=(hy<0?0:hy>255?255:hy);
- render_line(lx, ly, hx, hy, out);
+ render_line(lx, ly, hx, hy, FLOOR_fromdB_LOOKUP, out);
lx=hx;
ly=hy;