//*@@@+++@@@@******************************************************************1//2// Copyright © Microsoft Corp.3// All rights reserved.4//5// Redistribution and use in source and binary forms, with or without6// modification, are permitted provided that the following conditions are met:7//8// • Redistributions of source code must retain the above copyright notice,9// this list of conditions and the following disclaimer.10// • Redistributions in binary form must reproduce the above copyright notice,11// this list of conditions and the following disclaimer in the documentation12// and/or other materials provided with the distribution.13//14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"15// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE18// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR19// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF20// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS21// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN22// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)23// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE24// POSSIBILITY OF SUCH DAMAGE.25//26//*@@@---@@@@******************************************************************2728#ifndef WMI_DECODE_H29#define WMI_DECODE_H3031typedef struct CWMDecoderParameters {32/** ROI decode **/33Bool bDecodeFullFrame;34Bool bDecodeFullWidth;3536/** thumbnail decode **/37Bool bSkipFlexbits;38size_t cThumbnailScale; // 1: cThumbnailScale thumbnail, only supports cThumbnailScale = 2^m for now39Bool bDecodeHP;40Bool bDecodeLP;4142// Region of interest decoding43size_t cROILeftX;44size_t cROIRightX;45size_t cROITopY;46size_t cROIBottomY;4748// table lookups for rotation and flip49size_t * pOffsetX;50size_t * pOffsetY;51} CWMDecoderParameters;5253Void predCBPDec(CWMImageStrCodec *, CCodingContext *);54Void predDCACDec(CWMImageStrCodec *);55Void predACDec(CWMImageStrCodec *);5657Int dequantizeMacroblock(CWMImageStrCodec *);58Int invTransformMacroblock(CWMImageStrCodec * pSC);59Int invTransformMacroblock_alteredOperators_hard(CWMImageStrCodec * pSC);6061Int DecodeMacroblockDC(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);62Int DecodeMacroblockLowpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);63Int DecodeMacroblockHighpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);6465Int AdaptLowpassDec(struct CCodingContext *);66Int AdaptHighpassDec(struct CCodingContext *);6768Void ResetCodingContextDec(CCodingContext *pContext);69Void FreeCodingContextDec(struct CWMImageStrCodec *pSC);7071/*************************************************************************/72// Inverse transform functions73// 2-point post filter for boundaries (only used in 420 UV DC subband)74Void strPost2(PixelI *, PixelI *);7576// 2x2 post filter (only used in 420 UV DC subband)77Void strPost2x2(PixelI *, PixelI *, PixelI *, PixelI *);7879/** 4-point post filter for boundaries **/80Void strPost4(PixelI *, PixelI *, PixelI *, PixelI *);8182/** data allocation in working buffer (first stage) **/8384/** Y, 444 U and V **/85/** 0 1 2 3 **/86/** 32 33 34 35 **/87/** 64 65 66 67 **/88/** 96 97 98 99 **/8990/** 420 U and V **/91/** 0 2 4 6 **/92/** 64 66 68 70 **/93/** 128 130 132 134 **/94/** 192 194 196 198 **/9596/** 4x4 inverse DCT for first stage **/97Void strIDCT4x4FirstStage(PixelI *);98Void strIDCT4x4Stage1(PixelI*);99Void strIDCT4x4FirstStage420UV(PixelI *);100101/** 4x4 post filter for first stage **/102Void strPost4x4FirstStage(PixelI *);103Void strPost4x4Stage1Split(PixelI*, PixelI*, Int, Int, Bool);104Void strPost4x4Stage1(PixelI*, Int, Int, Bool);105Void strPost4x4Stage1Split_alternate(PixelI*, PixelI*, Int);106Void strPost4x4Stage1_alternate(PixelI*, Int);107//Void strPost4x4Stage1Split_420(PixelI*, PixelI*);108//Void strPost4x4Stage1_420(PixelI*);109110Void strPost4x4FirstStage420UV(PixelI *);111112/** data allocation in working buffer (second stage)**/113114/** Y, 444 U and V **/115/** 0 4 8 12 **/116/** 128 132 136 140 **/117/** 256 260 264 268 **/118/** 384 388 392 396 **/119120/** 420 U and V **/121/** 0 8 **/122/** 256 264 **/123124/** 4x4 invesr DCT for second stage **/125//Void strIDCT4x4SecondStage(PixelI *);126Void strIDCT4x4Stage2(PixelI*);127Void strNormalizeDec(PixelI*, Bool);128Void strDCT2x2dnDec(PixelI *, PixelI *, PixelI *, PixelI *);129130/** 4x4 post filter for second stage **/131Void strPost4x4SecondStage(PixelI *);132Void strPost4x4Stage2Split(PixelI*, PixelI*);133Void strPost4x4Stage2Split_alternate(PixelI*, PixelI*);134135/** Huffman decode related defines **/136#define HUFFMAN_DECODE_ROOT_BITS_LOG 3137#define HUFFMAN_DECODE_ROOT_BITS (5)138139Int getHuff(const short *pDecodeTable, BitIOInfo* pIO);140141#endif // WMI_DECODE_H142143144145