ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mpeg_encode/src/search.h
Revision: 22
Committed: Mon Jul 7 22:16:37 2008 UTC (11 years, 1 month ago) by wdelano
File size: 4073 byte(s)
Log Message:
initial checkin of mpeg_encode source
Line File contents
1 /*===========================================================================*
2 * search.h *
3 * *
4 * stuff dealing with the motion search *
5 * *
6 *===========================================================================*/
7
8 /*
9 * Copyright (c) 1995 The Regents of the University of California.
10 * All rights reserved.
11 *
12 * Permission to use, copy, modify, and distribute this software and its
13 * documentation for any purpose, without fee, and without written agreement is
14 * hereby granted, provided that the above copyright notice and the following
15 * two paragraphs appear in all copies of this software.
16 *
17 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
18 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
19 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
20 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
25 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27 */
28
29 /*
30 * $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/search.h,v 1.6 1995/08/15 23:43:36 smoot Exp $
31 * $Log: search.h,v $
32 * Revision 1.6 1995/08/15 23:43:36 smoot
33 * *** empty log message ***
34 *
35 * Revision 1.5 1995/01/19 23:55:20 eyhung
36 * Changed copyrights
37 *
38 * Revision 1.4 1994/12/07 00:42:01 smoot
39 * Added seperate P and B search ranges
40 *
41 * Revision 1.3 1994/11/12 02:12:58 keving
42 * nothing
43 *
44 * Revision 1.2 1993/07/22 22:24:23 keving
45 * nothing
46 *
47 * Revision 1.1 1993/07/09 00:17:23 keving
48 * nothing
49 *
50 */
51
52
53 /*==============*
54 * HEADER FILES *
55 *==============*/
56
57 #include "ansi.h"
58
59
60 /*===========*
61 * CONSTANTS *
62 *===========*/
63
64 #define PSEARCH_SUBSAMPLE 0
65 #define PSEARCH_EXHAUSTIVE 1
66 #define PSEARCH_LOGARITHMIC 2
67 #define PSEARCH_TWOLEVEL 3
68
69 #define BSEARCH_EXHAUSTIVE 0
70 #define BSEARCH_CROSS2 1
71 #define BSEARCH_SIMPLE 2
72
73
74 /*========*
75 * MACROS *
76 *========*/
77
78 #define COMPUTE_MOTION_BOUNDARY(by,bx,stepSize,leftMY,leftMX,rightMY,rightMX)\
79 leftMY = -2*DCTSIZE*by; /* these are valid motion vectors */ \
80 leftMX = -2*DCTSIZE*bx; \
81 /* these are invalid motion vectors */ \
82 rightMY = 2*(Fsize_y - (by+2)*DCTSIZE + 1) - 1; \
83 rightMX = 2*(Fsize_x - (bx+2)*DCTSIZE + 1) - 1; \
84 \
85 if ( stepSize == 2 ) { \
86 rightMY++; \
87 rightMX++; \
88 }
89
90 #define VALID_MOTION(y,x) \
91 (((y) >= leftMY) && ((y) < rightMY) && \
92 ((x) >= leftMX) && ((x) < rightMX) )
93
94
95 /*===============================*
96 * EXTERNAL PROCEDURE prototypes *
97 *===============================*/
98
99 void SetPSearchAlg _ANSI_ARGS_((char *alg));
100 void SetBSearchAlg _ANSI_ARGS_((char *alg));
101 char *BSearchName _ANSI_ARGS_((void));
102 char *PSearchName _ANSI_ARGS_((void));
103 int32 PLogarithmicSearch _ANSI_ARGS_((LumBlock currentBlock,
104 MpegFrame *prev,
105 int by, int bx,
106 int *motionY, int *motionX, int searchRange));
107 int32 PSubSampleSearch _ANSI_ARGS_((LumBlock currentBlock,
108 MpegFrame *prev, int by, int bx,
109 int *motionY, int *motionX, int searchRange));
110 int32 PLocalSearch _ANSI_ARGS_((LumBlock currentBlock,
111 MpegFrame *prev, int by, int bx,
112 int *motionY, int *motionX,
113 int32 bestSoFar, int searchRange));
114 int32 PTwoLevelSearch _ANSI_ARGS_((LumBlock currentBlock,
115 MpegFrame *prev, int by, int bx,
116 int *motionY, int *motionX,
117 int32 bestSoFar, int searchRange));
118 boolean PMotionSearch _ANSI_ARGS_((LumBlock currentBlock,
119 MpegFrame *prev,
120 int by, int bx,
121 int *motionY, int *motionX));
122
123
124 /*==================*
125 * GLOBAL VARIABLES *
126 *==================*/
127
128 extern int psearchAlg;