github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/image/jxr/jxrlib/jxrtestlib/JXRTest.h (about) 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 #pragma once 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <JXRGlue.h> 35 36 EXTERN_C const PKIID IID_PKImageBmpEncode; 37 EXTERN_C const PKIID IID_PKImagePnmEncode; 38 EXTERN_C const PKIID IID_PKImageTifEncode; 39 40 EXTERN_C const PKIID IID_PKImageBmpDecode; 41 EXTERN_C const PKIID IID_PKImagePnmDecode; 42 EXTERN_C const PKIID IID_PKImageTifDecode; 43 44 //---------------------------------------------------------------- 45 ERR GetTestEncodeIID(const char* szExt, const PKIID** ppIID); 46 ERR GetTestDecodeIID(const char* szExt, const PKIID** ppIID); 47 48 //================================================================ 49 #ifdef __ANSI__ 50 #define PKTestDecode struct tagPKTestDecode 51 #else // __ANSI__ 52 typedef struct tagPKTestDecode PKTestDecode; 53 #endif // __ANSI__ 54 //================================================================ 55 56 //---------------------------------------------------------------- 57 ERR PKTestFactory_CreateCodec(const PKIID* iid, void** ppv); 58 59 EXTERN_C ERR PKCreateTestFactory(PKCodecFactory**, U32); 60 61 //---------------------------------------------------------------- 62 ERR PKImageEncode_Create_BMP(PKImageEncode** ppIE); 63 ERR PKImageEncode_Create_PNM(PKImageEncode** ppIE); 64 ERR PKImageEncode_Create_TIF(PKImageEncode** ppIE); 65 ERR PKImageEncode_Create_HDR(PKImageEncode** ppIE); 66 ERR PKImageEncode_Create_IYUV(PKImageEncode** ppIE); 67 ERR PKImageEncode_Create_YUV422(PKImageEncode** ppIE); 68 ERR PKImageEncode_Create_YUV444(PKImageEncode** ppIE); 69 70 //================================================================ 71 typedef struct tagPKTestDecode 72 { 73 ERR (*Initialize)(PKTestDecode*, struct WMPStream* pStream); 74 75 ERR (*GetPixelFormat)(PKImageDecode*, PKPixelFormatGUID*); 76 ERR (*GetSize)(PKImageDecode*, I32*, I32*); 77 ERR (*GetResolution)(PKImageDecode*, Float*, Float*); 78 ERR (*GetColorContext)(PKImageDecode *pID, U8 *pbColorContext, 79 U32 *pcbColorContext); 80 ERR (*GetDescriptiveMetadata)(PKImageDecode *pIE, 81 DESCRIPTIVEMETADATA *pDescMetadata); 82 83 ERR (*GetRawStream)(PKImageDecode*, struct WMPStream**); 84 85 ERR (*Copy)(PKTestDecode*, const PKRect*, U8*, U32); 86 87 ERR (*GetFrameCount)(PKImageDecode*, U32*); 88 ERR (*SelectFrame)(PKImageDecode*, U32); 89 90 ERR (*Release)(PKTestDecode**); 91 92 struct WMPStream* pStream; 93 Bool fStreamOwner; 94 size_t offStart; 95 96 PKPixelFormatGUID guidPixFormat; 97 98 U32 uWidth; 99 U32 uHeight; 100 U32 idxCurrentLine; 101 102 Float fResX; 103 Float fResY; 104 105 U32 cFrame; 106 107 union 108 { 109 struct 110 { 111 size_t offPixel; 112 size_t cbPixel; 113 } BMP; 114 struct 115 { 116 size_t offPixel; 117 size_t cbPixel; 118 } HDR; 119 struct 120 { 121 size_t offPixel; 122 } PNM; 123 struct 124 { 125 U32 uRowsPerStrip; 126 U32* uStripOffsets; 127 U32* uStripByteCounts; 128 129 U32 uInterpretation; 130 U32 uSamplePerPixel; 131 U32 uBitsPerSample; 132 U32 uSampleFormat; 133 U32 uExtraSamples; 134 135 U16 uResolutionUnit; 136 Float fResX; 137 Float fResY; 138 Bool fLittleEndian; 139 } TIF; 140 } EXT; 141 #ifdef __ANSI__ 142 #undef PKTestDecode 143 #endif // __ANSI__ 144 } PKTestDecode; 145 146 //---------------------------------------------------------------- 147 ERR PKImageDecode_Create_BMP(PKTestDecode** ppID); 148 ERR PKImageDecode_Create_PNM(PKTestDecode** ppID); 149 ERR PKImageDecode_Create_TIF(PKTestDecode** ppID); 150 ERR PKImageDecode_Create_HDR(PKTestDecode** ppID); 151 ERR PKImageDecode_Create_IYUV(PKTestDecode** ppID); 152 ERR PKImageDecode_Create_YUV422(PKTestDecode** ppID); 153 ERR PKImageDecode_Create_YUV444(PKTestDecode** ppID); 154 155 ERR PKTestDecode_Initialize(PKTestDecode* pID, struct WMPStream* pStream); 156 ERR PKTestDecode_Copy(PKTestDecode* pID, const PKRect* pRect, U8* pb, U32 cbStride); 157 ERR PKTestDecode_Release(PKTestDecode** ppID); 158 159 ERR PKTestDecode_Create(PKTestDecode** ppID); 160 161 #ifdef __cplusplus 162 } // extern "C" 163 #endif 164