• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// -*- c++ -*-
2
3#ifdef SEARCH_EFFORT_FUNC
4#undef SEARCH_EFFORT_FUNC
5#endif
6
7#ifdef USE_STRANGE_BOB
8#define SEARCH_EFFORT_FUNC(n) SEFUNC(n##SB)
9#else
10#define SEARCH_EFFORT_FUNC(n) SEFUNC(n)
11#endif
12
13static inline int SEARCH_EFFORT_FUNC(0)		// we don't try at all ;-)
14{
15		//see Search_Effort_Max() for comments
16#define SKIP_SEARCH
17#include "SearchLoopTop.inc"
18#include "SearchLoopBottom.inc"
19#undef SKIP_SEARCH
20}
21
22static inline int SEARCH_EFFORT_FUNC(1)
23{
24#ifdef IS_C
25#define SKIP_SEARCH
26#include "SearchLoopTop.inc"
27#include "SearchLoopBottom.inc"
28#undef SKIP_SEARCH
29#else
30		//see Search_Effort_Max() for comments
31#include "SearchLoopTop.inc"
32	RESET_CHROMA		// pretend chroma diffs was 255 each
33#include "SearchLoop0A.inc"
34#include "SearchLoopBottom.inc"
35#endif
36}
37
38static inline int SEARCH_EFFORT_FUNC(3)
39{
40#ifdef IS_C
41#define SKIP_SEARCH
42#include "SearchLoopTop.inc"
43#include "SearchLoopBottom.inc"
44#undef SKIP_SEARCH
45#else
46		//see Search_Effort_Max() for comments
47#include "SearchLoopTop.inc"
48#include "SearchLoopOddA2.inc"
49	RESET_CHROMA		// pretend chroma diffs was 255 each
50#include "SearchLoop0A.inc"
51#include "SearchLoopBottom.inc"
52#endif
53}
54
55static inline int SEARCH_EFFORT_FUNC(5)
56{
57#ifdef IS_C
58#define SKIP_SEARCH
59#include "SearchLoopTop.inc"
60#include "SearchLoopBottom.inc"
61#undef SKIP_SEARCH
62#else
63		//see Search_Effort_Max() for comments
64#include "SearchLoopTop.inc"
65#include "SearchLoopOddA2.inc"
66#include "SearchLoopOddAH2.inc"
67	RESET_CHROMA		// pretend chroma diffs was 255 each
68#include "SearchLoop0A.inc"
69#include "SearchLoopBottom.inc"
70#endif
71}
72
73// 3x3 search
74static inline int SEARCH_EFFORT_FUNC(9)
75{
76#ifdef IS_C
77#define SKIP_SEARCH
78#include "SearchLoopTop.inc"
79#include "SearchLoopBottom.inc"
80#undef SKIP_SEARCH
81#else
82		//see SearchEffortMax() for comments
83#include "SearchLoopTop.inc"
84#include "SearchLoopOddA.inc"
85	RESET_CHROMA			// pretend chroma diffs was 255 each
86#include "SearchLoopVA.inc"
87#include "SearchLoop0A.inc"
88#include "SearchLoopBottom.inc"
89#endif
90}
91
92// Search 9 with 2 H-half pels added
93static inline int SEARCH_EFFORT_FUNC(11)
94{
95#ifdef IS_C
96#define SKIP_SEARCH
97#include "SearchLoopTop.inc"
98#include "SearchLoopBottom.inc"
99#undef SKIP_SEARCH
100#else
101		//see SearchEffortMax() for comments
102#include "SearchLoopTop.inc"
103#include "SearchLoopOddA.inc"
104#include "SearchLoopOddAH2.inc"
105	RESET_CHROMA			// pretend chroma diffs was 255 each
106#include "SearchLoopVA.inc"
107#include "SearchLoop0A.inc"
108#include "SearchLoopBottom.inc"
109#endif
110}
111
112// Search 11 with 2 V-half pels added
113static inline int SEARCH_EFFORT_FUNC(13)
114{
115#ifdef IS_C
116#define SKIP_SEARCH
117#include "SearchLoopTop.inc"
118#include "SearchLoopBottom.inc"
119#undef SKIP_SEARCH
120#else
121		//see SearchEffortMax() for comments
122#include "SearchLoopTop.inc"
123#include "SearchLoopOddA.inc"
124#include "SearchLoopOddAH2.inc"
125	RESET_CHROMA			// pretend chroma diffs was 255 each
126#include "SearchLoopVAH.inc"
127#include "SearchLoopVA.inc"
128#include "SearchLoop0A.inc"
129#include "SearchLoopBottom.inc"
130#endif
131}
132
133// 5x3
134static inline int SEARCH_EFFORT_FUNC(15)
135{
136#ifdef IS_C
137#define SKIP_SEARCH
138#include "SearchLoopTop.inc"
139#include "SearchLoopBottom.inc"
140#undef SKIP_SEARCH
141#else
142		//see SearchEffortMax() for comments
143#include "SearchLoopTop.inc"
144#include "SearchLoopOddA.inc"
145	RESET_CHROMA			// pretend chroma diffs was 255 each
146#include "SearchLoopEdgeA.inc"
147#include "SearchLoopVA.inc"
148#include "SearchLoop0A.inc"
149#include "SearchLoopBottom.inc"
150#endif
151}
152
153// 5x3 + 4 half pels
154static inline int SEARCH_EFFORT_FUNC(19)
155{
156#ifdef IS_C
157#define SKIP_SEARCH
158#include "SearchLoopTop.inc"
159#include "SearchLoopBottom.inc"
160#undef SKIP_SEARCH
161#else
162		//see SearchEffortMax() for comments
163#include "SearchLoopTop.inc"
164#include "SearchLoopOddA.inc"
165#include "SearchLoopOddAH2.inc"
166	RESET_CHROMA			// pretend chroma diffs was 255 each
167#include "SearchLoopEdgeA.inc"
168#include "SearchLoopVAH.inc"
169#include "SearchLoopVA.inc"
170#include "SearchLoop0A.inc"
171#include "SearchLoopBottom.inc"
172#endif
173}
174
175// Handle one 4x1 block of pixels
176// Search a 7x3 area, no half pels
177
178static inline int SEARCH_EFFORT_FUNC(21)
179{
180#ifdef IS_C
181#define SKIP_SEARCH
182#include "SearchLoopTop.inc"
183#include "SearchLoopBottom.inc"
184#undef SKIP_SEARCH
185#else
186		//see SearchLoopTop.inc for comments
187#include "SearchLoopTop.inc"
188
189		// odd addresses -- the pixels at odd address wouldn't generate
190		// good luma values but we will mask those off
191
192#include "SearchLoopOddA6.inc"  // 4 odd v half pels, 3 to left & right
193#include "SearchLoopOddA.inc"   // 6 odd pels, 1 to left & right
194
195	RESET_CHROMA		// pretend chroma diffs was 255 each
196
197		// even addresses -- use both luma and chroma from these
198		// search averages of 2 pixels left and right
199#include "SearchLoopEdgeA.inc"
200		// search vertical line and averages, -1,0,+1
201#include "SearchLoopVA.inc"
202		// blend our results and loop
203#include "SearchLoop0A.inc"
204#include "SearchLoopBottom.inc"
205#endif
206}
207
208// Handle one 4x1 block of pixels
209// Search a 9x3 area, no half pels
210static inline int SEARCH_EFFORT_FUNC(Max)
211{
212#ifdef IS_C
213#define SKIP_SEARCH
214#include "SearchLoopTop.inc"
215#include "SearchLoopBottom.inc"
216#undef SKIP_SEARCH
217#else
218		//see SearchLoopTop.inc for comments
219#include "SearchLoopTop.inc"
220
221		// odd addresses -- the pixels at odd address wouldn't generate
222		// good luma values but we will mask those off
223
224#include "SearchLoopOddA6.inc"  // 4 odd v half pels, 3 to left & right
225#include "SearchLoopOddA.inc"   // 6 odd pels, 1 to left & right
226
227	RESET_CHROMA		// pretend chroma diffs was 255 each
228
229		// even addresses -- use both luma and chroma from these
230		// search averages of 4 pixels left and right
231#include "SearchLoopEdgeA8.inc"
232		// search averages of 2 pixels left and right
233#include "SearchLoopEdgeA.inc"
234		// search vertical line and averages, -1,0,+1
235#include "SearchLoopVA.inc"
236		// blend our results and loop
237#include "SearchLoop0A.inc"
238#include "SearchLoopBottom.inc"
239#endif
240}
241
242#undef SEARCH_EFFORT_FUNC
243
244