]> git.sesse.net Git - vlc/commitdiff
* Makefile : ajout du nouveau d�codeur (comment�) ;
authorChristophe Massiot <massiot@videolan.org>
Mon, 3 Jan 2000 20:38:32 +0000 (20:38 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 3 Jan 2000 20:38:32 +0000 (20:38 +0000)
             suppression du video_output pour que Ptyx puisse committer
             ses trucs sans craindre de tout casser le cvs ;
* interface/* : d�sactivage du video_output ;
* include/config.h : plein de directives pour le parseur et le d�codeur ;
* include/decoder_fifo.h : nouvelles primitives pour le parseur ;
* le reste : ben de quoi faire compiler video_parser.c, bug fixes
  essentiellement ;

Eviv Bulgroz !

14 files changed:
Makefile
include/config.h
include/decoder_fifo.h
include/vdec_idct.h [new file with mode: 0644]
include/vdec_motion.h
include/video_decoder.h.new
include/video_fifo.h
include/video_parser.h
include/vpar_blocks.h
include/vpar_headers.h
src/interface/control.c
src/interface/interface.c
src/video_parser/video_parser.c
src/video_parser/vpar_headers.c

index a401258f023f0e77f7d77d91e4c8062a2d4c0667..3feb81305f27b7875bf04d6de6adab53a8f44caa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -135,9 +135,9 @@ input_obj =                         input/input_vlan.o \
 audio_output_obj =             audio_output/audio_output.o \
                                                audio_output/audio_dsp.o
 
-video_output_obj =             video_output/video_output.o \
-                                               video_output/video_x11.o \
-                                               video_output/video_graphics.o 
+#video_output_obj =            video_output/video_output.o \
+#                                              video_output/video_x11.o \
+#                                              video_output/video_graphics.o 
 
 audio_decoder_obj =            audio_decoder/audio_decoder.o \
                                                audio_decoder/audio_math.o
@@ -156,6 +156,17 @@ video_decoder_obj =                video_decoder_ref/video_decoder.o \
                                                video_decoder_ref/recon.o \
                                                video_decoder_ref/spatscal.o
 
+#video_parser_obj =            video_parser/video_parser.o \
+#                                              video_parser/vpar_headers.o \
+#                                              video_parser/vpar_blocks.o \
+#                                              video_parser/vpar_motion.o \
+#                                              video_parser/vpar_synchro.o \
+#                                              video_parser/video_fifo.o
+
+#video_decoder_obj =           video_decoder/video_decoder.o \
+#                                              video_decoder/vdec_idct.o \
+#                                              video_decoder/vdec_motion.o
+
 misc_obj =                     misc/mtime.o \
                                                misc/xutils.o \
                                                misc/rsc_files.o \
@@ -167,6 +178,7 @@ C_OBJ = $(interface_obj) \
                $(video_output_obj) \
                $(audio_decoder_obj) \
                $(generic_decoder_obj) \
+               $(video_parser_obj) \
                $(video_decoder_obj) \
                $(vlan_obj) \
                $(misc_obj) \
index da76a180680fc400628ca9510eb116eeee49c3d2..29206fc20ab7bfa31bf5462b7786efce54d180d6 100644 (file)
 //#define DVB_EXTENSIONS
 //#define DVB_RESTRICTIONS
 
+/* Define to disable some obscure heuristics behind the video_parser and the
+ * video_decoder that improve performance but are not fully MPEG2 compliant
+ * and might cause problems with some very weird streams. */
+//#define MPEG2_COMPLIANT
+
 /* Define for profiling support */
 //#define STATS
 
 /* ?? this constant will probably evolve to a calculated value */
 #define VOUT_DISPLAY_TOLERANCE          150000
 
+/*******************************************************************************
+ * Video parser configuration
+ *******************************************************************************/
+
+#define VPAR_IDLE_SLEEP                 100000
+
+/* Number of macroblock buffers available. It should be always greater than
+ * twice the number of macroblocks in a picture. VFIFO_SIZE + 1 should also
+ * be a power of two. */
+#define VFIFO_SIZE                      4095
+
+/* Maximum number of macroblocks in a picture. */
+#define MAX_MB                          2048
+
 /*******************************************************************************
  * Video decoder configuration
  *******************************************************************************/
 
 #define VDEC_IDLE_SLEEP                 100000
 
+/* Number of video_decoder threads to launch on startup of the video_parser.
+ * It should always be less than half the number of macroblocks of a
+ * picture. */
+#define NB_VDEC                         1
+
 /*******************************************************************************
  * Generic decoder configuration
  *******************************************************************************/
index 69d7741ac58c1a0de8e8b909d94fc43cb9bc17ab..bb4ae66021fc6c5a80a870f724b5011065e458b3 100644 (file)
@@ -96,12 +96,6 @@ typedef struct bit_stream_s
  *****************************************************************************/
 static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
 {
-    /* Is the input thread dying ? */
-    if ( p_bit_stream->p_input->b_die )
-    {
-        return( 0 );
-    }
-
     /* Are there some bytes left in the current TS packet ? */
     if ( p_bit_stream->i_byte < p_bit_stream->p_ts->i_payload_end )
     {
@@ -117,6 +111,12 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
              * time to jump to the next PES packet */
             if ( p_bit_stream->p_ts->p_next_ts == NULL )
             {
+                /* Is the input thread dying ? */
+                if ( p_bit_stream->p_input->b_die )
+                {
+                    return( 0 );
+                }
+                       
                 /* We are going to read/write the start and end indexes of the
                  * decoder fifo and to use the fifo's conditional variable,
                  * that's why we need to take the lock before */
@@ -164,7 +164,7 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
 
 /******************************************************************************
  * NeedBits : reads i_bits new bits in the bit stream and stores them in the
- *            bit buffer
+ *  <F4>          bit buffer
  ******************************************************************************
  * - i_bits must be less or equal 32 !
  * - There is something important to notice with that function : if the number
@@ -194,3 +194,65 @@ static __inline__ void DumpBits( bit_stream_t * p_bit_stream, int i_bits )
     p_bit_stream->fifo.buffer <<= i_bits;
     p_bit_stream->fifo.i_available -= i_bits;
 }
+
+/******************************************************************************
+ * DumpBits32 : removes 32 bits from the bit buffer
+ ******************************************************************************
+ * This function actually believes that you have already put 32 bits in the
+ * bit buffer, so you can't you use it anytime.
+ ******************************************************************************/
+static __inline__ void DumpBits32( bit_stream_t * p_bit_stream )
+{
+    p_bit_stream->fifo.buffer = 0;
+    p_bit_stream->fifo.i_available = 0;
+}
+
+/*
+ * For the following functions, please read VERY CAREFULLY the warning in
+ * NeedBits(). If i_bits > 24, the stream parser must be already aligned
+ * on an 8-bit boundary, or you will get curious results (that is, you
+ * need to call RealignBits() before).
+ */
+
+/******************************************************************************
+ * ShowBits : return i_bits bits from the bit stream
+ ******************************************************************************/
+static __inline__ u32 ShowBits( bit_stream_t * p_bit_stream, int i_bits )
+{
+    NeedBits( p_bit_stream, i_bits );
+    return( p_bit_stream->fifo.buffer >> (32 - i_bits) );
+}
+
+/******************************************************************************
+ * GetBits : returns i_bits bits from the bit stream and removes them
+ ******************************************************************************/
+static __inline__ u32 GetBits( bit_stream_t * p_bit_stream, int i_bits )
+{
+    u32 i_buffer;
+
+    NeedBits( p_bit_stream, i_bits );
+    i_buffer = p_bit_stream->fifo.buffer >> (32 - i_bits);
+    DumpBits( p_bit_stream, i_bits );
+    return( i_buffer );
+}
+
+/******************************************************************************
+ * GetBits32 : returns 32 bits from the bit stream and removes them
+ ******************************************************************************/
+static __inline__ u32 GetBits32( bit_stream_t * p_bit_stream )
+{
+    u32 i_buffer;
+
+    NeedBits( p_bit_stream, 32 );
+    i_buffer = p_bit_stream->fifo.buffer;
+    DumpBits32( p_bit_stream );
+    return( i_buffer );
+}
+
+/******************************************************************************
+ * RealignBits : realigns the bit buffer on an 8-bit boundary
+ ******************************************************************************/
+static __inline__ void RealignBits( bit_stream_t * p_bit_stream )
+{
+    DumpBits( p_bit_stream, p_bit_stream->fifo.i_available & 7 );
+}
diff --git a/include/vdec_idct.h b/include/vdec_idct.h
new file mode 100644 (file)
index 0000000..97309a1
--- /dev/null
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * vdec_idct.h : types for the inverse discrete cosine transform
+ * (c)1999 VideoLAN
+ *****************************************************************************
+ *****************************************************************************
+ * Requires:
+ *  "config.h"
+ *  "common.h"
+ *  "vlc_thread.h"
+ *  "video_parser.h"
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Common declarations
+ *****************************************************************************/ 
+#define elem_t short
+
+/*****************************************************************************
+ * Function pointers
+ *****************************************************************************/
+typedef void (*f_idct_t)( elem_t*, int );
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
index 44302a072c31115a0963963f3f67d9946228f6f8..2f1e7fc03364ed0d304f99a53ea1650c92e307a1 100644 (file)
 /*****************************************************************************
  * Function pointers
  *****************************************************************************/
-typedef void (*f_motion_mb_t)( coeff_t *, pel_lookup_table_t *,
-                               int, coeff_t *, int, int, int, int, int );
-typedef void (*f_motion_t)( vdec_thread_t *, undec_picture_t *, int,
-                            f_motion_mb_t );
+struct macroblock_s;
+struct vpar_thread_s;
+
+typedef void (*f_motion_t)( struct macroblock_s* );
+typedef void (*f_chroma_motion_t)( struct macroblock_s* );
 
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-void vdec_MotionMacroblock420( coeff_t * p_src, pel_lookup_table_t * p_lookup,
-                               int i_width_line,
-                               coeff_t * p_dest, int i_dest_x, i_dest_y,
-                               int i_stride_line,
-                               i_mv1_x, i_mv1_y, i_mv2_x, i_mv2_y );
index 5dbf77e15a3aa300af5ec5eb5be2b95478d75ea5..b4ef7b8bf8ca875fff36b8d9f06b61587ca2e6c2 100644 (file)
@@ -35,7 +35,7 @@ typedef struct vdec_thread_s
     
 
     /* Input properties */
-    video_parser_t *   p_vpar;                       /* video_parser thread */
+    struct video_parser_s *    p_vpar;                       /* video_parser thread */
         
 #ifdef STATS
     /* Statistics */
@@ -48,12 +48,21 @@ typedef struct vdec_thread_s
 #endif
 } vdec_thread_t;
 
+/* Move this somewhere else ASAP !! */
+#define data_t short
+
+/*****************************************************************************
+ * Function pointers
+ *****************************************************************************/
+typedef void (*f_addb_t)( elem_t*, data_t*, int );
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
+struct vpar_thread_s;
 
 /* Thread management functions */
-vdec_thread_t * vdec_CreateThread       ( vpar_thread_t *p_vpar /*, int *pi_status */ );
+vdec_thread_t * vdec_CreateThread       ( struct vpar_thread_s *p_vpar /*, int *pi_status */ );
 void            vdec_DestroyThread      ( vdec_thread_t *p_vdec /*, int *pi_status */ );
 
 /* Time management functions */
index 4c1ad5e3a4dd348dcc21d549691b8cb1c2d8c756..a8021179cbdd415658d1fef43073719a373c9060 100644 (file)
@@ -31,6 +31,8 @@
  *****************************************************************************
  * This rotative FIFO contains undecoded macroblocks that are to be decoded
  *****************************************************************************/
+struct video_parser_s;
+
 typedef struct video_fifo_s
 {
     vlc_mutex_t         lock;                              /* fifo data lock */
@@ -62,6 +64,7 @@ typedef struct video_buffer_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
+void vpar_InitFIFO( struct vpar_thread_s * p_vpar );
 macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo );
 macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo );
 void vpar_DecodeMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb );
index 86b35f27974171f0d038ba06489207480a484522..ff629c7941b5fdee8db6abbb5ae814caed3d3dfc 100644 (file)
@@ -87,3 +87,38 @@ void            vpar_DestroyThread      ( vpar_thread_t *p_vpar /*, int *pi_stat
 
 /* Dynamic thread settings */
 /* ?? */
+
+/*****************************************************************************
+ * LoadQuantizerScale
+ *****************************************************************************
+ * Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
+ *****************************************************************************/
+static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
+{
+    /* Quantization coefficient table */
+    static unsigned char    ppi_quantizer_scale[3][32] =
+    {
+        /* MPEG-2 */
+        {
+            /* q_scale_type */
+            /* linear */
+            0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
+            32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
+        },
+        {
+            /* non-linear */
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 10,12,14,16,18,20, 22,
+            24,28,32,36,40,44,48,52,56,64,72,80,88,96,104,112
+        },
+        /* MPEG-1 */
+        {
+            0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+            16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
+        }
+    };
+
+    p_vpar->slice.i_quantizer_scale = ppi_quantizer_scale
+           [(!p_vpar->sequence.b_mpeg2 << 1) | p_vpar->picture.b_q_scale_type]
+           [GetBits( &p_vpar->bit_stream, 5 )];
+}
+
index dcbc0fc61d15bca8d4f1ebb5ca13cee32c7aca63..321e5553fe6a38576ad5bf37874fd8c2f03414f6 100644 (file)
@@ -25,7 +25,6 @@ typedef struct macroblock_s
     int                     i_structure;
     int                     i_l_x, i_l_y;    /* position of macroblock (lum) */
     int                     i_c_x, i_c_y; /* position of macroblock (chroma) */
-    int                     i_structure;
     int                     i_chroma_nb_blocks;  /* nb of bks for a chr comp */
 
     /* IDCT information */
@@ -36,8 +35,10 @@ typedef struct macroblock_s
     /* Motion compensation information */
     f_motion_t              pf_motion;    /* function to use for motion comp */
     f_chroma_motion_t       pf_chroma_motion;
-    picture_t *             p_backw_top, p_backw_bot;
-    picture_t *             p_forw_top, p_forw_bot;
+    picture_t *             p_backw_top;
+    picture_t *             p_backw_bot;
+    picture_t *             p_forw_top;
+    picture_t *             p_forw_bot;
     int                     i_field_select_backw_top, i_field_select_backw_bot;
     int                     i_field_select_forw_top, i_field_select_forw_bot;
     int                     pi_motion_vectors_backw_top[2];
@@ -61,40 +62,6 @@ typedef struct
     boolean_t               b_dct_type;
 } macroblock_parsing_t;
 
-/*****************************************************************************
- * LoadQuantizerScale
- *****************************************************************************
- * Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
- *****************************************************************************/
-static __inline__ void LoadQuantizerScale( vpar_thread_t * p_vpar )
-{
-    /* Quantization coefficient table */
-    static unsigned char    ppi_quantizer_scale[3][32] =
-    {
-        /* MPEG-2 */
-        {
-            /* q_scale_type */
-            /* linear */
-            0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
-            32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
-        },
-        {
-            /* non-linear */
-            0, 1, 2, 3, 4, 5, 6, 7, 8, 10,12,14,16,18,20, 22,
-            24,28,32,36,40,44,48,52,56,64,72,80,88,96,104,112
-        },
-        /* MPEG-1 */
-        {
-            0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-            16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
-        }
-    };
-
-    p_vpar->slice.i_quantizer_scale = ppi_quantizer_scale
-           [(!p_vpar->sequence.b_mpeg2 << 1) | p_vpar->picture.b_q_scale_type]
-           [GetBits( &p_vpar->bit_stream, 5 )];
-}
-
 /*****************************************************************************
  * Standard codes
  *****************************************************************************/
index 7f2a7cd71b6e93eee3e6c652fadea234691c8ffa..90140dd9e8802525608824f6ad701bf11cc54a66 100644 (file)
 /*****************************************************************************
  * Function pointers
  *****************************************************************************/
-typedef (void *)    f_slice_header_t( vpar_thread_t*, int*, int, elem_t*, u32);
+struct vpar_thread_s;
+
+typedef void    (*f_slice_header_t)( struct vpar_thread_s*, int*, int, elem_t*, u32);
 
 /*****************************************************************************
  * quant_matrix_t : Quantization Matrix
  *****************************************************************************/
 typedef struct quant_matrix_s
 {
-    int         pi_matrix[64];
+    int *       pi_matrix;
     boolean_t   b_allocated;
                           /* Has the matrix been allocated by vpar_headers ? */
 } quant_matrix_t;
@@ -50,11 +52,12 @@ typedef struct sequence_s
     f_slice_header_t    pf_slice_header;
     quant_matrix_t      intra_quant, nonintra_quant;
     quant_matrix_t      chroma_intra_quant, chroma_nonintra_quant;
-    (void *)            pf_decode_mv( vpar_thread_t *, int );
-    (void *)            pf_decode_pattern( vpar_thread_t * );
+    void                (*pf_decode_mv)( struct vpar_thread_s *, int );
+    void                (*pf_decode_pattern)( struct vpar_thread_s * );
 
     /* Parser context */
-    picture_t *         p_forward, p_backward;
+    picture_t *         p_forward;
+    picture_t *         p_backward;
 
     /* Copyright extension */
     boolean_t               b_copyright_flag;     /* Whether the following
@@ -90,7 +93,7 @@ typedef struct picture_parsing_s
     /* Relative to the current field */
     int                 i_coding_type, i_structure;
     boolean_t           b_frame_structure;
-    (int *)             pf_macroblock_type( vpar_thread_t * );
+    int                 (*pf_macroblock_type)( struct vpar_thread_s * );
 
     boolean_t           b_error;
 } picture_parsing_t;
@@ -147,3 +150,10 @@ typedef struct slice_parsing_s
 #define TOP_FIELD               1
 #define BOTTOM_FIELD            2
 #define FRAME_STRUCTURE         3
+
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
+int vpar_ParseHeader( struct vpar_thread_s * p_vpar );
index 68915be5b217ac6f5655f7cc9ef745ec103a0abd..3dcaa6b2eca8ef28a68c7001e5cabdc2a684f1ce 100644 (file)
@@ -49,6 +49,7 @@
  *******************************************************************************/
 int intf_CreateVoutThread( intf_thread_t *p_intf, char *psz_title, int i_width, int i_height )
 {
+#if 0
     int             i_thread;                                  /* thread index */
     video_cfg_t     cfg;                               /* thread configuration */    
 
@@ -92,6 +93,7 @@ int intf_CreateVoutThread( intf_thread_t *p_intf, char *psz_title, int i_width,
 
     /* No empty place has been found */
     return( -1 );
+#endif
 }
 
 
@@ -103,6 +105,7 @@ int intf_CreateVoutThread( intf_thread_t *p_intf, char *psz_title, int i_width,
  *******************************************************************************/
 void intf_DestroyVoutThread( intf_thread_t *p_intf, int i_thread )
 {
+#if 0
 #ifdef DEBUG
     /* Check if thread still exists */
     if( p_intf->pp_vout[i_thread] == NULL )
@@ -115,6 +118,7 @@ void intf_DestroyVoutThread( intf_thread_t *p_intf, int i_thread )
     /* Destroy thread and marks its place as empty */
     vout_DestroyThread( p_intf->pp_vout[i_thread], NULL );
     p_intf->pp_vout[i_thread] = NULL;
+#endif
 }
 
 
index c382dce8cabc1491f756927b5ffb2b11c82210e1..ce335cd7437bc67df7936563acc214faba308045 100644 (file)
@@ -111,11 +111,13 @@ static int StartInterface( intf_thread_t *p_intf )
     int fd;
 #endif
 
+#if 0
     /* Empty all threads array */
     for( i_thread = 0; i_thread < VOUT_MAX_THREADS; i_thread++ )
     {
         p_intf->pp_vout[i_thread] = NULL;        
     }
+#endif
     for( i_thread = 0; i_thread < INPUT_MAX_THREADS; i_thread++ )
     {
         p_intf->pp_input[i_thread] = NULL;        
@@ -171,6 +173,7 @@ static void EndInterface( intf_thread_t *p_intf )
         }        
     }
 
+#if 0
     /* Destroy all remaining video output threads - all destruction orders are send,
      * then all THREAD_OVER status are received */
     for( i_thread = 0, b_thread = 0; i_thread < VOUT_MAX_THREADS; i_thread++ )
@@ -194,6 +197,6 @@ static void EndInterface( intf_thread_t *p_intf )
             }     
         }
     }
-    
+#endif
 
 }
index 07effa522249128f423c78e48a066df54ede8122..b6bd33f66b327360f33f19d1e37e7de73df66ec6 100644 (file)
 #include "decoder_fifo.h"
 #include "video.h"
 #include "video_output.h"
+
+#include "vdec_idct.h"
 #include "video_decoder.h"
+#include "vdec_motion.h"
+
+#include "vpar_blocks.h"
+#include "vpar_headers.h"
+#include "video_fifo.h"
 #include "video_parser.h"
-#include "parser_fifo.h"
 
 /*
  * Local prototypes
@@ -81,7 +87,7 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
     p_vpar->fifo.i_end = 0;
     /* Initialize the bit stream structure */
     p_vpar->bit_stream.p_input = p_input;
-    p_vpar->bit_stream.p_parser_fifo = &p_vpar->fifo;
+    p_vpar->bit_stream.p_decoder_fifo = &p_vpar->fifo;
     p_vpar->bit_stream.fifo.buffer = 0;
     p_vpar->bit_stream.fifo.i_available = 0;
 
@@ -172,12 +178,12 @@ static int InitThread( vpar_thread_t *p_vpar )
 #endif
 
     /* Initialize parsing data */
-    p_vpar->sequence.p_forward = p_vpar->sequence.p_backward = NULL;
-    p_vpar->sequence.intra_quant.b_allocated = FALSE;
-    p_vpar->sequence.nonintra_quant.b_allocated = FALSE;
-    p_vpar->sequence.chroma_intra_quant.b_allocated = FALSE;
-    p_vpar->sequence.chroma_nonintra_quant.b_allocated = FALSE;
-    p_vpar->sequence.i_frame_number = 0;
+    p_vpar->sequence.p_forward = NULL;
+    p_vpar->sequence.p_backward = NULL;
+    p_vpar->sequence.intra_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_nonintra_quant.b_allocated = 0;
     /* Initialize copyright information */
     p_vpar->sequence.b_copyright_flag = 0;
     p_vpar->sequence.b_original = 0;
@@ -201,7 +207,7 @@ static int InitThread( vpar_thread_t *p_vpar )
     /* Initialize video FIFO */
     vpar_InitFIFO( p_vpar );
     
-    bzero( p_vpar->p_vdec, MAX_VDEC*sizeof(vdec_thread_t *) );
+    bzero( p_vpar->p_vdec, NB_VDEC*sizeof(vdec_thread_t *) );
     
     /* Spawn video_decoder threads */
     /* ??? modify the number of vdecs at runtime ? */
@@ -226,8 +232,6 @@ static int InitThread( vpar_thread_t *p_vpar )
  *******************************************************************************/
 static void RunThread( vpar_thread_t *p_vpar )
 {
-    int i_dummy;
-
     intf_DbgMsg("vpar debug: running video parser thread (%p) (pid == %i)\n", p_vpar, getpid());
 
     /* 
index 14e216069e02411ae6546c99b2bd74f3acc8e193..8ebded607162b33a75a480a10acdb4f824a0f912 100644 (file)
@@ -67,14 +67,15 @@ static void ExtensionAndUserData( vpar_thread_t * p_vpar )
 /*****************************************************************************
  * vpar_NextSequenceHeader : Find the next sequence header
  *****************************************************************************/
-void vpar_NextSequenceHeader( vpar_thread_t * p_vpar )
+int vpar_NextSequenceHeader( vpar_thread_t * p_vpar )
 {
     while( !p_vpar->b_die )
     {
         NextStartCode( p_vpar );
         if( ShowBits( &p_vpar->bit_stream, 32 ) == SEQUENCE_START_CODE )
-            return;
+            return 0;
     }
+    return 1;
 }
 
 /*****************************************************************************
@@ -123,7 +124,7 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
 static __inline__ void NextStartCode( vpar_thread_t * p_vpar )
 {
     /* Re-align the buffer on an 8-bit boundary */
-    DumpBits( &p_vpar->bit_stream, p_vpar->bit_stream.fifo.i_available & 7 );
+    RealignBits( &p_vpar->bit_stream );
 
     while( ShowBits( &p_vpar->bit_stream, 24 ) != 0x01L && !p_vpar->b_die )
     {
@@ -461,7 +462,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         /* Initialize values. */
         P_picture->date = vpar_SynchroDecode( p_vpar, i_coding_type,
                                               i_structure );
-        bzero( p_vpar->picture.pp_mb, MAX_MB*sizeof( macroblock_t * ) );
         p_vpar->picture.i_lum_incr = - 8 + ( p_vpar->sequence.i_width
                     << ( i_structure != FRAME_STRUCTURE ) );
         p_vpar->picture.i_chroma_incr = -8 + ( p_vpar->sequence.i_width
@@ -469,7 +469,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
                         ( 3 - p_vpar->sequence.i_chroma_format )) );
 
         /* Update the reference pointers. */
-        ReferenceUpdate( p_vpar, i_coding_type, p_undec_p );
+        ReferenceUpdate( p_vpar, i_coding_type, p_picture );
     }
     p_vpar->picture.i_current_structure |= i_structure;
     p_vpar->picture.i_structure = i_structure;