OpenJPEG 1.5.2
dwt.c File Reference
#include "opj_includes.h"

Data Structures

struct  dwt_local
 
union  v4
 
struct  v4dwt_local
 

Macros

#define WS(i)
 
#define WD(i)
 

Local static functions

#define S(i)
 
#define D(i)
 
#define S_(i)
 
#define D_(i)
 
#define SS_(i)
 
#define DD_(i)
 
static const double dwt_norms [4][10]
 
static const double dwt_norms_real [4][10]
 
static void dwt_deinterleave_h (int *a, int *b, int dn, int sn, int cas)
 Forward lazy transform (horizontal)
 
static void dwt_deinterleave_v (int *a, int *b, int dn, int sn, int x, int cas)
 Forward lazy transform (vertical)
 
static void dwt_interleave_h (dwt_t *h, int *a)
 Inverse lazy transform (horizontal)
 
static void dwt_interleave_v (dwt_t *v, int *a, int x)
 Inverse lazy transform (vertical)
 
static void dwt_encode_1 (int *a, int dn, int sn, int cas)
 Forward 5-3 wavelet transform in 1-D.
 
static void dwt_decode_1 (dwt_t *v)
 Inverse 5-3 wavelet transform in 1-D.
 
static void dwt_encode_1_real (int *a, int dn, int sn, int cas)
 Forward 9-7 wavelet transform in 1-D.
 
static void dwt_encode_stepsize (int stepsize, int numbps, opj_stepsize_t *bandno_stepsize)
 Explicit calculation of the Quantization Stepsizes.
 
static void dwt_decode_tile (opj_tcd_tilecomp_t *tilec, int i, DWT1DFN fn)
 Inverse wavelet transform in 2-D.
 
static void dwt_decode_1_ (int *a, int dn, int sn, int cas)
 
void dwt_encode (opj_tcd_tilecomp_t *tilec)
 Forward 5-3 wavelet tranform in 2-D.
 
void dwt_decode (opj_tcd_tilecomp_t *tilec, int numres)
 Inverse 5-3 wavelet tranform in 2-D.
 
int dwt_getgain (int orient)
 Get the gain of a subband for the reversible 5-3 DWT.
 
double dwt_getnorm (int level, int orient)
 Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
 
void dwt_encode_real (opj_tcd_tilecomp_t *tilec)
 Forward 9-7 wavelet transform in 2-D.
 
int dwt_getgain_real (int orient)
 Get the gain of a subband for the irreversible 9-7 DWT.
 
double dwt_getnorm_real (int level, int orient)
 Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT.
 
void dwt_calc_explicit_stepsizes (opj_tccp_t *tccp, int prec)
 Explicit calculation of the Quantization Stepsizes.
 
static int dwt_decode_max_resolution (opj_tcd_resolution_t *restrict r, int i)
 
static void v4dwt_interleave_h (v4dwt_t *restrict w, float *restrict a, int x, int size)
 
static void v4dwt_interleave_v (v4dwt_t *restrict v, float *restrict a, int x)
 
static void v4dwt_decode_step1 (v4 *w, int count, const float c)
 
static void v4dwt_decode_step2 (v4 *l, v4 *w, int k, int m, float c)
 
static void v4dwt_decode (v4dwt_t *restrict dwt)
 
void dwt_decode_real (opj_tcd_tilecomp_t *restrict tilec, int numres)
 

Local data structures

typedef struct dwt_local dwt_t
 
typedef struct v4dwt_local v4dwt_t
 
typedef void(* DWT1DFN) (dwt_t *v)
 Virtual function type for wavelet transform in 1-D.
 
static const float dwt_alpha = 1.586134342f
 
static const float dwt_beta = 0.052980118f
 
static const float dwt_gamma = -0.882911075f
 
static const float dwt_delta = -0.443506852f
 
static const float K = 1.230174105f
 
static const float c13318 = 1.625732422f
 

Macro Definition Documentation

◆ D

#define D ( i)
Value:
a[(1+(i)*2)]

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ D_

#define D_ ( i)
Value:
((i)<0?D(0):((i)>=dn?D(dn-1):D(i)))
#define D(i)
Definition dwt.c:128

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ DD_

#define DD_ ( i)
Value:
((i)<0?D(0):((i)>=sn?D(sn-1):D(i)))

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ S

#define S ( i)
Value:
a[(i)*2]

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ S_

#define S_ ( i)
Value:
((i)<0?S(0):((i)>=sn?S(sn-1):S(i)))
#define S(i)
Definition dwt.c:127

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ SS_

#define SS_ ( i)
Value:
((i)<0?S(0):((i)>=dn?S(dn-1):S(i)))

Referenced by dwt_decode_1_(), dwt_encode_1(), and dwt_encode_1_real().

◆ WD

#define WD ( i)
Value:
v->mem[(1+(i)*2)]

◆ WS

#define WS ( i)
Value:
v->mem[(i)*2]

Typedef Documentation

◆ DWT1DFN

typedef void(* DWT1DFN) (dwt_t *v)

Virtual function type for wavelet transform in 1-D.

◆ dwt_t

typedef struct dwt_local dwt_t

◆ v4dwt_t

typedef struct v4dwt_local v4dwt_t

Function Documentation

◆ dwt_calc_explicit_stepsizes()

void dwt_calc_explicit_stepsizes ( opj_tccp_t * tccp,
int prec )

Explicit calculation of the Quantization Stepsizes.

Parameters
tccpTile-component coding parameters
precPrecint analyzed

References dwt_encode_stepsize(), dwt_norms_real, J2K_CCP_QNTSTY_NOQNT, opj_tccp::numresolutions, opj_tccp::qmfbid, opj_tccp::qntsty, and opj_tccp::stepsizes.

Referenced by j2k_setup_encoder().

◆ dwt_decode()

void dwt_decode ( opj_tcd_tilecomp_t * tilec,
int numres )

Inverse 5-3 wavelet tranform in 2-D.

Apply a reversible inverse DWT transform to a component of an image.

Parameters
tilecTile component information (current tile)
numresNumber of resolution levels to decode

References dwt_decode_1(), and dwt_decode_tile().

Referenced by tcd_decode_tile().

◆ dwt_decode_1()

static void dwt_decode_1 ( dwt_t * v)
static

Inverse 5-3 wavelet transform in 1-D.

References dwt_local::cas, dwt_local::dn, dwt_decode_1_(), dwt_local::mem, and dwt_local::sn.

Referenced by dwt_decode().

◆ dwt_decode_1_()

static void dwt_decode_1_ ( int * a,
int dn,
int sn,
int cas )
static

References D, D_, DD_, S, S_, and SS_.

Referenced by dwt_decode_1().

◆ dwt_decode_max_resolution()

static int dwt_decode_max_resolution ( opj_tcd_resolution_t *restrict r,
int i )
static

Referenced by dwt_decode_real(), and dwt_decode_tile().

◆ dwt_decode_real()

◆ dwt_decode_tile()

◆ dwt_deinterleave_h()

static void dwt_deinterleave_h ( int * a,
int * b,
int dn,
int sn,
int cas )
static

Forward lazy transform (horizontal)

Referenced by dwt_encode(), and dwt_encode_real().

◆ dwt_deinterleave_v()

static void dwt_deinterleave_v ( int * a,
int * b,
int dn,
int sn,
int x,
int cas )
static

Forward lazy transform (vertical)

Referenced by dwt_encode(), and dwt_encode_real().

◆ dwt_encode()

void dwt_encode ( opj_tcd_tilecomp_t * tilec)

Forward 5-3 wavelet tranform in 2-D.

Apply a reversible DWT transform to a component of an image.

Parameters
tilecTile component information (current tile)

References opj_tcd_tilecomp::data, dwt_deinterleave_h(), dwt_deinterleave_v(), dwt_encode_1(), opj_tcd_tilecomp::numresolutions, opj_free, opj_malloc, opj_tcd_tilecomp::resolutions, opj_tcd_resolution::x0, opj_tcd_tilecomp::x0, opj_tcd_resolution::x1, opj_tcd_tilecomp::x1, opj_tcd_resolution::y0, and opj_tcd_resolution::y1.

Referenced by tcd_encode_tile().

◆ dwt_encode_1()

static void dwt_encode_1 ( int * a,
int dn,
int sn,
int cas )
static

Forward 5-3 wavelet transform in 1-D.

References D, D_, DD_, S, S_, and SS_.

Referenced by dwt_encode().

◆ dwt_encode_1_real()

static void dwt_encode_1_real ( int * a,
int dn,
int sn,
int cas )
static

Forward 9-7 wavelet transform in 1-D.

References D, D_, DD_, fix_mul(), S, S_, and SS_.

Referenced by dwt_encode_real().

◆ dwt_encode_real()

void dwt_encode_real ( opj_tcd_tilecomp_t * tilec)

Forward 9-7 wavelet transform in 2-D.

Apply an irreversible DWT transform to a component of an image.

Parameters
tilecTile component information (current tile)

References opj_tcd_tilecomp::data, dwt_deinterleave_h(), dwt_deinterleave_v(), dwt_encode_1_real(), opj_tcd_tilecomp::numresolutions, opj_free, opj_malloc, opj_tcd_tilecomp::resolutions, opj_tcd_resolution::x0, opj_tcd_tilecomp::x0, opj_tcd_resolution::x1, opj_tcd_tilecomp::x1, opj_tcd_resolution::y0, and opj_tcd_resolution::y1.

Referenced by tcd_encode_tile().

◆ dwt_encode_stepsize()

static void dwt_encode_stepsize ( int stepsize,
int numbps,
opj_stepsize_t * bandno_stepsize )
static

Explicit calculation of the Quantization Stepsizes.

References opj_stepsize::expn, int_floorlog2(), and opj_stepsize::mant.

Referenced by dwt_calc_explicit_stepsizes().

◆ dwt_getgain()

int dwt_getgain ( int orient)

Get the gain of a subband for the reversible 5-3 DWT.

Parameters
orientNumber that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
Returns
Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise

Referenced by tcd_init_encode(), tcd_malloc_decode_tile(), and tcd_malloc_encode().

◆ dwt_getgain_real()

int dwt_getgain_real ( int orient)

Get the gain of a subband for the irreversible 9-7 DWT.

Parameters
orientNumber that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
Returns
Returns the gain of the 9-7 wavelet transform

Referenced by tcd_init_encode(), tcd_malloc_decode_tile(), and tcd_malloc_encode().

◆ dwt_getnorm()

double dwt_getnorm ( int level,
int orient )

Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.

Parameters
levelLevel of the wavelet function
orientBand of the wavelet function
Returns
Returns the norm of the wavelet function

References dwt_norms.

Referenced by t1_getwmsedec().

◆ dwt_getnorm_real()

double dwt_getnorm_real ( int level,
int orient )

Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT.

Parameters
levelLevel of the wavelet function
orientBand of the wavelet function
Returns
Returns the norm of the 9-7 wavelet

References dwt_norms_real.

Referenced by t1_getwmsedec().

◆ dwt_interleave_h()

static void dwt_interleave_h ( dwt_t * h,
int * a )
static

Inverse lazy transform (horizontal)

References dwt_local::cas, dwt_local::dn, dwt_local::mem, and dwt_local::sn.

Referenced by dwt_decode_tile().

◆ dwt_interleave_v()

static void dwt_interleave_v ( dwt_t * v,
int * a,
int x )
static

Inverse lazy transform (vertical)

References dwt_local::cas, dwt_local::dn, dwt_local::mem, and dwt_local::sn.

Referenced by dwt_decode_tile().

◆ v4dwt_decode()

static void v4dwt_decode ( v4dwt_t *restrict dwt)
static

◆ v4dwt_decode_step1()

static void v4dwt_decode_step1 ( v4 * w,
int count,
const float c )
static

References restrict.

Referenced by v4dwt_decode().

◆ v4dwt_decode_step2()

static void v4dwt_decode_step2 ( v4 * l,
v4 * w,
int k,
int m,
float c )
static

References restrict.

Referenced by v4dwt_decode().

◆ v4dwt_interleave_h()

static void v4dwt_interleave_h ( v4dwt_t *restrict w,
float *restrict a,
int x,
int size )
static

References restrict.

Referenced by dwt_decode_real().

◆ v4dwt_interleave_v()

static void v4dwt_interleave_v ( v4dwt_t *restrict v,
float *restrict a,
int x )
static

References restrict.

Referenced by dwt_decode_real().

Variable Documentation

◆ c13318

const float c13318 = 1.625732422f
static

Referenced by v4dwt_decode().

◆ dwt_alpha

const float dwt_alpha = 1.586134342f
static

Referenced by v4dwt_decode().

◆ dwt_beta

const float dwt_beta = 0.052980118f
static

Referenced by v4dwt_decode().

◆ dwt_delta

const float dwt_delta = -0.443506852f
static

Referenced by v4dwt_decode().

◆ dwt_gamma

const float dwt_gamma = -0.882911075f
static

Referenced by v4dwt_decode().

◆ dwt_norms

const double dwt_norms[4][10]
static
Initial value:
= {
{1.000, 1.500, 2.750, 5.375, 10.68, 21.34, 42.67, 85.33, 170.7, 341.3},
{1.038, 1.592, 2.919, 5.703, 11.33, 22.64, 45.25, 90.48, 180.9},
{1.038, 1.592, 2.919, 5.703, 11.33, 22.64, 45.25, 90.48, 180.9},
{.7186, .9218, 1.586, 3.043, 6.019, 12.01, 24.00, 47.97, 95.93}
}

Referenced by dwt_getnorm().

◆ dwt_norms_real

const double dwt_norms_real[4][10]
static
Initial value:
= {
{1.000, 1.965, 4.177, 8.403, 16.90, 33.84, 67.69, 135.3, 270.6, 540.9},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.080, 3.865, 8.307, 17.18, 34.71, 69.59, 139.3, 278.6, 557.2}
}

Referenced by dwt_calc_explicit_stepsizes(), and dwt_getnorm_real().

◆ K

const float K = 1.230174105f
static

Referenced by tcd_rateallocate(), and v4dwt_decode().