Commit b335e3b4 authored by Christophe Massiot's avatar Christophe Massiot

* vlc is now compiled without the STATS mode by default.

 * Fixed a bug which made frames go backwards with some displays (the
   video_decoder thread is now niced).
 * Made use of intf_WarnMsg() in the most needed places.
Also simplified the synchro algorithm and fixed a bug with non-(5/1) streams.
Fixed the optimizations in the configure stuff.
Warning : this release needs a full rebuild (make clean; make).
Warning : I might have broken the BeOS port, could somebody check ?
parent 313cf680
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
* Minor changes in the Debian files. * Minor changes in the Debian files.
* Fixed fps display. * Fixed fps display.
* Fixed MPEG1 video decoding. * Fixed MPEG1 video decoding. We don't read MPEG 1 PS files for the
moment.
* Fixed a 100% cpu usage bug, in the dummy aout. * Fixed a 100% cpu usage bug, in the dummy aout.
* Added a 'f' shortcut to switch between Windowed and Fullscreen * Added a 'f' shortcut to switch between Windowed and Fullscreen
mode. mode.
...@@ -18,6 +19,10 @@ ...@@ -18,6 +19,10 @@
* Added --enable-debug, --enable-stats, and --disable-optims in the * Added --enable-debug, --enable-stats, and --disable-optims in the
GNU configure stuff. GNU configure stuff.
* Added alsa audio support (plugin) * Added alsa audio support (plugin)
* vlc is now compiled without the STATS mode by default.
* Fixed a bug which made frames go backwards with some displays (the
video_decoder thread is now niced).
* Added intf_WarnMsg(), and made use of it in the most needed places.
Mon, 28 Aug 2000 02:34:18 +0200 Mon, 28 Aug 2000 02:34:18 +0200
0.1.99i : 0.1.99i :
......
...@@ -14,7 +14,7 @@ Description: Fix backwards moves ...@@ -14,7 +14,7 @@ Description: Fix backwards moves
Sometimes the frames seem to go backwards for a short period of Sometimes the frames seem to go backwards for a short period of
time. This is due to the output methods and is known to happen time. This is due to the output methods and is known to happen
with the x11 and SDL plugins. with the x11 and SDL plugins.
Status: Todo Status: Done 27 Nov 2000 (Meuuh)
Task: 0x3d Task: 0x3d
Difficulty: Easy Difficulty: Easy
...@@ -151,6 +151,25 @@ Description: SPU error recovery ...@@ -151,6 +151,25 @@ Description: SPU error recovery
friendly. friendly.
Status: Todo Status: Todo
Task: 0x2b
Difficulty: Hard
Urgency: Wishlist
Description: Shoot the TODO list on the web site
The TODO list on the web site hasn't been updated for months. We may
wonder then why the hell to we put a TODO list on the web site ? Maybe
we'd better shoot it in the head, that would make its suffering end.
Status: Todo
Task: 0x2a
Difficulty: Guru
Urgency: Critical
Description: Buy a new brain for Sam
Sam likes to show that he is a good developer, and for a good developer
hexadecimal notation really rules, though nobody really needs it. In this
TODO list, Sam has forgotten that 0x29 + 1 != 0x30, but 0x2a ! So, please
do something, and send your donations to sam@via.ecp.fr. Thanks for him.
Status: Todo
Task: 0x29 Task: 0x29
Difficulty: Medium Difficulty: Medium
Urgency: Normal Urgency: Normal
......
...@@ -18,7 +18,7 @@ ac_help="$ac_help ...@@ -18,7 +18,7 @@ ac_help="$ac_help
ac_help="$ac_help ac_help="$ac_help
--enable-debug Enable debug mode (default is no)" --enable-debug Enable debug mode (default is no)"
ac_help="$ac_help ac_help="$ac_help
--enable-stats Enable printing of statistics (default is yes)" --enable-stats Enable printing of statistics (default is no)"
ac_help="$ac_help ac_help="$ac_help
--enable-optimizations Enable compiler optimizations (default enabled)" --enable-optimizations Enable compiler optimizations (default enabled)"
ac_help="$ac_help ac_help="$ac_help
...@@ -40,7 +40,7 @@ ac_help="$ac_help ...@@ -40,7 +40,7 @@ ac_help="$ac_help
ac_help="$ac_help ac_help="$ac_help
--enable-x11 X11 support (default enabled)" --enable-x11 X11 support (default enabled)"
ac_help="$ac_help ac_help="$ac_help
--enable-alsa Alsa sound drivers supprt (default disabled)" --enable-alsa Alsa sound drivers supprt (Only for linux) (default disabled)"
# Initialize some variables set by options. # Initialize some variables set by options.
# The variables have the same names as the options, with # The variables have the same names as the options, with
...@@ -3056,6 +3056,7 @@ fi ...@@ -3056,6 +3056,7 @@ fi
PLUGINS=${PLUGINS}"yuv "; PLUGINS=${PLUGINS}"yuv ";
OPTIMS=1;
ARCH=${host_cpu} ARCH=${host_cpu}
# Check whether --enable-ppro or --disable-ppro was given. # Check whether --enable-ppro or --disable-ppro was given.
...@@ -3079,13 +3080,13 @@ fi ...@@ -3079,13 +3080,13 @@ fi
# Check whether --enable-stats or --disable-stats was given. # Check whether --enable-stats or --disable-stats was given.
if test "${enable_stats+set}" = set; then if test "${enable_stats+set}" = set; then
enableval="$enable_stats" enableval="$enable_stats"
if test x$enableval != xno; then STATS=1; fi if test x$enableval = xyes; then STATS=1; fi
fi fi
# Check whether --enable-optimizations or --disable-optimizations was given. # Check whether --enable-optimizations or --disable-optimizations was given.
if test "${enable_optimizations+set}" = set; then if test "${enable_optimizations+set}" = set; then
enableval="$enable_optimizations" enableval="$enable_optimizations"
if test x$enableval != xno; then OPTIMS=1; fi if test x$enableval = xno; then OPTIMS=0; fi
fi fi
...@@ -3158,17 +3159,17 @@ if test "${enable_alsa+set}" = set; then ...@@ -3158,17 +3159,17 @@ if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa" enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:3162: checking for sys/asoundlib.h" >&5 echo "configure:3163: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3167 "configure" #line 3168 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/asoundlib.h> #include <sys/asoundlib.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3185,7 +3186,7 @@ fi ...@@ -3185,7 +3186,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3189: checking for main in -lasound" >&5 echo "configure:3190: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
...@@ -3193,14 +3194,14 @@ else ...@@ -3193,14 +3194,14 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS" LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3197 "configure" #line 3198 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
main() main()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:3204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:3205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
......
...@@ -64,6 +64,7 @@ AC_HEADER_TIME ...@@ -64,6 +64,7 @@ AC_HEADER_TIME
dnl default plugins dnl default plugins
PLUGINS=${PLUGINS}"yuv "; PLUGINS=${PLUGINS}"yuv ";
OPTIMS=1;
ARCH=${host_cpu} ARCH=${host_cpu}
AC_ARG_ENABLE(ppro, AC_ARG_ENABLE(ppro,
...@@ -76,11 +77,11 @@ AC_ARG_ENABLE(debug, ...@@ -76,11 +77,11 @@ AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug mode (default is no)], [ --enable-debug Enable debug mode (default is no)],
[ if test x$enableval = xyes; then DEBUG=1; fi ]) [ if test x$enableval = xyes; then DEBUG=1; fi ])
AC_ARG_ENABLE(stats, AC_ARG_ENABLE(stats,
[ --enable-stats Enable printing of statistics (default is yes)], [ --enable-stats Enable printing of statistics (default is no)],
[ if test x$enableval != xno; then STATS=1; fi ]) [ if test x$enableval = xyes; then STATS=1; fi ])
AC_ARG_ENABLE(optimizations, AC_ARG_ENABLE(optimizations,
[ --enable-optimizations Enable compiler optimizations (default enabled)], [ --enable-optimizations Enable compiler optimizations (default enabled)],
[ if test x$enableval != xno; then OPTIMS=1; fi ]) [ if test x$enableval = xno; then OPTIMS=0; fi ])
SYS=${host_os} SYS=${host_os}
......
...@@ -399,6 +399,9 @@ ...@@ -399,6 +399,9 @@
/* Maximum range of values out of the IDCT + motion compensation. */ /* Maximum range of values out of the IDCT + motion compensation. */
#define VDEC_CROPRANGE 2048 #define VDEC_CROPRANGE 2048
/* Nice increments for decoders -- necessary for x11 scheduling */
#define VDEC_NICE 3
/***************************************************************************** /*****************************************************************************
* Generic decoder configuration * Generic decoder configuration
*****************************************************************************/ *****************************************************************************/
......
...@@ -188,12 +188,10 @@ typedef struct vout_thread_s ...@@ -188,12 +188,10 @@ typedef struct vout_thread_s
mtime_t last_idle_date; /* last idle display date */ mtime_t last_idle_date; /* last idle display date */
mtime_t init_display_date; mtime_t init_display_date;
#ifdef STATS
/* Statistics - these numbers are not supposed to be accurate, but are a /* Statistics - these numbers are not supposed to be accurate, but are a
* good indication of the thread status */ * good indication of the thread status */
count_t c_fps_samples; /* picture counts */ count_t c_fps_samples; /* picture counts */
mtime_t p_fps_sample[VOUT_FPS_SAMPLES]; /* FPS samples dates */ mtime_t p_fps_sample[VOUT_FPS_SAMPLES]; /* FPS samples dates */
#endif
/* Rendering buffers */ /* Rendering buffers */
int i_buffer_index; /* buffer index */ int i_buffer_index; /* buffer index */
......
...@@ -65,7 +65,7 @@ typedef struct video_synchro_s ...@@ -65,7 +65,7 @@ typedef struct video_synchro_s
mtime_t backward_pts, current_pts; mtime_t backward_pts, current_pts;
#ifdef STATS #ifdef STATS
unsigned int i_B_self, i_B_next, i_B_last, i_B_I; unsigned int i_trashed_pic;
#endif #endif
} video_synchro_t; } video_synchro_t;
......
...@@ -771,7 +771,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input, ...@@ -771,7 +771,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
if(i_ts_payload_size < PES_HEADER_SIZE) if(i_ts_payload_size < PES_HEADER_SIZE)
{ {
intf_DbgMsg("Code never tested encountered, WARNING ! (benny)\n"); intf_WarnMsg(3, "Code never tested encountered, WARNING ! (benny)\n");
if( !p_pes->p_pes_header_save ) if( !p_pes->p_pes_header_save )
{ {
p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE); p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE);
......
...@@ -183,6 +183,15 @@ int vdec_InitThread( vdec_thread_t *p_vdec ) ...@@ -183,6 +183,15 @@ int vdec_InitThread( vdec_thread_t *p_vdec )
} }
#endif #endif
#ifdef VDEC_SMP
/* Re-nice ourself */
if( nice(VDEC_NICE) == -1 )
{
intf_WarnMsg( 2, "vdec warning : couldn't nice() (%s)\n",
strerror(errno) );
}
#endif
/* Mark thread as running and return */ /* Mark thread as running and return */
intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec); intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec);
return( 0 ); return( 0 );
......
...@@ -176,10 +176,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -176,10 +176,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
p_vout->init_display_date = mdate(); p_vout->init_display_date = mdate();
p_vout->render_time = 10000; p_vout->render_time = 10000;
#ifdef STATS
/* Initialize statistics fields */ /* Initialize statistics fields */
p_vout->c_fps_samples = 0; p_vout->c_fps_samples = 0;
#endif
/* Initialize buffer index */ /* Initialize buffer index */
p_vout->i_buffer_index = 0; p_vout->i_buffer_index = 0;
...@@ -993,10 +991,9 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -993,10 +991,9 @@ static void RunThread( vout_thread_t *p_vout)
if( p_pic ) if( p_pic )
{ {
#ifdef STATS
/* Computes FPS rate */ /* Computes FPS rate */
p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date; p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date;
#endif
if( display_date < current_date ) if( display_date < current_date )
{ {
/* Picture is late: it will be destroyed and the thread /* Picture is late: it will be destroyed and the thread
...@@ -1012,7 +1009,8 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1012,7 +1009,8 @@ static void RunThread( vout_thread_t *p_vout)
p_pic->i_status = DESTROYED_PICTURE; p_pic->i_status = DESTROYED_PICTURE;
p_vout->i_pictures--; p_vout->i_pictures--;
} }
intf_DbgMsg( "warning: late picture skipped (%p)\n", p_pic ); intf_WarnMsg( 3,
"warning: late picture skipped (%p)\n", p_pic );
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
continue; continue;
...@@ -1687,11 +1685,8 @@ static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1687,11 +1685,8 @@ static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
*****************************************************************************/ *****************************************************************************/
static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic ) static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
{ {
#if defined(STATS) || defined(DEBUG)
char psz_buffer[256]; /* string buffer */ char psz_buffer[256]; /* string buffer */
#endif
#ifdef STATS
/* /*
* Print FPS rate in upper right corner * Print FPS rate in upper right corner
*/ */
...@@ -1712,7 +1707,6 @@ static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1712,7 +1707,6 @@ static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
sprintf( psz_buffer, "%ld frames, render: %ldus", sprintf( psz_buffer, "%ld frames, render: %ldus",
(long) p_vout->c_fps_samples, (long) p_vout->render_time ); (long) p_vout->c_fps_samples, (long) p_vout->render_time );
Print( p_vout, 0, 0, LEFT_RALIGN, TOP_RALIGN, psz_buffer ); Print( p_vout, 0, 0, LEFT_RALIGN, TOP_RALIGN, psz_buffer );
#endif
#ifdef DEBUG #ifdef DEBUG
/* /*
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <unistd.h> /* getpid() */ #include <unistd.h> /* getpid() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include <errno.h>
#include <string.h>
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
...@@ -262,6 +264,13 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -262,6 +264,13 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar->pp_vdec[0]->b_die = 0; p_vpar->pp_vdec[0]->b_die = 0;
p_vpar->pp_vdec[0]->b_error = 0; p_vpar->pp_vdec[0]->b_error = 0;
p_vpar->pp_vdec[0]->p_vpar = p_vpar; p_vpar->pp_vdec[0]->p_vpar = p_vpar;
/* Re-nice ourself */
if( nice(VDEC_NICE) == -1 )
{
intf_WarnMsg( 2, "vpar warning : couldn't nice() (%s)\n",
strerror(errno) );
}
#endif #endif
/* Initialize lookup tables */ /* Initialize lookup tables */
......
...@@ -48,13 +48,19 @@ ...@@ -48,13 +48,19 @@
* tau[I,P,B] : Mean time to decode an [I,P,B] picture. * tau[I,P,B] : Mean time to decode an [I,P,B] picture.
* tauYUV : Mean time to render a picture (given by the video_output). * tauYUV : Mean time to render a picture (given by the video_output).
* tau[I,P,B] = 2 * tau[I,P,B] + tauYUV * tau[I,P,B] = 2 * tau[I,P,B] + tauYUV
* : Mean time + typical difference (estimated to tau, that * : Mean time + typical difference (estimated to tau/2, that
* needs to be confirmed) + render time. * needs to be confirmed) + render time.
* DELTA : A given error margin. * DELTA : A given error margin.
* *
* 3. Decoding of an I picture * 3. General considerations
* ======================
* We define to types of machines :
* 2T > tauP : machines capable of decoding all P pictures
* 14T > tauI : machines capable of decoding all I pictures
*
* 4. Decoding of an I picture
* ======================== * ========================
* On fast machines (ie. those who can decode all Is), we decode all I. * On fast machines, we decode all I's.
* Otherwise : * Otherwise :
* We can decode an I picture if we simply have enough time to decode it * We can decode an I picture if we simply have enough time to decode it
* before displaying : * before displaying :
...@@ -62,13 +68,13 @@ ...@@ -62,13 +68,13 @@
* *
* 4. Decoding of a P picture * 4. Decoding of a P picture
* ======================= * =======================
* On fast machines (ie. those who can decode all Ps), we decode all P. * On fast machines, we decode all P's.
* Otherwise : * Otherwise :
* First criterion : have time to decode it. * First criterion : have time to decode it.
* t2 - t > tauP + DELTA * t2 - t > tauP + DELTA
* *
* Second criterion : it shouldn't prevent us from decoding the forthcoming I * Second criterion : it shouldn't prevent us from displaying the forthcoming
* picture, which is more important. * I picture, which is more important.
* t12 - t > tauP + tauI + DELTA * t12 - t > tauP + tauI + DELTA
* *
* 5. Decoding of a B picture * 5. Decoding of a B picture
...@@ -76,20 +82,9 @@ ...@@ -76,20 +82,9 @@
* First criterion : have time to decode it. * First criterion : have time to decode it.
* t1 - t > tauB + DELTA * t1 - t > tauB + DELTA
* *
* Second criterion : it shouldn't prevent us from decoding all P pictures * Second criterion : it shouldn't prevent us from displaying the forthcoming
* until the next I, which are more important. * P picture, which is more important.
* t4 - t > tauB + tauP + DELTA * t4 - t > tauB + tauP + DELTA
* [...]
* t10 - t > tauB + 4 * tauP + DELTA
* It is possible to demonstrate that if the first and the last inequations
* are verified, the inequations in between will be verified too.
*
* Third criterion : it shouldn't prevent us from decoding the forthcoming I
* picture, which is more important.
* t12 - t > tauB + 4 * tauP + tauI + DELTA
*
* If STATS is defined, the counters in p_vpar->synchro will refer to the
* number of failures of these inequations.
* *
* I hope you will have a pleasant flight and do not forget your life * I hope you will have a pleasant flight and do not forget your life
* jacket. * jacket.
...@@ -136,9 +131,7 @@ static int SynchroType( void ); ...@@ -136,9 +131,7 @@ static int SynchroType( void );
static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type ); static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type );
/* Error margins */ /* Error margins */
#define DELTA_I (int)(0.010*CLOCK_FREQ) #define DELTA (int)(0.060*CLOCK_FREQ)
#define DELTA_P (int)(0.010*CLOCK_FREQ)
#define DELTA_B (int)(0.060*CLOCK_FREQ)
#define DEFAULT_NB_P 5 #define DEFAULT_NB_P 5
#define DEFAULT_NB_B 1 #define DEFAULT_NB_B 1
...@@ -227,14 +220,14 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -227,14 +220,14 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
#define S p_vpar->synchro #define S p_vpar->synchro
/* VPAR_SYNCHRO_DEFAULT */ /* VPAR_SYNCHRO_DEFAULT */
mtime_t now, pts, period, tau_yuv; mtime_t now, pts, period, tau_yuv;
boolean_t b_decode = 0, b_decode2; boolean_t b_decode = 0;
now = mdate(); now = mdate();
period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001; period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
//vlc_mutex_lock( &p_vpar->p_vout->change_lock ); vlc_mutex_lock( &p_vpar->p_vout->change_lock );
tau_yuv = p_vpar->p_vout->render_time; tau_yuv = p_vpar->p_vout->render_time;
//vlc_mutex_unlock( &p_vpar->p_vout->change_lock ); vlc_mutex_unlock( &p_vpar->p_vout->change_lock );
vlc_mutex_lock( &p_vpar->synchro.fifo_lock ); vlc_mutex_lock( &p_vpar->synchro.fifo_lock );
...@@ -242,7 +235,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -242,7 +235,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
{ {
case I_CODING_TYPE: case I_CODING_TYPE:
/* Stream structure changes */ /* Stream structure changes */
S.i_n_p = S.i_eta_p || DEFAULT_NB_P; if( S.i_n_p )
S.i_n_p = S.i_eta_p;
if( S.backward_pts ) if( S.backward_pts )
{ {
...@@ -255,14 +249,15 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -255,14 +249,15 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
b_decode = ( (1 + S.i_n_p * (S.i_n_b + 1)) * period > b_decode = ( (1 + S.i_n_p * (S.i_n_b + 1)) * period >
S.p_tau[I_CODING_TYPE] ) || S.p_tau[I_CODING_TYPE] ) ||
( (pts - now) > (TAU_PRIME(I_CODING_TYPE) + DELTA_I) ); ( (pts - now) > (TAU_PRIME(I_CODING_TYPE) + DELTA) );
if( !b_decode ) if( !b_decode )
intf_Msg("vpar synchro: trashing I\n"); intf_WarnMsg( 3, "vpar synchro warning: trashing I\n" );
break; break;
case P_CODING_TYPE: case P_CODING_TYPE:
/* Stream structure changes */ /* Stream structure changes */
S.i_n_b = S.i_eta_b || DEFAULT_NB_B; if( S.i_n_b )
S.i_n_b = S.i_eta_b;
if( S.i_eta_p + 1 > S.i_n_p ) if( S.i_eta_p + 1 > S.i_n_p )
S.i_n_p++; S.i_n_p++;
...@@ -277,17 +272,18 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -277,17 +272,18 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
if( (S.i_n_b + 1) * period > S.p_tau[P_CODING_TYPE] ) if( (S.i_n_b + 1) * period > S.p_tau[P_CODING_TYPE] )
{ {
/* Security in case we're _really_ late */
b_decode = (pts - now > 0); b_decode = (pts - now > 0);
} }
else else
{ {
b_decode = (pts - now) > (TAU_PRIME(P_CODING_TYPE) + DELTA_P); b_decode = (pts - now) > (TAU_PRIME(P_CODING_TYPE) + DELTA);
/* next I */ /* next I */
b_decode &= (pts - now b_decode &= (pts - now
+ period + period
* ( (S.i_n_p - S.i_eta_p - 1) * (1 + S.i_n_b) - 1 )) * ( (S.i_n_p - S.i_eta_p - 1) * (1 + S.i_n_b) - 1 ))
> (TAU_PRIME(P_CODING_TYPE) > (TAU_PRIME(P_CODING_TYPE)
+ TAU_PRIME(I_CODING_TYPE) + DELTA_P); + TAU_PRIME(I_CODING_TYPE) + DELTA);
} }
break; break;
...@@ -300,51 +296,25 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -300,51 +296,25 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
if( (S.i_n_b + 1) * period > S.p_tau[P_CODING_TYPE] ) if( (S.i_n_b + 1) * period > S.p_tau[P_CODING_TYPE] )
{ {
b_decode = (pts - now) > (TAU_PRIME(B_CODING_TYPE) + DELTA_B); b_decode = (pts - now) > (TAU_PRIME(B_CODING_TYPE) + DELTA);
#ifdef STATS
S.i_B_self += !b_decode;
#endif
/* Remember that S.i_eta_b is for the moment only eta_b - 1. */ /* Remember that S.i_eta_b is for the moment only eta_b - 1. */
if( S.i_eta_p != S.i_n_p ) /* next P */ if( S.i_eta_p != S.i_n_p ) /* next P */
{ {
b_decode2 = (pts - now b_decode &= (pts - now
+ period + period
* ( 2 * S.i_n_b - S.i_eta_b - 1)) * ( 2 * S.i_n_b - S.i_eta_b - 1))
> (TAU_PRIME(B_CODING_TYPE) > (TAU_PRIME(B_CODING_TYPE)
+ TAU_PRIME(P_CODING_TYPE) + DELTA_B); + TAU_PRIME(P_CODING_TYPE) + DELTA);
b_decode &= b_decode2;
#ifdef STATS
S.i_B_next += !b_decode2;
#endif
} }
if( S.i_eta_p < S.i_n_p - 1 ) /* last P */ else /* next I */
{ {
b_decode2 = (pts - now b_decode &= (pts - now
+ period + period
* ( (S.i_n_p - S.i_eta_p) * (1 + S.i_n_b) * ( 2 * S.i_n_b - S.i_eta_b - 1))
+ S.i_n_b - (S.i_eta_b + 1) + 1)) > (TAU_PRIME(B_CODING_TYPE)
> (TAU_PRIME(B_CODING_TYPE) + TAU_PRIME(I_CODING_TYPE) + DELTA);
+ (S.i_n_p - S.i_eta_p)
* TAU_PRIME(P_CODING_TYPE)
+ DELTA_B);
b_decode &= b_decode2;
#ifdef STATS
S.i_B_last += !b_decode2;
#endif
} }
b_decode2 = (pts - now
+ period
* ( (S.i_n_p - S.i_eta_p + 1) * (1 + S.i_n_b)
+ S.i_n_b - (S.i_eta_b + 1) + 1 ))
> (TAU_PRIME(B_CODING_TYPE)
+ (S.i_n_p - S.i_eta_p)
* TAU_PRIME(P_CODING_TYPE)
+ TAU_PRIME(I_CODING_TYPE)
+ DELTA_B);
b_decode &= b_decode2;
#ifdef STATS
S.i_B_I += !b_decode2;
#endif
} }
else else
{ {
...@@ -366,6 +336,9 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -366,6 +336,9 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure ) int i_structure )
{ {
SynchroNewPicture( p_vpar, i_coding_type ); SynchroNewPicture( p_vpar, i_coding_type );
#ifdef STATS
p_vpar->synchro.i_trashed_pic++;
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -499,15 +472,17 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type ) ...@@ -499,15 +472,17 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type )
case I_CODING_TYPE: case I_CODING_TYPE:
p_vpar->synchro.i_eta_p = p_vpar->synchro.i_eta_b = 0; p_vpar->synchro.i_eta_p = p_vpar->synchro.i_eta_b = 0;
#ifdef STATS #ifdef STATS
intf_Msg( "vpar synchro stats: I(%lld) P(%lld) B(%lld)[%d:%d:%d:%d] YUV(%lld)\n", intf_Msg( "vpar synchro stats: I(%lld) P(%lld)[%d] B(%lld)[%d] YUV(%lld) : %d/%d\n",
p_vpar->synchro.p_tau[I_CODING_TYPE], p_vpar->synchro.p_tau[I_CODING_TYPE],
p_vpar->synchro.p_tau[P_CODING_TYPE], p_vpar->synchro.p_tau[P_CODING_TYPE],
p_vpar->synchro.i_n_p,
p_vpar->synchro.p_tau[B_CODING_TYPE], p_vpar->synchro.p_tau[B_CODING_TYPE],
p_vpar->synchro.i_B_self, p_vpar->synchro.i_B_next, p_vpar->synchro.i_n_b,
p_vpar->synchro.i_B_last, p_vpar->synchro.i_B_I, p_vpar->p_vout->render_time,
p_vpar->p_vout->render_time ); 1 + p_vpar->synchro.i_n_p * (1 + p_vpar->synchro.i_n_b) -
p_vpar->synchro.i_B_self = p_vpar->synchro.i_B_next = p_vpar->synchro.i_trashed_pic,
p_vpar->synchro.i_B_last = p_vpar->synchro.i_B_I = 0; 1 + p_vpar->synchro.i_n_p * (1 + p_vpar->synchro.i_n_b) );
p_vpar->synchro.i_trashed_pic = 0;
#endif #endif
break; break;
case P_CODING_TYPE: case P_CODING_TYPE:
...@@ -527,7 +502,8 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type ) ...@@ -527,7 +502,8 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type )
{ {
if( p_pes->i_pts < p_vpar->synchro.current_pts ) if( p_pes->i_pts < p_vpar->synchro.current_pts )
{ {
intf_ErrMsg("vpar warning: pts_date < current_date\n"); intf_WarnMsg( 2,
"vpar synchro warning: pts_date < current_date\n" );
} }
p_vpar->synchro.current_pts = p_pes->i_pts; p_vpar->synchro.current_pts = p_pes->i_pts;
p_pes->b_has_pts = 0; p_pes->b_has_pts = 0;
...@@ -547,7 +523,8 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type ) ...@@ -547,7 +523,8 @@ static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type )
{ {
if( p_vpar->synchro.backward_pts < p_vpar->synchro.current_pts ) if( p_vpar->synchro.backward_pts < p_vpar->synchro.current_pts )
{ {
intf_ErrMsg("vpar warning: backward_date < current_date\n"); intf_WarnMsg( 2,
"vpar warning: backward_date < current_date\n" );
} }
p_vpar->synchro.current_pts = p_vpar->synchro.backward_pts; p_vpar->synchro.current_pts = p_vpar->synchro.backward_pts;
p_vpar->synchro.backward_pts = 0; p_vpar->synchro.backward_pts = 0;
......
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