]> granicus.if.org Git - openjpeg/commitdiff
remove deprecated v1 style function dwt_encode; rename dwt_encode_v2 to opj_dwt_encode
authorMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 17 Aug 2012 08:27:57 +0000 (08:27 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 17 Aug 2012 08:27:57 +0000 (08:27 +0000)
remove deprecated v1 style function dwt_decode; rename dwt_decode_v2 to opj_dwt_decode
remove deprecated v1 style function dwt_getgain; rename dwt_getgain_v2 to opj_dwt_getgain
add opj_dwt_getnorm, opj_dwt_getnorm_real functions
remove deprecated v1 style function dwt_encode_real; rename dwt_encode_real_v2 to opj_dwt_encode_real
remove deprecated v1 style function dwt_getgain_real; rename dwt_getgain_real_v2 to opj_dwt_getgain_real
rename dwt_calc_explicit_stepsizes to opj_dwt_calc_explicit_stepsizes

libopenjpeg/dwt.c
libopenjpeg/dwt.h
libopenjpeg/function_list.h
libopenjpeg/j2k.c
libopenjpeg/t1.c
libopenjpeg/tcd.c

index dea806d2ee7a5db0d36873441690ffd3899a0007..a6ea248331586be26799b7d3164ee52a3cd3b3f8 100644 (file)
@@ -360,60 +360,6 @@ static void dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsi
 ==========================================================
 */
 
-/* <summary>                            */
-/* Forward 5-3 wavelet transform in 2-D. */
-/* </summary>                           */
-void dwt_encode(opj_tcd_tilecomp_t * tilec) {
-       int i, j, k;
-       int *a = NULL;
-       int *aj = NULL;
-       int *bj = NULL;
-       int w, l;
-       
-       w = tilec->x1-tilec->x0;
-       l = tilec->numresolutions-1;
-       a = tilec->data;
-       
-       for (i = 0; i < l; i++) {
-               int rw;                 /* width of the resolution level computed                                                           */
-               int rh;                 /* height of the resolution level computed                                                          */
-               int rw1;                /* width of the resolution level once lower than computed one                                       */
-               int rh1;                /* height of the resolution level once lower than computed one                                      */
-               int cas_col;    /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
-               int cas_row;    /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering   */
-               int dn, sn;
-               
-               rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
-               rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
-               rw1= tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
-               rh1= tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
-               
-               cas_row = tilec->resolutions[l - i].x0 % 2;
-               cas_col = tilec->resolutions[l - i].y0 % 2;
-        
-               sn = rh1;
-               dn = rh - rh1;
-               bj = (int*)opj_malloc(rh * sizeof(int));
-               for (j = 0; j < rw; j++) {
-                       aj = a + j;
-                       for (k = 0; k < rh; k++)  bj[k] = aj[k*w];
-                       dwt_encode_1(bj, dn, sn, cas_col);
-                       dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col);
-               }
-               opj_free(bj);
-               
-               sn = rw1;
-               dn = rw - rw1;
-               bj = (int*)opj_malloc(rw * sizeof(int));
-               for (j = 0; j < rh; j++) {
-                       aj = a + j * w;
-                       for (k = 0; k < rw; k++)  bj[k] = aj[k];
-                       dwt_encode_1(bj, dn, sn, cas_row);
-                       opj_dwt_deinterleave_h(bj, aj, dn, sn, cas_row);
-               }
-               opj_free(bj);
-       }
-}
 
 /* <summary>                            */
 /* Forward 5-3 wavelet transform in 2-D. */
@@ -499,31 +445,15 @@ INLINE opj_bool dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_func
 
 /* Forward 5-3 wavelet transform in 2-D. */
 /* </summary>                           */
-opj_bool dwt_encode_v2(opj_tcd_tilecomp_v2_t * tilec)
+opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec)
 {
        return dwt_encode_procedure(tilec,dwt_encode_1);
 }
 
-#ifdef OPJ_V1
-/* <summary>                            */
-/* Inverse 5-3 wavelet transform in 2-D. */
-/* </summary>                           */
-void dwt_decode(opj_tcd_tilecomp_t* tilec, int numres) {
-       dwt_decode_tile(tilec, numres, &dwt_decode_1);
-}
-#endif
-
-/* <summary>                            */
-/* Inverse 5-3 wavelet transform in 2-D. */
-/* </summary>                           */
-opj_bool dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) {
-       return dwt_decode_tile(tilec, numres, &dwt_decode_1);
-}
-
 /* <summary>                            */
 /* Inverse 5-3 wavelet transform in 2-D. */
 /* </summary>                           */
-opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
+opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
        return dwt_decode_tile_v2(tilec, numres, &dwt_decode_1);
 }
 
@@ -531,18 +461,7 @@ opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
 /* <summary>                          */
 /* Get gain of 5-3 wavelet transform. */
 /* </summary>                         */
-int dwt_getgain(int orient) {
-       if (orient == 0)
-               return 0;
-       if (orient == 1 || orient == 2)
-               return 1;
-       return 2;
-}
-
-/* <summary>                          */
-/* Get gain of 5-3 wavelet transform. */
-/* </summary>                         */
-OPJ_UINT32 dwt_getgain_v2(OPJ_UINT32 orient) {
+OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) {
        if (orient == 0)
                return 0;
        if (orient == 1 || orient == 2)
@@ -557,66 +476,17 @@ double dwt_getnorm(int level, int orient) {
        return dwt_norms[orient][level];
 }
 
-/* <summary>                             */
-/* Forward 9-7 wavelet transform in 2-D. */
-/* </summary>                            */
-
-void dwt_encode_real(opj_tcd_tilecomp_t * tilec) {
-       int i, j, k;
-       int *a = NULL;
-       int *aj = NULL;
-       int *bj = NULL;
-       int w, l;
-       
-       w = tilec->x1-tilec->x0;
-       l = tilec->numresolutions-1;
-       a = tilec->data;
-       
-       for (i = 0; i < l; i++) {
-               int rw;                 /* width of the resolution level computed                                                     */
-               int rh;                 /* height of the resolution level computed                                                    */
-               int rw1;                /* width of the resolution level once lower than computed one                                 */
-               int rh1;                /* height of the resolution level once lower than computed one                                */
-               int cas_col;    /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
-               int cas_row;    /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering   */
-               int dn, sn;
-               
-               rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
-               rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
-               rw1= tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
-               rh1= tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
-               
-               cas_row = tilec->resolutions[l - i].x0 % 2;
-               cas_col = tilec->resolutions[l - i].y0 % 2;
-               
-               sn = rh1;
-               dn = rh - rh1;
-               bj = (int*)opj_malloc(rh * sizeof(int));
-               for (j = 0; j < rw; j++) {
-                       aj = a + j;
-                       for (k = 0; k < rh; k++)  bj[k] = aj[k*w];
-                       dwt_encode_1_real(bj, dn, sn, cas_col);
-                       dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col);
-               }
-               opj_free(bj);
-               
-               sn = rw1;
-               dn = rw - rw1;
-               bj = (int*)opj_malloc(rw * sizeof(int));
-               for (j = 0; j < rh; j++) {
-                       aj = a + j * w;
-                       for (k = 0; k < rw; k++)  bj[k] = aj[k];
-                       dwt_encode_1_real(bj, dn, sn, cas_row);
-                       opj_dwt_deinterleave_h(bj, aj, dn, sn, cas_row);
-               }
-               opj_free(bj);
-       }
+/* <summary>                */
+/* Get norm of 5-3 wavelet. */
+/* </summary>               */
+OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient) {
+       return dwt_norms[orient][level];
 }
 
 /* <summary>                             */
 /* Forward 9-7 wavelet transform in 2-D. */
 /* </summary>                            */
-opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec)
+opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec)
 {
        return dwt_encode_procedure(tilec,dwt_encode_1_real);
 }
@@ -624,32 +494,31 @@ opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec)
 /* <summary>                          */
 /* Get gain of 9-7 wavelet transform. */
 /* </summary>                         */
-int dwt_getgain_real(int orient) {
+OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient) {
        (void)orient;
        return 0;
 }
 
-/* <summary>                          */
-/* Get gain of 9-7 wavelet transform. */
-/* </summary>                         */
-OPJ_UINT32 dwt_getgain_real_v2(OPJ_UINT32 orient) {
-       (void)orient;
-       return 0;
+/* <summary>                */
+/* Get norm of 9-7 wavelet. */
+/* </summary>               */
+double dwt_getnorm_real(int level, int orient) {
+       return dwt_norms_real[orient][level];
 }
 
 /* <summary>                */
 /* Get norm of 9-7 wavelet. */
 /* </summary>               */
-double dwt_getnorm_real(int level, int orient) {
+OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient) {
        return dwt_norms_real[orient][level];
 }
 
-void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec) {
-       int numbands, bandno;
+void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
+       OPJ_UINT32 numbands, bandno;
        numbands = 3 * tccp->numresolutions - 2;
        for (bandno = 0; bandno < numbands; bandno++) {
-               double stepsize;
-               int resno, level, orient, gain;
+               OPJ_FLOAT64 stepsize;
+               OPJ_UINT32 resno, level, orient, gain;
 
                resno = (bandno == 0) ? 0 : ((bandno - 1) / 3 + 1);
                orient = (bandno == 0) ? 0 : ((bandno - 1) % 3 + 1);
@@ -658,10 +527,10 @@ void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec) {
                if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
                        stepsize = 1.0;
                } else {
-                       double norm = dwt_norms_real[orient][level];
+                       OPJ_FLOAT64 norm = dwt_norms_real[orient][level];
                        stepsize = (1 << (gain)) / norm;
                }
-               dwt_encode_stepsize((int) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
+               dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
        }
 }
 
index 3b8333919a86ddde3b893aa7b8c03912288b3f82..88308164dc2e0d2875556315c62bda5c1d326348 100644 (file)
@@ -52,49 +52,36 @@ Forward 5-3 wavelet tranform in 2-D.
 Apply a reversible DWT transform to a component of an image.
 @param tilec Tile component information (current tile)
 */
-opj_bool dwt_encode_v2(struct opj_tcd_tilecomp_v2 * tilec);
+opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec);
 
-/**
-Forward 5-3 wavelet tranform in 2-D.
-Apply a reversible DWT transform to a component of an image.
-@param tilec Tile component information (current tile)
-*/
-void dwt_encode(opj_tcd_tilecomp_t * tilec);
 /**
 Inverse 5-3 wavelet tranform in 2-D.
 Apply a reversible inverse DWT transform to a component of an image.
 @param tilec Tile component information (current tile)
 @param numres Number of resolution levels to decode
 */
-#ifdef OPJ_V1
-void dwt_decode(opj_tcd_tilecomp_t* tilec, int numres);
-#endif
-opj_bool dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
-
-opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres);
+opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres);
 
 /**
 Get the gain of a subband for the reversible 5-3 DWT.
 @param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
 @return Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise
 */
-int dwt_getgain(int orient);
-
-OPJ_UINT32 dwt_getgain_v2(OPJ_UINT32 orient) ;
+OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) ;
 /**
 Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
 @param level Level of the wavelet function
 @param orient Band of the wavelet function
 @return Returns the norm of the wavelet function
 */
-double dwt_getnorm(int level, int orient);
+double dwt_getnorm(int level, int orient); /* TODO REMOVE IT*/
+OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
 /**
 Forward 9-7 wavelet transform in 2-D. 
 Apply an irreversible DWT transform to a component of an image.
 @param tilec Tile component information (current tile)
 */
-void dwt_encode_real(opj_tcd_tilecomp_t * tilec);
-opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec);
+opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec);
 /**
 KEEP TRUNK VERSION + return type of v2 because rev557
 Inverse 9-7 wavelet transform in 2-D. 
@@ -112,8 +99,7 @@ Get the gain of a subband for the irreversible 9-7 DWT.
 @param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
 @return Returns the gain of the 9-7 wavelet transform
 */
-int dwt_getgain_real(int orient);
-OPJ_UINT32 dwt_getgain_real_v2(OPJ_UINT32 orient);
+OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient);
 /**
 Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT
 @param level Level of the wavelet function
@@ -121,12 +107,13 @@ Get the norm of a wavelet function of a subband at a specified level for the irr
 @return Returns the norm of the 9-7 wavelet
 */
 double dwt_getnorm_real(int level, int orient);
+OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient);
 /**
 Explicit calculation of the Quantization Stepsizes 
 @param tccp Tile-component coding parameters
 @param prec Precint analyzed
 */
-void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec);
+void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec);
 /* ----------------------------------------------------------------------- */
 /*@}*/
 
index 418f8277e38864ea8ecb69775844c9e4045b840c..d44c1795115f8d5bbe92721c25325e7704931b6b 100644 (file)
 /** @defgroup validation validation procedure*/
 /*@{*/
 
-/*#include "openjpeg.h" */
 /**************************************************************************************************
  ***************************************** FORWARD DECLARATION ************************************
  **************************************************************************************************/
-struct opj_jp2;
 
 /**
  * declare a function pointer
index 54c1b5f73af79da78cfd94b29365ad74224152c0..eb77110eb91e42c4f445821a2db940ae06740eaa 100644 (file)
@@ -6261,7 +6261,7 @@ void opj_j2k_setup_encoder(       opj_j2k_v2_t *p_j2k,
                                }
                        }
 
-                       dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);
+                       opj_dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);
                }
        }
 
index 5ace77bee50d3a1502dbfcf779add20c7ed174bd..82c9ca1f91ed64de09a0a9df277ee8e38cf96f4a 100644 (file)
@@ -1209,9 +1209,9 @@ static OPJ_FLOAT64 t1_getwmsedec_v2(
        }
 
        if (qmfbid == 1) {
-               w2 = dwt_getnorm(level, orient);
+               w2 = opj_dwt_getnorm(level, orient);
        } else {        /* if (qmfbid == 0) */
-               w2 = dwt_getnorm_real(level, orient);
+               w2 = opj_dwt_getnorm_real(level, orient);
        }
 
        wmsedec = w1 * w2 * stepsize * (1 << bpno);
index 6aa19759b1162bdc51a7a8d016519c6969f248b3..d6c2748c2df60429c72073e9c25c66dd7ea3a4b4 100644 (file)
@@ -735,10 +735,10 @@ opj_bool FUNCTION (       opj_tcd_v2_t *p_tcd,                                                                            \
                l_res = l_tilec->resolutions;                                                                                   \
                l_step_size = l_tccp->stepsizes;                                                                                \
                if (l_tccp->qmfbid == 0) {                                                                                              \
-                       l_gain_ptr = &dwt_getgain_real_v2;                                                                      \
+                       l_gain_ptr = &opj_dwt_getgain_real;                                                                     \
                }                                                                                                                                               \
                else {                                                                                                                                  \
-                       l_gain_ptr  = &dwt_getgain_v2;                                                                          \
+                       l_gain_ptr  = &opj_dwt_getgain;                                                                         \
                }                                                                                                                                               \
                /*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/                                              \
                                                                                                                                                                \
@@ -1521,7 +1521,7 @@ opj_bool opj_tcd_dwt_decode ( opj_tcd_v2_t *p_tcd )
                */
 
                if (l_tccp->qmfbid == 1) {
-                       if (! dwt_decode_v2(l_tile_comp, l_img_comp->resno_decoded+1)) {
+                       if (! opj_dwt_decode(l_tile_comp, l_img_comp->resno_decoded+1)) {
                                return OPJ_FALSE;
                        }
                }
@@ -1884,12 +1884,12 @@ opj_bool opj_tcd_dwt_encode ( opj_tcd_v2_t *p_tcd )
 
        for (compno = 0; compno < l_tile->numcomps; ++compno) {
                if (l_tccp->qmfbid == 1) {
-                       if (! dwt_encode_v2(l_tile_comp)) {
+                       if (! opj_dwt_encode(l_tile_comp)) {
                                return OPJ_FALSE;
                        }
                }
                else if (l_tccp->qmfbid == 0) {
-                       if (! dwt_encode_real_v2(l_tile_comp)) {
+                       if (! opj_dwt_encode_real(l_tile_comp)) {
                                return OPJ_FALSE;
                        }
                }