aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-31 15:36:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-01 11:48:09 +0200
commit6cbd0241f216d74ac46c3ab73a36f6e341aa39e6 (patch)
tree5f7ad6e00a2b9dbbd3468740b565ad274b155dff
parentc485c835fef46dea5dddf66243954275291dcdee (diff)
downloadffmpeg-6cbd0241f216d74ac46c3ab73a36f6e341aa39e6.tar.gz
jpeg2000dec: optimize dequantization_float()
4700 -> 2700 cycles (sandybridge i7) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/jpeg2000dec.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index e2540a6c82..3b035b88c3 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -923,13 +923,14 @@ static void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,
Jpeg2000Component *comp,
Jpeg2000T1Context *t1, Jpeg2000Band *band)
{
- int i, j, idx;
- float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x];
- 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) {
- idx = (comp->coord[0][1] - comp->coord[0][0]) * j + i;
- datap[idx] = (float)(t1->data[j][i]) * band->f_stepsize;
- }
+ int i, j;
+ int w = cblk->coord[0][1] - cblk->coord[0][0];
+ for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
+ float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
+ int *src = t1->data[j];
+ for (i = 0; i < w; ++i)
+ datap[i] = src[i] * band->f_stepsize;
+ }
}
/* Integer dequantization of a codeblock.*/