Commit 653053d2 authored by Jean-Marc Dressler's avatar Jean-Marc Dressler

Avancement du debuggage du motion.

--Meuuh+Stef+Polux+Jimmy
parent a47bce5f
...@@ -79,8 +79,11 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest, ...@@ -79,8 +79,11 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
{ {
for( i_x = 0; i_x < i_width; i_x += 8 ) for( i_x = 0; i_x < i_width; i_x += 8 )
{ {
memcpy( &p_dest[i_x], &p_src[i_x], 8 * sizeof(yuv_data_t) ); for( i_x1 = 0; i_x1 < 8; i_x1++ )
} {
p_dest[i_x+i_x1] = p_src[i_x+i_x1];
}
}
p_dest += i_x_step; p_dest += i_x_step;
p_src += i_x_step; p_src += i_x_step;
} }
...@@ -219,7 +222,6 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest, ...@@ -219,7 +222,6 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
} }
} }
break; break;
} }
} }
...@@ -445,6 +447,7 @@ void vdec_MotionFrameDMV( macroblock_t * p_mb ) ...@@ -445,6 +447,7 @@ void vdec_MotionFrameDMV( macroblock_t * p_mb )
*****************************************************************************/ *****************************************************************************/
void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion ) void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
{ {
p_motion->i_mv_x = p_motion->i_mv_y = 0;
/* Luminance */ /* Luminance */
MotionComponent( /* source */ MotionComponent( /* source */
p_motion->p_source->p_y p_motion->p_source->p_y
...@@ -495,6 +498,7 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion ) ...@@ -495,6 +498,7 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
(p_motion->b_average << 2) (p_motion->b_average << 2)
| (((p_motion->i_mv_y/2) & 1) << 1) | (((p_motion->i_mv_y/2) & 1) << 1)
| ((p_motion->i_mv_x/2) & 1) ); | ((p_motion->i_mv_x/2) & 1) );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -302,7 +302,7 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb ) ...@@ -302,7 +302,7 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
void vdec_AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, yuv_data_t * p_data, int i_incr ) void vdec_AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, yuv_data_t * p_data, int i_incr )
{ {
int i_x, i_y; int i_x, i_y;
for( i_y = 0; i_y < 8; i_y++ ) for( i_y = 0; i_y < 8; i_y++ )
{ {
for( i_x = 0; i_x < 8; i_x++ ) for( i_x = 0; i_x < 8; i_x++ )
......
...@@ -155,14 +155,14 @@ fprintf(stderr, "Image decodee\n"); ...@@ -155,14 +155,14 @@ fprintf(stderr, "Image decodee\n");
vpar_SynchroEnd( p_fifo->p_vpar ); vpar_SynchroEnd( p_fifo->p_vpar );
/* Unlink referenced pictures */ /* Unlink referenced pictures */
/* if( p_mb->p_forward != NULL ) if( p_mb->p_forward != NULL )
{ {
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward ); vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
} }
if( p_mb->p_backward != NULL ) if( p_mb->p_backward != NULL )
{ {
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward ); vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
}*/ }
} }
/* Release the macroblock_t structure */ /* Release the macroblock_t structure */
...@@ -197,14 +197,14 @@ fprintf(stderr, "Image trashee\n"); ...@@ -197,14 +197,14 @@ fprintf(stderr, "Image trashee\n");
vpar_SynchroEnd( p_fifo->p_vpar ); vpar_SynchroEnd( p_fifo->p_vpar );
/* Unlink referenced pictures */ /* Unlink referenced pictures */
/* if( p_mb->p_forward != NULL ) if( p_mb->p_forward != NULL )
{ {
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward ); vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
} }
if( p_mb->p_backward != NULL ) if( p_mb->p_backward != NULL )
{ {
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward ); vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
}*/ }
} }
/* Release the macroblock_t structure */ /* Release the macroblock_t structure */
......
...@@ -587,11 +587,14 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar, ...@@ -587,11 +587,14 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
p_mb->pf_chroma_motion = pf_chroma_motion[p_vpar->sequence.i_chroma_format]; 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 ); p_mb->b_P_coding_type = ( p_vpar->picture.i_coding_type == P_CODING_TYPE );
p_mb->p_forward = p_vpar->sequence.p_forward; if( (p_vpar->picture.i_coding_type == P_CODING_TYPE) ||
p_mb->p_backward = p_vpar->sequence.p_backward; (p_vpar->picture.i_coding_type == B_CODING_TYPE) )
p_mb->p_forward = p_vpar->sequence.p_forward;
if( p_vpar->picture.i_coding_type == B_CODING_TYPE )
p_mb->p_backward = p_vpar->sequence.p_backward;
p_mb->i_addb_l_stride = (p_mb->i_l_stride = p_vpar->picture.i_l_stride) - 8; p_mb->i_addb_l_stride = (p_mb->i_l_stride = p_vpar->picture.i_l_stride) - 8;
p_mb->i_addb_c_stride = (p_mb->i_c_stride = p_vpar->picture.i_c_stride) - 9; p_mb->i_addb_c_stride = (p_mb->i_c_stride = p_vpar->picture.i_c_stride) - 8;
/* Update macroblock real position. */ /* Update macroblock real position. */
p_vpar->mb.i_l_x += 16; p_vpar->mb.i_l_x += 16;
...@@ -754,7 +757,7 @@ i_count++; ...@@ -754,7 +757,7 @@ i_count++;
static int pi_dc_dct_reinit[4] = {128,256,512,1024}; static int pi_dc_dct_reinit[4] = {128,256,512,1024};
static f_motion_t pf_motion_skipped[4] = {NULL, vdec_MotionFieldField, static f_motion_t pf_motion_skipped[4] = {NULL, vdec_MotionFieldField,
vdec_MotionFieldField, vdec_MotionFrameFrame}; vdec_MotionFieldField, vdec_MotionFrameFrame};
fprintf(stderr, "On sauuuute !\n");
/* Reset DC predictors (7.2.1). */ /* Reset DC predictors (7.2.1). */
p_vpar->slice.pi_dc_dct_pred[0] = p_vpar->slice.pi_dc_dct_pred[1] p_vpar->slice.pi_dc_dct_pred[0] = p_vpar->slice.pi_dc_dct_pred[1]
= p_vpar->slice.pi_dc_dct_pred[2] = p_vpar->slice.pi_dc_dct_pred[2]
...@@ -785,6 +788,7 @@ i_count++; ...@@ -785,6 +788,7 @@ i_count++;
/* Motion type is picture structure. */ /* Motion type is picture structure. */
p_mb->pf_motion = pf_motion_skipped[p_vpar->picture.i_structure]; p_mb->pf_motion = pf_motion_skipped[p_vpar->picture.i_structure];
p_mb->i_mb_type = MB_MOTION_FORWARD;
/* Set the field we use for motion compensation */ /* Set the field we use for motion compensation */
p_mb->ppi_field_select[0][0] = p_mb->ppi_field_select[0][1] p_mb->ppi_field_select[0][0] = p_mb->ppi_field_select[0][1]
...@@ -946,6 +950,12 @@ if( 0 ) ...@@ -946,6 +950,12 @@ if( 0 )
/* Reset MV predictors. */ /* Reset MV predictors. */
memset( p_vpar->slice.pppi_pmv, 0, 8*sizeof(int) ); memset( p_vpar->slice.pppi_pmv, 0, 8*sizeof(int) );
} }
if( p_mb->b_P_coding_type && !(p_vpar->mb.i_mb_type & (MB_MOTION_FORWARD|MB_INTRA)) )
{
p_mb->i_mb_type |= MB_MOTION_FORWARD;
}
if( 0 ) if( 0 )
//i_count == 249) //i_count == 249)
// i_count != *pi_mb_address) // i_count != *pi_mb_address)
......
...@@ -614,23 +614,23 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -614,23 +614,23 @@ static void PictureHeader( vpar_thread_t * p_vpar )
intf_DbgMsg("vpar debug: odd number of field picture.\n"); intf_DbgMsg("vpar debug: odd number of field picture.\n");
} }
if( p_vpar->picture.i_current_structure ) /* Do we have the reference pictures ? */
b_parsable = !(((p_vpar->picture.i_coding_type == P_CODING_TYPE) &&
(p_vpar->sequence.p_backward == NULL)) ||
/* p_backward will become p_forward later */
((p_vpar->picture.i_coding_type == B_CODING_TYPE) &&
(p_vpar->sequence.p_forward == NULL ||
p_vpar->sequence.p_backward == NULL)));
if( b_parsable )
{ {
/* Second field of a frame. We will decode it if, and only if we if( p_vpar->picture.i_current_structure )
* have decoded the first frame. */ {
b_parsable = (p_vpar->picture.p_picture != NULL); /* Second field of a frame. We will decode it if, and only if we
} * have decoded the first frame. */
else b_parsable = (p_vpar->picture.p_picture != NULL);
{ }
/* Do we have the reference pictures ? */ else
b_parsable = !((p_vpar->picture.i_coding_type == P_CODING_TYPE) &&
(p_vpar->sequence.p_backward == NULL)) ||
/* p_backward will become p_forward later */
((p_vpar->picture.i_coding_type == B_CODING_TYPE) &&
(p_vpar->sequence.p_forward == NULL ||
p_vpar->sequence.p_backward == NULL));
if( b_parsable )
{ {
/* Does synchro say we have enough time to decode it ? */ /* Does synchro say we have enough time to decode it ? */
b_parsable = vpar_SynchroChoose( p_vpar, b_parsable = vpar_SynchroChoose( p_vpar,
...@@ -688,6 +688,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -688,6 +688,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
P_picture->i_deccount = p_vpar->sequence.i_mb_size; P_picture->i_deccount = p_vpar->sequence.i_mb_size;
memset( p_vpar->picture.pp_mb, 0, MAX_MB ); memset( p_vpar->picture.pp_mb, 0, MAX_MB );
memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
/* Update the reference pointers. */ /* Update the reference pointers. */
ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture ); ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture );
...@@ -761,16 +762,16 @@ fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type); ...@@ -761,16 +762,16 @@ fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type);
/* Link referenced pictures for the decoder /* Link referenced pictures for the decoder
* They are unlinked in vpar_ReleaseMacroblock() & vpar_DestroyMacroblock() */ * They are unlinked in vpar_ReleaseMacroblock() & vpar_DestroyMacroblock() */
#if 0 if( p_vpar->picture.i_coding_type == P_CODING_TYPE ||
if( p_vpar->sequence.p_forward != NULL ) p_vpar->picture.i_coding_type == B_CODING_TYPE )
{ {
vout_LinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward ); vout_LinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
} }
if( p_vpar->sequence.p_backward != NULL ) if( p_vpar->picture.i_coding_type == B_CODING_TYPE )
{ {
vout_LinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward ); vout_LinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
} }
#endif
/* Send signal to the video_decoder. */ /* Send signal to the video_decoder. */
vlc_mutex_lock( &p_vpar->vfifo.lock ); vlc_mutex_lock( &p_vpar->vfifo.lock );
vlc_cond_signal( &p_vpar->vfifo.wait ); vlc_cond_signal( &p_vpar->vfifo.wait );
......
...@@ -104,13 +104,13 @@ static __inline__ void vpar_DecodeMotionVector( int * pi_prediction, int i_r_siz ...@@ -104,13 +104,13 @@ static __inline__ void vpar_DecodeMotionVector( int * pi_prediction, int i_r_siz
i_limit = 16 << i_r_size; i_limit = 16 << i_r_size;
i_vector = *pi_prediction >> i_full_pel; i_vector = *pi_prediction >> i_full_pel;
if( i_motion_code < 0 ) if( i_motion_code > 0 )
{ {
i_vector += ((i_motion_code-1) << i_r_size) + i_motion_residual + 1; i_vector += ((i_motion_code-1) << i_r_size) + i_motion_residual + 1;
if( i_vector >= i_limit ) if( i_vector >= i_limit )
i_vector -= i_limit << 1; i_vector -= i_limit << 1;
} }
else if( i_motion_code > 0 ) else if( i_motion_code < 0 )
{ {
i_vector -= ((-i_motion_code-1) << i_r_size) + i_motion_residual + 1; i_vector -= ((-i_motion_code-1) << i_r_size) + i_motion_residual + 1;
if( i_vector < i_limit ) if( i_vector < i_limit )
......
...@@ -148,7 +148,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, ...@@ -148,7 +148,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure ) int i_structure )
{ {
return( 1 ); // return( 1 );
return( i_coding_type == I_CODING_TYPE || i_coding_type == P_CODING_TYPE ); return( i_coding_type == I_CODING_TYPE || i_coding_type == P_CODING_TYPE );
//return( i_coding_type == I_CODING_TYPE ); //return( i_coding_type == I_CODING_TYPE );
} }
...@@ -171,7 +171,7 @@ mtime_t vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -171,7 +171,7 @@ mtime_t vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
{ {
vpar_SynchroUpdateStructures (p_vpar, i_coding_type); vpar_SynchroUpdateStructures (p_vpar, i_coding_type);
return mdate() + 3000000; return mdate() + 700000;
} }
/***************************************************************************** /*****************************************************************************
......
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