⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chenimagewavelet.h

📁 LDPC码的实现,包括编码器和解码器,使用了DCT.
💻 H
字号:
// ChenImageWavelet.h

#ifndef _CHENIMGWAVELET_H_
#define _CHENIMGWAVELET_H_
#include <stdio.h>

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_showWavelet
 * -----------------------------------------------------------------------------
 * Displays wavelet in one window and line profile in another window.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * short** pSubbands
 * const int nLevels
 * const char* pName
 * const bool bNewFigure
 * const bool bScaleDC
 * const bool bScaleAC
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_showWavelet(const int nWidth, const int nHeight, const short** pSubbands, const int nLevels, const char* pName = NULL, const bool bNewFigure = true, const bool bScaleDC = false, const bool bScaleAC = false);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletStack
 * -----------------------------------------------------------------------------
 * Stacks wavelet subbands into one image.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pSubbands
 * const int nLevels
 * 
 * Outputs:
 * short* pStacked
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletStack(const int nWidth, const int nHeight, const short** pSubbands, const int nLevels, short* pStacked);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletDestack
 * -----------------------------------------------------------------------------
 * Destacks a stacked wavelet image into separate subbands.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const* pStacked
 * const int nLevels
 * 
 * Outputs:
 * short** pSubbands
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletDestack(const int nWidth, const int nHeight, const short* pStacked, const int nLevels, short** pSubbands);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletStackPositions
 * -----------------------------------------------------------------------------
 * Converts positions in a stack to subband numbers.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const int nLevels
 * 
 * Outputs:
 * int* pStackedToSubband
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletStackPositions(const int nWidth, const int nHeight, const int nLevels, int* pStackedToSubband);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletMultiLevelAlloc
 * -----------------------------------------------------------------------------
 * Calculates dimensions of subbands for a multi-level wavelet decomposition.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const int nLevels
 *
 * Outputs:
 * int* pWidths
 * int* pHeights
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletMultiLevelAlloc(const int nWidth, const int nHeight, const int nLevels, int* pWidths, int* pHeights);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet97MultiLevelForward
 * -----------------------------------------------------------------------------
 * Performs a multi-level forward 9/7 wavelet transform. Uses lifting 
 * implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc
 * const int nLevels
 *
 * Outputs:
 * short** pDst
 * -----------------------------------------------------------------------------
 */
int ChenImage_wavelet97MultiLevelForward(const int nWidth, const int nHeight, const short* pSrc, const int nLevels, short** pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet97MultiLevelInverse
 * -----------------------------------------------------------------------------
 * Performs a multi-level inverse 9/7 wavelet transform. Uses lifting 
 * implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pDst
 * const int nLevels
 *
 * Outputs:
 * short* pDst
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet97MultiLevelInverse(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, short* pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet97Forward
 * -----------------------------------------------------------------------------
 * Performs a forward 9/7 wavelet transform. Uses lifting implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc
 *
 * Outputs:
 * short* pDst[4]
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet97Forward(const int nWidth, const int nHeight, const short* pSrc, short* pDst[4]);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet97Inverse
 * -----------------------------------------------------------------------------
 * Performs an inverse 9/7 wavelet transform. Uses lifting implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc[4]
 *
 * Outputs:
 * short* pDst
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet97Inverse(const int nWidth, const int nHeight, const short** pSrc, short* pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet53MultiLevelForward
 * -----------------------------------------------------------------------------
 * Performs a multi-level forward 5/3 wavelet transform. Uses lifting 
 * implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc
 * const int nLevels
 *
 * Outputs:
 * short** pDst
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet53MultiLevelForward(const int nWidth, const int nHeight, const short* pSrc, const int nLevels, short** pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet53MultiLevelInverse
 * -----------------------------------------------------------------------------
 * Performs a multi-level inverse 5/3 wavelet transform. Uses lifting 
 * implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pDst
 * const int nLevels
 *
 * Outputs:
 * short* pDst
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet53MultiLevelInverse(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, short* pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet53Forward
 * -----------------------------------------------------------------------------
 * Performs a forward 5/3 wavelet transform. Uses lifting implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc
 *
 * Outputs:
 * short* pDst[4]
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet53Forward(const int nWidth, const int nHeight, const short* pSrc, short* pDst[4]);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_wavelet53Inverse
 * -----------------------------------------------------------------------------
 * Performs an inverse 5/3 wavelet transform. Uses lifting implementation.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc[4]
 *
 * Outputs:
 * short* pDst
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_wavelet53Inverse(const int nWidth, const int nHeight, const short** pSrc, short* pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletRateAllocate
 * -----------------------------------------------------------------------------
 * Performs rate allocation for the subbands of a wavelet decomposition. Uses 
 * rate-distortion optimized algorithm. Also suggests step sizes for uniform
 * scalar quantization.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pSrc -- unquantized subbands
 * const int nLevels
 * const float fRate
 * const float fConditionalReduction -- H(X|Y) / H(X)
 *
 * Outputs:
 * float* pStepSizes
 * float* pRates
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletRateAllocate(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, const float fRate, const float fConditionalReduction, float pStepSizes[4], float pRates[4]); 

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletQuantize
 * -----------------------------------------------------------------------------
 * Uniform-scalar-quantizes the subbands of a wavelet decomposition. Uses 
 * rate-distortion optimized algorithm.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pSrc -- unquantized subbands
 * const int nLevels -- levels of decomposition
 * const float* pStepSizes
 *
 * Outputs:
 * short** pDst -- quantized subbands
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletQuantize(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, const float* pStepSizes, short** pDst); 

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletDequantize
 * -----------------------------------------------------------------------------
 * Uniform-scalar-dequantizes the subbands of a wavelet decomposition.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pSrc -- quantized subbands
 * const int nLevels -- levels of decomposition
 * const float* pStepSizes
 *
 * Outputs:
 * short** pDst -- dequantized subbands
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletDequantize(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, const float* pStepSizes, short** pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletMultiLevelInterleavePositions
 * -----------------------------------------------------------------------------
 * Calculates mappings from stacked to interleaved, interleave to stacked, etc.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const int nLevels
 *
 * Outputs:
 * int* pInterleavedToStacked
 * int* pStackedToInterleaved
 * int* pInterleavedToSubband
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletMultiLevelInterleavePositions(const int nWidth, const int nHeight, const int nLevels, int* pInterleavedToStacked, int* pStackedToInterleaved, int* pInterleavedToSubband);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletMultiLevelInterleave
 * -----------------------------------------------------------------------------
 * Interleaves subbands of multi-level wavelet decomposition into a single 
 * array.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short** pSrc -- subbands
 * const int nLevels
 *
 * Outputs:
 * short* pDst -- interleaved array
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletMultiLevelInterleave(const int nWidth, const int nHeight, const short** pSrc, const int nLevels, short* pDst);

/* -----------------------------------------------------------------------------
 * ChenImageWavelet_waveletMultiLevelDeinterleave
 * -----------------------------------------------------------------------------
 * Deinterleaves an interleaved array of multi-level wavelet coefficients.
 *
 * Inputs:
 * const int nWidth
 * const int nHeight
 * const short* pSrc -- interleaved array
 * const int nLevels
 *
 * Outputs:
 * short** pDst -- subbands
 * -----------------------------------------------------------------------------
 */
int ChenImageWavelet_waveletMultiLevelDeinterleave(const int nWidth, const int nHeight, const short* pSrc, const int nLevels, short** pDst);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -