1 /*****************************************************************************
2 * vdec_motion_inner.c : motion compensation inner routines
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: vdec_motion_inner.c,v 1.1 2001/01/18 05:13:22 sam Exp $
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 * Jean-Marc Dressler <polux@via.ecp.fr>
9 * Michel Lespinasse <walken@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
38 #define __MotionComponent_x_y_copy(width,height) \
39 void MotionComponent_x_y_copy_##width##_##height(yuv_data_t * p_src, \
40 yuv_data_t * p_dest, \
45 for( i_y = 0; i_y < height; i_y ++ ) \
47 for( i_x = 0; i_x < width; i_x++ ) \
49 p_dest[i_x] = p_src[i_x]; \
56 #define __MotionComponent_X_y_copy(width,height) \
57 void MotionComponent_X_y_copy_##width##_##height(yuv_data_t * p_src, \
58 yuv_data_t * p_dest, \
63 for( i_y = 0; i_y < height; i_y ++ ) \
65 for( i_x = 0; i_x < width; i_x++ ) \
67 p_dest[i_x] = (unsigned int)(p_src[i_x] \
76 #define __MotionComponent_x_Y_copy(width,height) \
77 void MotionComponent_x_Y_copy_##width##_##height(yuv_data_t * p_src, \
78 yuv_data_t * p_dest, \
83 for( i_y = 0; i_y < height; i_y ++ ) \
85 for( i_x = 0; i_x < width; i_x++ ) \
87 p_dest[i_x] = (unsigned int)(p_src[i_x] \
88 + p_src[i_x + i_stride] \
96 #define __MotionComponent_X_Y_copy(width,height) \
97 void MotionComponent_X_Y_copy_##width##_##height(yuv_data_t * p_src, \
98 yuv_data_t * p_dest, \
103 for( i_y = 0; i_y < height; i_y ++ ) \
105 for( i_x = 0; i_x < width; i_x++ ) \
107 p_dest[i_x] = (unsigned int)(p_src[i_x] \
109 + p_src[i_x + i_stride] \
110 + p_src[i_x + i_stride + 1] \
113 p_dest += i_stride; \
118 #define __MotionComponent_x_y_avg(width,height) \
119 void MotionComponent_x_y_avg_##width##_##height(yuv_data_t * p_src, \
120 yuv_data_t * p_dest, \
124 unsigned int i_dummy; \
126 for( i_y = 0; i_y < height; i_y ++ ) \
128 for( i_x = 0; i_x < width; i_x++ ) \
130 i_dummy = p_dest[i_x] + p_src[i_x]; \
131 p_dest[i_x] = (i_dummy + 1) >> 1; \
133 p_dest += i_stride; \
138 #define __MotionComponent_X_y_avg(width,height) \
139 void MotionComponent_X_y_avg_##width##_##height(yuv_data_t * p_src, \
140 yuv_data_t * p_dest, \
144 unsigned int i_dummy; \
146 for( i_y = 0; i_y < height; i_y ++ ) \
148 for( i_x = 0; i_x < width; i_x++ ) \
150 i_dummy = p_dest[i_x] + ((unsigned int)(p_src[i_x] \
153 p_dest[i_x] = (i_dummy + 1) >> 1; \
155 p_dest += i_stride; \
160 #define __MotionComponent_x_Y_avg(width,height) \
161 void MotionComponent_x_Y_avg_##width##_##height(yuv_data_t * p_src, \
162 yuv_data_t * p_dest, \
166 unsigned int i_dummy; \
168 for( i_y = 0; i_y < height; i_y ++ ) \
170 for( i_x = 0; i_x < width; i_x++ ) \
173 p_dest[i_x] + ((unsigned int)(p_src[i_x] \
174 + p_src[i_x + i_stride] \
176 p_dest[i_x] = (i_dummy + 1) >> 1; \
178 p_dest += i_stride; \
183 #define __MotionComponent_X_Y_avg(width,height) \
184 void MotionComponent_X_Y_avg_##width##_##height(yuv_data_t * p_src, \
185 yuv_data_t * p_dest, \
189 unsigned int i_dummy; \
191 for( i_y = 0; i_y < height; i_y ++ ) \
193 for( i_x = 0; i_x < width; i_x++ ) \
196 p_dest[i_x] + ((unsigned int)(p_src[i_x] \
198 + p_src[i_x + i_stride] \
199 + p_src[i_x + i_stride + 1] \
201 p_dest[i_x] = (i_dummy + 1) >> 1; \
203 p_dest += i_stride; \
208 #define __MotionComponents(width,height) \
209 __MotionComponent_x_y_copy(width,height) \
210 __MotionComponent_X_y_copy(width,height) \
211 __MotionComponent_x_Y_copy(width,height) \
212 __MotionComponent_X_Y_copy(width,height) \
213 __MotionComponent_x_y_avg(width,height) \
214 __MotionComponent_X_y_avg(width,height) \
215 __MotionComponent_x_Y_avg(width,height) \
216 __MotionComponent_X_Y_avg(width,height)
218 __MotionComponents (16,16) /* 444, 422, 420 */
219 __MotionComponents (16,8) /* 444, 422, 420 */
220 __MotionComponents (8,8) /* 422, 420 */
221 __MotionComponents (8,4) /* 420 */
223 __MotionComponents (8,16) /* 422 */