diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-28 09:30:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-28 09:35:49 +0200 |
commit | cf05fe8a7e588c005b93948e2e418a7b4744fe79 (patch) | |
tree | 50993336b1ec3fc0cd491af8e196c19f641528d5 /libavcodec | |
parent | 3fc8500483bef4dcb43b4a1e5fe628e416ca1a0e (diff) | |
download | ffmpeg-cf05fe8a7e588c005b93948e2e418a7b4744fe79.tar.gz |
jpeg2000dwt: remove floats from mixed float/int 9/7 dwt
This should fix some fate failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/jpeg2000dwt.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c index 905ce1805b..7a6b9e45b5 100644 --- a/libavcodec/jpeg2000dwt.c +++ b/libavcodec/jpeg2000dwt.c @@ -145,31 +145,31 @@ static void dwt_encode53(DWTContext *s, int *t) } } -static void sd_1d97(float *p, int i0, int i1) +static void sd_1d97_int(int *p, int i0, int i1) { int i; if (i1 == i0 + 1) return; - extend97_float(p, i0, i1); + extend97_int(p, i0, i1); i0++; i1++; for (i = i0/2 - 2; i < i1/2 + 1; i++) - p[2*i+1] -= 1.586134 * (p[2*i] + p[2*i+2]); + p[2 * i + 1] -= (I_LFTG_ALPHA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; for (i = i0/2 - 1; i < i1/2 + 1; i++) - p[2*i] -= 0.052980 * (p[2*i-1] + p[2*i+1]); + p[2 * i] -= (I_LFTG_BETA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; for (i = i0/2 - 1; i < i1/2; i++) - p[2*i+1] += 0.882911 * (p[2*i] + p[2*i+2]); + p[2 * i + 1] += (I_LFTG_GAMMA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; for (i = i0/2; i < i1/2; i++) - p[2*i] += 0.443506 * (p[2*i-1] + p[2*i+1]); + p[2 * i] += (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; } static void dwt_encode97_int(DWTContext *s, int *t) { int lev, w = s->linelen[s->ndeclevels-1][0]; - float *line = s->i_linebuf; + int *line = s->i_linebuf; line += 5; for (lev = s->ndeclevels-1; lev >= 0; lev--){ @@ -178,7 +178,7 @@ static void dwt_encode97_int(DWTContext *s, int *t) mh = s->mod[lev][0], mv = s->mod[lev][1], lp; - float *l; + int *l; // HOR_SD l = line + mh; @@ -188,13 +188,13 @@ static void dwt_encode97_int(DWTContext *s, int *t) for (i = 0; i < lh; i++) l[i] = t[w*lp + i]; - sd_1d97(line, mh, mh + lh); + sd_1d97_int(line, mh, mh + lh); // copy back and deinterleave for (i = mh; i < lh; i+=2, j++) - t[w*lp + j] = F_LFTG_X * l[i] / 2; + t[w*lp + j] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17; for (i = 1-mh; i < lh; i+=2, j++) - t[w*lp + j] = F_LFTG_K * l[i] / 2; + t[w*lp + j] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17; } // VER_SD @@ -205,13 +205,13 @@ static void dwt_encode97_int(DWTContext *s, int *t) for (i = 0; i < lv; i++) l[i] = t[w*i + lp]; - sd_1d97(line, mv, mv + lv); + sd_1d97_int(line, mv, mv + lv); // copy back and deinterleave for (i = mv; i < lv; i+=2, j++) - t[w*j + lp] = F_LFTG_X * l[i] / 2; + t[w*j + lp] = ((l[i] * I_LFTG_X) + (1 << 16)) >> 17; for (i = 1-mv; i < lv; i+=2, j++) - t[w*j + lp] = F_LFTG_K * l[i] / 2; + t[w*j + lp] = ((l[i] * I_LFTG_K) + (1 << 16)) >> 17; } } } |