]> git.sesse.net Git - vlc/commitdiff
Modification du decoder_fifo : le GetByte devrait etre un chouilla plus rapide,
authorMichel Lespinasse <walken@videolan.org>
Fri, 18 Feb 2000 00:26:23 +0000 (00:26 +0000)
committerMichel Lespinasse <walken@videolan.org>
Fri, 18 Feb 2000 00:26:23 +0000 (00:26 +0000)
ce qui devrait au minimum compenser la perte due a ma derniere modification.

Makefile
include/decoder_fifo.h
src/ac3_decoder/ac3_decoder.c
src/audio_decoder/audio_decoder.c
src/misc/decoder_fifo.c
src/spu_decoder/spu_decoder.c
src/video_parser/video_parser.c

index 01373b35358bf5cc8740154c06e2b7e7219c5b02..d415dada12718b1b949e5442b1a8bd555af08700 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ AUDIO += dummy
 
 # Video output settings
 VIDEO = x11
-VIDEO += fb
+#VIDEO += fb
 #VIDEO += ggi
 #VIDEO += glide
 # Not yet supported
index 2e0fadf5187527cd0ecda87dfe3b190887558d87..4e0dbf7b35c05861eb40175a4b46adadd1799299 100644 (file)
@@ -80,8 +80,10 @@ typedef struct bit_stream_s
      */
     /* Current TS packet (in the current PES packet of the PES stream) */
     ts_packet_t *       p_ts;
-    /* Index of the next byte that is to be read (in the current TS packet) */
-    unsigned int        i_byte;
+    /* Pointer to the next byte that is to be read (in the current TS packet) */
+    byte_t *            p_byte;
+    /* Pointer to the last byte that is to be read (in the current TS packet */
+    byte_t *            p_end;
 
     /*
      * Bit structures
@@ -98,13 +100,14 @@ void decoder_fifo_next( bit_stream_t * p_bit_stream );
 static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
 {
     /* Are there some bytes left in the current TS packet ? */
-    if ( p_bit_stream->i_byte >= p_bit_stream->p_ts->i_payload_end )
+    /* could change this test to have a if (! (bytes--)) instead */
+    if ( p_bit_stream->p_byte >= p_bit_stream->p_end )
     {
        /* no, switch to next TS packet */
        decoder_fifo_next( p_bit_stream );
     }
 
-    return( p_bit_stream->p_ts->buffer[ p_bit_stream->i_byte++ ] );
+    return( *(p_bit_stream->p_byte++));
 }
 
 /*****************************************************************************
index f6b713df539948c131f69658f35e00ab8860375b..483bfc18b230f20a10b22271dcd331ef69b40ea6 100644 (file)
@@ -177,7 +177,8 @@ static int InitThread( ac3dec_thread_t * p_ac3dec )
         vlc_cond_wait( &p_ac3dec->fifo.data_wait, &p_ac3dec->fifo.data_lock );
     }
     p_ac3dec->bit_stream.p_ts = DECODER_FIFO_START( p_ac3dec->fifo )->p_first_ts;
-    p_ac3dec->bit_stream.i_byte = p_ac3dec->bit_stream.p_ts->i_payload_start;
+    p_ac3dec->bit_stream.p_byte = p_ac3dec->bit_stream.p_ts->buffer + p_ac3dec->bit_stream.p_ts->i_payload_start;
+    p_ac3dec->bit_stream.p_end = p_ac3dec->bit_stream.p_ts->buffer + p_ac3dec->bit_stream.p_ts->i_payload_end;
     vlc_mutex_unlock( &p_ac3dec->fifo.data_lock );
 
     aout_fifo.i_type = AOUT_ADEC_STEREO_FIFO;
index 6555d766cfdd3a3cab52e5c8d563111ea62128ad..fd348ab9368a043137ce297bfe13c8d8e0c6159c 100644 (file)
@@ -721,7 +721,8 @@ static int InitThread( adec_thread_t * p_adec )
         vlc_cond_wait( &p_adec->fifo.data_wait, &p_adec->fifo.data_lock );
     }
     p_adec->bit_stream.p_ts = DECODER_FIFO_START( p_adec->fifo )->p_first_ts;
-    p_adec->bit_stream.i_byte = p_adec->bit_stream.p_ts->i_payload_start;
+    p_adec->bit_stream.p_byte = p_adec->bit_stream.p_ts->buffer + p_adec->bit_stream.p_ts->i_payload_start;
+    p_adec->bit_stream.p_end = p_adec->bit_stream.p_ts->buffer + p_adec->bit_stream.p_ts->i_payload_end;
     vlc_mutex_unlock( &p_adec->fifo.data_lock );
 
     /* Now we look for an audio frame header in the input stream */
index 24c6a8c19f58d710c019ceea0a6bb15645effe6f..e87f82b9f4a738b2bcbf54ded9d4a4d41f7f7725 100644 (file)
@@ -71,5 +71,6 @@ void decoder_fifo_next( bit_stream_t * p_bit_stream )
     } while ( p_bit_stream->p_ts->i_payload_start == p_bit_stream->p_ts->i_payload_end );
 
     /* We've found a TS packet which contains interesting data... */
-    p_bit_stream->i_byte = p_bit_stream->p_ts->i_payload_start;
+    p_bit_stream->p_byte = p_bit_stream->p_ts->buffer + p_bit_stream->p_ts->i_payload_start;
+    p_bit_stream->p_end = p_bit_stream->p_ts->buffer + p_bit_stream->p_ts->i_payload_end;
 }
index add2858db48cd5f41798c452e78814ae3a3a6323..06de40dc15c86f3f67ed868fb0e7c29139a2c9af 100644 (file)
@@ -141,7 +141,8 @@ static int InitThread( spudec_thread_t *p_spudec )
     }
 
     p_spudec->bit_stream.p_ts = DECODER_FIFO_START( p_spudec->fifo )->p_first_ts;
-    p_spudec->bit_stream.i_byte = p_spudec->bit_stream.p_ts->i_payload_start;
+    p_spudec->bit_stream.p_byte = p_spudec->bit_stream.p_ts->buffer + p_spudec->bit_stream.p_ts->i_payload_start;
+    p_spudec->bit_stream.p_end = p_spudec->bit_stream.p_ts->buffer + p_spudec->bit_stream.p_ts->i_payload_end;
     vlc_mutex_unlock( &p_spudec->fifo.data_lock );
 
     /* Mark thread as running and return */
index 87f78d6bf7171b2c07874ff7ed58ddead93bc37b..97c50c1abfb1a76ba700c8bbdb86fd1b93bf5474 100644 (file)
@@ -181,7 +181,8 @@ static int InitThread( vpar_thread_t *p_vpar )
         vlc_cond_wait( &p_vpar->fifo.data_wait, &p_vpar->fifo.data_lock );
     }
     p_vpar->bit_stream.p_ts = DECODER_FIFO_START( p_vpar->fifo )->p_first_ts;
-    p_vpar->bit_stream.i_byte = p_vpar->bit_stream.p_ts->i_payload_start;
+    p_vpar->bit_stream.p_byte = p_vpar->bit_stream.p_ts->buffer + p_vpar->bit_stream.p_ts->i_payload_start;
+    p_vpar->bit_stream.p_end = p_vpar->bit_stream.p_ts->buffer + p_vpar->bit_stream.p_ts->i_payload_end;
     vlc_mutex_unlock( &p_vpar->fifo.data_lock );
 
     /* Initialize parsing data */