events, but there is no way to print these structures. In stats
mode, we should print these structures regularly, or at quit
time (whichever is the more convenient).
-Status: Todo
+Status: Done 27 Nov 2000 (Meuuh)
Task: 0x3c
Difficulty: Easy
We have intf_ErrMsg to display fatal errors, but warnings are
drowned in an ocean of unreadable intf_DbgMsg. Same for
statistics messages.
-Status: Todo
+Status: Done 23 Nov 2000 (Stef)
Task: 0x3a
Difficulty: Hard
u8 pi_crop_buf[VDEC_CROPRANGE];
u8 * pi_crop;
#endif
-
-#ifdef STATS
- /* Statistics */
- count_t c_loops; /* number of loops */
- count_t c_idle_loops; /* number of idle loops */
- count_t c_decoded_pictures; /* number of pictures decoded */
- count_t c_decoded_i_pictures; /* number of I pictures decoded */
- count_t c_decoded_p_pictures; /* number of P pictures decoded */
- count_t c_decoded_b_pictures; /* number of B pictures decoded */
-#endif
} vdec_thread_t;
/*****************************************************************************
vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 0 );
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 0 );
}
#endif
}
vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 1 );
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 1 );
}
#endif
}
#ifdef STATS
/* Statistics */
count_t c_loops; /* number of loops */
- count_t c_idle_loops; /* number of idle loops */
count_t c_sequences; /* number of sequences */
- count_t c_pictures; /* number of pictures read */
- count_t c_i_pictures; /* number of I pictures read */
- count_t c_p_pictures; /* number of P pictures read */
- count_t c_b_pictures; /* number of B pictures read */
- count_t c_decoded_pictures; /* number of pictures decoded */
- count_t c_decoded_i_pictures; /* number of I pictures decoded */
- count_t c_decoded_p_pictures; /* number of P pictures decoded */
- count_t c_decoded_b_pictures; /* number of B pictures decoded */
+ count_t pc_pictures[4]; /* number of (coding_type) pictures read */
+ count_t pc_decoded_pictures[4]; /* number of (coding_type)
+ * pictures decoded */
+ count_t pc_malformed_pictures[4]; /* number of pictures trashed
+ * during parsing */
#endif
} vpar_thread_t;
int i_coding_type, int i_structure );
void vpar_SynchroDecode ( struct vpar_thread_s * p_vpar,
int i_coding_type, int i_structure );
-void vpar_SynchroEnd ( struct vpar_thread_s * p_vpar );
+void vpar_SynchroEnd ( struct vpar_thread_s * p_vpar, int i_garbage );
mtime_t vpar_SynchroDate ( struct vpar_thread_s * p_vpar );
#ifdef STATS
i_dummy = p_ts_packet->i_payload_end - p_ts_packet->i_payload_start;
p_es_descriptor->c_payload_bytes += i_dummy;
+ p_input->c_payload_bytes += i_dummy;
#endif
/* We can check if the packet is finished */
pi_status = p_input->pi_status;
*pi_status = THREAD_END;
+#ifdef STATS
+ intf_Msg("input stats: Done %d loops\n", p_input->c_loops);
+ intf_Msg("input stats: Read %d bytes (payload : %d)\n", p_input->c_bytes,
+ p_input->c_payload_bytes);
+ intf_Msg("input stats: Read %d packets (trashed : %d)\n",
+ p_input->c_packets_read, p_input->c_packets_trashed);
+#endif
+
/* Close input method */
p_input->p_Close( p_input );
intf_DbgMsg("vdec debug: initializing video decoder thread %p\n", p_vdec);
- /* Initialize other properties */
-#ifdef STATS
- p_vdec->c_loops = 0;
- p_vdec->c_idle_loops = 0;
- p_vdec->c_decoded_pictures = 0;
- p_vdec->c_decoded_i_pictures = 0;
- p_vdec->c_decoded_p_pictures = 0;
- p_vdec->c_decoded_b_pictures = 0;
-#endif
-
#ifndef HAVE_MMX
/* Init crop table */
p_vdec->pi_crop = p_vdec->pi_crop_buf + (VDEC_CROPRANGE >> 1);
/* Initialize other properties */
#ifdef STATS
p_vpar->c_loops = 0;
- p_vpar->c_idle_loops = 0;
- p_vpar->c_pictures = 0;
- p_vpar->c_i_pictures = 0;
- p_vpar->c_p_pictures = 0;
- p_vpar->c_b_pictures = 0;
- p_vpar->c_decoded_pictures = 0;
- p_vpar->c_decoded_i_pictures = 0;
- p_vpar->c_decoded_p_pictures = 0;
- p_vpar->c_decoded_b_pictures = 0;
+ p_vpar->c_sequences = 0;
+ memset(p_vpar->pc_pictures, 0, sizeof(p_vpar->pc_pictures));
+ memset(p_vpar->pc_decoded_pictures, 0, sizeof(p_vpar->pc_decoded_pictures));
+ memset(p_vpar->pc_malformed_pictures, 0,
+ sizeof(p_vpar->pc_malformed_pictures));
#endif
/* Initialize video FIFO */
/* Find the next sequence header in the stream */
p_vpar->b_error = vpar_NextSequenceHeader( p_vpar );
-#ifdef STATS
- p_vpar->c_sequences++;
-#endif
-
while( (!p_vpar->b_die) && (!p_vpar->b_error) )
{
+#ifdef STATS
+ p_vpar->c_loops++;
+#endif
/* Parse the next sequence, group or picture header */
if( vpar_ParseHeader( p_vpar ) )
{
/* XXX?? */
#endif
+#ifdef STATS
+ intf_Msg("vpar stats: %d loops among %d sequence(s)\n",
+ p_vpar->c_loops, p_vpar->c_sequences);
+ intf_Msg("vpar stats: Read %d frames/fields (I %d/P %d/B %d)\n",
+ p_vpar->pc_pictures[I_CODING_TYPE]
+ + p_vpar->pc_pictures[P_CODING_TYPE]
+ + p_vpar->pc_pictures[B_CODING_TYPE],
+ p_vpar->pc_pictures[I_CODING_TYPE],
+ p_vpar->pc_pictures[P_CODING_TYPE],
+ p_vpar->pc_pictures[B_CODING_TYPE]);
+ intf_Msg("vpar stats: Decoded %d frames/fields (I %d/P %d/B %d)\n",
+ p_vpar->pc_decoded_pictures[I_CODING_TYPE]
+ + p_vpar->pc_decoded_pictures[P_CODING_TYPE]
+ + p_vpar->pc_decoded_pictures[B_CODING_TYPE],
+ p_vpar->pc_decoded_pictures[I_CODING_TYPE],
+ p_vpar->pc_decoded_pictures[P_CODING_TYPE],
+ p_vpar->pc_decoded_pictures[B_CODING_TYPE]);
+ intf_Msg("vpar stats: Read %d malformed frames/fields (I %d/P %d/B %d)\n",
+ p_vpar->pc_malformed_pictures[I_CODING_TYPE]
+ + p_vpar->pc_malformed_pictures[P_CODING_TYPE]
+ + p_vpar->pc_malformed_pictures[B_CODING_TYPE],
+ p_vpar->pc_malformed_pictures[I_CODING_TYPE],
+ p_vpar->pc_malformed_pictures[P_CODING_TYPE],
+ p_vpar->pc_malformed_pictures[B_CODING_TYPE]);
+#endif
+
/* Destroy thread structures allocated by InitThread */
// vout_DestroyStream( p_vpar->p_vout, p_vpar->i_stream );
/* XXX?? */
{
NextStartCode( p_vpar );
if( ShowBits( &p_vpar->bit_stream, 32 ) == SEQUENCE_HEADER_CODE )
+ {
return 0;
+ }
RemoveBits( &p_vpar->bit_stream, 8 );
}
return 1;
switch( GetBits32( &p_vpar->bit_stream ) )
{
case SEQUENCE_HEADER_CODE:
+#ifdef STATS
+ p_vpar->c_sequences++;
+#endif
SequenceHeader( p_vpar );
return 0;
break;
p_vpar->picture.b_progressive_frame = 1;
}
+#ifdef STATS
+ p_vpar->pc_pictures[p_vpar->picture.i_coding_type]++;
+#endif
+
if( p_vpar->picture.i_current_structure &&
(i_structure == FRAME_STRUCTURE ||
i_structure == p_vpar->picture.i_current_structure) )
}
/* OK, now we are sure we will decode the picture. */
+#ifdef STATS
+ p_vpar->pc_decoded_pictures[p_vpar->picture.i_coding_type]++;
+#endif
+
#define P_picture p_vpar->picture.p_picture
p_vpar->picture.b_error = 0;
p_vpar->picture.b_frame_structure = (i_structure == FRAME_STRUCTURE);
}
#endif
+#ifdef STATS
+ p_vpar->pc_malformed_pictures[p_vpar->picture.i_coding_type]++;
+#endif
+
if( P_picture->i_deccount != 1 )
{
+ vpar_SynchroEnd( p_vpar, 1 );
vout_DestroyPicture( p_vpar->p_vout, P_picture );
}
static void SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type );
/* Error margins */
-#define DELTA (int)(0.060*CLOCK_FREQ)
+#define DELTA (int)(0.040*CLOCK_FREQ)
#define DEFAULT_NB_P 5
#define DEFAULT_NB_B 1
b_decode = (pts - now) > (TAU_PRIME(B_CODING_TYPE) + DELTA);
/* 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 */
- {
- b_decode &= (pts - now
- + period
- * ( 2 * S.i_n_b - S.i_eta_b - 1))
- > (TAU_PRIME(B_CODING_TYPE)
- + TAU_PRIME(P_CODING_TYPE) + DELTA);
- }
- else /* next I */
- {
- b_decode &= (pts - now
- + period
- * ( 2 * S.i_n_b - S.i_eta_b - 1))
- > (TAU_PRIME(B_CODING_TYPE)
- + TAU_PRIME(I_CODING_TYPE) + DELTA);
- }
+ b_decode &= (pts - now
+ + period
+ * ( 2 * S.i_n_b - S.i_eta_b + 2))
+ > (TAU_PRIME(B_CODING_TYPE)
+ + TAU_PRIME(P_CODING_TYPE) + DELTA);
}
else
{
/*****************************************************************************
* vpar_SynchroEnd : Called when the image is totally decoded
*****************************************************************************/
-void vpar_SynchroEnd( vpar_thread_t * p_vpar )
+void vpar_SynchroEnd( vpar_thread_t * p_vpar, int i_garbage )
{
mtime_t tau;
int i_coding_type;
vlc_mutex_lock( &p_vpar->synchro.fifo_lock );
- tau = mdate() - p_vpar->synchro.p_date_fifo[p_vpar->synchro.i_start];
- i_coding_type = p_vpar->synchro.pi_coding_types[p_vpar->synchro.i_start];
-
- /* Mean with average tau, to ensure stability. */
- p_vpar->synchro.p_tau[i_coding_type] =
- (p_vpar->synchro.pi_meaningful[i_coding_type]
- * p_vpar->synchro.p_tau[i_coding_type] + tau)
- / (p_vpar->synchro.pi_meaningful[i_coding_type] + 1);
- if( p_vpar->synchro.pi_meaningful[i_coding_type] < MAX_PIC_AVERAGE )
+ if (!i_garbage)
{
- p_vpar->synchro.pi_meaningful[i_coding_type]++;
+ tau = mdate() - p_vpar->synchro.p_date_fifo[p_vpar->synchro.i_start];
+ i_coding_type = p_vpar->synchro.pi_coding_types[p_vpar->synchro.i_start];
+
+ /* Mean with average tau, to ensure stability. */
+ p_vpar->synchro.p_tau[i_coding_type] =
+ (p_vpar->synchro.pi_meaningful[i_coding_type]
+ * p_vpar->synchro.p_tau[i_coding_type] + tau)
+ / (p_vpar->synchro.pi_meaningful[i_coding_type] + 1);
+ if( p_vpar->synchro.pi_meaningful[i_coding_type] < MAX_PIC_AVERAGE )
+ {
+ p_vpar->synchro.pi_meaningful[i_coding_type]++;
+ }
}
FIFO_INCREMENT( i_start );
case I_CODING_TYPE:
p_vpar->synchro.i_eta_p = p_vpar->synchro.i_eta_b = 0;
#ifdef STATS
- intf_Msg( "vpar synchro stats: I(%lld) P(%lld)[%d] B(%lld)[%d] YUV(%lld) : %d/%d\n",
+ if( p_vpar->synchro.i_type == VPAR_SYNCHRO_DEFAULT )
+ {
+ 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[P_CODING_TYPE],
p_vpar->synchro.i_n_p,
1 + p_vpar->synchro.i_n_p * (1 + p_vpar->synchro.i_n_b) -
p_vpar->synchro.i_trashed_pic,
1 + p_vpar->synchro.i_n_p * (1 + p_vpar->synchro.i_n_b) );
- p_vpar->synchro.i_trashed_pic = 0;
+ p_vpar->synchro.i_trashed_pic = 0;
+ }
#endif
break;
case P_CODING_TYPE: