//*@@@+++@@@@******************************************************************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_ENCODE_H29#define WMI_ENCODE_H3031#include "strcodec.h"3233/*************************************************************************34struct / class definitions35*************************************************************************/3637Int EncodeMacroblockDC(CWMImageStrCodec*, CCodingContext *, Int, Int);38Int EncodeMacroblockLowpass(CWMImageStrCodec*, CCodingContext *, Int, Int);39Int EncodeMacroblockHighpass(CWMImageStrCodec*, CCodingContext *, Int, Int);4041Int quantizeMacroblock(CWMImageStrCodec *);42Void transformMacroblock(CWMImageStrCodec *);43Void predMacroblockEnc(CWMImageStrCodec *);4445Void AdaptLowpassEnc(CCodingContext *pContext);46Void AdaptHighpassEnc(CCodingContext *pContext);47Void ResetCodingContextEnc(CCodingContext *pContext);48Int AllocateCodingContextEnc(struct CWMImageStrCodec *pSC, Int iNumContexts, Int iTrimFlexBits);49Void FreeCodingContextEnc(struct CWMImageStrCodec *pSC);50Void predCBPEnc(CWMImageStrCodec *pSC, CCodingContext *pContext);5152/*************************************************************************53Forward transform definitions54*************************************************************************/55/** 2-point pre filter for boundaries (only used in 420 UV DC subband) **/56Void strPre2(PixelI *, PixelI *);5758/** 2x2 pre filter (only used in 420 UV DC subband) **/59Void strPre2x2(PixelI *, PixelI *, PixelI *, PixelI *);6061/** 4-point pre filter for boundaries **/62Void strPre4(PixelI *, PixelI *, PixelI *, PixelI *);6364/** data allocation in working buffer (first stage) **/6566/** Y, 444 U and V **/67/** 0 1 2 3 **/68/** 32 33 34 35 **/69/** 64 65 66 67 **/70/** 96 97 98 99 **/7172/** 420 U and V **/73/** 0 2 4 6 **/74/** 64 66 68 70 **/75/** 128 130 132 134 **/76/** 192 194 196 198 **/7778/** 4x4 foward DCT for first stage **/79Void strDCT4x4FirstStage(PixelI *);80Void strDCT4x4FirstStage420UV(PixelI *);8182Void strDCT4x4Stage1(PixelI*);8384/** 4x4 pre filter for first stage **/85Void strPre4x4FirstStage(PixelI *);86Void strPre4x4FirstStage420UV(PixelI *);8788Void strPre4x4Stage1Split(PixelI* p0, PixelI* p1, Int iOffset);89Void strPre4x4Stage1(PixelI* p, Int iOffset);9091/** data allocation in working buffer (second stage)**/9293/** Y, 444 U and V **/94/** 0 4 8 12 **/95/** 128 132 136 140 **/96/** 256 260 264 268 **/97/** 384 388 392 396 **/9899/** 420 U and V **/100/** 0 8 **/101/** 256 264 **/102103/** 4x4 foward DCT for second stage **/104Void strDCT4x4SecondStage(PixelI *);105Void strNormalizeEnc(PixelI *, Bool);106Void strDCT2x2dnEnc(PixelI *, PixelI *, PixelI *, PixelI *);107108/** 4x4 pre filter for second stage **/109Void strPre4x4Stage2Split(PixelI* p0, PixelI* p1);110111#endif // ENCODE_H112113114115