📄 encoderquad.h
字号:
// encoderQuad.h
//------------------------------------------------------------
// David Chen*, David Varodayan, Markus Flierl, Bernd Girod
// Image, Video, and Multimedia Systems Group
// Information Systems Laboratory
// Stanford University
//
// *Contact: dmchen@stanford.edu
//------------------------------------------------------------
#ifndef _ENCODERQUAD_H_
#define _ENCODERQUAD_H_
#include "common.h"
#include <ChenImage.h>
// [[ * ]] indicates dimension or length
/* -----------------------------------------------------------------------------
* pixelQuads_encodeFrameYUV
* -----------------------------------------------------------------------------
* Encodes a YUV [4:2:0] frame into six LDPC parity streams, one for each
* quadrant of the luminance component and one for each chrominance
* component.
*
* Inputs:
* const short* pFrame[3]
* Y component [[ HEIGHT x WIDTH ]]
* U component [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* V component [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const char* pLadderFile
* name of ladder file
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* unsigned char* pAccumSyndromeQuads[6]
* LDPC parity streams [[ BITS_QUAD ]]
* four streams for four quadrants of luminance component
two streams for two chrominance components
* -----------------------------------------------------------------------------
*/
int pixelQuads_encodeFrameYUV(const short** pFrame, const char* pLadderFile, const short* pScaledQArray, uchar** pAccumSyndrome);
/* -----------------------------------------------------------------------------
* pixelQuads_encodeImage
* -----------------------------------------------------------------------------
* Encodes a regular image into four LDPC parity streams (50688),
* one for each quadrant of the image.
*
* Inputs:
* const short* pImgX
* grayscale image [[ HEIGHT x WIDTH ]]
* const char* pLadderFile
* name of ladder file
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* unsigned char* pAccumSyndromeQuads[4]
* LDPC parity streams [[ BITS_QUAD ]]
* four streams for four quadrants of image
* -----------------------------------------------------------------------------
*/
int pixelQuads_encodeImage(const short* pImgX, const char* pLadderFile, const short* pScaledQArray, uchar** pAccumSyndromeQuads);
/* -----------------------------------------------------------------------------
* pixelQuads_encodeImageQuad
* -----------------------------------------------------------------------------
* Encodes a regular image into an LDPC parity stream. The image is first
* transformed by DCT, quantized, and level-shifted.
*
* Inputs:
* const short* pImgX
* grayscale image [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const char* pLadderFile
* name of ladder file
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* unsigned char* pAccumSyndrome
* LDPC parity stream [[ BITS_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_encodeImageQuad(const short* pImgX, const char* pLadderFile, const short* pScaledQArray, uchar* pAccumSyndrome);
/* -----------------------------------------------------------------------------
* pixelQuads_modelChannelFrameYUV
* -----------------------------------------------------------------------------
* Models differences between quantized DCT subbands of frame X and frame Y
* as independent Laplacian channels.
*
* Inputs:
* const short* pFrameX
* frame to be encoded
* one luminance component [[ HEIGHT x WIDTH ]]
* two chrominance components [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const short* pFrameY
* side information frame at decoder, same dimensions as other frame
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* float* pLambda[6]
* Laplacian parameter sets [[ NUM_COEFFS ]]
* four sets for four quadrants of luminance component
* two sets for two chrominance components
* float pEntropy[6]
* conditional entropies H( Q-DCT(X_quad) | Q-DCT(Y_quad) )
* four values for four quadrants of luminance component
* two values for two chrominance components
* bits-per-original-bit
* short* pShiftsX[6]
* short* pShiftsY[6]
* blockwise oracle motion fields
* [[ BLOCK_ROWS_QUAD x BLOCK_COLS_QUAD ]]
* four fields for four quadrants of luminance component
* two fields for two chrominance components
* -----------------------------------------------------------------------------
*/
int pixelQuads_modelChannelFrameYUV(const short** pFrameX, const short** pFrameY, const short* pScaledQArray, float** pLambda, float* pEntropy, short** pShiftsX, short** pShiftsY);
/* -----------------------------------------------------------------------------
* pixelQuads_modelChannelImage
* -----------------------------------------------------------------------------
* Models differences between quantized DCT subbands of image X and image Y
* as independent Laplacian channels.
*
* Inputs:
* const short* pImgX
* image to be encoded [[ HEIGHT x WIDTH ]]
* const short* pImgY
* side information image at decoder [[ HEIGHT x WIDTH ]]
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* float* pLambda[4]
* Laplacian parameter sets [[ NUM_COEFFS ]]
four sets for four quadrants
* float pEntropy[4]
* conditional entropies H( Q-DCT(X_quad) | Q-DCT(Y_quad) )
* four values for four quadrants
* bits-per-original-bit
* short* pShiftsX[4]
* short* pShiftsY[4]
* blockwise oracle motion fields
* [[ BLOCK_ROWS_QUAD x BLOCK_COLS_QUAD ]]
* four fields for four quadrants
* -----------------------------------------------------------------------------
*/
int pixelQuads_modelChannelImage(const short* pImgX, const short* pImgY, const short* pScaledQArray, float** pLambda, float* pEntropy, short** pShiftsX, short** pShiftsY);
/* -----------------------------------------------------------------------------
* pixelQuads_modelChannelQuad
* -----------------------------------------------------------------------------
* Models differences between quantized DCT subbands of image X and image Y
* as independent Laplacian channels.
*
* Inputs:
* const short* pImgX
* image to be encoded [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const short* pImgY
* side information image at decoder [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const short* pScaledQArray
* table for quantization of DCT coefficients [[ NUM_COEFFS ]]
*
* Outputs:
* float* pLambda
* Laplacian parameters for DCT subbands [[ NUM_COEFFS ]]
* float* pEntropy
* conditional entropy H( Q-DCT(X) | Q-DCT(Y) ) [[ 1 ]]
* bits-per-original-bit
* short* pShiftsX
* short* pShiftsY
* blockwise oracle motion field
* [[ BLOCK_ROWS_QUAD x BLOCK_COLS_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_modelChannelQuad(const short* pImgX, const short* pImgY, const short* pScaledQArray, float* pLambda, float* pEntropy, short* pShiftsX, short* pShiftsY);
/* -----------------------------------------------------------------------------
* pixelQuads_encodeUnsignedCoeffQuad
* -----------------------------------------------------------------------------
* Encodes level-shifted, quantized transform coefficients into a binary
* bitstream and an LDPC parity bitstream.
*
* Inputs:
* const short* pImgX
* grayscale image [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const char* pLadderFile
* name of ladder file
*
* Outputs:
* unsigned char* pSource
* binary bitstream [[ BITS_QUAD ]]
* unsigned char* pAccumSyndrome
* LDPC parity bitstream [[ BITS_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_encodeUnsignedCoeffQuad(const short* pCoeffX, const char* pLadderFile, uchar* pSource, uchar* pAccumSyndrome);
/* -----------------------------------------------------------------------------
* pixelQuads_encodeBitsLDPCQuad
* -----------------------------------------------------------------------------
* Encodes a binary bitstream into an LDPC parity bitstream.
*
* Inputs:
* const double* pSource
* binary bitstream [[ BITS_QUAD ]]
* const char* pLadderFile
* name of ladder file
*
* Outputs:
* double* pAccumSyndrome
* LDPC parity bitstream [[ BITS_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_encodeBitsLDPCQuad(const double* pSource, const char* pLadderFile, double* pAccumSyndrome);
/* -----------------------------------------------------------------------------
* pixelQuads_unsignedCoefficientsToBitstreamQuad
* -----------------------------------------------------------------------------
* Converts an unsigned image to a binary bitstream.
*
* Inputs:
* const short* pImg
* grayscale image [[ HEIGHT_QUAD x WIDTH_QUAD ]]
*
* Outputs:
* unsigned char* pBitstream
* binary bitstream [[ BITS_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_unsignedCoefficientsToBitstreamQuad(const short* pImg, uchar* pBitstream);
/* -----------------------------------------------------------------------------
* pixelQuads_bitstreamToSignedCoefficientsQuad
* -----------------------------------------------------------------------------
* Converts a binary bitstream to a signed image.
*
* Inputs:
* const unsigned char* pBitstream
* binary bitstream [[ BITS_QUAD ]]
*
* Outputs:
* short* pImg
* grayscale image [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* -----------------------------------------------------------------------------
*/
int pixelQuads_bitstreamToSignedCoefficientsQuad(const uchar* pBitstream, short* pImg);
/* -----------------------------------------------------------------------------
* pixelQuads_findLaplacianConstantTransformQuad
* -----------------------------------------------------------------------------
* Finds a Laplacian constant for each subband of a blockwise DCT.
*
* Inputs:
* const short* pTransResidual
* residual in transform domain after motion compensation
* [[ HEIGHT_QUAD x WIDTH_QUAD ]]
* const int nBlockSize
* size of block for blockwise DCT
*
* Outputs:
* float* pLaplacian
* Laplacian constants for DCT subbands [[ NUM_COEFFS ]]
* float* pEntropy
* conditional entropy H( Q-DCT(X) | Q-DCT(Y) ) [[ 1 ]]
* bits-per-original-bit
* -----------------------------------------------------------------------------
*/
int pixelQuads_findLaplacianConstantTransformQuad(const short* pTransResidual, const int nBlockSize, float* pLaplacian, float* pEntropy);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -