From 56bb12917e2270e26f9506c7301c830b68b3ccce Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Mon, 3 Jan 2000 20:38:32 +0000 Subject: [PATCH] =?UTF-8?q?*=20Makefile=20:=20ajout=20du=20nouveau=20d?= =?UTF-8?q?=EF=BF=BDcodeur=20(comment=EF=BF=BD)=20;=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20suppression=20du=20video=5Foutput=20pour?= =?UTF-8?q?=20que=20Ptyx=20puisse=20committer=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20ses=20trucs=20sans=20craindre=20de=20tout=20cass?= =?UTF-8?q?er=20le=20cvs=20;=20*=20interface/*=20:=20d=EF=BF=BDsactivage?= =?UTF-8?q?=20du=20video=5Foutput=20;=20*=20include/config.h=20:=20plein?= =?UTF-8?q?=20de=20directives=20pour=20le=20parseur=20et=20le=20d=EF=BF=BD?= =?UTF-8?q?codeur=20;=20*=20include/decoder=5Ffifo.h=20:=20nouvelles=20pri?= =?UTF-8?q?mitives=20pour=20le=20parseur=20;=20*=20le=20reste=20:=20ben=20?= =?UTF-8?q?de=20quoi=20faire=20compiler=20video=5Fparser.c,=20bug=20fixes?= =?UTF-8?q?=20=20=20essentiellement=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eviv Bulgroz ! --- Makefile | 18 ++++++-- include/config.h | 24 +++++++++++ include/decoder_fifo.h | 76 ++++++++++++++++++++++++++++++--- include/vdec_idct.h | 25 +++++++++++ include/vdec_motion.h | 14 +++--- include/video_decoder.h.new | 13 +++++- include/video_fifo.h | 3 ++ include/video_parser.h | 35 +++++++++++++++ include/vpar_blocks.h | 41 ++---------------- include/vpar_headers.h | 22 +++++++--- src/interface/control.c | 4 ++ src/interface/interface.c | 5 ++- src/video_parser/video_parser.c | 26 ++++++----- src/video_parser/vpar_headers.c | 10 ++--- 14 files changed, 235 insertions(+), 81 deletions(-) create mode 100644 include/vdec_idct.h diff --git a/Makefile b/Makefile index a401258f02..3feb81305f 100644 --- 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) \ diff --git a/include/config.h b/include/config.h index da76a18068..29206fc20a 100644 --- a/include/config.h +++ b/include/config.h @@ -25,6 +25,11 @@ //#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 @@ -219,12 +224,31 @@ /* ?? 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 *******************************************************************************/ diff --git a/include/decoder_fifo.h b/include/decoder_fifo.h index 69d7741ac5..bb4ae66021 100644 --- a/include/decoder_fifo.h +++ b/include/decoder_fifo.h @@ -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 + * 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 index 0000000000..97309a122c --- /dev/null +++ b/include/vdec_idct.h @@ -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 + *****************************************************************************/ diff --git a/include/vdec_motion.h b/include/vdec_motion.h index 44302a072c..2f1e7fc033 100644 --- a/include/vdec_motion.h +++ b/include/vdec_motion.h @@ -14,16 +14,12 @@ /***************************************************************************** * 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 ); diff --git a/include/video_decoder.h.new b/include/video_decoder.h.new index 5dbf77e15a..b4ef7b8bf8 100644 --- a/include/video_decoder.h.new +++ b/include/video_decoder.h.new @@ -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 */ diff --git a/include/video_fifo.h b/include/video_fifo.h index 4c1ad5e3a4..a8021179cb 100644 --- a/include/video_fifo.h +++ b/include/video_fifo.h @@ -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 ); diff --git a/include/video_parser.h b/include/video_parser.h index 86b35f2797..ff629c7941 100644 --- a/include/video_parser.h +++ b/include/video_parser.h @@ -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 )]; +} + diff --git a/include/vpar_blocks.h b/include/vpar_blocks.h index dcbc0fc61d..321e5553fe 100644 --- a/include/vpar_blocks.h +++ b/include/vpar_blocks.h @@ -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 *****************************************************************************/ diff --git a/include/vpar_headers.h b/include/vpar_headers.h index 7f2a7cd71b..90140dd9e8 100644 --- a/include/vpar_headers.h +++ b/include/vpar_headers.h @@ -18,14 +18,16 @@ /***************************************************************************** * 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 ); diff --git a/src/interface/control.c b/src/interface/control.c index 68915be5b2..3dcaa6b2ec 100644 --- a/src/interface/control.c +++ b/src/interface/control.c @@ -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 } diff --git a/src/interface/interface.c b/src/interface/interface.c index c382dce8ca..ce335cd743 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -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 } diff --git a/src/video_parser/video_parser.c b/src/video_parser/video_parser.c index 07effa5222..b6bd33f66b 100644 --- a/src/video_parser/video_parser.c +++ b/src/video_parser/video_parser.c @@ -30,9 +30,15 @@ #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()); /* diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index 14e216069e..8ebded6071 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -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;