Commit 2d82e8bf authored by Christophe Massiot's avatar Christophe Massiot

Corrections de bugs dans le motion.

parent bb545321
......@@ -45,6 +45,9 @@ typedef struct macroblock_s
int ppi_field_select[2][2];
int pppi_motion_vectors[2][2][2];
int pi_dm_vector[2];
int i_motion_l_y;
int i_motion_c_y;
boolean_t b_motion_field;
/* AddBlock information */
f_addb_t pf_addb[12]; /* pointer to the Add function */
......
......@@ -98,6 +98,7 @@ typedef struct picture_parsing_s
/* Relative to the current field */
int i_coding_type, i_structure;
boolean_t b_frame_structure;
boolean_t b_motion_field;
f_macroblock_type_t pf_macroblock_type;
boolean_t b_error;
......
......@@ -254,17 +254,14 @@ void vdec_MotionFieldField( macroblock_t * p_mb )
args.i_height = 16;
args.b_average = 0;
args.b_dest_field = 0;
args.b_dest_field = p_mb->b_motion_field;
args.i_offset = 0;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
boolean_t b_current_field;
b_current_field = ( p_mb->i_structure == BOTTOM_FIELD );
if( p_mb->b_P_coding_type
&& (p_mb->i_current_structure == FRAME_STRUCTURE)
&& (b_current_field != p_mb->ppi_field_select[0][0]) )
&& (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )
args.p_source = p_mb->p_picture;
else
args.p_source = p_mb->p_forward;
......@@ -296,17 +293,14 @@ void vdec_MotionField16x8( macroblock_t * p_mb )
args.i_height = 8;
args.b_average = 0;
args.b_dest_field = 0;
args.b_dest_field = p_mb->b_motion_field;
args.i_offset = 0;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
boolean_t b_current_field;
b_current_field = ( p_mb->i_structure == BOTTOM_FIELD );
if( p_mb->b_P_coding_type
&& (p_mb->i_current_structure == FRAME_STRUCTURE)
&& (b_current_field != p_mb->ppi_field_select[0][0]) )
&& (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )
args.p_source = p_mb->p_picture;
else
args.p_source = p_mb->p_forward;
......@@ -317,7 +311,7 @@ void vdec_MotionField16x8( macroblock_t * p_mb )
if( p_mb->b_P_coding_type
&& (p_mb->i_current_structure == FRAME_STRUCTURE)
&& (b_current_field != p_mb->ppi_field_select[1][0]) )
&& (p_mb->b_motion_field != p_mb->ppi_field_select[1][0]) )
args.p_source = p_mb->p_picture;
else
args.p_source = p_mb->p_forward;
......@@ -406,18 +400,14 @@ void vdec_MotionFrameField( macroblock_t * p_mb )
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
args.p_source = p_mb->p_forward;
#
args.b_source_field = p_mb->ppi_field_select[0][0];
args.b_dest_field = 0;
args.i_mv_x = p_mb->pppi_motion_vectors[0][0][0];
args.i_mv_y = p_mb->pppi_motion_vectors[0][0][1] >> 1;
// p_mb->pf_chroma_motion( p_mb, &args );
p_mb->pf_chroma_motion( p_mb, &args );
p_mb->i_l_y ++;
p_mb->i_c_y ++;
args.b_source_field = p_mb->ppi_field_select[1][0]-1;
//args.b_dest_field = 1;
args.b_source_field = p_mb->ppi_field_select[1][0];
args.b_dest_field = 1;
args.i_mv_x = p_mb->pppi_motion_vectors[1][0][0];
args.i_mv_y = p_mb->pppi_motion_vectors[1][0][1] >> 1;
p_mb->pf_chroma_motion( p_mb, &args );
......@@ -463,14 +453,15 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
MotionComponent( /* source */
p_motion->p_source->p_y
+ (p_mb->i_l_x + (p_motion->i_mv_x >> 1))
+ ((p_mb->i_l_y + p_motion->i_offset
+ (p_motion->i_mv_y >> 1))
+ (p_motion->b_source_field - p_motion->b_dest_field))
+ (p_mb->i_motion_l_y + p_motion->i_offset
+ (p_motion->i_mv_y >> 1)
+ p_motion->b_source_field)
* p_mb->p_picture->i_width,
/* destination */
p_mb->p_picture->p_y
+ (p_mb->i_l_x)
+ (p_mb->i_l_y) * p_mb->p_picture->i_width,
+ (p_mb->i_motion_l_y + p_motion->b_dest_field)
* p_mb->p_picture->i_width,
/* prediction width and height */
16, p_motion->i_height,
/* step */
......@@ -483,13 +474,14 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
/* Chrominance Cr */
MotionComponent( p_motion->p_source->p_u
+ (p_mb->i_c_x + ((p_motion->i_mv_x/2) >> 1))
+ ((p_mb->i_c_y + (p_motion->i_offset >> 1)
+ ((p_mb->i_motion_c_y + (p_motion->i_offset >> 1)
+ ((p_motion->i_mv_y/2) >> 1))
+ (p_motion->b_source_field - p_motion->b_dest_field))
+ p_motion->b_source_field)
* p_mb->p_picture->i_chroma_width,
p_mb->p_picture->p_u
+ (p_mb->i_c_x)
+ (p_mb->i_c_y) * p_mb->p_picture->i_chroma_width,
+ (p_mb->i_motion_c_y + p_motion->b_dest_field)
* p_mb->p_picture->i_chroma_width,
8, p_motion->i_height >> 1, p_mb->i_c_stride,
(p_motion->b_average << 2)
| (((p_motion->i_mv_y/2) & 1) << 1)
......@@ -498,13 +490,14 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
/* Chrominance Cb */
MotionComponent( p_motion->p_source->p_v
+ (p_mb->i_c_x + ((p_motion->i_mv_x/2) >> 1))
+ ((p_mb->i_c_y + (p_motion->i_offset >> 1)
+((p_motion->i_mv_y/2) >> 1))
+ (p_motion->b_source_field - p_motion->b_dest_field))
+ ((p_mb->i_motion_c_y + (p_motion->i_offset >> 1)
+ ((p_motion->i_mv_y/2) >> 1))
+ p_motion->b_source_field)
* p_mb->p_picture->i_chroma_width,
p_mb->p_picture->p_v
+ (p_mb->i_c_x)
+ (p_mb->i_c_y) * p_mb->p_picture->i_chroma_width,
+ (p_mb->i_motion_c_y + p_motion->b_dest_field)
* p_mb->p_picture->i_chroma_width,
8, p_motion->i_height >> 1, p_mb->i_c_stride,
(p_motion->b_average << 2)
| (((p_motion->i_mv_y/2) & 1) << 1)
......
......@@ -580,9 +580,9 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
p_mb->i_structure = p_vpar->picture.i_structure;
p_mb->i_current_structure = p_vpar->picture.i_current_structure;
p_mb->i_l_x = p_vpar->mb.i_l_x;
p_mb->i_l_y = p_vpar->mb.i_l_y;
p_mb->i_motion_l_y = p_mb->i_l_y = p_vpar->mb.i_l_y;
p_mb->i_c_x = p_vpar->mb.i_c_x;
p_mb->i_c_y = p_vpar->mb.i_c_y;
p_mb->i_motion_c_y = p_mb->i_c_y = p_vpar->mb.i_c_y;
p_mb->i_chroma_nb_blocks = p_vpar->sequence.i_chroma_nb_blocks;
p_mb->pf_chroma_motion = pf_chroma_motion[p_vpar->sequence.i_chroma_format];
p_mb->b_P_coding_type = ( p_vpar->picture.i_coding_type == P_CODING_TYPE );
......@@ -607,6 +607,11 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
* (2 - p_vpar->picture.b_frame_structure)
* p_vpar->sequence.i_chroma_mb_height;
p_vpar->mb.i_c_x %= p_vpar->sequence.i_chroma_width;
if( p_mb->b_motion_field = p_vpar->picture.b_motion_field )
{
p_mb->i_motion_l_y--;
p_mb->i_motion_c_y--;
}
}
/*****************************************************************************
......
......@@ -699,7 +699,7 @@ memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
p_vpar->picture.b_frame_structure = (i_structure == FRAME_STRUCTURE);
/* Initialize picture data for decoding. */
if( i_structure == BOTTOM_FIELD )
if( p_vpar->picture.b_motion_field = (i_structure == BOTTOM_FIELD) )
{
i_mb_base = p_vpar->sequence.i_mb_size >> 1;
p_vpar->mb.i_l_y = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment