📄 vdec_motion.c
字号:
* Motion422 : motion compensation for a 4:2:2 macroblock *****************************************************************************/static __inline__ void Motion422( macroblock_t * p_mb, /* destination macroblock */ picture_t * p_source, /* source picture */ boolean_t b_source_field, /* source field */ boolean_t b_dest_field, /* destination field */ int i_mv_x, int i_mv_y, /* motion vector coordinates, * in half pels */ int i_l_stride, /* number of coeffs to jump to * go to the next predicted * line */ int i_c_stride, int i_height, /* height of the block to * predict, in luminance * (explicit) */ int i_offset, /* position of the first * predicted line (explicit) */ boolean_t b_average /* (explicit) averaging of * several predictions */ ){#if 0 int i_source_offset, i_dest_offset, i_c_select; /* Luminance */ MotionComponent( /* source */ p_source->p_y + (p_mb->i_l_x + (i_mv_x >> 1)) + (p_mb->i_motion_l_y + i_offset + (i_mv_y >> 1) + b_source_field) * p_mb->p_picture->i_width, /* destination */ p_mb->p_picture->p_y + (p_mb->i_l_x) + (p_mb->i_motion_l_y + b_dest_field) * p_mb->p_picture->i_width, /* prediction width and height */ 16, i_height, /* stride */ i_l_stride, p_mb->i_l_stride, /* select */ ((i_mv_y & 1) << 1) | (i_mv_x & 1), b_average ); i_source_offset = (p_mb->i_c_x + ((i_mv_x/2) >> 1)) + ((p_mb->i_motion_c_y + (i_offset) + ((i_mv_y) >> 1)) + b_source_field) * p_mb->p_picture->i_chroma_width; i_dest_offset = (p_mb->i_c_x) + (p_mb->i_motion_c_y + b_dest_field) * p_mb->p_picture->i_chroma_width; i_c_select = ((i_mv_y & 1) << 1) | ((i_mv_x/2) & 1); /* Chrominance Cr */ MotionComponent( p_source->p_u + i_source_offset, p_mb->p_picture->p_u + i_dest_offset, 8, i_height, i_c_stride, p_mb->i_c_stride, i_c_select, b_average ); /* Chrominance Cb */ MotionComponent( p_source->p_v + i_source_offset, p_mb->p_picture->p_u + i_dest_offset, 8, i_height, i_c_stride, p_mb->i_c_stride, i_c_select, b_average );#endif}/***************************************************************************** * Motion444 : motion compensation for a 4:4:4 macroblock *****************************************************************************/static __inline__ void Motion444( macroblock_t * p_mb, /* destination macroblock */ picture_t * p_source, /* source picture */ boolean_t b_source_field, /* source field */ boolean_t b_dest_field, /* destination field */ int i_mv_x, int i_mv_y, /* motion vector coordinates, * in half pels */ int i_l_stride, /* number of coeffs to jump to * go to the next predicted * line */ int i_c_stride, int i_height, /* height of the block to * predict, in luminance * (explicit) */ int i_offset, /* position of the first * predicted line (explicit) */ boolean_t b_average /* (explicit) averaging of * several predictions */ ){#if 0 int i_source_offset, i_dest_offset, i_select; i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1)) + (p_mb->i_motion_l_y + i_offset + (i_mv_y >> 1) + b_source_field) * p_mb->p_picture->i_width; i_dest_offset = (p_mb->i_l_x) + (p_mb->i_motion_l_y + b_dest_field) * p_mb->p_picture->i_width; i_select = ((i_mv_y & 1) << 1) | (i_mv_x & 1); /* Luminance */ MotionComponent( p_source->p_y + i_source_offset, p_mb->p_picture->p_y + i_dest_offset, 16, i_height, i_l_stride, p_mb->i_l_stride, i_select, b_average ); /* Chrominance Cr */ MotionComponent( p_source->p_u + i_source_offset, p_mb->p_picture->p_u + i_dest_offset, 16, i_height, i_l_stride, p_mb->i_l_stride, i_select, b_average ); /* Chrominance Cb */ MotionComponent( p_source->p_v + i_source_offset, p_mb->p_picture->p_v + i_dest_offset, 16, i_height, i_l_stride, p_mb->i_l_stride, i_select, b_average );#endif}/***************************************************************************** * vdec_MotionFieldField : motion compensation for field motion type (field) *****************************************************************************/#define FIELDFIELD( MOTION ) \ picture_t * p_pred; \ \ if( p_mb->i_mb_type & MB_MOTION_FORWARD ) \ { \ if( p_mb->b_P_second \ && (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )\ p_pred = p_mb->p_picture; \ else \ p_pred = p_mb->p_forward; \ \ MOTION( p_mb, p_pred, p_mb->ppi_field_select[0][0], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[0][0][0], \ p_mb->pppi_motion_vectors[0][0][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 ); \ \ if( p_mb->i_mb_type & MB_MOTION_BACKWARD ) \ { \ MOTION( p_mb, p_mb->p_backward, \ p_mb->ppi_field_select[0][1], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[0][1][0], \ p_mb->pppi_motion_vectors[0][1][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 ); \ } \ \ else /* MB_MOTION_BACKWARD */ \ { \ MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[0][1], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[0][1][0], \ p_mb->pppi_motion_vectors[0][1][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 ); \ } \}void vdec_MotionFieldField420( macroblock_t * p_mb ){ FIELDFIELD( Motion420 )}void vdec_MotionFieldField422( macroblock_t * p_mb ){ //FIELDFIELD( Motion422 )}void vdec_MotionFieldField444( macroblock_t * p_mb ){ //FIELDFIELD( Motion444 )}/***************************************************************************** * vdec_MotionField16x8XXX?? : motion compensation for 16x8 motion type (field) *****************************************************************************/#define FIELD16X8( MOTION ) \{ \ picture_t * p_pred; \ \ if( p_mb->i_mb_type & MB_MOTION_FORWARD ) \ { \ if( p_mb->b_P_second \ && (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )\ p_pred = p_mb->p_picture; \ else \ p_pred = p_mb->p_forward; \ \ MOTION( p_mb, p_pred, p_mb->ppi_field_select[0][0], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[0][0][0], \ p_mb->pppi_motion_vectors[0][0][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 8, 0, 0 ); \ \ if( p_mb->b_P_second \ && (p_mb->b_motion_field != p_mb->ppi_field_select[1][0]) )\ p_pred = p_mb->p_picture; \ else \ p_pred = p_mb->p_forward; \ \ MOTION( p_mb, p_pred, p_mb->ppi_field_select[1][0], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[1][0][0], \ p_mb->pppi_motion_vectors[1][0][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 8, 8, 0 ); \ \ if( p_mb->i_mb_type & MB_MOTION_BACKWARD ) \ { \ MOTION( p_mb, p_mb->p_backward, \ p_mb->ppi_field_select[0][1], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[0][1][0], \ p_mb->pppi_motion_vectors[0][1][1], \ p_mb->i_l_stride, p_mb->i_c_stride, 8, 0, 1 ); \ \ MOTION( p_mb, p_mb->p_backward, \ p_mb->ppi_field_select[1][1], \ p_mb->b_motion_field, \ p_mb->pppi_motion_vectors[1][1][0], \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -