Merge pull request #636 from uclouvain/opj_malloc-625
[openjpeg.git] / src / lib / openjp2 / dwt.c
index 4ad99ed98c3ef99c00fc743f6b5de6688e6f0aa6..92752f4289821352dd624ca46d3bb76a27420df2 100644 (file)
@@ -567,9 +567,11 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres
        OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0);  /* height of the resolution level computed */
 
        OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
-
-       h.mem = (OPJ_INT32*)
-       opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
+       
+       if (numres == 1U) {
+               return OPJ_TRUE;
+       }
+       h.mem = (OPJ_INT32*)opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
        if (! h.mem){
                /* FIXME event manager error callback */
                return OPJ_FALSE;
@@ -741,8 +743,8 @@ static void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT
 
 static void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)
 {
-       OPJ_FLOAT32* restrict fl = (OPJ_FLOAT32*) l;
-       OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;
+       OPJ_FLOAT32* fl = (OPJ_FLOAT32*) l;
+       OPJ_FLOAT32* fw = (OPJ_FLOAT32*) w;
        OPJ_INT32 i;
        for(i = 0; i < m; ++i){
                OPJ_FLOAT32 tmp1_1 = fl[0];