Commit 34aa3762 authored by Christophe Massiot's avatar Christophe Massiot

Corrections de bugs mineurs divers et vari�s, dont :

* video_parser.c : d�placement de l'initialisation de la synchro dans
  InitThread(), correction d'un memory leak ;
* vpar_headers.c : correction d'un segfault potentiel, erreur dans une
  en-t�te dont on se bat les couilles.
parent ee589c59
...@@ -96,27 +96,6 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i ...@@ -96,27 +96,6 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
p_vpar->bit_stream.fifo.buffer = 0; p_vpar->bit_stream.fifo.buffer = 0;
p_vpar->bit_stream.fifo.i_available = 0; p_vpar->bit_stream.fifo.i_available = 0;
/*
* Initialize the synchro properties
*/
p_vpar->synchro.modulo = 0;
/* assume there were about 3 P and 6 B images between I's */
p_vpar->synchro.current_p_count = 1;
p_vpar->synchro.p_count_predict = 3;
p_vpar->synchro.current_b_count = 1;
p_vpar->synchro.b_count_predict = 6;
{
int i;
for( i=0; i<6; i++)
{
p_vpar->synchro.tab_p[i].mean = 3;
p_vpar->synchro.tab_p[i].deviation = .5;
p_vpar->synchro.tab_b[i].mean = 6;
p_vpar->synchro.tab_b[i].deviation = .5;
}
}
/* FIXME !!!! */ /* FIXME !!!! */
p_vpar->p_vout = p_main->p_intf->p_vout; p_vpar->p_vout = p_main->p_intf->p_vout;
...@@ -203,6 +182,7 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -203,6 +182,7 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar->sequence.nonintra_quant.b_allocated = 0; p_vpar->sequence.nonintra_quant.b_allocated = 0;
p_vpar->sequence.chroma_intra_quant.b_allocated = 0; p_vpar->sequence.chroma_intra_quant.b_allocated = 0;
p_vpar->sequence.chroma_nonintra_quant.b_allocated = 0; p_vpar->sequence.chroma_nonintra_quant.b_allocated = 0;
/* Initialize copyright information */ /* Initialize copyright information */
p_vpar->sequence.b_copyright_flag = 0; p_vpar->sequence.b_copyright_flag = 0;
p_vpar->sequence.b_original = 0; p_vpar->sequence.b_original = 0;
...@@ -252,6 +232,24 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -252,6 +232,24 @@ static int InitThread( vpar_thread_t *p_vpar )
vpar_InitCodedPattern( p_vpar ); vpar_InitCodedPattern( p_vpar );
vpar_InitDCTTables( p_vpar ); vpar_InitDCTTables( p_vpar );
/*
* Initialize the synchro properties
*/
p_vpar->synchro.modulo = 0;
/* assume there were about 3 P and 6 B images between I's */
p_vpar->synchro.current_p_count = 1;
p_vpar->synchro.p_count_predict = 3;
p_vpar->synchro.current_b_count = 1;
p_vpar->synchro.b_count_predict = 6;
for( i_dummy = 0; i_dummy < 6; i_dummy++)
{
p_vpar->synchro.tab_p[i_dummy].mean = 3;
p_vpar->synchro.tab_p[i_dummy].deviation = .5;
p_vpar->synchro.tab_b[i_dummy].mean = 6;
p_vpar->synchro.tab_b[i_dummy].deviation = .5;
}
/* Mark thread as running and return */ /* Mark thread as running and return */
intf_DbgMsg("vpar debug: InitThread(%p) succeeded\n", p_vpar); intf_DbgMsg("vpar debug: InitThread(%p) succeeded\n", p_vpar);
return( 0 ); return( 0 );
...@@ -365,6 +363,24 @@ static void EndThread( vpar_thread_t *p_vpar ) ...@@ -365,6 +363,24 @@ static void EndThread( vpar_thread_t *p_vpar )
// vout_DestroyStream( p_vpar->p_vout, p_vpar->i_stream ); // vout_DestroyStream( p_vpar->p_vout, p_vpar->i_stream );
/* ?? */ /* ?? */
/* Dispose of matrices if they have been allocated. */
if( p_vpar->sequence.intra_quant.b_allocated )
{
free( p_vpar->sequence.intra_quant.pi_matrix );
}
if( p_vpar->sequence.nonintra_quant.b_allocated )
{
free( p_vpar->sequence.nonintra_quant.pi_matrix) ;
}
if( p_vpar->sequence.chroma_intra_quant.b_allocated )
{
free( p_vpar->sequence.chroma_intra_quant.pi_matrix );
}
if( p_vpar->sequence.chroma_nonintra_quant.b_allocated )
{
free( p_vpar->sequence.chroma_nonintra_quant.pi_matrix );
}
/* Destroy vdec threads */ /* Destroy vdec threads */
for( i_dummy = 0; i_dummy < NB_VDEC; i_dummy++ ) for( i_dummy = 0; i_dummy < NB_VDEC; i_dummy++ )
{ {
......
...@@ -221,7 +221,12 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma ...@@ -221,7 +221,12 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
if( !p_matrix->b_allocated ) if( !p_matrix->b_allocated )
{ {
/* Allocate a piece of memory to load the matrix. */ /* Allocate a piece of memory to load the matrix. */
p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) ); if( (p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) )) == NULL )
{
intf_ErrMsg("vpar error: allocation error in LoadMatrix()\n");
p_vpar->b_error = 1;
return;
}
p_matrix->b_allocated = 1; p_matrix->b_allocated = 1;
} }
...@@ -608,7 +613,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type ); ...@@ -608,7 +613,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type );
p_vpar->picture.i_coding_type, p_vpar->picture.i_coding_type,
NULL ); NULL );
for( i_mb = 0; i_mb < p_vpar->sequence.i_mb_size >> 1; i_mb++ ) for( i_mb = 0; p_vpar->picture.pp_mb[i_mb] != NULL; i_mb++ )
{ {
vpar_DestroyMacroblock( &p_vpar->vfifo, vpar_DestroyMacroblock( &p_vpar->vfifo,
p_vpar->picture.pp_mb[i_mb] ); p_vpar->picture.pp_mb[i_mb] );
...@@ -634,7 +639,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type ); ...@@ -634,7 +639,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type );
if( p_vpar->picture.i_current_structure ) if( p_vpar->picture.i_current_structure )
{ {
/* Second field of a frame. We will decode it if, and only if we /* Second field of a frame. We will decode it if, and only if we
* have decoded the first frame. */ * have decoded the first field. */
b_parsable = (p_vpar->picture.p_picture != NULL); b_parsable = (p_vpar->picture.p_picture != NULL);
} }
else else
...@@ -674,8 +679,8 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type ); ...@@ -674,8 +679,8 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type );
p_vpar->sequence.i_height ) ) p_vpar->sequence.i_height ) )
== NULL ) == NULL )
{ {
intf_ErrMsg("vpar debug: allocation error in vout_CreatePicture\n"); intf_DbgMsg("vpar debug: allocation error in vout_CreatePicture\n");
if( p_vpar->b_die ) if( p_vpar->b_die || p_vpar->b_error )
{ {
return; return;
} }
...@@ -700,6 +705,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type ); ...@@ -700,6 +705,7 @@ fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type );
P_picture->i_deccount = p_vpar->sequence.i_mb_size; P_picture->i_deccount = p_vpar->sequence.i_mb_size;
vlc_mutex_init( &p_vpar->picture.p_picture->lock_deccount ); vlc_mutex_init( &p_vpar->picture.p_picture->lock_deccount );
memset( p_vpar->picture.pp_mb, 0, MAX_MB ); memset( p_vpar->picture.pp_mb, 0, MAX_MB );
/* FIXME ! remove asap */
memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384)); memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
/* Update the reference pointers. */ /* Update the reference pointers. */
...@@ -767,7 +773,7 @@ fprintf(stderr, "Image trashee\n"); ...@@ -767,7 +773,7 @@ fprintf(stderr, "Image trashee\n");
{ {
fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type); 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] != NULL; i_mb++ )
{ {
vpar_DecodeMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] ); vpar_DecodeMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] );
} }
...@@ -1046,15 +1052,19 @@ static void SequenceScalableExtension( vpar_thread_t * p_vpar ) ...@@ -1046,15 +1052,19 @@ static void SequenceScalableExtension( vpar_thread_t * p_vpar )
static void PictureDisplayExtension( vpar_thread_t * p_vpar ) static void PictureDisplayExtension( vpar_thread_t * p_vpar )
{ {
/* Number of frame center offset */ /* Number of frame center offset */
int nb; int i_nb, i_dummy;
/* I am not sure it works but it should /* I am not sure it works but it should
(fewer tests than shown in 6.3.12) */ (fewer tests than shown in 6.3.12) */
nb = p_vpar->sequence.b_progressive ? p_vpar->sequence.b_progressive + i_nb = p_vpar->sequence.b_progressive ? p_vpar->sequence.b_progressive +
p_vpar->picture.b_repeat_first_field + p_vpar->picture.b_repeat_first_field +
p_vpar->picture.b_top_field_first p_vpar->picture.b_top_field_first
: ( p_vpar->picture.b_frame_structure + 1 ) + : ( p_vpar->picture.b_frame_structure + 1 ) +
p_vpar->picture.b_repeat_first_field; p_vpar->picture.b_repeat_first_field;
RemoveBits( &p_vpar->bit_stream, 34 * nb ); for( i_dummy = 0; i_dummy < i_nb; i_dummy++ )
{
RemoveBits( &p_vpar->bit_stream, 17 );
RemoveBits( &p_vpar->bit_stream, 17 );
}
} }
...@@ -1103,7 +1113,7 @@ static void CopyrightExtension( vpar_thread_t * p_vpar ) ...@@ -1103,7 +1113,7 @@ static void CopyrightExtension( vpar_thread_t * p_vpar )
i_copyright_nb_2 = GetBits( &p_vpar->bit_stream, 22 ); i_copyright_nb_2 = GetBits( &p_vpar->bit_stream, 22 );
RemoveBits( &p_vpar->bit_stream, 1 ); RemoveBits( &p_vpar->bit_stream, 1 );
/* third part and sum */ /* third part and sum */
p_vpar->sequence.i_copyright_nb = ( (u64)i_copyright_nb_1 << 44 ) + p_vpar->sequence.i_copyright_nb = ( (u64)i_copyright_nb_1 << 44 ) |
( (u64)i_copyright_nb_2 << 22 ) + ( (u64)i_copyright_nb_2 << 22 ) |
( (u64)GetBits( &p_vpar->bit_stream, 22 ) ); ( (u64)GetBits( &p_vpar->bit_stream, 22 ) );
} }
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