1 //*@@@+++@@@@****************************************************************** 2 // 3 // Copyright � Microsoft Corp. 4 // All rights reserved. 5 // 6 // Redistribution and use in source and binary forms, with or without 7 // modification, are permitted provided that the following conditions are met: 8 // 9 // � Redistributions of source code must retain the above copyright notice, 10 // this list of conditions and the following disclaimer. 11 // � Redistributions in binary form must reproduce the above copyright notice, 12 // this list of conditions and the following disclaimer in the documentation 13 // and/or other materials provided with the distribution. 14 // 15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 // POSSIBILITY OF SUCH DAMAGE. 26 // 27 //*@@@---@@@@****************************************************************** 28 29 #ifndef WMI_DECODE_H 30 #define WMI_DECODE_H 31 32 typedef struct CWMDecoderParameters { 33 /** ROI decode **/ 34 Bool bDecodeFullFrame; 35 Bool bDecodeFullWidth; 36 37 /** thumbnail decode **/ 38 Bool bSkipFlexbits; 39 size_t cThumbnailScale; // 1: cThumbnailScale thumbnail, only supports cThumbnailScale = 2^m for now 40 Bool bDecodeHP; 41 Bool bDecodeLP; 42 43 // Region of interest decoding 44 size_t cROILeftX; 45 size_t cROIRightX; 46 size_t cROITopY; 47 size_t cROIBottomY; 48 49 // table lookups for rotation and flip 50 size_t * pOffsetX; 51 size_t * pOffsetY; 52 } CWMDecoderParameters; 53 54 Void predCBPDec(CWMImageStrCodec *, CCodingContext *); 55 Void predDCACDec(CWMImageStrCodec *); 56 Void predACDec(CWMImageStrCodec *); 57 58 Int dequantizeMacroblock(CWMImageStrCodec *); 59 Int invTransformMacroblock(CWMImageStrCodec * pSC); 60 Int invTransformMacroblock_alteredOperators_hard(CWMImageStrCodec * pSC); 61 62 Int DecodeMacroblockDC(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY); 63 Int DecodeMacroblockLowpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY); 64 Int DecodeMacroblockHighpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY); 65 66 Int AdaptLowpassDec(struct CCodingContext *); 67 Int AdaptHighpassDec(struct CCodingContext *); 68 69 Void ResetCodingContextDec(CCodingContext *pContext); 70 Void FreeCodingContextDec(struct CWMImageStrCodec *pSC); 71 72 /*************************************************************************/ 73 // Inverse transform functions 74 // 2-point post filter for boundaries (only used in 420 UV DC subband) 75 Void strPost2(PixelI *, PixelI *); 76 77 // 2x2 post filter (only used in 420 UV DC subband) 78 Void strPost2x2(PixelI *, PixelI *, PixelI *, PixelI *); 79 80 /** 4-point post filter for boundaries **/ 81 Void strPost4(PixelI *, PixelI *, PixelI *, PixelI *); 82 83 /** data allocation in working buffer (first stage) **/ 84 85 /** Y, 444 U and V **/ 86 /** 0 1 2 3 **/ 87 /** 32 33 34 35 **/ 88 /** 64 65 66 67 **/ 89 /** 96 97 98 99 **/ 90 91 /** 420 U and V **/ 92 /** 0 2 4 6 **/ 93 /** 64 66 68 70 **/ 94 /** 128 130 132 134 **/ 95 /** 192 194 196 198 **/ 96 97 /** 4x4 inverse DCT for first stage **/ 98 Void strIDCT4x4FirstStage(PixelI *); 99 Void strIDCT4x4Stage1(PixelI*); 100 Void strIDCT4x4FirstStage420UV(PixelI *); 101 102 /** 4x4 post filter for first stage **/ 103 Void strPost4x4FirstStage(PixelI *); 104 Void strPost4x4Stage1Split(PixelI*, PixelI*, Int, Int, Bool); 105 Void strPost4x4Stage1(PixelI*, Int, Int, Bool); 106 Void strPost4x4Stage1Split_alternate(PixelI*, PixelI*, Int); 107 Void strPost4x4Stage1_alternate(PixelI*, Int); 108 //Void strPost4x4Stage1Split_420(PixelI*, PixelI*); 109 //Void strPost4x4Stage1_420(PixelI*); 110 111 Void strPost4x4FirstStage420UV(PixelI *); 112 113 /** data allocation in working buffer (second stage)**/ 114 115 /** Y, 444 U and V **/ 116 /** 0 4 8 12 **/ 117 /** 128 132 136 140 **/ 118 /** 256 260 264 268 **/ 119 /** 384 388 392 396 **/ 120 121 /** 420 U and V **/ 122 /** 0 8 **/ 123 /** 256 264 **/ 124 125 /** 4x4 invesr DCT for second stage **/ 126 //Void strIDCT4x4SecondStage(PixelI *); 127 Void strIDCT4x4Stage2(PixelI*); 128 Void strNormalizeDec(PixelI*, Bool); 129 Void strDCT2x2dnDec(PixelI *, PixelI *, PixelI *, PixelI *); 130 131 /** 4x4 post filter for second stage **/ 132 Void strPost4x4SecondStage(PixelI *); 133 Void strPost4x4Stage2Split(PixelI*, PixelI*); 134 Void strPost4x4Stage2Split_alternate(PixelI*, PixelI*); 135 136 /** Huffman decode related defines **/ 137 #define HUFFMAN_DECODE_ROOT_BITS_LOG 3 138 #define HUFFMAN_DECODE_ROOT_BITS (5) 139 140 Int getHuff(const short *pDecodeTable, BitIOInfo* pIO); 141 142 #endif // WMI_DECODE_H 143 144