Commit dd4339a9 authored by Christophe Massiot's avatar Christophe Massiot

Le motion compensation. Notez que �a ne marche pas (encore).

parent e70d9d1f
...@@ -16,30 +16,27 @@ ...@@ -16,30 +16,27 @@
*****************************************************************************/ *****************************************************************************/
struct macroblock_s; struct macroblock_s;
struct vpar_thread_s; struct vpar_thread_s;
struct motion_arg_s;
typedef void (*f_motion_t)( struct macroblock_s* ); typedef void (*f_motion_t)( struct macroblock_s* );
typedef void (*f_chroma_motion_t)( struct macroblock_s* ); typedef void (*f_chroma_motion_t)( struct macroblock_s*, struct motion_arg_s* );
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
/* Empty function for intra macroblocks motion compensation */ /* Empty function for intra macroblocks motion compensation */
void vdec_DummyRecon ( struct macroblock_s* ); void vdec_MotionDummy( struct macroblock_s * p_mb );
/* Motion compensation for skipped macroblocks */ /* Motion compensation */
void vdec_MotionField ( struct macroblock_s* ); void vdec_MotionFieldField( struct macroblock_s * p_mb );
void vdec_MotionFrame ( struct macroblock_s* ); void vdec_MotionField16x8( struct macroblock_s * p_mb );
void vdec_MotionFieldDMV( struct macroblock_s * p_mb );
/* Motion compensation for non skipped macroblocks */ void vdec_MotionFrameFrame( struct macroblock_s * p_mb );
void vdec_FieldDMVRecon ( struct macroblock_s* ); void vdec_MotionFrameField( struct macroblock_s * p_mb );
void vdec_FieldFieldRecon ( struct macroblock_s* ); void vdec_MotionFrameDMV( struct macroblock_s * p_mb );
void vdec_Field16x8Recon ( struct macroblock_s* );
void vdec_FrameFrameRecon ( struct macroblock_s* );
void vdec_FrameFieldRecon ( struct macroblock_s* );
void vdec_FrameDMVRecon ( struct macroblock_s* );
/* Motion compensation functions for the 3 chroma formats */ /* Motion compensation functions for the 3 chroma formats */
void vdec_Motion420(); void vdec_Motion420( struct macroblock_s * p_mb, struct motion_arg_s * p_motion );
void vdec_Motion422(); void vdec_Motion422( struct macroblock_s * p_mb, struct motion_arg_s * p_motion );
void vdec_Motion444(); void vdec_Motion444( struct macroblock_s * p_mb, struct motion_arg_s * p_motion );
This diff is collapsed.
...@@ -590,8 +590,8 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar, ...@@ -590,8 +590,8 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
p_mb->p_forward = p_vpar->sequence.p_forward; p_mb->p_forward = p_vpar->sequence.p_forward;
p_mb->p_backward = p_vpar->sequence.p_backward; 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; 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; p_mb->i_addb_c_stride = (p_mb->i_c_stride = p_vpar->picture.i_c_stride) - 9;
/* Update macroblock real position. */ /* Update macroblock real position. */
p_vpar->mb.i_l_x += 16; p_vpar->mb.i_l_x += 16;
...@@ -639,8 +639,8 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar, ...@@ -639,8 +639,8 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
macroblock_t * p_mb ) macroblock_t * p_mb )
{ {
static f_motion_t pf_motion[2][4] = static f_motion_t pf_motion[2][4] =
{ {NULL, vdec_FieldFieldRecon, vdec_Field16x8Recon, vdec_FieldDMVRecon}, { {NULL, vdec_MotionFieldField, vdec_MotionField16x8, vdec_MotionFieldDMV},
{NULL, vdec_FrameFieldRecon, vdec_FrameFrameRecon, vdec_FrameDMVRecon} }; {NULL, vdec_MotionFrameField, vdec_MotionFrameFrame, vdec_MotionFrameDMV} };
static int ppi_mv_count[2][4] = { {0, 1, 2, 1}, {0, 2, 1, 1} }; static int ppi_mv_count[2][4] = { {0, 1, 2, 1}, {0, 2, 1, 1} };
static int ppi_mv_format[2][4] = { {0, 1, 1, 1}, {0, 1, 2, 1} }; static int ppi_mv_format[2][4] = { {0, 1, 1, 1}, {0, 1, 2, 1} };
...@@ -685,7 +685,7 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar, ...@@ -685,7 +685,7 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
{ {
/* For the intra macroblocks, we use an empty motion /* For the intra macroblocks, we use an empty motion
* compensation function */ * compensation function */
p_mb->pf_motion = vdec_DummyRecon; p_mb->pf_motion = vdec_MotionDummy;
} }
else else
{ {
...@@ -752,8 +752,8 @@ i_count++; ...@@ -752,8 +752,8 @@ i_count++;
{ {
/* Skipped macroblock (ISO/IEC 13818-2 7.6.6). */ /* Skipped macroblock (ISO/IEC 13818-2 7.6.6). */
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_MotionField, static f_motion_t pf_motion_skipped[4] = {NULL, vdec_MotionFieldField,
vdec_MotionField, vdec_MotionFrame}; vdec_MotionFieldField, vdec_MotionFrameFrame};
/* 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]
......
...@@ -624,7 +624,8 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -624,7 +624,8 @@ static void PictureHeader( vpar_thread_t * p_vpar )
{ {
/* Do we have the reference pictures ? */ /* Do we have the reference pictures ? */
b_parsable = !((p_vpar->picture.i_coding_type == P_CODING_TYPE) && b_parsable = !((p_vpar->picture.i_coding_type == P_CODING_TYPE) &&
(p_vpar->sequence.p_forward == NULL)) || (p_vpar->sequence.p_backward == NULL)) ||
/* p_backward will become p_forward later */
((p_vpar->picture.i_coding_type == B_CODING_TYPE) && ((p_vpar->picture.i_coding_type == B_CODING_TYPE) &&
(p_vpar->sequence.p_forward == NULL || (p_vpar->sequence.p_forward == NULL ||
p_vpar->sequence.p_backward == NULL)); p_vpar->sequence.p_backward == NULL));
...@@ -660,17 +661,19 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -660,17 +661,19 @@ static void PictureHeader( vpar_thread_t * p_vpar )
if( !p_vpar->picture.i_current_structure ) if( !p_vpar->picture.i_current_structure )
{ {
/* This is a new frame. Get a structure from the video_output. */ /* This is a new frame. Get a structure from the video_output. */
if( ( P_picture = vout_CreatePicture( p_vpar->p_vout, while( ( P_picture = vout_CreatePicture( p_vpar->p_vout,
99+p_vpar->sequence.i_chroma_format, /*???*/ 99+p_vpar->sequence.i_chroma_format, /*???*/
p_vpar->sequence.i_width, p_vpar->sequence.i_width,
p_vpar->sequence.i_height, p_vpar->sequence.i_height ) )
p_vpar->sequence.i_width*sizeof(yuv_data_t) ) )
== NULL ) == NULL )
{ {
intf_ErrMsg("vpar debug: allocation error in vout_CreatePicture\n"); intf_ErrMsg("vpar debug: allocation error in vout_CreatePicture\n");
p_vpar->b_error = 1; if( p_vpar->b_die )
{
return; return;
} }
mwait( VPAR_IDLE_SLEEP );
}
/* Initialize values. */ /* Initialize values. */
P_picture->date = vpar_SynchroDecode( p_vpar, P_picture->date = vpar_SynchroDecode( p_vpar,
...@@ -678,9 +681,9 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -678,9 +681,9 @@ static void PictureHeader( vpar_thread_t * p_vpar )
i_structure ); i_structure );
P_picture->i_aspect_ratio = p_vpar->sequence.i_aspect_ratio; P_picture->i_aspect_ratio = p_vpar->sequence.i_aspect_ratio;
P_picture->i_matrix_coefficients = p_vpar->sequence.i_matrix_coefficients; P_picture->i_matrix_coefficients = p_vpar->sequence.i_matrix_coefficients;
p_vpar->picture.i_l_stride = - 8 + ( p_vpar->sequence.i_width p_vpar->picture.i_l_stride = ( p_vpar->sequence.i_width
<< ( 1 - p_vpar->picture.b_frame_structure ) ); << ( 1 - p_vpar->picture.b_frame_structure ) );
p_vpar->picture.i_c_stride = - 8 + ( p_vpar->sequence.i_chroma_width p_vpar->picture.i_c_stride = ( p_vpar->sequence.i_chroma_width
<< ( 1 - p_vpar->picture.b_frame_structure )); << ( 1 - p_vpar->picture.b_frame_structure ));
P_picture->i_deccount = p_vpar->sequence.i_mb_size; P_picture->i_deccount = p_vpar->sequence.i_mb_size;
...@@ -749,7 +752,7 @@ fprintf(stderr, "Image trashee\n"); ...@@ -749,7 +752,7 @@ fprintf(stderr, "Image trashee\n");
} }
else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE ) else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE )
{ {
fprintf(stderr, "Image parsee\n"); fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type);
/* Frame completely parsed. */ /* Frame completely parsed. */
for( i_mb = 1; p_vpar->picture.pp_mb[i_mb]; i_mb++ ) for( i_mb = 1; p_vpar->picture.pp_mb[i_mb]; i_mb++ )
{ {
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
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 );
} }
...@@ -69,7 +69,7 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -69,7 +69,7 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
mtime_t vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type, mtime_t vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure ) int i_structure )
{ {
return mdate() + 500000; return mdate() + 3000000;
} }
/***************************************************************************** /*****************************************************************************
......
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