|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Function prototypes for motion vector counting for H.263 decoder. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef _VDCMVC_H_ |
|
22 #define _VDCMVC_H_ |
|
23 |
|
24 |
|
25 #include "epoclib.h" |
|
26 |
|
27 /* |
|
28 * Defines |
|
29 */ |
|
30 |
|
31 #define MVC_XM1_UP 0 |
|
32 #define MVC_XM1_DOWN 1 |
|
33 #define MVC_YM1_LEFT 2 |
|
34 #define MVC_YM1_RIGHT 3 |
|
35 #define MVC_XP1_UP 4 |
|
36 #define MVC_XP1_DOWN 5 |
|
37 |
|
38 #define MVC_MB_INTER 1 |
|
39 #define MVC_MB_INTRA 2 |
|
40 #define MVC_MB_NOT_CODED 3 |
|
41 |
|
42 |
|
43 /* |
|
44 * Structs and typedefs |
|
45 */ |
|
46 |
|
47 /* {{-output"mvRowItem_t_info.txt" -ignore"*" -noCR}} |
|
48 mvRowItem_t is capable of storing one P frame motion vector. |
|
49 It is used internally within the MVC module. |
|
50 {{-output"mvRowItem_t_info.txt"}} */ |
|
51 |
|
52 /* {{-output"mvRowItem_t.txt"}} */ |
|
53 typedef struct { |
|
54 int mvx; /* motion vector value or MVD_INTRA or MVD_NOT_CODED */ |
|
55 int mvy; |
|
56 int y; /* the y coordinate for motion vector in block units */ |
|
57 int time; /* a relative time when motion vector was counted */ |
|
58 u_char fourMVs; /* flag indicating four MBs per macroblock */ |
|
59 int type; /* MVC_MB_INTER, MVC_MB_INTRA or MVC_MB_NOT_CODED */ |
|
60 } mvRowItem_t; |
|
61 /* {{-output"mvRowItem_t.txt"}} */ |
|
62 |
|
63 |
|
64 /* {{-output"mvBFBufItem_t_info.txt" -ignore"*" -noCR}} |
|
65 mvBFBufItem_t is capable of storing one B frame motion vector. |
|
66 It is used internally within the MVC module. |
|
67 {{-output"mvBFBufItem_t_info.txt"}} */ |
|
68 |
|
69 /* {{-output"mvBFBufItem_t.txt"}} */ |
|
70 typedef struct { |
|
71 int mvx; /* motion vector value */ |
|
72 int mvy; |
|
73 int x; /* the x coordinate for mv in block units */ |
|
74 int y; /* the y coordinate for mv in block units */ |
|
75 int time; /* a relative time when mv was counted */ |
|
76 u_char fourMVs; /* flag indicating four MBs per macroblock */ |
|
77 } mvBFBufItem_t; |
|
78 /* {{-output"mvBFBufItem_t.txt"}} */ |
|
79 |
|
80 |
|
81 /* {{-output"mvcData_t_info.txt" -ignore"*" -noCR}} |
|
82 mvcData_t is used to store the instance data for one MVC module and |
|
83 it is capable of keeping state of the motion vector decoding process |
|
84 for one encoded H.263 bitstream. |
|
85 {{-output"mvcData_t_info.txt"}} */ |
|
86 |
|
87 /* {{-output"mvcData_t.txt"}} */ |
|
88 typedef struct { |
|
89 /* motion vector buffers |
|
90 * |
|
91 * mvRow contains three motion vector lines: mvRow0, mvRow1 and mvRow2 |
|
92 * mvRow0 is the lower block line in the previous macroblock line |
|
93 * mvRow1 is the higher block line in the current macroblock line |
|
94 * mvRow2 is the lower block line in the current macroblock line |
|
95 */ |
|
96 mvRowItem_t *mvRow; |
|
97 mvRowItem_t *mvRow0; |
|
98 mvRowItem_t *mvRow1; |
|
99 mvRowItem_t *mvRow2; |
|
100 |
|
101 int currMaxX; /* maxX, when mvcStart was last called */ |
|
102 int currX; /* x for current macroblock being handled */ |
|
103 int currY; /* y for current macroblock */ |
|
104 int currTime; /* time for current macroblock */ |
|
105 int mvRowIndex; /* the index of mvRow0 in mvRow array (0..2) */ |
|
106 |
|
107 mvBFBufItem_t mvFBufArray[2][4]; /* forward motion vectors for B frame |
|
108 for current and previous MB */ |
|
109 mvBFBufItem_t mvBBufArray[2][4]; /* backward motion vectors for B frame |
|
110 for current and previous MB */ |
|
111 int mvBFBufIndex; /* the index of the current MB in mvFBufArray and |
|
112 mvBBufArray. The index of the previous MB is generated |
|
113 by XORing 1 to this variable. */ |
|
114 int currLumWidth; |
|
115 int currLumHeight; |
|
116 int mvRangeLowX; /* Lower boundary for horz. MV range */ |
|
117 int mvRangeHighX; /* Higher boundary for horz. MV range */ |
|
118 int mvRangeLowY; /* Lower boundary for vert. MV range */ |
|
119 int mvRangeHighY; /* Higher boundary for vert. MV range */ |
|
120 int prevPredMode; /* Flag for prediction of forward prediction vector in IPB |
|
121 1 => MB to the left has a FWD MV |
|
122 0 => Otherwise */ |
|
123 int rightOfBorder; /* There is a border on the left of the current MB */ |
|
124 int downOfBorder; /* There is a border on top of the current MB */ |
|
125 int leftOfBorder; /* There is a border on the right of the previous MB */ |
|
126 int rightOfBorderPrev; /* There is a border on the left of the previous MB */ |
|
127 int downOfBorderPrev; /* There is a border on top of the previous MB */ |
|
128 int upRightMBIsStart; /* The MB, on the previous line and next column is |
|
129 the starting MB of the slice. If Annex K is not |
|
130 in use returns zero.*/ |
|
131 int fSS; /* Annex K use flag */ |
|
132 |
|
133 |
|
134 int range; /* allowed range of the MVs: low= -range; high= range-1 */ |
|
135 int f_code; /* f_code_forward for P-frames */ |
|
136 |
|
137 } mvcData_t; |
|
138 /* {{-output"mvcData_t.txt"}} */ |
|
139 |
|
140 |
|
141 /* |
|
142 * Function prototypes |
|
143 */ |
|
144 |
|
145 void mvcCalcMV(mvcData_t *mvcData, int mvdx, int mvdy, |
|
146 int *mvx, int *mvy, u_char predictorMode, u_char fourMVs, |
|
147 u_char unrestrictedMV, u_char nonEmptyGOBHeader, int x, |
|
148 int y, int time, int mbType, int16 *error, int fPLUSPTYPE, |
|
149 int fUMVLimited); |
|
150 |
|
151 void mvcSetBorders( |
|
152 mvcData_t *mvcData, int x, int y, int mba, int numMBsInMBLine, |
|
153 int *rightOfBorder, int *downOfBorder); |
|
154 |
|
155 void mvcCalcMPEGMV(mvcData_t *mvcData, |
|
156 int mvdx, int mvdy, int *mvx, int *mvy, |
|
157 u_char predictorMode, u_char fourMVs, |
|
158 u_char topOfVP, u_char leftOfVP, u_char fmv3_out, |
|
159 int x, int y, int time, int mbType, int16 *error); |
|
160 |
|
161 void mvcCalcMVsForBFrame(mvcData_t *mvcData, int *mvfx, int *mvfy, |
|
162 int *mvbx, int *mvby, int *mvx, int *mvy, int mvdx, int mvdy, |
|
163 int trb, int trd, int numMVs, u_char unrestrictedMV, |
|
164 int x, int y, int time); |
|
165 |
|
166 void mvcCalcFwdMVsForImpBFrame(mvcData_t *mvcData, int *mvfx, int *mvfy, |
|
167 int *mvbx, int *mvby, int mvdx, int mvdy, int x, int y, int fUMV); |
|
168 |
|
169 void mvcFree(mvcData_t *mvcData); |
|
170 |
|
171 void mvcGetCurrNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy, |
|
172 int16 *error); |
|
173 |
|
174 void mvcGetPrevNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy, |
|
175 int *pmvx, int *pmvy, u_char *fourMVs, int16 *error); |
|
176 |
|
177 void mvcGetPrevMVFsAndMVBs(mvcData_t *mvcData, int *mvfx, int *mvfy, |
|
178 int *mvbx, int *mvby, u_char *fourMVs, int16 *error); |
|
179 |
|
180 void mvcMarkMBIntra(mvcData_t *mvcData, int x, int y, int time); |
|
181 |
|
182 void mvcMarkMBNotCoded(mvcData_t *mvcData, int x, int y, int time); |
|
183 |
|
184 void mvcStart(mvcData_t *mvcData, int maxX, int lumWidth, |
|
185 int lumHeight, int16 *error); |
|
186 |
|
187 void mvcGetCurrentMVs(mvcData_t *mvcData, int *mvx, int *mvy, |
|
188 int16 *error); |
|
189 |
|
190 #endif |
|
191 // End of File |