OpenJPEG: DWT - Implementation of a discrete wavelet transform

OpenJPEG 2.1.2

Data Structures | Macros | Typedefs
DWT - Implementation of a discrete wavelet transform

## Data Structures
struct | dwt_local
union | opj_v4_t
struct | v4dwt_local

## Macros
#define | OPJ_WS(i) v->mem[(i)*2]
#define | OPJ_WD(i) v->mem[(1+(i)*2)]

## Typedefs
typedef void(* | DWT1DFN) (opj_dwt_t *v)
| Virtual function type for wavelet transform in 1-D. More...

## Local data structures
typedef struct dwt_local | opj_dwt_t
typedef struct v4dwt_local | opj_v4dwt_t
static const OPJ_FLOAT32 | opj_dwt_alpha = 1.586134342f
static const OPJ_FLOAT32 | opj_dwt_beta = 0.052980118f
static const OPJ_FLOAT32 | opj_dwt_gamma = -0.882911075f
static const OPJ_FLOAT32 | opj_dwt_delta = -0.443506852f
static const OPJ_FLOAT32 | opj_K = 1.230174105f
static const OPJ_FLOAT32 | opj_c13318 = 1.625732422f

## Local static functions
static void | opj_dwt_deinterleave_h (OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
| Forward lazy transform (horizontal) More...
static void | opj_dwt_deinterleave_v (OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas)
| Forward lazy transform (vertical) More...
static void | opj_dwt_interleave_h (opj_dwt_t *h, OPJ_INT32 *a)
| Inverse lazy transform (horizontal) More...
static void | opj_dwt_interleave_v (opj_dwt_t *v, OPJ_INT32 *a, OPJ_INT32 x)
| Inverse lazy transform (vertical) More...
static void | opj_dwt_encode_1 (OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
| Forward 5-3 wavelet transform in 1-D. More...
static void | opj_dwt_decode_1 (opj_dwt_t *v)
| Inverse 5-3 wavelet transform in 1-D. More...
static void | opj_dwt_decode_1_ (OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
static void | opj_dwt_encode_1_real (OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
| Forward 9-7 wavelet transform in 1-D. More...
static void | opj_dwt_encode_stepsize (OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize)
| Explicit calculation of the Quantization Stepsizes. More...
static OPJ_BOOL | opj_dwt_decode_tile (opj_tcd_tilecomp_t *tilec, OPJ_UINT32 i, DWT1DFN fn)
| Inverse wavelet transform in 2-D. More...
static OPJ_BOOL | opj_dwt_encode_procedure (opj_tcd_tilecomp_t *tilec, void(*p_function)(OPJ_INT32 *, OPJ_INT32, OPJ_INT32, OPJ_INT32))
static OPJ_UINT32 | opj_dwt_max_resolution (opj_tcd_resolution_t *OPJ_RESTRICT r, OPJ_UINT32 i)
static void | opj_v4dwt_decode (opj_v4dwt_t *OPJ_RESTRICT dwt)
static void | opj_v4dwt_interleave_h (opj_v4dwt_t *OPJ_RESTRICT w, OPJ_FLOAT32 *OPJ_RESTRICT a, OPJ_INT32 x, OPJ_INT32 size)
static void | opj_v4dwt_interleave_v (opj_v4dwt_t *OPJ_RESTRICT v, OPJ_FLOAT32 *OPJ_RESTRICT a, OPJ_INT32 x, OPJ_INT32 nb_elts_read)
static void | opj_v4dwt_decode_step1 (opj_v4_t *w, OPJ_INT32 count, const OPJ_FLOAT32 c)
static void | opj_v4dwt_decode_step2 (opj_v4_t *l, opj_v4_t *w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)

## Exported functions
OPJ_BOOL | opj_dwt_encode (opj_tcd_tilecomp_t *tilec)
| Forward 5-3 wavelet transform in 2-D. More...
OPJ_BOOL | opj_dwt_decode (opj_tcd_tilecomp_t *tilec, OPJ_UINT32 numres)
| Inverse 5-3 wavelet transform in 2-D. More...
OPJ_UINT32 | opj_dwt_getgain (OPJ_UINT32 orient)
| Get the gain of a subband for the reversible 5-3 DWT. More...
OPJ_FLOAT64 | opj_dwt_getnorm (OPJ_UINT32 level, OPJ_UINT32 orient)
| Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT. More...
OPJ_BOOL | opj_dwt_encode_real (opj_tcd_tilecomp_t *tilec)
| Forward 9-7 wavelet transform in 2-D. More...
OPJ_BOOL | opj_dwt_decode_real (opj_tcd_tilecomp_t *OPJ_RESTRICT tilec, OPJ_UINT32 numres)
| Inverse 9-7 wavelet transform in 2-D. More...
OPJ_UINT32 | opj_dwt_getgain_real (OPJ_UINT32 orient)
| Get the gain of a subband for the irreversible 9-7 DWT. More...
OPJ_FLOAT64 | opj_dwt_getnorm_real (OPJ_UINT32 level, OPJ_UINT32 orient)
| Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT. More...
void | opj_dwt_calc_explicit_stepsizes (opj_tccp_t *tccp, OPJ_UINT32 prec)
| Explicit calculation of the Quantization Stepsizes. More...

## Detailed Description

## Macro Definition Documentation

## § OPJ_WD

#define OPJ_WD | ( |  | i | ) | v->mem[(1+(i)*2)]

## § OPJ_WS

#define OPJ_WS | ( |  | i | ) | v->mem[(i)*2]

## Typedef Documentation

## § DWT1DFN

typedef void(* DWT1DFN) (opj_dwt_t *v)

Virtual function type for wavelet transform in 1-D.

## § opj_dwt_t

typedef struct dwt_local opj_dwt_t

## § opj_v4dwt_t

typedef struct v4dwt_local opj_v4dwt_t

## Function Documentation

## § opj_dwt_calc_explicit_stepsizes()

void opj_dwt_calc_explicit_stepsizes | ( | opj_tccp_t * | tccp,
|  | OPJ_UINT32 | prec
| ) |  |

Explicit calculation of the Quantization Stepsizes.

Parameters

  tccp | Tile-component coding parameters
  prec | Precint analyzed

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

Referenced by opj_j2k_setup_encoder().

## § opj_dwt_decode()

OPJ_BOOL opj_dwt_decode | ( | opj_tcd_tilecomp_t * | tilec,
|  | OPJ_UINT32 | numres
| ) |  |

Inverse 5-3 wavelet transform in 2-D.

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

Parameters

  tilec | Tile component information (current tile)
  numres | Number of resolution levels to decode

References opj_dwt_decode_1(), and opj_dwt_decode_tile().

Referenced by opj_tcd_dwt_decode().

## § opj_dwt_decode_1()

static void opj_dwt_decode_1 | ( | opj_dwt_t * | v | ) |
| static

Inverse 5-3 wavelet transform in 1-D.

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

Referenced by opj_dwt_decode().

## § opj_dwt_decode_1_()

static void opj_dwt_decode_1_ | ( | OPJ_INT32 * | a,
|  | OPJ_INT32 | dn,
|  | OPJ_INT32 | sn,
|  | OPJ_INT32 | cas
| ) |  |
| static

References dwt_local::dn, OPJ_D, OPJ_D_, OPJ_DD_, OPJ_S, OPJ_SS_, and dwt_local::sn.

Referenced by opj_dwt_decode_1().

## § opj_dwt_decode_real()

OPJ_BOOL opj_dwt_decode_real | ( | opj_tcd_tilecomp_t *OPJ_RESTRICT | tilec,
|  | OPJ_UINT32 | numres
| ) |  |

Inverse 9-7 wavelet transform in 2-D.

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

Parameters

  tilec | Tile component information (current tile)
  numres | Number of resolution levels to decode

References v4dwt_local::cas, v4dwt_local::dn, opj_v4_t::f, opj_aligned_free(), opj_aligned_malloc(), opj_dwt_max_resolution(), OPJ_FALSE, OPJ_RESTRICT, OPJ_TRUE, opj_v4dwt_decode(), opj_v4dwt_interleave_h(), opj_v4dwt_interleave_v(), SIZE_MAX, v4dwt_local::sn, v4dwt_local::wavelet, opj_tcd_resolution::x0, opj_tcd_resolution::x1, opj_tcd_resolution::y0, and opj_tcd_resolution::y1.

Referenced by opj_tcd_dwt_decode().

## § opj_dwt_decode_tile()

static OPJ_BOOL opj_dwt_decode_tile | ( | opj_tcd_tilecomp_t * | tilec,
|  | OPJ_UINT32 | i,
|  | DWT1DFN | fn
| ) |  |
| static

Inverse wavelet transform in 2-D.

References dwt_local::cas, opj_tcd_tilecomp::data, dwt_local::dn, dwt_local::mem, opj_aligned_free(), opj_aligned_malloc(), opj_dwt_interleave_h(), opj_dwt_interleave_v(), opj_dwt_max_resolution(), OPJ_FALSE, OPJ_RESTRICT, OPJ_TRUE, opj_tcd_tilecomp::resolutions, SIZE_MAX, dwt_local::sn, 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 opj_dwt_decode().

## § opj_dwt_deinterleave_h()

static void opj_dwt_deinterleave_h | ( | OPJ_INT32 * | a,
|  | OPJ_INT32 * | b,
|  | OPJ_INT32 | dn,
|  | OPJ_INT32 | sn,
|  | OPJ_INT32 | cas
| ) |  |
| static

Forward lazy transform (horizontal)

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

Referenced by opj_dwt_encode_procedure().

## § opj_dwt_deinterleave_v()

static void opj_dwt_deinterleave_v | ( | OPJ_INT32 * | a,
|  | OPJ_INT32 * | b,
|  | OPJ_INT32 | dn,
|  | OPJ_INT32 | sn,
|  | OPJ_INT32 | x,
|  | OPJ_INT32 | cas
| ) |  |
| static

Forward lazy transform (vertical)

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

Referenced by opj_dwt_encode_procedure().

## § opj_dwt_encode()

OPJ_BOOL opj_dwt_encode | ( | opj_tcd_tilecomp_t * | tilec | ) |

Forward 5-3 wavelet transform in 2-D.

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

Parameters

  tilec | Tile component information (current tile)

References opj_dwt_encode_1(), and opj_dwt_encode_procedure().

Referenced by opj_tcd_dwt_encode().

## § opj_dwt_encode_1()

static void opj_dwt_encode_1 | ( | OPJ_INT32 * | a,
|  | OPJ_INT32 | dn,
|  | OPJ_INT32 | sn,
|  | OPJ_INT32 | cas
| ) |  |
| static

Forward 5-3 wavelet transform in 1-D.

References dwt_local::dn, OPJ_D, OPJ_D_, OPJ_DD_, OPJ_S, OPJ_S_, and dwt_local::sn.

Referenced by opj_dwt_encode().

## § opj_dwt_encode_1_real()

static void opj_dwt_encode_1_real | ( | OPJ_INT32 * | a,
|  | OPJ_INT32 | dn,
|  | OPJ_INT32 | sn,
|  | OPJ_INT32 | cas
| ) |  |
| static

Forward 9-7 wavelet transform in 1-D.

References dwt_local::dn, OPJ_D, OPJ_D_, OPJ_DD_, opj_int_fix_mul(), OPJ_S, OPJ_S_, OPJ_SS_, and dwt_local::sn.

Referenced by opj_dwt_encode_real().

## § opj_dwt_encode_procedure()

static INLINE OPJ_BOOL opj_dwt_encode_procedure | ( | opj_tcd_tilecomp_t * | tilec,
|  | void(*)(OPJ_INT32 *, OPJ_INT32, OPJ_INT32, OPJ_INT32) | p_function
| ) |  |
| static

References opj_tcd_tilecomp::data, dwt_local::dn, opj_tcd_tilecomp::numresolutions, opj_dwt_deinterleave_h(), opj_dwt_deinterleave_v(), opj_dwt_max_resolution(), OPJ_FALSE, opj_free(), opj_malloc(), OPJ_TRUE, opj_tcd_tilecomp::resolutions, SIZE_MAX, dwt_local::sn, 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 opj_dwt_encode(), and opj_dwt_encode_real().

## § opj_dwt_encode_real()

OPJ_BOOL opj_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

  tilec | Tile component information (current tile)

References opj_dwt_encode_1_real(), and opj_dwt_encode_procedure().

Referenced by opj_tcd_dwt_encode().

## § opj_dwt_encode_stepsize()

static void opj_dwt_encode_stepsize | ( | OPJ_INT32 | stepsize,
|  | OPJ_INT32 | numbps,
|  | opj_stepsize_t * | bandno_stepsize
| ) |  |
| static

Explicit calculation of the Quantization Stepsizes.

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

Referenced by opj_dwt_calc_explicit_stepsizes().

## § opj_dwt_getgain()

OPJ_UINT32 opj_dwt_getgain | ( | OPJ_UINT32 | orient | ) |

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

Parameters

  orient | Number 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 opj_tcd_init_tile().

## § opj_dwt_getgain_real()

OPJ_UINT32 opj_dwt_getgain_real | ( | OPJ_UINT32 | orient | ) |

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

Parameters

  orient | Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)

Returns
  Returns the gain of the 9-7 wavelet transform

Referenced by opj_tcd_init_tile().

## § opj_dwt_getnorm()

OPJ_FLOAT64 opj_dwt_getnorm | ( | OPJ_UINT32 | level,
|  | OPJ_UINT32 | orient
| ) |  |

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

Parameters

  level | Level of the wavelet function
  orient | Band of the wavelet function

Returns
  Returns the norm of the wavelet function

Referenced by opj_t1_getwmsedec().

## § opj_dwt_getnorm_real()

OPJ_FLOAT64 opj_dwt_getnorm_real | ( | OPJ_UINT32 | level,
|  | OPJ_UINT32 | orient
| ) |  |

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

Parameters

  level | Level of the wavelet function
  orient | Band of the wavelet function

Returns
  Returns the norm of the 9-7 wavelet

Referenced by opj_t1_getwmsedec().

## § opj_dwt_interleave_h()

static void opj_dwt_interleave_h | ( | opj_dwt_t * | h,
|  | OPJ_INT32 * | a
| ) |  |
| static

Inverse lazy transform (horizontal)

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

Referenced by opj_dwt_decode_tile().

## § opj_dwt_interleave_v()

static void opj_dwt_interleave_v | ( | opj_dwt_t * | v,
|  | OPJ_INT32 * | a,
|  | OPJ_INT32 | x
| ) |  |
| static

Inverse lazy transform (vertical)

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

Referenced by opj_dwt_decode_tile().

## § opj_dwt_max_resolution()

static OPJ_UINT32 opj_dwt_max_resolution | ( | opj_tcd_resolution_t *OPJ_RESTRICT | r,
|  | OPJ_UINT32 | i
| ) |  |
| static

Referenced by opj_dwt_decode_real(), opj_dwt_decode_tile(), and opj_dwt_encode_procedure().

## § opj_v4dwt_decode()

static void opj_v4dwt_decode | ( | opj_v4dwt_t *OPJ_RESTRICT | dwt | ) |
| static

References opj_c13318, opj_dwt_alpha, opj_dwt_beta, opj_dwt_delta, opj_dwt_gamma, opj_int_min(), opj_K, opj_v4dwt_decode_step1(), and opj_v4dwt_decode_step2().

Referenced by opj_dwt_decode_real().

## § opj_v4dwt_decode_step1()

static void opj_v4dwt_decode_step1 | ( | opj_v4_t * | w,
|  | OPJ_INT32 | count,
|  | const OPJ_FLOAT32 | c
| ) |  |
| static

References OPJ_RESTRICT.

Referenced by opj_v4dwt_decode().

## § opj_v4dwt_decode_step2()

static void opj_v4dwt_decode_step2 | ( | opj_v4_t * | l,
|  | opj_v4_t * | w,
|  | OPJ_INT32 | k,
|  | OPJ_INT32 | m,
|  | OPJ_FLOAT32 | c
| ) |  |
| static

Referenced by opj_v4dwt_decode().

## § opj_v4dwt_interleave_h()

static void opj_v4dwt_interleave_h | ( | opj_v4dwt_t *OPJ_RESTRICT | w,
|  | OPJ_FLOAT32 *OPJ_RESTRICT | a,
|  | OPJ_INT32 | x,
|  | OPJ_INT32 | size
| ) |  |
| static

References OPJ_RESTRICT.

Referenced by opj_dwt_decode_real().

## § opj_v4dwt_interleave_v()

static void opj_v4dwt_interleave_v | ( | opj_v4dwt_t *OPJ_RESTRICT | v,
|  | OPJ_FLOAT32 *OPJ_RESTRICT | a,
|  | OPJ_INT32 | x,
|  | OPJ_INT32 | nb_elts_read
| ) |  |
| static

References OPJ_RESTRICT.

Referenced by opj_dwt_decode_real().

## Variable Documentation

## § opj_c13318

const OPJ_FLOAT32 opj_c13318 = 1.625732422f
| static

Referenced by opj_v4dwt_decode().

## § opj_dwt_alpha

const OPJ_FLOAT32 opj_dwt_alpha = 1.586134342f
| static

Referenced by opj_v4dwt_decode().

## § opj_dwt_beta

const OPJ_FLOAT32 opj_dwt_beta = 0.052980118f
| static

Referenced by opj_v4dwt_decode().

## § opj_dwt_delta

const OPJ_FLOAT32 opj_dwt_delta = -0.443506852f
| static

Referenced by opj_v4dwt_decode().

## § opj_dwt_gamma

const OPJ_FLOAT32 opj_dwt_gamma = -0.882911075f
| static

Referenced by opj_v4dwt_decode().

## § opj_K

const OPJ_FLOAT32 opj_K = 1.230174105f
| static

Referenced by opj_v4dwt_decode().