[svn] / branches / dev-api-3 / xvidcore / src / motion / motion.h Repository:
ViewVC logotype

Annotation of /branches/dev-api-3/xvidcore/src/motion/motion.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 539 - (view) (download)

1 : chl 326 /**************************************************************************
2 :     *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - Motion sad header -
5 :     *
6 : chl 530 * This program is an implementation of a part of one or more MPEG-4
7 :     * Video tools as specified in ISO/IEC 14496-2 standard. Those intending
8 :     * to use this software module in hardware or software products are
9 :     * advised that its use may infringe existing patents or copyrights, and
10 :     * any such use would be at such party's own risk. The original
11 :     * developer of this software module and his/her company, and subsequent
12 :     * editors and their companies, will have no liability for use of this
13 :     * software or modifications or derivatives thereof.
14 :     *
15 : chl 326 * This program is free software; you can redistribute it and/or modify
16 :     * it under the terms of the GNU General Public License as published by
17 :     * the Free Software Foundation; either version 2 of the License, or
18 :     * (at your option) any later version.
19 :     *
20 :     * This program is distributed in the hope that it will be useful,
21 :     * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 :     * GNU General Public License for more details.
24 :     *
25 :     * You should have received a copy of the GNU General Public License
26 :     * along with this program; if not, write to the Free Software
27 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 :     *
29 : Isibaar 539 * $Id: motion.h,v 1.13.2.2 2002-09-25 21:28:48 Isibaar Exp $
30 : chl 326 *
31 :     ***************************************************************************/
32 :    
33 :     #ifndef _MOTION_H_
34 :     #define _MOTION_H_
35 :    
36 :     #include "../portab.h"
37 :     #include "../global.h"
38 :    
39 :     // fast ((A)/2)*2
40 :     #define EVEN(A) (((A)<0?(A)+1:(A)) & ~1)
41 :    
42 :     #define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) )
43 :     #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )
44 :    
45 :     /*
46 : chl 530 * getref: calculate reference image pointer
47 : chl 326 * the decision to use interpolation h/v/hv or the normal image is
48 :     * based on dx & dy.
49 :     */
50 :    
51 : Isibaar 539 static const uint32_t roundtab[16] =
52 :     { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };
53 :    
54 :    
55 : chl 326 static __inline const uint8_t *
56 :     get_ref(const uint8_t * const refn,
57 :     const uint8_t * const refh,
58 :     const uint8_t * const refv,
59 :     const uint8_t * const refhv,
60 :     const uint32_t x,
61 :     const uint32_t y,
62 :     const uint32_t block, /* block dimension, 8 or 16 */
63 :    
64 :     const int32_t dx,
65 :     const int32_t dy,
66 :     const uint32_t stride)
67 :     {
68 :    
69 :    
70 :     switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */
71 :     case 0:
72 :     return refn + (int) ((x * block + dx / 2) + (y * block + dy / 2) * stride);
73 :     case 1:
74 :     return refv + (int) ((x * block + dx / 2) + (y * block +
75 :     (dy - 1) / 2) * stride);
76 :     case 2:
77 :     return refh + (int) ((x * block + (dx - 1) / 2) + (y * block +
78 :     dy / 2) * stride);
79 :     default:
80 :     return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block +
81 :     (dy - 1) / 2) * stride);
82 :     }
83 :    
84 :     }
85 :    
86 :    
87 :     /* This is somehow a copy of get_ref, but with MV instead of X,Y */
88 :    
89 :     static __inline const uint8_t *
90 :     get_ref_mv(const uint8_t * const refn,
91 :     const uint8_t * const refh,
92 :     const uint8_t * const refv,
93 :     const uint8_t * const refhv,
94 :     const uint32_t x,
95 :     const uint32_t y,
96 :     const uint32_t block, /* block dimension, 8 or 16 */
97 :    
98 :     const VECTOR * mv, /* measured in half-pel! */
99 :    
100 :     const uint32_t stride)
101 :     {
102 :    
103 :     switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) {
104 :     case 0:
105 :     return refn + (int) ((x * block + (mv->x) / 2) + (y * block +
106 :     (mv->y) / 2) * stride);
107 :     case 1:
108 :     return refv + (int) ((x * block + (mv->x) / 2) + (y * block +
109 :     ((mv->y) - 1) / 2) * stride);
110 :     case 2:
111 :     return refh + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block +
112 :     (mv->y) / 2) * stride);
113 :     default:
114 :     return refhv + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block +
115 :     ((mv->y) -
116 :     1) / 2) * stride);
117 :     }
118 :    
119 :     }
120 :    
121 :     void MotionEstimationBVOP(MBParam * const pParam,
122 :     FRAMEINFO * const frame,
123 :     // forward (past) reference
124 :     const int32_t time_bp,
125 :     const int32_t time_pp,
126 :     const MACROBLOCK * const f_mbs,
127 :     const IMAGE * const f_ref,
128 :     const IMAGE * const f_refH,
129 :     const IMAGE * const f_refV,
130 :     const IMAGE * const f_refHV,
131 :     // backward (future) reference
132 :     const MACROBLOCK * const b_mbs,
133 :     const IMAGE * const b_ref,
134 :     const IMAGE * const b_refH,
135 :     const IMAGE * const b_refV,
136 :     const IMAGE * const b_refHV);
137 :    
138 :     void MBMotionCompensationBVOP(MBParam * pParam,
139 :     MACROBLOCK * const mb,
140 :     const uint32_t i,
141 :     const uint32_t j,
142 :     IMAGE * const cur,
143 :     const IMAGE * const f_ref,
144 :     const IMAGE * const f_refh,
145 :     const IMAGE * const f_refv,
146 :     const IMAGE * const f_refhv,
147 :     const IMAGE * const b_ref,
148 :     const IMAGE * const b_refh,
149 :     const IMAGE * const b_refv,
150 :     const IMAGE * const b_refhv,
151 :     int16_t * dct_codes);
152 :    
153 : chl 530 void
154 :     MotionEstimationHinted( MBParam * const pParam,
155 :     FRAMEINFO * const current,
156 :     FRAMEINFO * const reference,
157 :     const IMAGE * const pRefH,
158 :     const IMAGE * const pRefV,
159 :     const IMAGE * const pRefHV);
160 : chl 326
161 : Isibaar 539 int
162 :     MEanalysis( const IMAGE * const pRef,
163 :     const IMAGE * const pCurrent,
164 :     MBParam * const pParam,
165 :     MACROBLOCK * const pMBs,
166 :     const uint32_t iFcode);
167 : chl 326
168 : Isibaar 539
169 : chl 326 #endif /* _MOTION_H_ */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4