summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2005-06-02 15:28:37 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2005-06-02 15:28:37 +0000
commit32ba9920dba8f60e4da28dafd2903feb826c2d64 (patch)
treeda641e5bf673ae5e8ffd697fe3c91e232459cf4a /libopenjpeg
parent7ae6a670fae0267ae7bb5c3bca144520d0cacdf9 (diff)
At lines 577, 692 and 699, zeroing of effective region of code-block rather than the 1024*1024 allocated integers of code-block. This optimization has been proposed by Dmitry Kolyadin. Thanks for your help !
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/t1.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c
index f5513ba4..d4a4e440 100644
--- a/libopenjpeg/t1.c
+++ b/libopenjpeg/t1.c
@@ -37,7 +37,6 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
-#include <memory.h>
#define T1_MAXCBLKW 1024
#define T1_MAXCBLKH 1024
@@ -574,7 +573,11 @@ void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qm
cblk->numbps = max ? (int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS : 0;
- memset(t1_flags,0,sizeof(t1_flags));
+ /* Changed by Dmitry Kolyadin */
+ for (i = 0; i <= w; i++)
+ for (j = 0; j <= h; j++){
+ t1_flags[j][i] = 0;
+ }
bpno = cblk->numbps - 1;
passtype = 2;
@@ -678,16 +681,28 @@ void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qm
void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift,
int cblksty)
{
- int w, h;
+ int i, j, w, h;
int bpno, passtype;
int segno, passno;
char type = T1_TYPE_MQ; //BYPASS mode
- memset(t1_data,0,sizeof(t1_data));
- memset(t1_flags,0,sizeof(t1_flags));
-
w = cblk->x1 - cblk->x0;
h = cblk->y1 - cblk->y0;
+
+ /* Changed by Dmitry Kolyadin */
+ for (j = 0; j <= h; j++){
+ for (i = 0; i <= w; i++) {
+ t1_flags[j][i] = 0;
+ }
+ }
+
+ /* Changed by Dmitry Kolyadin */
+ for (i = 0; i < w; i++) {
+ for (j = 0; j < h; j++){
+ t1_data[j][i] = 0;
+ }
+ }
+
bpno = roishift + cblk->numbps - 1;
passtype = 2;
@@ -709,8 +724,6 @@ void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift,
mqc_init_dec(seg->data, seg->len);
// ddA
-
-
if (bpno==0) cblk->lastbp=1; // Add Antonin : quantizbug1
for (passno = 0; passno < seg->numpasses; passno++) {