Commit aa9d7e09 authored by Christophe Massiot's avatar Christophe Massiot

Correction d'un bug de synchro pour les images monotrames.

parent 9a43a27e
......@@ -164,33 +164,20 @@ static void __inline__ ReferenceUpdate( vpar_thread_t * p_vpar,
if( i_coding_type != B_CODING_TYPE )
{
if( p_vpar->sequence.p_forward != NULL )
{
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
}
if( p_vpar->sequence.p_backward != NULL )
{
#ifdef POLUX_SYNCHRO
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
vpar_SynchroDate( p_vpar ) );
#endif
#ifdef SAM_SYNCHRO
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
vpar_SynchroDate( p_vpar ) );
#endif
#ifdef MEUUH_SYNCHRO
mtime_t date;
date = vpar_SynchroDate( p_vpar );
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
date );
if( p_vpar->synchro.i_coding_type == I_CODING_TYPE )
vpar_SynchroKludge( p_vpar, date );
#endif
}
p_vpar->sequence.p_forward = p_vpar->sequence.p_backward;
p_vpar->sequence.p_backward = p_newref;
if( p_newref != NULL )
{
vout_LinkPicture( p_vpar->p_vout, p_newref );
#ifdef MEUUH_SYNCHRO
p_vpar->synchro.i_coding_type = i_coding_type;
#endif
}
}
else if( p_newref != NULL )
{
......@@ -210,11 +197,15 @@ static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar,
if( i_coding_type != B_CODING_TYPE )
{
if( p_vpar->sequence.p_backward != NULL )
{
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
}
p_vpar->sequence.p_backward = p_newref;
if( p_newref != NULL )
{
vout_LinkPicture( p_vpar->p_vout, p_newref );
}
}
}
/*****************************************************************************
......@@ -623,21 +614,12 @@ static void PictureHeader( vpar_thread_t * p_vpar )
p_vpar->picture.i_coding_type, i_structure );
}
}
#ifdef POLUX_SYNCHRO
else if( !p_vpar->picture.i_current_structure )
{
vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
}
#endif
if( !b_parsable )
{
/* Update the reference pointers. */
ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, NULL );
#ifndef POLUX_SYNCHRO
/* Warn Synchro we have trashed a picture. */
vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
#endif
/* Update context. */
if( i_structure != FRAME_STRUCTURE )
{
......@@ -648,9 +630,16 @@ static void PictureHeader( vpar_thread_t * p_vpar )
}
else
{
/* The frame is complete. */
p_vpar->picture.i_current_structure = i_structure;
vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
}
}
else
{
/* Warn Synchro we have trashed a picture. */
vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
}
p_vpar->picture.p_picture = NULL;
return;
......
......@@ -387,7 +387,9 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
return i_displaydate;
#else
static s64 i_last_date = 0;
//printf("%d: %lld\n", p_vpar->picture.i_coding_type, p_vpar->synchro.i_last_pts - i_last_date);
//i_last_date = p_vpar->synchro.i_last_pts;
return p_vpar->synchro.i_last_pts;
#endif
......@@ -395,125 +397,6 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
#endif
#ifdef MEUUH_SYNCHRO
/* synchro a deux balles backportee du decodeur de reference. NE MARCHE PAS
AVEC LES IMAGES MONOTRAMES */
boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
switch (i_coding_type)
{
case B_CODING_TYPE:
if ((p_vpar->synchro.kludge_level <= p_vpar->synchro.kludge_nbp))
{
p_vpar->synchro.kludge_b++;
return( 0 );
}
if (p_vpar->synchro.kludge_b %
(p_vpar->synchro.kludge_nbb /
(p_vpar->synchro.kludge_level - p_vpar->synchro.kludge_nbp)))
{
p_vpar->synchro.kludge_b++;
return( 0 );
}
p_vpar->synchro.kludge_b++;
return( 1 );
case P_CODING_TYPE:
if (p_vpar->synchro.kludge_p++ >= p_vpar->synchro.kludge_level)
{
return( 0 );
}
return( 1 );
default:
return( 1 );
}
}
void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
if (DECODER_FIFO_START(p_vpar->fifo)->b_has_pts && i_coding_type == I_CODING_TYPE)
{
p_vpar->synchro.kludge_nbframes = 0;
p_vpar->synchro.kludge_date = DECODER_FIFO_START(p_vpar->fifo)->i_pts;
}
else
p_vpar->synchro.kludge_nbframes++;
DECODER_FIFO_START(p_vpar->fifo)->b_has_pts = 0;
}
void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
if (DECODER_FIFO_START(p_vpar->fifo)->b_has_pts && i_coding_type == I_CODING_TYPE)
{
p_vpar->synchro.kludge_nbframes = 0;
p_vpar->synchro.kludge_date = DECODER_FIFO_START(p_vpar->fifo)->i_pts;
DECODER_FIFO_START(p_vpar->fifo)->b_has_pts = 0;
}
else
p_vpar->synchro.kludge_nbframes++;
}
mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
{
return( p_vpar->synchro.kludge_date
+ p_vpar->synchro.kludge_nbframes * 1000000
/ (p_vpar->sequence.i_frame_rate ) * 1001 );
}
void vpar_SynchroEnd( vpar_thread_t * p_vpar )
{
}
void vpar_SynchroKludge( vpar_thread_t * p_vpar, mtime_t date )
{
mtime_t show_date;
int temp = p_vpar->synchro.kludge_level;
p_vpar->synchro.kludge_nbp = p_vpar->synchro.kludge_p ? p_vpar->synchro.kludge_p : 5;
p_vpar->synchro.kludge_nbb = p_vpar->synchro.kludge_b ? p_vpar->synchro.kludge_b : 6;
show_date = date - mdate();
p_vpar->synchro.kludge_p = 0;
p_vpar->synchro.kludge_b = 0;
if (show_date < (SYNC_DELAY - SYNC_TOLERATE) && show_date <= p_vpar->synchro.kludge_prevdate)
{
p_vpar->synchro.kludge_level--;
if (p_vpar->synchro.kludge_level < 0)
p_vpar->synchro.kludge_level = 0;
else if (p_vpar->synchro.kludge_level >
p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb)
p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb;
#ifdef DEBUG
if (temp != p_vpar->synchro.kludge_level)
intf_DbgMsg("vdec debug: Level changed from %d to %d (%Ld)\n",
temp, p_vpar->synchro.kludge_level, show_date );
#endif
}
else if (show_date > (SYNC_DELAY + SYNC_TOLERATE) && show_date >= p_vpar->synchro.kludge_prevdate)
{
p_vpar->synchro.kludge_level++;
if (p_vpar->synchro.kludge_level > p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb)
p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb;
#ifdef DEBUG
if (temp != p_vpar->synchro.kludge_level)
intf_DbgMsg("vdec debug: Level changed from %d to %d (%Ld)\n",
temp, p_vpar->synchro.kludge_level, show_date );
#endif
}
p_vpar->synchro.kludge_prevdate = show_date;
if ((p_vpar->synchro.kludge_level - p_vpar->synchro.kludge_nbp) > p_vpar->synchro.kludge_nbb)
p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbb + p_vpar->synchro.kludge_nbp;
}
#endif
#ifdef POLUX_SYNCHRO
......
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