From: Sam Hocevar Date: Mon, 7 Aug 2000 22:18:24 +0000 (+0000) Subject: * vlc.init becomes ~/.vlcrc X-Git-Tag: 0.2.70~434 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f6268f60f4d02aadbb8b14046f0aa96b39af63a8;p=vlc * vlc.init becomes ~/.vlcrc * removed float operations in the video decoder, and all emms asm functions * borrowed linuxvideo's MMX motion compensation * fixed an undefined symbol in the MMX YUV plugin Meuuh & Sam. --- diff --git a/AUTHORS b/AUTHORS index 1bd31b4166..ae27f66211 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,8 +2,7 @@ Régis Duchesne Michel Lespinasse - Olivier Baxa - Eric Estievenart + Olivier Pomel Jean-Philippe Grimaldi Andres Krapf @@ -14,11 +13,9 @@ Jean-Marc Dressler Gaël Hendryckx Samuel Hocevar + Brieuc Jeunhomme Michel Kaempf Stéphane Borel Renaud Dartus - Henri Fallon - Contributors include Aaron Holtzman for his ac3dec decoder, and the - LiViD team for a few lines of code we borrowed here and there. diff --git a/ChangeLog b/ChangeLog index 6cabbeb3e7..76e794a057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ * "gvlc", "fbvlc", "ggivlc" aliases now work * fixed functions that weren't properly inlined * removed bloat from the MMX YUV plugin + * vlc.init becomes ~/.vlcrc + * removed float operations in the video decoder, and all emms asm functions + * borrowed linuxvideo's MMX motion compensation + * fixed an undefined symbol in the MMX YUV plugin Thu Jul 20 15:14:06 CEST 2000 0.1.99e : diff --git a/Makefile.in b/Makefile.in index e1d3a5fdcc..706e8da3fb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -156,69 +156,75 @@ endif # # C Objects # -interface_obj = interface/main.o \ - interface/interface.o \ - interface/intf_msg.o \ - interface/intf_cmd.o \ - interface/intf_ctrl.o \ - interface/intf_console.o - -input_obj = input/input_vlan.o \ - input/input_file.o \ - input/input_netlist.o \ - input/input_network.o \ - input/input_ctrl.o \ - input/input_pcr.o \ - input/input_psi.o \ - input/input.o - -audio_output_obj = audio_output/audio_output.o - -video_output_obj = video_output/video_output.o \ - video_output/video_text.o \ - video_output/video_spu.o \ - video_output/video_yuv.o - -ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \ - ac3_decoder/ac3_decoder.o \ - ac3_decoder/ac3_parse.o \ - ac3_decoder/ac3_exponent.o \ - ac3_decoder/ac3_bit_allocate.o \ - ac3_decoder/ac3_mantissa.o \ - ac3_decoder/ac3_rematrix.o \ - ac3_decoder/ac3_imdct.o \ - ac3_decoder/ac3_downmix.o +interface_obj = interface/main.o \ + interface/interface.o \ + interface/intf_msg.o \ + interface/intf_cmd.o \ + interface/intf_ctrl.o \ + interface/intf_console.o + +input_obj = input/input_vlan.o \ + input/input_file.o \ + input/input_netlist.o \ + input/input_network.o \ + input/input_ctrl.o \ + input/input_pcr.o \ + input/input_psi.o \ + input/input.o + +audio_output_obj = audio_output/audio_output.o + +video_output_obj = video_output/video_output.o \ + video_output/video_text.o \ + video_output/video_spu.o \ + video_output/video_yuv.o + +ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \ + ac3_decoder/ac3_decoder.o \ + ac3_decoder/ac3_parse.o \ + ac3_decoder/ac3_exponent.o \ + ac3_decoder/ac3_bit_allocate.o \ + ac3_decoder/ac3_mantissa.o \ + ac3_decoder/ac3_rematrix.o \ + ac3_decoder/ac3_imdct.o \ + ac3_decoder/ac3_downmix.o -lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \ - lpcm_decoder/lpcm_decoder.o +lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \ + lpcm_decoder/lpcm_decoder.o -audio_decoder_obj = audio_decoder/audio_decoder_thread.o \ - audio_decoder/audio_decoder.o \ - audio_decoder/audio_math.o +audio_decoder_obj = audio_decoder/audio_decoder_thread.o \ + audio_decoder/audio_decoder.o \ + audio_decoder/audio_math.o -spu_decoder_obj = spu_decoder/spu_decoder.o +spu_decoder_obj = spu_decoder/spu_decoder.o #??generic_decoder_obj = generic_decoder/generic_decoder.o # remeber to add it to OBJ -video_parser_obj = video_parser/video_parser.o \ - video_parser/vpar_headers.o \ - video_parser/vpar_blocks.o \ - video_parser/vpar_synchro.o \ - video_parser/video_fifo.o - -video_decoder_obj = video_decoder/video_decoder.o \ - video_decoder/vdec_motion.o \ - video_decoder/vdec_motion_inner.o \ - video_decoder/vdec_idct.o - -misc_obj = misc/mtime.o \ - misc/tests.o \ - misc/rsc_files.o \ - misc/netutils.o \ - misc/playlist.o \ - misc/plugins.o \ - misc/decoder_fifo.o +video_parser_obj = video_parser/video_parser.o \ + video_parser/vpar_headers.o \ + video_parser/vpar_blocks.o \ + video_parser/vpar_synchro.o \ + video_parser/video_fifo.o + +ifneq (,$(findstring mmx,$(ARCH))) + vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o +else + vdec_motion_inner = video_decoder/vdec_motion_inner.o +endif + +video_decoder_obj = video_decoder/video_decoder.o \ + video_decoder/vdec_motion.o \ + video_decoder/vdec_idct.o \ + $(vdec_motion_inner) + +misc_obj = misc/mtime.o \ + misc/tests.o \ + misc/rsc_files.o \ + misc/netutils.o \ + misc/playlist.o \ + misc/plugins.o \ + misc/decoder_fifo.o C_OBJ = $(interface_obj) \ diff --git a/include/config.h.in b/include/config.h.in index 24c9aafb51..cdeeadfece 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -127,8 +127,8 @@ *****************************************************************************/ /* Environment variable used to store startup script name and default value */ -#define INTF_INIT_SCRIPT_VAR "vlc_init" -#define INTF_INIT_SCRIPT_DEFAULT "vlc.init" +#define INTF_INIT_SCRIPT_VAR "vlcrc" +#define INTF_INIT_SCRIPT_DEFAULT ".vlcrc" /* Environment variable used to store channels file and default value */ #define INTF_CHANNELS_VAR "vlc_channels" @@ -434,6 +434,7 @@ * Synchro configuration *****************************************************************************/ -#define VOUT_SYNCHRO_LEVEL_START 5 -#define VOUT_SYNCHRO_LEVEL_MAX 15 +#define VOUT_SYNCHRO_LEVEL_START 5 << 10 +#define VOUT_SYNCHRO_LEVEL_MAX 15 << 10 #define VOUT_SYNCHRO_HEAP_IDEAL_SIZE 5 + diff --git a/include/vpar_blocks.h b/include/vpar_blocks.h index d757f5ac93..1d6ef17bf0 100644 --- a/include/vpar_blocks.h +++ b/include/vpar_blocks.h @@ -166,17 +166,4 @@ void vpar_InitPMBType( struct vpar_thread_s * p_vpar ); void vpar_InitBMBType( struct vpar_thread_s * p_vpar ); void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar ); void vpar_InitDCTTables( struct vpar_thread_s * p_vpar ); -void vpar_PictureDataGENERIC( struct vpar_thread_s * p_vpar, int i_mb_base ); -#if (VPAR_OPTIM_LEVEL > 0) -void vpar_PictureData2I420F0( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2P420F0( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2B420F0( struct vpar_thread_s * p_vpar, int i_mb_base ); -#endif -#if (VPAR_OPTIM_LEVEL > 1) -void vpar_PictureData2I420TZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2P420TZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2B420TZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2I420BZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2P420BZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -void vpar_PictureData2B420BZ( struct vpar_thread_s * p_vpar, int i_mb_base ); -#endif +void vpar_PictureData( struct vpar_thread_s * p_vpar, int i_mb_base ); diff --git a/include/vpar_headers.h b/include/vpar_headers.h index 6b27a1f1af..72ed0e6301 100644 --- a/include/vpar_headers.h +++ b/include/vpar_headers.h @@ -58,7 +58,7 @@ typedef struct sequence_s /* the same, in macroblock units */ unsigned int i_aspect_ratio; /* height/width display ratio */ unsigned int i_matrix_coefficients;/* coeffs of the YUV transform */ - float r_frame_rate; /* theoritical frame rate in fps */ + int i_frame_rate; /* theoritical frame rate in fps*1001 */ boolean_t b_mpeg2; /* guess */ boolean_t b_progressive; /* progressive (ie. * non-interlaced) frame */ diff --git a/include/vpar_synchro.h b/include/vpar_synchro.h index 6f7bdfc441..151531053c 100644 --- a/include/vpar_synchro.h +++ b/include/vpar_synchro.h @@ -67,9 +67,9 @@ typedef struct video_synchro_s /* can we display pictures ? */ boolean_t b_all_I; boolean_t b_all_P; - double displayable_p; + int displayable_p; boolean_t b_all_B; - double displayable_b; + int displayable_b; } video_synchro_t; @@ -100,7 +100,7 @@ typedef struct video_synchro_s /* Date Section */ /* Dates needed to compute the date of the current frame - * We also use the stream frame rate (sequence.r_frame_rate) */ + * We also use the stream frame rate (sequence.i_frame_rate) */ mtime_t i_current_frame_date; mtime_t i_backward_frame_date; diff --git a/plugins/yuvmmx/video_yuv.c b/plugins/yuvmmx/video_yuv.c index e8087038cf..69840ff472 100644 --- a/plugins/yuvmmx/video_yuv.c +++ b/plugins/yuvmmx/video_yuv.c @@ -131,12 +131,8 @@ int yuv_MMXReset( vout_thread_t *p_vout ) + *****************************************************************************/ void SetYUV( vout_thread_t *p_vout ) { - int pi_gamma[256]; /* gamma table */ int i_index; /* index in tables */ - /* Build gamma table */ - SetGammaTable( pi_gamma, p_vout->f_gamma ); - /* * Set pointers and build YUV tables */ diff --git a/plugins/yuvmmx/video_yuv.h b/plugins/yuvmmx/video_yuv.h index 4e0673bb3b..a2771b995a 100644 --- a/plugins/yuvmmx/video_yuv.h +++ b/plugins/yuvmmx/video_yuv.h @@ -53,7 +53,6 @@ int i_pic_height, int i_pic_line_width, int i_matrix_coefficients /***************************************************************************** * Local prototypes *****************************************************************************/ -void SetGammaTable ( int *pi_table, double f_gamma ); void SetYUV ( vout_thread_t *p_vout ); void SetOffset ( int i_width, int i_height, int i_pic_width, int i_pic_height, boolean_t *pb_h_scaling, diff --git a/src/interface/intf_cmd.c b/src/interface/intf_cmd.c index 5f89ce9563..d5933b7681 100644 --- a/src/interface/intf_cmd.c +++ b/src/interface/intf_cmd.c @@ -158,14 +158,23 @@ int intf_ExecScript( char *psz_filename ) FILE * p_file; /* file */ char psz_line[INTF_MAX_CMD_SIZE]; /* line */ char * psz_index; /* index in string */ + char * psz_vlcrc; /* full path to vlcrc */ int i_err; /* error indicator */ /* Open file */ i_err = 0; - p_file = fopen( psz_filename, "r" ); + + if( !( psz_index = getenv("HOME") ) ) + { + psz_index = "/"; + } + psz_vlcrc = malloc( strlen( psz_index ) + 1 + strlen( psz_filename ) + 1 ); + sprintf( psz_vlcrc, "%s/%s", psz_index, psz_filename ); + + p_file = fopen( psz_vlcrc, "r" ); if( p_file == NULL ) { - intf_DbgMsg("intf warning: %s: %s\n", psz_filename, strerror(errno)); + intf_DbgMsg("intf warning: %s: %s\n", psz_vlcrc, strerror(errno)); return( -1 ); } @@ -194,7 +203,7 @@ int intf_ExecScript( char *psz_filename ) } if( !feof( p_file ) ) { - intf_ErrMsg("error: %s: %s\n", psz_filename, strerror(errno)); + intf_ErrMsg("error: %s: %s\n", psz_vlcrc, strerror(errno)); return( -1 ); } diff --git a/src/video_decoder/video_decoder.c b/src/video_decoder/video_decoder.c index 5e40392f88..acca7dad72 100644 --- a/src/video_decoder/video_decoder.c +++ b/src/video_decoder/video_decoder.c @@ -322,8 +322,8 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, "packuswb %%mm1,%%mm2\n\t" "movq %%mm2,(%0)\n\t" - "emms" - :"+r" (p_data): "r" (p_block),"r" (i_incr+8)); + //"emms" + :"+r" (p_data): "r" (p_block),"r" (i_incr+8)); } #endif @@ -389,7 +389,7 @@ static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, "movq 112(%1),%%mm0\n\t" "packuswb 120(%1),%%mm0\n\t" "movq %%mm0,(%0)\n\t" - "emms" + //"emms" :"+r" (p_data): "r" (p_block),"r" (i_incr+8)); } #endif diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 86a0a779be..4941555973 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1691,7 +1691,7 @@ static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic ) */ if( p_vout->c_fps_samples > VOUT_FPS_SAMPLES ) { - sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 / + sprintf( psz_buffer, "%.2f fps/10", VOUT_FPS_SAMPLES * 1000000 * 10 / ( p_vout->p_fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] - p_vout->p_fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) ); Print( p_vout, 0, 0, RIGHT_RALIGN, TOP_RALIGN, psz_buffer ); @@ -1939,7 +1939,7 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay ) /* XXX?? gore following */ static int i_panic_count = 0; static int i_last_synchro_inc = 0; - static float r_synchro_level = VOUT_SYNCHRO_LEVEL_START; + static int i_synchro_level = VOUT_SYNCHRO_LEVEL_START; static int i_truc = 10; if( i_delay < 0 ) @@ -1965,7 +1965,7 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay ) } } - if( i_truc > VOUT_SYNCHRO_LEVEL_MAX*2*2*2*2*2 || + if( i_truc > VOUT_SYNCHRO_LEVEL_MAX >> 5 || i_synchro_inc*i_last_synchro_inc < 0 ) { i_truc = 32; @@ -1985,17 +1985,17 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay ) } else if( i_delay > 100000 ) { - r_synchro_level += 1; + i_synchro_level += 1 << 10; if( i_delay > 130000 ) - r_synchro_level += 1; + i_synchro_level += 1 << 10; } - r_synchro_level += (float)i_synchro_inc / i_truc; - p_vout->i_synchro_level = (int)(r_synchro_level+0.5); + i_synchro_level += ( i_synchro_inc << 10 ) / i_truc; + p_vout->i_synchro_level = ( i_synchro_level + (1 << 9) ); - if( r_synchro_level > VOUT_SYNCHRO_LEVEL_MAX ) + if( i_synchro_level > VOUT_SYNCHRO_LEVEL_MAX ) { - r_synchro_level = VOUT_SYNCHRO_LEVEL_MAX; + i_synchro_level = VOUT_SYNCHRO_LEVEL_MAX; } //fprintf( stderr, "synchro level : %d, heap : %d (%d, %d) (%d, %f) - %Ld\n", p_vout->i_synchro_level, diff --git a/src/video_parser/video_parser.c b/src/video_parser/video_parser.c index 45abb382d6..aaa559d31b 100644 --- a/src/video_parser/video_parser.c +++ b/src/video_parser/video_parser.c @@ -291,14 +291,14 @@ static int InitThread( vpar_thread_t *p_vpar ) p_vpar->synchro.i_delay = 200000; p_vpar->synchro.i_theorical_delay = 40000; /* 25 fps */ /* assume we can display all Is and 2 Ps */ - p_vpar->synchro.b_all_I = 1; + p_vpar->synchro.b_all_I = 1 << 10; p_vpar->synchro.b_all_P = 0; - p_vpar->synchro.displayable_p = 2; + p_vpar->synchro.displayable_p = 2 << 10; p_vpar->synchro.b_all_B = 0; p_vpar->synchro.displayable_b = 0; /* assume there were about 3 P and 6 B images between I's */ - p_vpar->synchro.i_P_seen = p_vpar->synchro.i_P_kept = 1; - p_vpar->synchro.i_B_seen = p_vpar->synchro.i_B_kept = 1; + p_vpar->synchro.i_P_seen = p_vpar->synchro.i_P_kept = 1 << 10; + p_vpar->synchro.i_B_seen = p_vpar->synchro.i_B_kept = 1 << 10; #endif #ifdef MEUUH_SYNCHRO diff --git a/src/video_parser/vpar_blocks.c b/src/video_parser/vpar_blocks.c index c8386d74a1..d6dbbe654b 100644 --- a/src/video_parser/vpar_blocks.c +++ b/src/video_parser/vpar_blocks.c @@ -618,7 +618,7 @@ void vpar_InitDCTTables( vpar_thread_t * p_vpar ) /***************************************************************************** * DecodeMPEG1NonIntra : decode MPEG-1 non-intra blocks *****************************************************************************/ -static void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar, +static __inline__ void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b, int i_chroma_format ) { @@ -729,7 +729,7 @@ static void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar, /***************************************************************************** * DecodeMPEG1Intra : decode MPEG-1 intra blocks *****************************************************************************/ -static void DecodeMPEG1Intra( vpar_thread_t * p_vpar, +static __inline__ void DecodeMPEG1Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b , int i_chroma_format ) { @@ -876,7 +876,7 @@ static void DecodeMPEG1Intra( vpar_thread_t * p_vpar, /***************************************************************************** * DecodeMPEG2NonIntra : decode MPEG-2 non-intra blocks *****************************************************************************/ -static void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar, +static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b, int i_chroma_format ) { @@ -985,7 +985,7 @@ static void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar, /***************************************************************************** * DecodeMPEG2Intra : decode MPEG-2 intra blocks *****************************************************************************/ -static void DecodeMPEG2Intra( vpar_thread_t * p_vpar, +static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b, int i_chroma_format ) { @@ -1135,7 +1135,7 @@ static void DecodeMPEG2Intra( vpar_thread_t * p_vpar, /**************************************************************************** * MotionCode : Parse the next motion code ****************************************************************************/ -static int MotionCode( vpar_thread_t * p_vpar ) +static __inline__ int MotionCode( vpar_thread_t * p_vpar ) { int i_code; static lookup_t pl_mv_tab0[8] = @@ -1184,7 +1184,7 @@ static int MotionCode( vpar_thread_t * p_vpar ) /**************************************************************************** * DecodeMotionVector : Decode a motion_vector ****************************************************************************/ -static void DecodeMotionVector( int * pi_prediction, int i_r_size, +static __inline__ void DecodeMotionVector( int * pi_prediction, int i_r_size, int i_motion_code, int i_motion_residual, int i_full_pel ) { int i_limit, i_vector; @@ -1211,7 +1211,7 @@ static void DecodeMotionVector( int * pi_prediction, int i_r_size, /**************************************************************************** * MotionVector : Parse the next motion_vector field ****************************************************************************/ -static void MotionVector( vpar_thread_t * p_vpar, +static __inline__ void MotionVector( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_r, int i_s, int i_full_pel, int i_structure ) { @@ -1321,7 +1321,7 @@ static void MotionVector( vpar_thread_t * p_vpar, * DecodeMVMPEG1 : Parse the next MPEG-1 motion vectors *****************************************************************************/ static void DecodeMVMPEG1( vpar_thread_t * p_vpar, - macroblock_t * p_mb, int i_s, int i_structure ) + macroblock_t * p_mb, int i_s, int i_structure ) { MotionVector( p_vpar, p_mb, 0, i_s, p_vpar->picture.pb_full_pel_vector[i_s], i_structure ); @@ -1331,7 +1331,7 @@ static void DecodeMVMPEG1( vpar_thread_t * p_vpar, * DecodeMVMPEG2 : Parse the next MPEG-2 motion_vectors field *****************************************************************************/ static void DecodeMVMPEG2( vpar_thread_t * p_vpar, - macroblock_t * p_mb, int i_s, int i_structure ) + macroblock_t * p_mb, int i_s, int i_structure ) { if( p_vpar->mb.i_mv_count == 1 ) { @@ -1389,7 +1389,7 @@ static int MacroblockAddressIncrement( vpar_thread_t * p_vpar ) /***************************************************************************** * IMBType : macroblock_type in I pictures *****************************************************************************/ -static int IMBType( vpar_thread_t * p_vpar ) +static __inline__ int IMBType( vpar_thread_t * p_vpar ) { /* Take two bits for testing */ int i_type = ShowBits( &p_vpar->bit_stream, 2 ); @@ -1407,7 +1407,7 @@ static int IMBType( vpar_thread_t * p_vpar ) /***************************************************************************** * PMBType : macroblock_type in P pictures *****************************************************************************/ -static int PMBType( vpar_thread_t * p_vpar ) +static __inline__ int PMBType( vpar_thread_t * p_vpar ) { /* Testing on 6 bits */ int i_type = ShowBits( &p_vpar->bit_stream, 6 ); @@ -1421,7 +1421,7 @@ static int PMBType( vpar_thread_t * p_vpar ) /***************************************************************************** * BMBType : macroblock_type in B pictures *****************************************************************************/ -static int BMBType( vpar_thread_t * p_vpar ) +static __inline__ int BMBType( vpar_thread_t * p_vpar ) { /* Testing on 6 bits */ int i_type = ShowBits( &p_vpar->bit_stream, 6 ); @@ -1436,7 +1436,7 @@ static int BMBType( vpar_thread_t * p_vpar ) /***************************************************************************** * DMBType : macroblock_type in D pictures *****************************************************************************/ -static int DMBType( vpar_thread_t * p_vpar ) +static __inline__ int DMBType( vpar_thread_t * p_vpar ) { return GetBits( &p_vpar->bit_stream, 1 ); } @@ -1444,7 +1444,7 @@ static int DMBType( vpar_thread_t * p_vpar ) /***************************************************************************** * CodedPattern420 : coded_block_pattern with 4:2:0 chroma *****************************************************************************/ -static int CodedPattern420( vpar_thread_t * p_vpar ) +static __inline__ int CodedPattern420( vpar_thread_t * p_vpar ) { /* Take the max 9 bits length vlc code for testing */ int i_vlc = ShowBits( &p_vpar->bit_stream, 9 ); @@ -1459,7 +1459,7 @@ static int CodedPattern420( vpar_thread_t * p_vpar ) /***************************************************************************** * CodedPattern422 : coded_block_pattern with 4:2:2 chroma *****************************************************************************/ -static int CodedPattern422( vpar_thread_t * p_vpar ) +static __inline__ int CodedPattern422( vpar_thread_t * p_vpar ) { int i_vlc = ShowBits( &p_vpar->bit_stream, 9 ); @@ -1473,7 +1473,7 @@ static int CodedPattern422( vpar_thread_t * p_vpar ) /***************************************************************************** * CodedPattern444 : coded_block_pattern with 4:4:4 chroma *****************************************************************************/ -static int CodedPattern444( vpar_thread_t * p_vpar ) +static __inline__ int CodedPattern444( vpar_thread_t * p_vpar ) { int i_vlc = ShowBits( &p_vpar->bit_stream, 9 ); @@ -1486,7 +1486,7 @@ static int CodedPattern444( vpar_thread_t * p_vpar ) /***************************************************************************** * InitMacroblock : Initialize macroblock values *****************************************************************************/ -static void InitMacroblock( vpar_thread_t * p_vpar, +static __inline__ void InitMacroblock( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_coding_type, int i_chroma_format, int i_structure, @@ -1521,7 +1521,7 @@ static void InitMacroblock( vpar_thread_t * p_vpar, /***************************************************************************** * UpdateContext : Update the p_vpar contextual values *****************************************************************************/ -static void UpdateContext( vpar_thread_t * p_vpar, int i_structure ) +static __inline__ void UpdateContext( vpar_thread_t * p_vpar, int i_structure ) { /* Update macroblock real position. */ p_vpar->mb.i_l_x += 16; @@ -1539,7 +1539,7 @@ static void UpdateContext( vpar_thread_t * p_vpar, int i_structure ) /***************************************************************************** * SkippedMacroblock : Generate a skipped macroblock with NULL motion vector *****************************************************************************/ -static void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb, +static __inline__ void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb, int i_mb_base, int i_coding_type, int i_chroma_format, int i_structure, @@ -1599,7 +1599,7 @@ static void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb, /***************************************************************************** * MacroblockModes : Get the macroblock_modes structure *****************************************************************************/ -static void MacroblockModes( vpar_thread_t * p_vpar, +static __inline__ void MacroblockModes( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_chroma_format, int i_coding_type, @@ -1683,7 +1683,6 @@ if( p_vpar->picture.b_error ) \ return; \ } - #define PARSEBLOCKS( MPEG1FUNC, MPEG2FUNC ) \ { \ i_mask = 1 << (3 + (1 << i_chroma_format)); \ @@ -1746,7 +1745,7 @@ if( p_vpar->picture.b_error ) \ } \ } -static void ParseMacroblock( +static __inline__ void ParseMacroblock( vpar_thread_t * p_vpar, int * pi_mb_address, /* previous address to be * used for mb_addr_incr */ @@ -1977,10 +1976,137 @@ i_count++; * Picture data parsing management */ +/***************************************************************************** + * ParseMacroblockVWXYZ : Parse the next macroblock ; specific functions + ***************************************************************************** + * V = MPEG2 ? + * W = coding type ? + * X = chroma format ? + * Y = structure ? + * Z = second field ? + *****************************************************************************/ +void ParseMacroblockGENERIC( vpar_thread_t * p_vpar, int * pi_mb_address, + int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ +/* ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + b_mpeg2, i_coding_type, i_chroma_format, + i_structure, b_second_field );*/ +} + +#if (VPAR_OPTIM_LEVEL > 0) +/* Optimizations for frame pictures */ +void ParseMacroblock2I420F0( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, I_CODING_TYPE, CHROMA_420, + FRAME_STRUCTURE, 0 ); +} + +void ParseMacroblock2P420F0( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, P_CODING_TYPE, CHROMA_420, + FRAME_STRUCTURE, 0 ); +} + +void ParseMacroblock2B420F0( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, B_CODING_TYPE, CHROMA_420, + FRAME_STRUCTURE, 0 ); +} +#endif + +#if (VPAR_OPTIM_LEVEL > 1) +/* Optimizations for field pictures */ +void ParseMacroblock2I420TZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, I_CODING_TYPE, CHROMA_420, + TOP_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} + +void ParseMacroblock2P420TZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, P_CODING_TYPE, CHROMA_420, + TOP_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} + +void ParseMacroblock2B420TZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, B_CODING_TYPE, CHROMA_420, + TOP_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} + +void ParseMacroblock2I420BZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, I_CODING_TYPE, CHROMA_420, + BOTTOM_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} + +void ParseMacroblock2P420BZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, P_CODING_TYPE, CHROMA_420, + BOTTOM_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} + +void ParseMacroblock2B420BZ( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ) +{ + ParseMacroblock( p_vpar, pi_mb_address, i_mb_previous, i_mb_base, + 1, B_CODING_TYPE, CHROMA_420, + BOTTOM_FIELD, (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); +} +#endif + /***************************************************************************** * SliceHeader : Parse the next slice structure *****************************************************************************/ -static void SliceHeader( vpar_thread_t * p_vpar, +typedef void (*f_parse_mb_t)( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_previous, int i_mb_base, + boolean_t b_mpeg2, int i_coding_type, + int i_chroma_format, int i_structure, + boolean_t b_second_field ); + +static __inline__ void SliceHeader( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, u32 i_vert_code, boolean_t b_high, boolean_t b_dp_scalable, @@ -1988,6 +2114,43 @@ static void SliceHeader( vpar_thread_t * p_vpar, int i_chroma_format, int i_structure, boolean_t b_second_field ) { + static f_parse_mb_t ppf_parse_mb[4][4] = + { + { + NULL, NULL, NULL, NULL + }, + { + /* TOP_FIELD */ +#if (VPAR_OPTIM_LEVEL > 1) + NULL, ParseMacroblock2I420TZ, ParseMacroblock2P420TZ, + ParseMacroblock2B420TZ +#else + NULL, ParseMacroblockGENERIC, ParseMacroblockGENERIC, + ParseMacroblockGENERIC +#endif + }, + { + /* BOTTOM_FIELD */ +#if (VPAR_OPTIM_LEVEL > 1) + NULL, ParseMacroblock2I420BZ, ParseMacroblock2P420BZ, + ParseMacroblock2B420BZ +#else + NULL, ParseMacroblockGENERIC, ParseMacroblockGENERIC, + ParseMacroblockGENERIC +#endif + }, + { + /* FRAME_PICTURE */ +#if (VPAR_OPTIM_LEVEL > 0) + NULL, ParseMacroblock2I420F0, ParseMacroblock2P420F0, + ParseMacroblock2B420F0 +#else + NULL, ParseMacroblockGENERIC, ParseMacroblockGENERIC, + ParseMacroblockGENERIC +#endif + } + }; + int i_mb_address_save = *pi_mb_address; p_vpar->picture.b_error = 0; @@ -2039,10 +2202,37 @@ static void SliceHeader( vpar_thread_t * p_vpar, p_vpar->picture.b_error = 1; return; } - ParseMacroblock( p_vpar, pi_mb_address, i_mb_address_save, + + if( p_vpar->sequence.i_chroma_format != CHROMA_420 + || !p_vpar->sequence.b_mpeg2 || p_vpar->sequence.i_height > 2800 + || p_vpar->sequence.i_scalable_mode == SC_DP ) + { + /* Weird stream. Use the slower generic function. */ + ParseMacroblockGENERIC( p_vpar, pi_mb_address, i_mb_address_save, + i_mb_base, b_mpeg2, i_coding_type, + i_chroma_format, i_structure, + b_second_field ); + } + else + { + /* Try to find an optimized function. */ + if( ppf_parse_mb[p_vpar->picture.i_structure] + [p_vpar->picture.i_coding_type] == NULL ) + { + intf_ErrMsg( "vpar error: bad ppf_parse_mb function pointer (struct:%d, coding type:%d)\n", + p_vpar->picture.i_structure, p_vpar->picture.i_coding_type ); + } + else + { + ppf_parse_mb[p_vpar->picture.i_structure] + [p_vpar->picture.i_coding_type] + ( p_vpar, pi_mb_address, i_mb_address_save, i_mb_base, b_mpeg2, i_coding_type, i_chroma_format, i_structure, b_second_field ); + } + } + i_mb_address_save = *pi_mb_address; if( p_vpar->picture.b_error ) { @@ -2056,17 +2246,14 @@ static void SliceHeader( vpar_thread_t * p_vpar, /***************************************************************************** * PictureData : Parse off all macroblocks (ISO/IEC 13818-2 6.2.3.7) *****************************************************************************/ -static void PictureData( vpar_thread_t * p_vpar, int i_mb_base, - boolean_t b_high, boolean_t b_dp_scalable, - boolean_t b_mpeg2, int i_coding_type, - int i_chroma_format, int i_structure, - boolean_t b_second_field ) +void vpar_PictureData( vpar_thread_t * p_vpar, int i_mb_base ) { int i_mb_address = 0; u32 i_dummy; NextStartCode( p_vpar ); - while( ((i_coding_type != I_CODING_TYPE && i_coding_type != D_CODING_TYPE) + while( ((p_vpar->picture.i_coding_type != I_CODING_TYPE + && p_vpar->picture.i_coding_type != D_CODING_TYPE) || !p_vpar->picture.b_error) && i_mb_address+i_mb_base < p_vpar->sequence.i_mb_size && !p_vpar->b_die ) @@ -2083,17 +2270,23 @@ static void PictureData( vpar_thread_t * p_vpar, int i_mb_base, /* Decode slice data. */ SliceHeader( p_vpar, &i_mb_address, i_mb_base, i_dummy & 255, - b_high, b_dp_scalable, b_mpeg2, i_coding_type, - i_chroma_format, i_structure, b_second_field ); + (p_vpar->sequence.i_height > 2800), + (p_vpar->sequence.i_scalable_mode == SC_DP), + p_vpar->sequence.b_mpeg2, p_vpar->picture.i_coding_type, + p_vpar->sequence.i_chroma_format, + p_vpar->picture.i_structure, + (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); } /* Try to recover from error. If we missed less than half the * number of macroblocks of the picture, mark the missed ones * as skipped. */ - if( (i_coding_type == P_CODING_TYPE || i_coding_type == B_CODING_TYPE) + if( (p_vpar->picture.i_coding_type == P_CODING_TYPE + || p_vpar->picture.i_coding_type == B_CODING_TYPE) && p_vpar->picture.b_error && ( (i_mb_address-i_mb_base) > (p_vpar->sequence.i_mb_size >> 1) - || (i_structure != FRAME_STRUCTURE + || (p_vpar->picture.i_structure != FRAME_STRUCTURE && (i_mb_address-i_mb_base) > (p_vpar->sequence.i_mb_size >> 2) ) ) ) { int i_mb; @@ -2101,97 +2294,16 @@ static void PictureData( vpar_thread_t * p_vpar, int i_mb_base, p_vpar->picture.b_error = 0; for( i_mb = i_mb_address + 1; i_mb < (p_vpar->sequence.i_mb_size - << (i_structure != FRAME_STRUCTURE)); + << (p_vpar->picture.i_structure != FRAME_STRUCTURE)); i_mb++ ) { - SkippedMacroblock( p_vpar, i_mb, i_mb_base, i_coding_type, - i_chroma_format, i_structure, b_second_field ); + SkippedMacroblock( p_vpar, i_mb, i_mb_base, + p_vpar->picture.i_coding_type, + p_vpar->sequence.i_chroma_format, + p_vpar->picture.i_structure, + (p_vpar->picture.i_structure != + p_vpar->picture.i_current_structure) ); } } } -/***************************************************************************** - * vpar_PictureDataVWXYZ : Parse the next macroblock ; specific functions - ***************************************************************************** - * V = MPEG2 ? - * W = coding type ? - * X = chroma format ? - * Y = structure ? - * Z = second field ? - *****************************************************************************/ -void vpar_PictureDataGENERIC( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, (p_vpar->sequence.i_height > 2800), - (p_vpar->sequence.i_scalable_mode == SC_DP), - p_vpar->sequence.b_mpeg2, p_vpar->picture.i_coding_type, - p_vpar->sequence.i_chroma_format, - p_vpar->picture.i_structure, - (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -#if (VPAR_OPTIM_LEVEL > 0) -/* Optimizations for frame pictures */ -void vpar_PictureData2I420F0( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, 0, 0, 0, 1, I_CODING_TYPE, CHROMA_420, - FRAME_STRUCTURE, 0 ); -} - -void vpar_PictureData2P420F0( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, 0, 0, 0, 1, P_CODING_TYPE, CHROMA_420, - FRAME_STRUCTURE, 0 ); -} - -void vpar_PictureData2B420F0( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, 0, 0, 0, 1, B_CODING_TYPE, CHROMA_420, - FRAME_STRUCTURE, 0 ); -} -#endif - -#if (VPAR_OPTIM_LEVEL > 1) -/* Optimizations for field pictures */ -void vpar_PictureData2I420TZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, I_CODING_TYPE, CHROMA_420, - TOP_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -void vpar_PictureData2P420TZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, P_CODING_TYPE, CHROMA_420, - TOP_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -void vpar_PictureData2B420TZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, B_CODING_TYPE, CHROMA_420, - TOP_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -void vpar_PictureData2I420BZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, I_CODING_TYPE, CHROMA_420, - BOTTOM_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -void vpar_PictureData2P420BZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, P_CODING_TYPE, CHROMA_420, - BOTTOM_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} - -void vpar_PictureData2B420BZ( vpar_thread_t * p_vpar, int i_mb_base ) -{ - PictureData( p_vpar, i_mb_base, 0, 0, 1, B_CODING_TYPE, CHROMA_420, - BOTTOM_FIELD, (p_vpar->picture.i_structure != - p_vpar->picture.i_current_structure) ); -} -#endif diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index 92106369c3..1859f52839 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -52,11 +52,6 @@ #include "video_parser.h" #include "video_fifo.h" -/* - * Function pointer - */ -typedef void (*f_picture_data_t)( vpar_thread_t*, int ); - /* * Local prototypes */ @@ -334,17 +329,17 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar ) static void SequenceHeader( vpar_thread_t * p_vpar ) { #define RESERVED -1 - static float r_frame_rate_table[16] = - { - 0.0, - ((23.0*1000.0)/1001.0), - 24.0, - 25.0, - ((30.0*1000.0)/1001.0), - 30.0, - 50.0, - ((60.0*1000.0)/1001.0), - 60.0, + static int i_frame_rate_table[16] = + { + 0, + 23 * 1000, + 24 * 1001, + 25 * 1001, + 30 * 1000, + 30 * 1001, + 50 * 1001, + 60 * 1000, + 60 * 1001, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED }; #undef RESERVED @@ -357,8 +352,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 ); p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 ); p_vpar->sequence.i_aspect_ratio = GetBits( &p_vpar->bit_stream, 4 ); - p_vpar->sequence.r_frame_rate = - r_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ]; + p_vpar->sequence.i_frame_rate = + i_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ]; /* We don't need bit_rate_value, marker_bit, vbv_buffer_size, * constrained_parameters_flag */ @@ -418,7 +413,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) /* frame_rate_extension_n */ i_dummy = GetBits( &p_vpar->bit_stream, 2 ); /* frame_rate_extension_d */ - p_vpar->sequence.r_frame_rate *= (i_dummy + 1) + p_vpar->sequence.i_frame_rate *= (i_dummy + 1) / (GetBits( &p_vpar->bit_stream, 5 ) + 1); } else @@ -496,44 +491,6 @@ static void GroupHeader( vpar_thread_t * p_vpar ) *****************************************************************************/ static void PictureHeader( vpar_thread_t * p_vpar ) { - /* Table of optimized PictureData functions. */ - static f_picture_data_t ppf_picture_data[4][4] = - { - { - NULL, NULL, NULL, NULL - }, - { - /* TOP_FIELD */ -#if (VPAR_OPTIM_LEVEL > 1) - NULL, vpar_PictureData2I420TZ, vpar_PictureData2P420TZ, - vpar_PictureData2B420TZ -#else - NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC, - vpar_PictureDataGENERIC -#endif - }, - { - /* BOTTOM_FIELD */ -#if (VPAR_OPTIM_LEVEL > 1) - NULL, vpar_PictureData2I420BZ, vpar_PictureData2P420BZ, - vpar_PictureData2B420BZ -#else - NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC, - vpar_PictureDataGENERIC -#endif - }, - { - /* FRAME_PICTURE */ -#if (VPAR_OPTIM_LEVEL > 0) - NULL, vpar_PictureData2I420F0, vpar_PictureData2P420F0, - vpar_PictureData2B420F0 -#else - NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC, - vpar_PictureDataGENERIC -#endif - } - }; - int i_structure; int i_mb_base; boolean_t b_parsable; @@ -764,28 +721,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) /* Extension and User data. */ ExtensionAndUserData( p_vpar ); - /* Picture data (ISO/IEC 13818-2 6.2.3.7). */ - if( p_vpar->sequence.i_chroma_format != CHROMA_420 - || !p_vpar->sequence.b_mpeg2 || p_vpar->sequence.i_height > 2800 - || p_vpar->sequence.i_scalable_mode == SC_DP ) - { - /* Weird stream. Use the slower generic function. */ - vpar_PictureDataGENERIC( p_vpar, i_mb_base ); - } - else - { - /* Try to find an optimized function. */ - if( ppf_picture_data[p_vpar->picture.i_structure][p_vpar->picture.i_coding_type] == NULL ) - { - intf_ErrMsg( "vpar error: bad ppf_picture_data function pointer (struct:%d, coding type:%d)\n", - p_vpar->picture.i_structure, p_vpar->picture.i_coding_type ); - } - else - { - ppf_picture_data[p_vpar->picture.i_structure] - [p_vpar->picture.i_coding_type]( p_vpar, i_mb_base ); - } - } + vpar_PictureData( p_vpar, i_mb_base ); if( p_vpar->b_die || p_vpar->b_error ) { diff --git a/src/video_parser/vpar_synchro.c b/src/video_parser/vpar_synchro.c index fe813eeada..49f8849b11 100644 --- a/src/video_parser/vpar_synchro.c +++ b/src/video_parser/vpar_synchro.c @@ -65,7 +65,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, int i_coding_type, boolean_t b_kept ) { - double i_can_display; + int i_can_display; mtime_t i_pts; pes_packet_t * p_pes = p_vpar->bit_stream.p_decoder_fifo->buffer[ p_vpar->bit_stream.p_decoder_fifo->i_start ]; @@ -100,13 +100,13 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, { case P_CODING_TYPE: - p_vpar->synchro.i_P_seen++; - if( b_kept ) p_vpar->synchro.i_P_kept++; + p_vpar->synchro.i_P_seen += 1024; + if( b_kept ) p_vpar->synchro.i_P_kept += 1024; break; case B_CODING_TYPE: - p_vpar->synchro.i_B_seen++; - if( b_kept ) p_vpar->synchro.i_B_kept++; + p_vpar->synchro.i_B_seen += 1024; + if( b_kept ) p_vpar->synchro.i_B_kept += 1024; break; case I_CODING_TYPE: @@ -118,8 +118,8 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, if ( p_vpar->synchro.i_last_seen_I_pts ) { p_vpar->synchro.i_theorical_delay = - ( i_pts - p_vpar->synchro.i_last_seen_I_pts ) - / ( 1 + p_vpar->synchro.i_B_seen + 1024 * ( i_pts - p_vpar->synchro.i_last_seen_I_pts ) + / ( 1024 + p_vpar->synchro.i_B_seen + p_vpar->synchro.i_P_seen); } p_vpar->synchro.i_last_seen_I_pts = i_pts; @@ -127,7 +127,8 @@ 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_can_display = (float)(i_pts - p_vpar->synchro.i_last_kept_I_pts) + i_can_display = + ( (i_pts - p_vpar->synchro.i_last_kept_I_pts) << 10 ) / p_vpar->synchro.i_delay; p_vpar->synchro.b_all_I = 0; @@ -136,9 +137,9 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, p_vpar->synchro.displayable_p = 0; p_vpar->synchro.displayable_b = 0; - if( ( p_vpar->synchro.b_all_I = ( i_can_display > 1 ) ) ) + if( ( p_vpar->synchro.b_all_I = ( i_can_display >= 1024 ) ) ) { - i_can_display -= 1; + i_can_display -= 1024; if( !( p_vpar->synchro.b_all_P = ( i_can_display > p_vpar->synchro.i_P_seen ) ) ) @@ -159,20 +160,21 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar, #if 1 if( p_vpar->synchro.b_all_I ) - intf_ErrMsg( " I: 1/1 " ); + intf_ErrMsg( " I: 1024/1024 " ); if( p_vpar->synchro.b_all_P ) 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: %.2f/%i ", p_vpar->synchro.displayable_p, + intf_ErrMsg( "P: %i/%i ", p_vpar->synchro.displayable_p, p_vpar->synchro.i_P_seen ); if( p_vpar->synchro.b_all_B ) intf_ErrMsg( "B: %i/%i", p_vpar->synchro.i_B_seen, p_vpar->synchro.i_B_seen ); else if( p_vpar->synchro.displayable_b > 0 ) - intf_ErrMsg( "B: %.2f/%i", p_vpar->synchro.displayable_b, + intf_ErrMsg( "B: %i/%i", p_vpar->synchro.displayable_b, p_vpar->synchro.i_B_seen ); - intf_ErrMsg( " " ); +// intf_ErrMsg( " " ); + intf_ErrMsg( "\n" ); #endif p_vpar->synchro.i_P_seen = 0; p_vpar->synchro.i_B_seen = 0; @@ -197,8 +199,6 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, { mtime_t i_delay = p_vpar->synchro.i_last_pts - mdate(); - //return (i_coding_type == I_CODING_TYPE); - switch( i_coding_type ) { case I_CODING_TYPE: @@ -407,7 +407,8 @@ void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type, mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar ) { return( p_vpar->synchro.kludge_date - + p_vpar->synchro.kludge_nbframes*1000000/(p_vpar->sequence.r_frame_rate ) ); + + p_vpar->synchro.kludge_nbframes * 1000000 + / (p_vpar->sequence.i_frame_rate ) * 1001 ); } void vpar_SynchroEnd( vpar_thread_t * p_vpar ) @@ -481,7 +482,7 @@ void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type ) } else { - p_vpar->synchro.i_current_frame_date += 1000000/(p_vpar->sequence.r_frame_rate); + p_vpar->synchro.i_current_frame_date += 1000000 / (p_vpar->sequence.i_frame_rate) * 1001; } break; @@ -489,7 +490,7 @@ void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type ) if( p_vpar->synchro.i_backward_frame_date == 0 ) { - p_vpar->synchro.i_current_frame_date += 1000000/(p_vpar->sequence.r_frame_rate); + p_vpar->synchro.i_current_frame_date += 1000000 / (p_vpar->sequence.i_frame_rate) * 1001; } else {