Commit 054ac943 authored by Mathieu Malaterre's avatar Mathieu Malaterre

Import Upstream version 1.0

parents
##//*@@@+++@@@@******************************************************************
##//
##// Copyright Microsoft Corp.
##// All rights reserved.
##//
##// Redistribution and use in source and binary forms, with or without
##// modification, are permitted provided that the following conditions are met:
##//
##// Redistributions of source code must retain the above copyright notice,
##// this list of conditions and the following disclaimer.
##// Redistributions in binary form must reproduce the above copyright notice,
##// this list of conditions and the following disclaimer in the documentation
##// and/or other materials provided with the distribution.
##//
##// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
##// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
##// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
##// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
##// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
##// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
##// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
##// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
##// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
##// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
##// POSSIBILITY OF SUCH DAMAGE.
##//
##//*@@@---@@@@******************************************************************
## Makefile for building JPEG XR Porting Kit
##
build: all
CC=cc
DIR_SYS=image/sys
DIR_DEC=image/decode
DIR_ENC=image/encode
DIR_GLUE=jxrgluelib
DIR_TEST=jxrtestlib
DIR_EXEC=jxrencoderdecoder
CFLAGS=-I. -Icommon/include -I$(DIR_SYS) -D__ANSI__ -DDISABLE_PERF_MEASUREMENT -w -O
##
## Add following flag to CFLAGS above if target is a big endian machine
## -D_BIG__ENDIAN_
##
##--------------------------------
##
## Common files
##
OBJ_SYS=adapthuff.o image.o strcodec.o strPredQuant.o strTransform.o perfTimerANSI.o
$(OBJ_SYS):
$(CC) $(CFLAGS) -c $(DIR_SYS)/$*.c
##--------------------------------
##
## Decode files
##
OBJ_DEC=decode.o postprocess.o segdec.o strdec.o strInvTransform.o strPredQuantDec.o JXRTranscode.o
$(OBJ_DEC):
$(CC) $(CFLAGS) -c $(DIR_DEC)/$*.c
##--------------------------------
##
## Encode files
##
OBJ_ENC=encode.o segenc.o strenc.o strFwdTransform.o strPredQuantEnc.o
$(OBJ_ENC):
$(CC) $(CFLAGS) -c $(DIR_ENC)/$*.c
##--------------------------------
##
## JPEG XR library
##
libjpegxr.a: $(OBJ_ENC) $(OBJ_DEC) $(OBJ_SYS)
ar rvu $@ $(OBJ_ENC) $(OBJ_DEC) $(OBJ_SYS)
ranlib $@
##--------------------------------
##
## Glue files
##
OBJ_GLUE=JXRGlue.o JXRMeta.o JXRGluePFC.o JXRGlueJxr.o
$(OBJ_GLUE):
$(CC) $(CFLAGS) -I$(DIR_GLUE) -c $(DIR_GLUE)/$*.c
##--------------------------------
##
## Test files
##
OBJ_TEST=JXRTest.o JXRTestBmp.o JXRTestHdr.o JXRTestPnm.o JXRTestTif.o JXRTestYUV.o
$(OBJ_TEST):
$(CC) $(CFLAGS) -I$(DIR_GLUE) -I$(DIR_TEST) -c $(DIR_TEST)/$*.c
##--------------------------------
##
## JPEG XR Glue library
##
libjxrglue.a: $(OBJ_GLUE) $(OBJ_TEST)
ar rvu $@ $(OBJ_GLUE) $(OBJ_TEST)
ranlib $@
##--------------------------------
##
## Enc app files
##
LIBRARIES=libjxrglue.a libjpegxr.a
LIBS=-L. $(LIBRARIES)
ENCAPP=JxrEncApp
$(ENCAPP): $(LIBRARIES)
$(CC) $(DIR_EXEC)/$(ENCAPP).c -o $(ENCAPP) $(CFLAGS) -I$(DIR_GLUE) -I$(DIR_TEST) $(LIBS)
##--------------------------------
##
## Dec app files
##
DECAPP=JxrDecApp
$(DECAPP): $(LIBRARIES)
$(CC) $(DIR_EXEC)/$(DECAPP).c -o $(DECAPP) $(CFLAGS) -I$(DIR_GLUE) -I$(DIR_TEST) $(LIBS)
##--------------------------------
##
## JPEG XR library
##
all: $(ENCAPP) $(DECAPP)
clean:
rm -rf *App *.o libj*.a
##
//+---------------------------------------------------------------------------
//
// Copyright Microsoft Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// File: guiddef.h
//
// Contents: GUID definition
//
//----------------------------------------------------------------------------
#ifndef GUID_DEFINED
#define GUID_DEFINED
#if defined(__midl)
typedef struct {
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
byte Data4[ 8 ];
} GUID;
#else
typedef struct _GUID {
#if defined(_WINDOWS_) || !__LP64__
unsigned long Data1;
#else
unsigned int Data1;
#endif
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
} GUID;
#endif
#endif
#ifndef FAR
#if defined(_WIN32) || defined(__ANSI__)
#define FAR
#else
#define FAR _far
#endif
#endif
#ifndef DECLSPEC_SELECTANY
#if (_MSC_VER >= 1100)
#define DECLSPEC_SELECTANY __declspec(selectany)
#else
#define DECLSPEC_SELECTANY
#endif
#endif
#ifndef EXTERN_C
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
#endif
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#endif
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
const GUID DECLSPEC_SELECTANY name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID FAR name
#endif // INITGUID
#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
#ifndef _GUIDDEF_H_
#define _GUIDDEF_H_
#ifndef __LPGUID_DEFINED__
#define __LPGUID_DEFINED__
typedef GUID *LPGUID;
#endif
#ifndef __LPCGUID_DEFINED__
#define __LPCGUID_DEFINED__
typedef const GUID *LPCGUID;
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef GUID IID;
typedef IID *LPIID;
#define IID_NULL GUID_NULL
#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
typedef GUID CLSID;
typedef CLSID *LPCLSID;
#define CLSID_NULL GUID_NULL
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
typedef GUID FMTID;
typedef FMTID *LPFMTID;
#define FMTID_NULL GUID_NULL
#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
#ifdef __midl_proxy
#define __MIDL_CONST
#else
#define __MIDL_CONST const
#endif
#ifndef _REFGUID_DEFINED
#define _REFGUID_DEFINED
#ifdef __cplusplus
#define REFGUID const GUID &
#else
#define REFGUID const GUID * __MIDL_CONST
#endif
#endif
#ifndef _REFIID_DEFINED
#define _REFIID_DEFINED
#ifdef __cplusplus
#define REFIID const IID &
#else
#define REFIID const IID * __MIDL_CONST
#endif
#endif
#ifndef _REFCLSID_DEFINED
#define _REFCLSID_DEFINED
#ifdef __cplusplus
#define REFCLSID const IID &
#else
#define REFCLSID const IID * __MIDL_CONST
#endif
#endif
#ifndef _REFFMTID_DEFINED
#define _REFFMTID_DEFINED
#ifdef __cplusplus
#define REFFMTID const IID &
#else
#define REFFMTID const IID * __MIDL_CONST
#endif
#endif
#endif // !__IID_DEFINED__
#if !defined (__midl)
#if !defined (_SYS_GUID_OPERATORS_)
#define _SYS_GUID_OPERATORS_
#include <string.h>
// Faster (but makes code fatter) inline version...use sparingly
#ifdef __cplusplus
__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
return (
((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
}
__inline int IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
return !memcmp(&rguid1, &rguid2, sizeof(GUID));
}
#else // ! __cplusplus
#define InlineIsEqualGUID(rguid1, rguid2) \
(((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] && \
((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] && \
((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] && \
((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
#endif // __cplusplus
#ifdef __INLINE_ISEQUAL_GUID
#undef IsEqualGUID
#define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID(rguid1, rguid2)
#endif
// Same type, different name
#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
#define _SYS_GUID_OPERATOR_EQ_
// A couple of C++ helpers
#ifdef __cplusplus
__inline int operator==(REFGUID guidOne, REFGUID guidOther)
{
return IsEqualGUID(guidOne,guidOther);
}
__inline int operator!=(REFGUID guidOne, REFGUID guidOther)
{
return !(guidOne == guidOther);
}
#endif
#endif // _SYS_GUID_OPERATOR_EQ_
#endif // _SYS_GUID_OPERATORS_
#endif // __midl
#endif // _GUIDDEF_H_
This diff is collapsed.
This diff is collapsed.
//*@@@+++@@@@******************************************************************
//
// Copyright © Microsoft Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// • Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// • Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//*@@@---@@@@******************************************************************
#pragma once
/*************************************************************************
* DEFINITIONS OF NEW TYPES
*************************************************************************/
#if !defined(__midl)
#define __$compname_props \
__type_has_adt_prop(compname,nullterminated) \
__type_has_adt_prop(compname,valid_schars) \
__type_has_adt_prop(compname,correct_len) \
__nullterminated
#if defined(UNICODE) || defined(_UNICODE)
#define __$TCHAR unsigned short
#else
#define __$TCHAR char
#endif
typedef __$compname_props char* ValidCompNameA;
typedef __$compname_props unsigned short* ValidCompNameW;
typedef __$compname_props const unsigned short* ConstValidCompNameW;
typedef __$compname_props __$TCHAR* SAL_ValidCompNameT;
typedef __$compname_props const __$TCHAR* SAL_ConstValidCompNameT;
#undef __$compname_props
#undef __$TCHAR
#endif
/*************************************************************************
* DEFINITIONS OF INLINE FUNCTIONS FOR CASTING TO THE NEW TYPES : USER
*************************************************************************/
#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_)
#ifdef __cplusplus
extern "C" {
#endif
void __inline __nothrow __SAL_ValidCompNameA(__out_has_type_adt_props(ValidCompNameA) const void *expr) { expr;}
void __inline __nothrow __SAL_ValidCompNameW(__out_has_type_adt_props(ValidCompNameW) const void *expr) { expr;}
#ifdef __cplusplus
}
#endif
#define __assume_ValidCompNameA(expr) __SAL_ValidCompNameA(expr)
#define __assume_ValidCompNameW(expr) __SAL_ValidCompNameW(expr)
#else
#define __assume_ValidCompNameA(expr)
#define __assume_ValidCompNameW(expr)
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//*@@@+++@@@@******************************************************************
//
// Copyright Microsoft Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//*@@@---@@@@******************************************************************
/******************************************************************************
Module Name:
decode.c
Abstract:
Defines the entry point for the console application.
Author:
Revision History:
*******************************************************************************/
#include "strcodec.h"
#include "decode.h"
#ifdef MEM_TRACE
#define TRACE_MALLOC 1
#define TRACE_NEW 0
#define TRACE_HEAP 0
#include "memtrace.h"
#endif
/******************************************************************
Free Adaptive Huffman Table
******************************************************************/
static Void CleanAH(CAdaptiveHuffman **ppAdHuff)
{
CAdaptiveHuffman *pAdHuff;
if (NULL != ppAdHuff) {
pAdHuff = *ppAdHuff;
if (NULL != pAdHuff) {
free(pAdHuff);
}
*ppAdHuff = NULL;
}
}
static Void CleanAHDec(CCodingContext * pSC)
{
Int kk;
for (kk = 0; kk < NUMVLCTABLES; kk++) {
CleanAH(&(pSC->m_pAHexpt[kk]));
}
CleanAH(&(pSC->m_pAdaptHuffCBPCY));
CleanAH(&(pSC->m_pAdaptHuffCBPCY1));
}
/*************************************************************************
Initialize an adaptive huffman table
*************************************************************************/
static Int InitializeAH(CAdaptiveHuffman **ppAdHuff, Int iSym)
{
Int iMemStatus = 0;
CAdaptiveHuffman *pAdHuff = Allocate(iSym, DECODER);
if (pAdHuff == NULL) {
iMemStatus = -1; // out of memory
goto ErrorExit;
}
//Adapt(pAdHuff, bFixedTables);
//InitHuffman(pAdHuff->m_pHuffman);
//if (ICERR_OK != initHuff(pAdHuff->m_pHuffman, 1, pAdHuff->m_pTable, NULL)) {
// goto ErrorExit;
//}
*ppAdHuff = pAdHuff;
return ICERR_OK;
ErrorExit:
if (pAdHuff) {
free(pAdHuff);
}
*ppAdHuff = NULL;
if (-1 == iMemStatus) {
printf("Insufficient memory to init decoder.\n");
}
return ICERR_ERROR;
}
/*************************************************************************
Context allocation
*************************************************************************/
Int AllocateCodingContextDec(CWMImageStrCodec *pSC, Int iNumContexts)
{
Int i, iCBPSize, k;
static const Int aAlphabet[] = {5,4,8,7,7, 12,6,6,12,6,6,7,7, 12,6,6,12,6,6,7,7};
if (iNumContexts > MAX_TILES || iNumContexts < 1) // only between 1 and MAX_TILES allowed
return ICERR_ERROR;
if (pSC == NULL)
return ICERR_ERROR;
pSC->m_pCodingContext = malloc (iNumContexts * sizeof (CCodingContext));
if (pSC->m_pCodingContext == NULL) {
pSC->cNumCodingContext = 0;
return ICERR_ERROR;
}
memset (pSC->m_pCodingContext, 0, iNumContexts * sizeof (CCodingContext));
pSC->cNumCodingContext = iNumContexts;
iCBPSize = (pSC->m_param.cfColorFormat == Y_ONLY || pSC->m_param.cfColorFormat == NCOMPONENT
|| pSC->m_param.cfColorFormat == CMYK) ? 5 : 9;
/** allocate / initialize members **/
for (i = 0; i < iNumContexts; i++) {
CCodingContext *pContext = &(pSC->m_pCodingContext[i]);
/** allocate adaptive Huffman encoder **/
if (InitializeAH(&pContext->m_pAdaptHuffCBPCY, iCBPSize) != ICERR_OK) {
return ICERR_ERROR;
}
if (InitializeAH(&pContext->m_pAdaptHuffCBPCY1, 5) != ICERR_OK) {
return ICERR_ERROR;
}
for(k = 0; k < NUMVLCTABLES; k ++){
if (InitializeAH(&pContext->m_pAHexpt[k], aAlphabet[k]) != ICERR_OK) {
return ICERR_ERROR;
}
}
ResetCodingContextDec(pContext);
}
return ICERR_OK;
}
/*************************************************************************
Context reset on encoder
*************************************************************************/
Void ResetCodingContextDec(CCodingContext *pContext)
{
Int k;
/** set flags **/
pContext->m_pAdaptHuffCBPCY->m_bInitialize = FALSE;
pContext->m_pAdaptHuffCBPCY1->m_bInitialize = FALSE;
for(k = 0; k < NUMVLCTABLES; k ++)
pContext->m_pAHexpt[k]->m_bInitialize = FALSE;
// reset VLC tables
AdaptLowpassDec (pContext);
AdaptHighpassDec (pContext);
// reset zigzag patterns, totals
InitZigzagScan(pContext);
// reset bit reduction and cbp models
ResetCodingContext(pContext);
}
/*************************************************************************
Context deletion
*************************************************************************/
Void FreeCodingContextDec(CWMImageStrCodec *pSC)
{
Int iContexts = (Int)(pSC->cNumCodingContext), i, k;
if (iContexts > 0 && pSC->m_pCodingContext) {
for (i = 0; i < iContexts; i++) {
CCodingContext *pContext = &(pSC->m_pCodingContext[i]);
CleanAH (&pContext->m_pAdaptHuffCBPCY);
CleanAH (&pContext->m_pAdaptHuffCBPCY1);
for (k = 0; k < NUMVLCTABLES; k++)
CleanAH (&pContext->m_pAHexpt[k]);
}
free (pSC->m_pCodingContext);
}
}
//*@@@+++@@@@******************************************************************
//
// Copyright Microsoft Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//*@@@---@@@@******************************************************************
#ifndef WMI_DECODE_H
#define WMI_DECODE_H
typedef struct CWMDecoderParameters {
/** ROI decode **/
Bool bDecodeFullFrame;
Bool bDecodeFullWidth;
/** thumbnail decode **/
Bool bSkipFlexbits;
size_t cThumbnailScale; // 1: cThumbnailScale thumbnail, only supports cThumbnailScale = 2^m for now
Bool bDecodeHP;
Bool bDecodeLP;
// Region of interest decoding
size_t cROILeftX;
size_t cROIRightX;
size_t cROITopY;
size_t cROIBottomY;
// table lookups for rotation and flip
size_t * pOffsetX;
size_t * pOffsetY;
} CWMDecoderParameters;
Void predCBPDec(CWMImageStrCodec *, CCodingContext *);
Void predDCACDec(CWMImageStrCodec *);
Void predACDec(CWMImageStrCodec *);
Int dequantizeMacroblock(CWMImageStrCodec *);
Int invTransformMacroblock(CWMImageStrCodec * pSC);
Int invTransformMacroblock_alteredOperators_hard(CWMImageStrCodec * pSC);
Int DecodeMacroblockDC(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);
Int DecodeMacroblockLowpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);
Int DecodeMacroblockHighpass(CWMImageStrCodec * pSC, CCodingContext *pContext, Int iMBX, Int iMBY);
Int AdaptLowpassDec(struct CCodingContext *);
Int AdaptHighpassDec(struct CCodingContext *);
Void ResetCodingContextDec(CCodingContext *pContext);
Void FreeCodingContextDec(struct CWMImageStrCodec *pSC);
/*************************************************************************/
// Inverse transform functions
// 2-point post filter for boundaries (only used in 420 UV DC subband)
Void strPost2(PixelI *, PixelI *);