OSDN Git Service

9e58844181d12f3de6eeaa71a3bd347902068145
[qtheora/main.git] / Lib / QTheoraEx / FrameDecoder.h
1 /* FrameDecoder.h */
2 /* 2009/06/29     */
3
4 #pragma once
5
6 #include "BitReader.h"
7
8 #include "MemoryPool.h"
9
10 #include "BlockIndex.h"
11
12 #include "SetupDecoder.h"
13
14 /* QT_FrameHeader */
15 struct QT_FrameHeader {
16
17         UINT8 Type;
18
19         UINT8 NQIS;
20         UINT8 QIS[3];
21
22 }; /* QT_FrameHeader */
23
24 typedef struct QT_FrameHeader FrameHeader_t;
25
26 /* DequantizeMatrix */
27 struct DequantizeMatrix {
28
29         INT16 Matrix[2][3][64];
30
31 }; /* DequantizeMatrix */
32
33 typedef struct DequantizeMatrix DequantizeMatrix_t;
34
35 /* LoopFilter */
36 struct LoopFilter {
37
38         INT16 Delta[0x100];
39
40         INT32 Limit;
41
42 }; /* LoopFilter */
43
44 typedef struct LoopFilter LoopFilter_t;
45
46 /* Plane */
47 struct Plane {
48
49         UINT8* Plane;
50         INT32  Pitch;
51         INT32  CX;
52         INT32  CY;
53
54 }; /* Plane */
55
56 typedef struct Plane Plane_t;
57
58 /* RunLength */
59 struct RunLength {
60
61         INT32 Bit;
62         INT32 Run;
63
64 }; /* RunLength */
65
66 typedef struct RunLength RunLength_t;
67
68 /* MotionVector */
69 struct MotionVector {
70
71         INT8 X;
72         INT8 Y;
73
74 }; /* MotionVector */
75
76 typedef struct MotionVector MotionVector_t;
77
78 /* QT_FrameDecoder */
79
80 struct QT_FrameDecoder;
81
82 typedef struct QT_FrameDecoder FrameDecoder_t;
83
84 struct QT_FrameDecoder {
85
86         const BlockIndex_t* Index;
87
88         const SetupHeader_t* Setup;
89
90         Plane_t  Plane[9];
91         Plane_t* Frame[3];
92
93         FrameHeader_t Header;
94
95         DequantizeMatrix_t Dequantize;
96
97         LoopFilter_t Filter;
98
99         INT32 QIndex;
100
101         INT8* SBCoded;
102
103         UINT8* Count;
104
105         UINT8* MBMode;
106
107         UINT8* BMode;
108
109         MotionVector_t* MV;
110
111         MotionVector_t* MVC;
112
113         INT32 BlocksCoded[3];
114
115         INT8*  DCTRun;
116         INT16* DCTCoeff;
117
118         INT16* DC;
119
120         /* */
121
122         INT8*  BRun  [3][64];
123         INT16* BCoeff[3][64];
124
125         /* */
126
127         BOOL (*Decode)(FrameDecoder_t*, const VOID*, SIZE_T);
128
129 }; /* QT_FrameDecoder */
130
131 /* */
132
133 #define NOT_CODED -32768
134
135 /* */
136
137 BOOL QT_FrameDecoder_Setup(
138         FrameDecoder_t*      t,
139         const BlockIndex_t*  index,
140         const SetupHeader_t* setup,
141         MemoryPool_t*        pool);
142
143 BOOL QT_FrameDecoder_DecodeFrame(
144         FrameDecoder_t* t,
145         const VOID*     p,
146         SIZE_T          size);
147
148 /* */
149