Initial release.
[gst-davinci.git] / ti_plugins / adecoder / src / #loadstuff.h#
blobfc8a31f3d2a8e07c9d9501e92790ac737a7679ba
1 /** ==================================================================
2 * @file loadstuff.h
4 * @path $(codecs_dev)\WMA_Decoder\AlgSource\GoldenC\Include\configurable\WMA_specific
6 * @desc This File contains macros for loading bitstream data.
8 * =====================================================================
9 * Copyright (c) Texas Instruments Inc 2007
11 * Use of this software is controlled by the terms and conditions found
12 * in the license agreement under which this software has been supplied
13 =====================================================================*/
16 //*@@@+++@@@@******************************************************************
18 // Microsoft Windows Media
19 // Copyright (C) Microsoft Corporation. All rights reserved.
21 //*@@@---@@@@******************************************************************
22 //+-------------------------------------------------------------------------
24 //  Microsoft Windows Media
26 //  Copyright (C) Microsoft Corporation, 1999 - 1999
28 //  File:       loadStuff.h
30 //--------------------------------------------------------------------------
32 #ifndef LOADSTUFF_H
33 #define LOADSTUFF_H
35 /**** Robustness: START OF BLOCK ****/
37 #ifndef UNALIGNED
38 #define UNALIGNED
39 #endif
42 /****************************************************************************/
43 #ifndef _BOOL_DEFINED
44 #define _BOOL_DEFINED
45 typedef long BOOL;
46 #endif /* _BOOL_DEFINED */
48 #ifndef _U8_DEFINED
49 #define _U8_DEFINED
50 typedef unsigned char   U8;
51 #endif /* _U8_DEFINED */
53 #ifndef _WORD_DEFINED
54 #define _WORD_DEFINED
55 typedef unsigned short  WORD;
56 #endif /* _WORD_DEFINED */
58 #ifndef _DWORD_DEFINED
59 #define _DWORD_DEFINED
60 typedef unsigned int    DWORD; 
61 #endif /* _DWORD_DEFINED */
63 #ifndef _QWORD_DEFINED
64 #define _QWORD_DEFINED
65 typedef PACKED struct tQWORD
67     DWORD   dwLo;
68     DWORD   dwHi;
70 }   QWORD;
71 #endif /* _QWORD_DEFINED */
72 #ifndef GUID_DEFINED
73 #define GUID_DEFINED
75 typedef struct {          // size is 16
76     tWMA_U32  Data1;
77     tWMA_U16 Data2;
78     tWMA_U16 Data3;
79     tWMA_U8  Data4[8];
80 } GUID;
82 #endif // !GUID_DEFINED
83 #define WAVE_FORMAT_WMAUDIO3  0x0162
84 #define WAVE_FORMAT_WMAUDIO2  0x0161
85 #define WAVE_FORMAT_MSAUDIO1  0x0160
86 #define WAVE_FORMAT_WMAUDIO_LOSSLESS  0x0163
88 #ifdef _MSC_VER
89 #define LITTLE_ENDIAN
90 #endif
92 #ifdef LITTLE_ENDIAN
93 #if 1// C64X
94 #define GetUnalignedWord( pb, w )   (w) = (WORD)(*pb) + ((WORD) *(pb+1) << 8); 
95 #else
96 #define GetUnalignedWord( pb, w )   (w) = *(UNALIGNED WORD*)(pb); 
97 #endif // C64X
99 #if 1 // C64X
100 #define GetUnalignedDword( pb, dw ) (dw) = (DWORD) *pb + ((DWORD) *(pb+1) <<8) \
101                                            + ((DWORD) *(pb+2) <<16) \
102                                            + ((DWORD) *(pb+3) <<24);
103 #else
104 #define GetUnalignedDword( pb, dw ) (dw) = *(UNALIGNED DWORD*)(pb);
105 #endif // C64X
107 #if 1 // C64X
108 #define GetUnalignedQword( pb, qw ) \
109                  GetUnalignedDword( pb, (qw).dwLo ); \
110                  GetUnalignedDword( (pb + 4), (qw).dwHi );
111 #else
112 #define GetUnalignedQword( pb, qw ) (qw) = *(UNALIGNED QWORD*)(pb);
113 #endif // C64X
115 #define GetUnalignedDouble( pb, d ) (d) = *(UNALIGNED Double*)(pb);
117 #else
119 #define GetUnalignedWord( pb, w ) \
120             (w) = ((WORD) *(pb + 1) << 8) + *pb;
122 #define GetUnalignedDword( pb, dw ) \
123             (dw) = ((DWORD) *(pb + 3) << 24) + \
124                    ((DWORD) *(pb + 2) << 16) + \
125                    ((DWORD) *(pb + 1) << 8) + *pb;
127 #define GetUnalignedQword( pb, qw ) \
128             GetUnalignedDword( pb, (qw).dwLo ); \
129             GetUnalignedDword( (pb + 4), (qw).dwHi );
131 #define GetUnalignedDouble( pb, d ) (d) = *(UNALIGNED Double*)(pb);
133 #endif
135 #define GetUnalignedWordEx( pb, w )     GetUnalignedWord( pb, w ); (pb) += sizeof(WORD);
136 #define GetUnalignedDwordEx( pb, dw )   GetUnalignedDword( pb, dw ); (pb) += sizeof(DWORD);
137 #define GetUnalignedQwordEx( pb, qw )   GetUnalignedQword( pb, qw ); (pb) += sizeof(QWORD);
138 #define GetUnalignedDoubleEx( pb, d )   GetUnalignedDouble( pb, d ); (pb) += sizeof(Double);
140 #define LoadBYTE( b, p )    b = *(U8 *)(p);  (p) += sizeof( U8 )
142 #define LoadWORD( w, p )    GetUnalignedWordEx( p, w )
143 #define LoadDWORD( dw, p )  GetUnalignedDwordEx( p, dw )
144 #define LoadQWORD( qw, p )  GetUnalignedQwordEx( p, qw )
146 #define LoadGUID( g, p ) \
147         { \
148             LoadDWORD( (g).Data1, p ); \
149             LoadWORD( (g).Data2, p ); \
150             LoadWORD( (g).Data3, p ); \
151             LoadBYTE( (g).Data4[0], p ); \
152             LoadBYTE( (g).Data4[1], p ); \
153             LoadBYTE( (g).Data4[2], p ); \
154             LoadBYTE( (g).Data4[3], p ); \
155             LoadBYTE( (g).Data4[4], p ); \
156             LoadBYTE( (g).Data4[5], p ); \
157             LoadBYTE( (g).Data4[6], p ); \
158             LoadBYTE( (g).Data4[7], p ); \
159         }
161 #endif  // LOADSTUFF_H