1 /*****************************************************************************
2 * vdec_motion.c : motion compensation routines
4 *****************************************************************************/
6 /*****************************************************************************
8 *****************************************************************************/
19 #include "vlc_thread.h"
22 #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
25 #include "input_netlist.h"
26 #include "decoder_fifo.h"
28 #include "video_output.h"
30 #include "vdec_idct.h"
31 #include "video_decoder.h"
32 #include "vdec_motion.h"
34 #include "vpar_blocks.h"
35 #include "vpar_headers.h"
36 #include "vpar_synchro.h"
37 #include "video_parser.h"
38 #include "video_fifo.h"
40 #define __MotionComponent_x_y_copy(width,height) \
41 void MotionComponent_x_y_copy_##width##_##height(yuv_data_t * p_src, \
42 yuv_data_t * p_dest, \
47 for( i_y = 0; i_y < height; i_y ++ ) \
49 for( i_x = 0; i_x < width; i_x++ ) \
51 p_dest[i_x] = p_src[i_x]; \
58 #define __MotionComponent_X_y_copy(width,height) \
59 void MotionComponent_X_y_copy_##width##_##height(yuv_data_t * p_src, \
60 yuv_data_t * p_dest, \
65 for( i_y = 0; i_y < height; i_y ++ ) \
67 for( i_x = 0; i_x < width; i_x++ ) \
69 p_dest[i_x] = (unsigned int)(p_src[i_x] \
78 #define __MotionComponent_x_Y_copy(width,height) \
79 void MotionComponent_x_Y_copy_##width##_##height(yuv_data_t * p_src, \
80 yuv_data_t * p_dest, \
86 for( i_y = 0; i_y < height; i_y ++ ) \
88 for( i_x = 0; i_x < width; i_x++ ) \
90 p_dest[i_x] = (unsigned int)(p_src[i_x] \
91 + p_src[i_x + i_step] \
99 #define __MotionComponent_X_Y_copy(width,height) \
100 void MotionComponent_X_Y_copy_##width##_##height(yuv_data_t * p_src, \
101 yuv_data_t * p_dest, \
107 for( i_y = 0; i_y < height; i_y ++ ) \
109 for( i_x = 0; i_x < width; i_x++ ) \
111 p_dest[i_x] = (unsigned int)(p_src[i_x] \
113 + p_src[i_x + i_step] \
114 + p_src[i_x + i_step + 1] \
117 p_dest += i_stride; \
122 #define __MotionComponent_x_y_avg(width,height) \
123 void MotionComponent_x_y_avg_##width##_##height(yuv_data_t * p_src, \
124 yuv_data_t * p_dest, \
128 unsigned int i_dummy; \
130 for( i_y = 0; i_y < height; i_y ++ ) \
132 for( i_x = 0; i_x < width; i_x++ ) \
134 i_dummy = p_dest[i_x] + p_src[i_x]; \
135 p_dest[i_x] = (i_dummy + 1) >> 1; \
137 p_dest += i_stride; \
142 #define __MotionComponent_X_y_avg(width,height) \
143 void MotionComponent_X_y_avg_##width##_##height(yuv_data_t * p_src, \
144 yuv_data_t * p_dest, \
148 unsigned int i_dummy; \
150 for( i_y = 0; i_y < height; i_y ++ ) \
152 for( i_x = 0; i_x < width; i_x++ ) \
154 i_dummy = p_dest[i_x] + ((unsigned int)(p_src[i_x] \
157 p_dest[i_x] = (i_dummy + 1) >> 1; \
159 p_dest += i_stride; \
164 #define __MotionComponent_x_Y_avg(width,height) \
165 void MotionComponent_x_Y_avg_##width##_##height(yuv_data_t * p_src, \
166 yuv_data_t * p_dest, \
171 unsigned int i_dummy; \
173 for( i_y = 0; i_y < height; i_y ++ ) \
175 for( i_x = 0; i_x < width; i_x++ ) \
178 p_dest[i_x] + ((unsigned int)(p_src[i_x] \
179 + p_src[i_x + i_step] \
181 p_dest[i_x] = (i_dummy + 1) >> 1; \
183 p_dest += i_stride; \
188 #define __MotionComponent_X_Y_avg(width,height) \
189 void MotionComponent_X_Y_avg_##width##_##height(yuv_data_t * p_src, \
190 yuv_data_t * p_dest, \
195 unsigned int i_dummy; \
197 for( i_y = 0; i_y < height; i_y ++ ) \
199 for( i_x = 0; i_x < width; i_x++ ) \
202 p_dest[i_x] + ((unsigned int)(p_src[i_x] \
204 + p_src[i_x + i_step] \
205 + p_src[i_x + i_step + 1] \
207 p_dest[i_x] = (i_dummy + 1) >> 1; \
209 p_dest += i_stride; \
214 #define __MotionComponents(width,height) \
215 __MotionComponent_x_y_copy(width,height) \
216 __MotionComponent_X_y_copy(width,height) \
217 __MotionComponent_x_Y_copy(width,height) \
218 __MotionComponent_X_Y_copy(width,height) \
219 __MotionComponent_x_y_avg(width,height) \
220 __MotionComponent_X_y_avg(width,height) \
221 __MotionComponent_x_Y_avg(width,height) \
222 __MotionComponent_X_Y_avg(width,height)
224 __MotionComponents (16,16) /* 444, 422, 420 */
225 __MotionComponents (16,8) /* 444, 422, 420 */
226 __MotionComponents (8,8) /* 422, 420 */
227 __MotionComponents (8,4) /* 420 */
229 __MotionComponents (8,16) /* 422 */