1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

jpeg2000: Optimize dequantization

Float:   4700 -> 2700 cycles
Integer: 4400 -> 2800 cycles

(sandybridge  i7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Michael Niedermayer
2013-07-01 10:01:35 +02:00
committed by Luca Barbato
parent c1dcbc590d
commit e11099db20

View File

@@ -1006,12 +1006,13 @@ static void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,
Jpeg2000Component *comp, Jpeg2000Component *comp,
Jpeg2000T1Context *t1, Jpeg2000Band *band) Jpeg2000T1Context *t1, Jpeg2000Band *band)
{ {
int i, j, idx; int i, j;
float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]; int w = cblk->coord[0][1] - cblk->coord[0][0];
for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
for (i = 0; i < (cblk->coord[0][1] - cblk->coord[0][0]); ++i) { float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
idx = (comp->coord[0][1] - comp->coord[0][0]) * j + i; int *src = t1->data[j];
datap[idx] = (float)(t1->data[j][i]) * band->f_stepsize; for (i = 0; i < w; ++i)
datap[i] = src[i] * band->f_stepsize;
} }
} }
@@ -1020,13 +1021,13 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,
Jpeg2000Component *comp, Jpeg2000Component *comp,
Jpeg2000T1Context *t1, Jpeg2000Band *band) Jpeg2000T1Context *t1, Jpeg2000Band *band)
{ {
int i, j, idx; int i, j;
int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]; int w = cblk->coord[0][1] - cblk->coord[0][0];
for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
for (i = 0; i < (cblk->coord[0][1] - cblk->coord[0][0]); ++i) { int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
idx = (comp->coord[0][1] - comp->coord[0][0]) * j + i; int *src = t1->data[j];
datap[idx] = for (i = 0; i < w; ++i)
((int32_t)(t1->data[j][i]) * band->i_stepsize + (1 << 15)) >> 16; datap[i] = (src[i] * band->i_stepsize + (1 << 15)) >> 16;
} }
} }