]> git.sesse.net Git - vlc/commitdiff
. fix� une b�vue dans la YUV 8 bits
authorSam Hocevar <sam@videolan.org>
Thu, 6 Jul 2000 14:45:51 +0000 (14:45 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 6 Jul 2000 14:45:51 +0000 (14:45 +0000)
 . descendu le d�lai de d�marrage � .5 secondes au lieu de 2
 . un nouvelle synchro qui devrait punixe !!!

include/config.h.in
plugins/yuv/video_yuv8.c
plugins/yuv/video_yuv_macros_8bpp.h
src/ac3_decoder/ac3_decoder_thread.c
src/audio_decoder/audio_decoder_thread.c
src/input/input.c
src/video_parser/vpar_synchro.c

index c5b1e7a657a9dd1c290f2db83ea4a0ecd2a72baa..9aa49cd2f6b7ee2f62d32d01de77abe226e8a387 100644 (file)
 
 /* Duration between the time we receive the TS packet, and the time we will
  * mark it to be presented */
-#define INPUT_PTS_DELAY                 (2*CLOCK_FREQ)
+#define INPUT_PTS_DELAY                 (.5*CLOCK_FREQ)
 
 #define INPUT_DVD_AUDIO_VAR             "vlc_dvd_audio"
 #define INPUT_DVD_CHANNEL_VAR           "vlc_dvd_channel"
  * standard width and height broadcasted MPEG-2 streams or DVDs */
 #define VOUT_WIDTH_VAR                  "vlc_width"
 #define VOUT_HEIGHT_VAR                 "vlc_height"
-#define VOUT_WIDTH_DEFAULT              360
-#define VOUT_HEIGHT_DEFAULT             288
+#define VOUT_WIDTH_DEFAULT              400
+#define VOUT_HEIGHT_DEFAULT             300
 
 /* Maximum width of a scaled source picture - this should be relatively high,
  * since higher stream values will result in no display at all. */
index 15c6b8dc182cc96ecd5a73748da248b2924e3efd..c86178af4c12fd3ec3842053a8bdbf9392cee9a9 100644 (file)
@@ -134,7 +134,6 @@ void ConvertYUV420RGB8( YUV_ARGS_8BPP )
     int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
     int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
 
-    return;
     /*
      * Initialize some values  - i_pic_line_width will store the line skip
      */
index 116f7ae71e6f087cfaa21630093b3cec9dc1f3b5..5c675a0ef0badef20ea79ef73de966be68318f8d 100644 (file)
             p_y -= i_width;                                                   \
             p_u -= i_chroma_width;                                            \
             p_v -= i_chroma_width;                                            \
-            p_pic +=        i_pic_line_width;                                 \
+            p_pic += i_pic_line_width;                                        \
         }                                                                     \
         i_scale_count += i_pic_height;                                        \
         break;                                                                \
index 5d43aec35275e5681fdad49a476a93d89fa5fe1b..ba950ff1e5872fb409dd2752bab7c0b1bafa26e2 100644 (file)
@@ -219,7 +219,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
             int ptr;
             ac3_byte_stream_t * p_byte_stream;
 
-            intf_Msg ("ac3dec: sync\n");
+            intf_DbgMsg ("ac3dec: sync\n");
 
             p_byte_stream = ac3_byte_stream (&p_ac3dec->ac3_decoder);
 
index 29d3efea911e20a30fd4906fd8a85286434c05fe..cfa80bb39519facb46c7c5f88c5520bf8f8a22f1 100644 (file)
@@ -238,7 +238,7 @@ static void RunThread (adec_thread_t * p_adec)
             /* have to find a synchro point */
             adec_byte_stream_t * p_byte_stream;
             
-            intf_Msg ( "adec: sync\n" );
+            intf_DbgMsg ( "adec: sync\n" );
             
             p_adec->align = 0;
             p_byte_stream = adec_byte_stream ( &p_adec->audio_decoder );
index 056a1bf04af792d3f3c4ee21dcc5a770cb31361f..31613dcf6db4f46fc799205efae3bd8b6ade8b4f 100644 (file)
@@ -943,7 +943,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                   intf_DbgMsg("PES packet too short: trashed\n");
                   input_NetlistFreePES( p_input, p_pes );
                   p_pes = NULL;
-                  /* Stats XXX?? */
+                  /* XXX: Stats */
                   return;
                 }
 
@@ -1106,7 +1106,7 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
     {
       /* Trash the packet and set p_pes to NULL to be sure the next PES
          packet will have its b_data_lost flag set */
-      intf_DbgMsg("Corrupted PES packet received: trashed\n");
+      intf_DbgMsg("Corrupted PES packet (size doesn't match) : trashed\n");
       input_NetlistFreePES( p_input, p_pes );
       p_pes = NULL;
       /* Stats XXX?? */
@@ -1133,58 +1133,72 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
             break;
 
         default:
-            /* The PES header contains at least 3 more bytes: parse them */
-            p_pes->b_data_alignment = p_pes->p_pes_header[6] & 0x04;
-            p_pes->b_has_pts = p_pes->p_pes_header[7] & 0x80;
-            i_pes_header_size = p_pes->p_pes_header[8] + 9;
-
-            /* Now parse the optional header extensions (in the limit of
-               the 14 bytes */
-            if( p_pes->b_has_pts )
+            switch( p_pes->p_pes_header[8] & 0xc0 )
             {
-                pcr_descriptor_t * p_pcr;
+              case 0x80: /* MPEG2: 10xx xxxx */
+              case 0x00: /* FIXME: This shouldn't be allowed !! */
+                /* The PES header contains at least 3 more bytes: parse them */
+                p_pes->b_data_alignment = p_pes->p_pes_header[6] & 0x04;
+                p_pes->b_has_pts = p_pes->p_pes_header[7] & 0x80;
+                i_pes_header_size = p_pes->p_pes_header[8] + 9;
+
+                /* Now parse the optional header extensions (in the limit of
+                   the 14 bytes */
+                if( p_pes->b_has_pts )
+                {
+                    pcr_descriptor_t * p_pcr;
 
-                p_pcr = p_input->p_pcr;
+                    p_pcr = p_input->p_pcr;
 
-                p_pes->i_pts =
-                    ( ((mtime_t)(p_pes->p_pes_header[9] & 0x0E) << 29) |
-                      (((mtime_t)U16_AT(p_pes->p_pes_header + 10) << 14) - (1 << 14)) |
-                      ((mtime_t)U16_AT(p_pes->p_pes_header + 12) >> 1) ) * 300;
-                p_pes->i_pts /= 27;
+                    p_pes->i_pts =
+                        ( ((mtime_t)(p_pes->p_pes_header[9] & 0x0E) << 29) |
+                          (((mtime_t)U16_AT(p_pes->p_pes_header + 10) << 14) - (1 << 14)) |
+                          ((mtime_t)U16_AT(p_pes->p_pes_header + 12) >> 1) ) * 300;
+                    p_pes->i_pts /= 27;
 
-                if( p_pcr->i_synchro_state )
-                {
-                    switch( p_pcr->i_synchro_state )
+                    if( p_pcr->i_synchro_state )
                     {
-                        case SYNCHRO_NOT_STARTED:
-                            p_pes->b_has_pts = 0;
-                            break;
-
-                        case SYNCHRO_START:
-                            p_pes->i_pts += p_pcr->delta_pcr;
-                            p_pcr->delta_absolute = mdate() - p_pes->i_pts + INPUT_PTS_DELAY;
-                            p_pes->i_pts += p_pcr->delta_absolute;
-                            p_pcr->i_synchro_state = 0;
-                            break;
-
-                        case SYNCHRO_REINIT: /* We skip a PES */
-                            p_pes->b_has_pts = 0;
-                            p_pcr->i_synchro_state = SYNCHRO_START;
-                            break;
+                        switch( p_pcr->i_synchro_state )
+                        {
+                            case SYNCHRO_NOT_STARTED:
+                                p_pes->b_has_pts = 0;
+                                break;
+
+                            case SYNCHRO_START:
+                                p_pes->i_pts += p_pcr->delta_pcr;
+                                p_pcr->delta_absolute = mdate() - p_pes->i_pts + INPUT_PTS_DELAY;
+                                p_pes->i_pts += p_pcr->delta_absolute;
+                                p_pcr->i_synchro_state = 0;
+                                break;
+
+                            case SYNCHRO_REINIT: /* We skip a PES */
+                                p_pes->b_has_pts = 0;
+                                p_pcr->i_synchro_state = SYNCHRO_START;
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        p_pes->i_pts += p_pcr->delta_pcr + p_pcr->delta_absolute;
                     }
                 }
-                else
-                {
-                    p_pes->i_pts += p_pcr->delta_pcr + p_pcr->delta_absolute;
-                }
+                break;
+
+            default: /* MPEG1 or some strange thing */
+                /* since this isn't supported yet, we certainly gonna crash */
+                intf_ErrMsg( "FIXME: unknown PES type %.2x\n",
+                             p_pes->p_pes_header[8] );
+                i_pes_header_size = 6;
+                break;
+
             }
             break;
         }
 
         /* Now we've parsed the header, we just have to indicate in some
-           specific TS packets where the PES payload begins (renumber
-           i_payload_start), so that the decoders can find the beginning
-           of their data right out of the box. */
+         * specific TS packets where the PES payload begins (renumber
+         * i_payload_start), so that the decoders can find the beginning
+         * of their data right out of the box. */
         p_ts = p_pes->p_first_ts;
         i_ts_payload_size = p_ts->i_payload_end - p_ts->i_payload_start;
         while( i_pes_header_size > i_ts_payload_size )
@@ -1193,8 +1207,8 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
             i_pes_header_size -= i_ts_payload_size;
             p_ts->i_payload_start = p_ts->i_payload_end;
             /* Go to the next TS packet: here we won't have to test it is
-               not NULL because we trash the PES packets when packet lost
-               occurs */
+             * not NULL because we trash the PES packets when packet lost
+             * occurs */
             p_ts = p_ts->p_next_ts;
             i_ts_payload_size = p_ts->i_payload_end - p_ts->i_payload_start;
         }
@@ -1203,7 +1217,7 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
 
 
         /* Now we can eventually put the PES packet in the decoder's
-           PES fifo */
+         * PES fifo */
         switch( p_es_descriptor->i_type )
         {
             case MPEG1_VIDEO_ES:
@@ -1308,9 +1322,9 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
 
 
     /* Try to find the beginning of the payload in the packet to initialise
-       the do-while loop that follows -> Compute the i_data_offset variable:
-       by default, the value is set so that we won't enter in the while loop.
-       It will be set to a correct value if the data are not corrupted */
+     * the do-while loop that follows -> Compute the i_data_offset variable:
+     * by default, the value is set so that we won't enter in the while loop.
+     * It will be set to a correct value if the data are not corrupted */
     i_data_offset = TS_PACKET_SIZE;
 
     /* Has the reassembly of a section already begun in a previous packet ? */
@@ -1328,7 +1342,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
         else
         {
             /* The data that complete a previously began section are always at
-               the beginning of the TS payload... */
+             * the beginning of the TS payload... */
             i_data_offset = p_ts_packet->i_payload_start;
             /* ...Unless there is a pointer field, that we have to bypass */
             if( b_unit_start )
@@ -1342,9 +1356,9 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
         if( b_unit_start )
         {
             /* Get the offset at which the data for that section can be found
-               The offset is stored in the pointer_field since we are
-               interested in the first section of the TS packet. Note that
-               the +1 is to bypass the pointer field */
+             * The offset is stored in the pointer_field since we are
+             * interested in the first section of the TS packet. Note that
+             * the +1 is to bypass the pointer field */
             i_data_offset = p_ts_packet->i_payload_start +
                             p_ts_packet->buffer[p_ts_packet->i_payload_start] + 1;
             //intf_DbgMsg( "New section beginning at offset %d in TS packet\n", i_data_offset );
@@ -1401,7 +1415,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
                 i_data_length );
 
         /* Interesting data are now after the ones we copied, since no gap is
-           allowed between 2 sections in a TS packets */
+         * allowed between 2 sections in a TS packets */
         i_data_offset += i_data_length;
 
         /* Decode the packet if it is now complete */
@@ -1434,3 +1448,4 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
 
 #undef p_psi
 }
+
index 764b718142b39fa0cfef73ee07220a133c113fe3..c7ef44e1cd556934d81a2144ac9d80feed02a0d9 100644 (file)
@@ -65,9 +65,9 @@
 void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                                    int i_coding_type, boolean_t b_kept )
 {
-    mtime_t         i_delay;
+    double          i_can_display;
     mtime_t         i_pts;
-    pes_packet_t *  p_pes = p_vpar->bit_stream.p_decoder_fifo->buffer[ 
+    pes_packet_t *  p_pes = p_vpar->bit_stream.p_decoder_fifo->buffer[
                                p_vpar->bit_stream.p_decoder_fifo->i_start ];
 
     /* try to guess the current DTS and PTS */
@@ -126,58 +126,52 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
             }
 
             /* now we calculated all statistics, it's time to
-             * decide what we have the time to display
-             */
-            i_delay = i_pts - p_vpar->synchro.i_last_kept_I_pts;
+             * decide what we have the time to display */
+            i_can_display = (float)(i_pts - p_vpar->synchro.i_last_kept_I_pts)
+                                / p_vpar->synchro.i_delay;
 
-            p_vpar->synchro.b_all_I
-                = ( p_vpar->synchro.i_delay < i_delay );
+            p_vpar->synchro.b_all_I = 0;
+            p_vpar->synchro.b_all_B = 0;
+            p_vpar->synchro.b_all_P = 0;
+            p_vpar->synchro.displayable_p = 0;
+            p_vpar->synchro.displayable_b = 0;
 
-            p_vpar->synchro.b_all_P
-                    = ( p_vpar->synchro.i_delay
-                    * (1 + p_vpar->synchro.i_P_seen) < i_delay );
-
-            if( !p_vpar->synchro.b_all_P )
-            {
-                p_vpar->synchro.displayable_p
-                    //= -1.0 + (float)i_delay / (float)p_vpar->synchro.i_delay;
-                    = (-1.0 + (float)p_vpar->synchro.displayable_p + (float)i_delay / (float)p_vpar->synchro.i_delay) / 2.0;
-                if( p_vpar->synchro.displayable_p < 0 )
-                    p_vpar->synchro.displayable_p = 0;
-
-                p_vpar->synchro.b_all_B = 0;
-                p_vpar->synchro.displayable_b = 0;
-            }
-            else
+            if( ( p_vpar->synchro.b_all_I = ( i_can_display > 1 ) ) )
             {
-                p_vpar->synchro.displayable_p = p_vpar->synchro.i_P_seen;
+                i_can_display -= 1;
 
-                if( !(p_vpar->synchro.b_all_B
-                        = ( p_vpar->synchro.i_delay
-                        * (1 + p_vpar->synchro.i_B_seen
-                            + p_vpar->synchro.i_P_seen)) < i_delay) )
+                if( !( p_vpar->synchro.b_all_P
+                        = ( i_can_display > p_vpar->synchro.i_P_seen ) ) )
                 {
-                    p_vpar->synchro.displayable_b
-                        //= -2.0 + i_delay / p_vpar->synchro.i_delay - p_vpar->synchro.b_all_P;
-                        = ( -2.0 + (float)p_vpar->synchro.displayable_b + (float)i_delay / (float)p_vpar->synchro.i_delay - (float)p_vpar->synchro.b_all_P) / 2.0;
+                    p_vpar->synchro.displayable_p = i_can_display;
                 }
                 else
                 {
-                    p_vpar->synchro.displayable_b = p_vpar->synchro.i_B_seen;
+                    i_can_display -= p_vpar->synchro.i_P_seen;
+
+                    if( !( p_vpar->synchro.b_all_B
+                            = ( i_can_display > p_vpar->synchro.i_B_seen ) ) )
+                    {
+                        p_vpar->synchro.displayable_b = i_can_display;
+                    }
                 }
             }
 
 #if 1
             if( p_vpar->synchro.b_all_I )
-                intf_ErrMsg( "I: all  " );
+                intf_ErrMsg( "I: 1/1  " );
             if( p_vpar->synchro.b_all_P )
-                intf_ErrMsg( "P: all  " );
+                intf_ErrMsg( "P: %i/%i  ", p_vpar->synchro.i_P_seen,
+                                           p_vpar->synchro.i_P_seen );
             else if( p_vpar->synchro.displayable_p > 0 )
-                intf_ErrMsg( "P: %f  ", p_vpar->synchro.displayable_p );
+                intf_ErrMsg( "P: %.2f/%i  ", p_vpar->synchro.displayable_p,
+                                             p_vpar->synchro.i_P_seen );
             if( p_vpar->synchro.b_all_B )
-                intf_ErrMsg( "B: all" );
+                intf_ErrMsg( "B: %i/%i", p_vpar->synchro.displayable_b,
+                                         p_vpar->synchro.displayable_b );
             else if( p_vpar->synchro.displayable_b > 0 )
-                intf_ErrMsg( "B: %f", p_vpar->synchro.displayable_b );
+                intf_ErrMsg( "B: %.2f/%i", p_vpar->synchro.displayable_b,
+                                           p_vpar->synchro.i_B_seen );
             intf_ErrMsg( "\n" );
 #endif
             p_vpar->synchro.i_P_seen = 0;
@@ -212,6 +206,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
 
         case P_CODING_TYPE:
 
+            //return(1);
             if( p_vpar->synchro.b_all_P )
             {
                 //intf_ErrMsg( " p  " );