Parent Directory | Revision Log
Revision 1.1.2.4 - (view) (download)
1 : | edgomez | 1.1.2.1 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - Motion Estimation related header - | ||
5 : | * | ||
6 : | * Copyright(C) 2002 Christoph Lampert <gruel@web.de> | ||
7 : | * 2002 Michael Militzer <michael@xvid.org> | ||
8 : | * 2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net> | ||
9 : | * | ||
10 : | * This program is free software ; you can redistribute it and/or modify | ||
11 : | * it under the terms of the GNU General Public License as published by | ||
12 : | * the Free Software Foundation ; either version 2 of the License, or | ||
13 : | * (at your option) any later version. | ||
14 : | * | ||
15 : | * This program is distributed in the hope that it will be useful, | ||
16 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
17 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 : | * GNU General Public License for more details. | ||
19 : | * | ||
20 : | * You should have received a copy of the GNU General Public License | ||
21 : | * along with this program ; if not, write to the Free Software | ||
22 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 : | * | ||
24 : | syskin | 1.1.2.3 | * $Id: estimation.h,v 1.1.2.2 2003/09/30 18:20:31 edgomez Exp $ |
25 : | edgomez | 1.1.2.1 | * |
26 : | ****************************************************************************/ | ||
27 : | |||
28 : | #ifndef _ESTIMATION_H_ | ||
29 : | #define _ESTIMATION_H_ | ||
30 : | |||
31 : | #include "../portab.h" | ||
32 : | #include "../global.h" | ||
33 : | #include "../image/reduced.h" | ||
34 : | |||
35 : | /* hard coded motion search parameters */ | ||
36 : | |||
37 : | /* very large value */ | ||
38 : | #define MV_MAX_ERROR (4096 * 256) | ||
39 : | |||
40 : | /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */ | ||
41 : | #define MV16_INTER_BIAS 512 | ||
42 : | |||
43 : | /* vector map (vlc delta size) smoother parameters ! float !*/ | ||
44 : | #define NEIGH_TEND_16X16 10.5 | ||
45 : | #define NEIGH_TEND_8X8 40.0 | ||
46 : | #define NEIGH_8X8_BIAS 30 | ||
47 : | |||
48 : | #define BITS_MULT 16 | ||
49 : | |||
50 : | #define INITIAL_SKIP_THRESH 10 | ||
51 : | #define FINAL_SKIP_THRESH 50 | ||
52 : | #define MAX_SAD00_FOR_SKIP 20 | ||
53 : | #define MAX_CHROMA_SAD_FOR_SKIP 22 | ||
54 : | |||
55 : | /* Parameters which control inter/inter4v decision */ | ||
56 : | #define IMV16X16 2 | ||
57 : | |||
58 : | extern const int xvid_me_lambda_vec16[32]; | ||
59 : | |||
60 : | #define CHECK_CANDIDATE(X,Y,D) { \ | ||
61 : | CheckCandidate((X),(Y), data, (D) ); } | ||
62 : | |||
63 : | #define RRV_MV_SCALEDOWN(a) ( (a)>=0 ? (a+1)/2 : (a-1)/2 ) | ||
64 : | |||
65 : | /* fast ((A)/2)*2 */ | ||
66 : | #define EVEN(A) (((A)<0?(A)+1:(A)) & ~1) | ||
67 : | |||
68 : | #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) ) | ||
69 : | |||
70 : | static const VECTOR zeroMV = { 0, 0 }; | ||
71 : | |||
72 : | typedef struct | ||
73 : | { | ||
74 : | /* general fields */ | ||
75 : | int max_dx, min_dx, max_dy, min_dy; | ||
76 : | uint32_t rounding; | ||
77 : | VECTOR predMV; | ||
78 : | VECTOR * currentMV; | ||
79 : | VECTOR * currentQMV; | ||
80 : | VECTOR * currentQMV2; | ||
81 : | int32_t * iMinSAD; | ||
82 : | int32_t * iMinSAD2; | ||
83 : | const uint8_t * RefP[6]; /* N, V, H, HV, cU, cV */ | ||
84 : | const uint8_t * CurU; | ||
85 : | const uint8_t * CurV; | ||
86 : | uint8_t * RefQ; | ||
87 : | const uint8_t * Cur; | ||
88 : | uint32_t lambda16; | ||
89 : | uint32_t lambda8; | ||
90 : | uint32_t iEdgedWidth; | ||
91 : | uint32_t iFcode; | ||
92 : | int * temp; | ||
93 : | unsigned int * dir; | ||
94 : | int qpel, qpel_precision; | ||
95 : | int chroma; | ||
96 : | int rrv; | ||
97 : | |||
98 : | /* fields for interpolate and direct modes */ | ||
99 : | const uint8_t * b_RefP[6]; /* N, V, H, HV, cU, cV */ | ||
100 : | VECTOR bpredMV; | ||
101 : | uint32_t bFcode; | ||
102 : | |||
103 : | /* fields for direct mode */ | ||
104 : | VECTOR directmvF[4]; | ||
105 : | VECTOR directmvB[4]; | ||
106 : | const VECTOR * referencemv; | ||
107 : | |||
108 : | /* BITS/R-D stuff */ | ||
109 : | int16_t * dctSpace; | ||
110 : | uint32_t iQuant; | ||
111 : | uint32_t quant_type; | ||
112 : | int * cbp; | ||
113 : | syskin | 1.1.2.4 | const uint16_t * scan_table; |
114 : | edgomez | 1.1.2.1 | |
115 : | } SearchData; | ||
116 : | |||
117 : | typedef void(CheckFunc)(const int x, const int y, | ||
118 : | const SearchData * const Data, | ||
119 : | const unsigned int Direction); | ||
120 : | |||
121 : | CheckFunc CheckCandidate16no4v; /* shared between p-vop and b-vop search */ | ||
122 : | |||
123 : | uint8_t * | ||
124 : | xvid_me_interpolate8x8qpel(const int x, const int y, const uint32_t block, | ||
125 : | const uint32_t dir, const SearchData * const data); | ||
126 : | |||
127 : | uint8_t * | ||
128 : | xvid_me_interpolate16x16qpel(const int x, const int y, const uint32_t dir, | ||
129 : | const SearchData * const data); | ||
130 : | |||
131 : | int32_t | ||
132 : | xvid_me_ChromaSAD(const int dx, const int dy, const SearchData * const data); | ||
133 : | |||
134 : | int | ||
135 : | xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference, | ||
136 : | const int x, const int y, | ||
137 : | const uint32_t stride, const uint32_t iQuant, int rrv); | ||
138 : | |||
139 : | #define iDiamondSize 2 | ||
140 : | typedef void | ||
141 : | MainSearchFunc(int x, int y, const SearchData * const Data, | ||
142 : | int bDirection, CheckFunc * const CheckCandidate); | ||
143 : | |||
144 : | MainSearchFunc xvid_me_DiamondSearch, xvid_me_AdvDiamondSearch, xvid_me_SquareSearch; | ||
145 : | |||
146 : | void | ||
147 : | xvid_me_SubpelRefine(const SearchData * const data, CheckFunc * const CheckCandidate); | ||
148 : | |||
149 : | void | ||
150 : | xvid_me_ModeDecision_RD(SearchData * const Data, | ||
151 : | MACROBLOCK * const pMB, | ||
152 : | const MACROBLOCK * const pMBs, | ||
153 : | const int x, const int y, | ||
154 : | const MBParam * const pParam, | ||
155 : | const uint32_t MotionFlags, | ||
156 : | const uint32_t VopFlags, | ||
157 : | const uint32_t VolFlags, | ||
158 : | const IMAGE * const pCurrent, | ||
159 : | const IMAGE * const pRef, | ||
160 : | const IMAGE * const vGMC, | ||
161 : | const int coding_type); | ||
162 : | |||
163 : | void | ||
164 : | xvid_me_ModeDecision_Fast(SearchData * const Data, | ||
165 : | MACROBLOCK * const pMB, | ||
166 : | const MACROBLOCK * const pMBs, | ||
167 : | const int x, const int y, | ||
168 : | const MBParam * const pParam, | ||
169 : | const uint32_t MotionFlags, | ||
170 : | const uint32_t VopFlags, | ||
171 : | const uint32_t VolFlags, | ||
172 : | const IMAGE * const pCurrent, | ||
173 : | const IMAGE * const pRef, | ||
174 : | const IMAGE * const vGMC, | ||
175 : | const int coding_type); | ||
176 : | |||
177 : | |||
178 : | #endif /* _ESTIMATION_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |