[FFmpeg-cvslog] jpeg2000dec: optimize dequantization_int()

Michael Niedermayer git at videolan.org
Sat Jun 1 11:48:38 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 31 15:39:22 2013 +0200| [dc60061bb6e3b2ee87a12fb3a26239d7b5a74379] | committer: Michael Niedermayer

jpeg2000dec: optimize dequantization_int()

4400->2800 cycles

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc60061bb6e3b2ee87a12fb3a26239d7b5a74379
---

 libavcodec/jpeg2000dec.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 3b035b8..9822900 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -938,14 +938,14 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,
                                Jpeg2000Component *comp,
                                Jpeg2000T1Context *t1, Jpeg2000Band *band)
 {
-    int i, j, idx;
-    int32_t *datap = &comp->i_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] =
-                ((int32_t)(t1->data[j][i]) * band->i_stepsize + (1 << 15)) >> 16;
-        }
+    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) {
+        int32_t *datap = &comp->i_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->i_stepsize + (1 << 15)) >> 16;
+    }
 }
 
 /* Inverse ICT parameters in float and integer.



More information about the ffmpeg-cvslog mailing list