From: Jean-Marc Dressler Date: Thu, 17 Feb 2000 22:17:35 +0000 (+0000) Subject: La plupart des causes de segfault de la video ont �t� �limin�es, les messages X-Git-Tag: 0.1.99e~95 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2f2ce6f4d1d67057c2db76a5463e6f9870e7cbe9;p=vlc La plupart des causes de segfault de la video ont �t� �limin�es, les messages d'erreur qui sont affich�s sur stderr vous donnerons une bonne id�e du nombres d'occasions de planter qui se pr�sentent au client. J'ai aussi remis le flag DEBUG � 1 et commenter omit-frame-pointer pour que tout le monde puisse avoir la chance de participer � la chasse aux segfaults avec son gdb. Les bugs report sont le bienvenu (surtout si c pour l'audio ;). --- diff --git a/Makefile b/Makefile index 0bdf77fb6f..01373b3535 100644 --- 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 @@ -50,7 +50,7 @@ MMX=YES DECODER=new # Debugging mode on or off (set to 1 to activate) -DEBUG=0 +DEBUG=1 #----------------- do not change anything below this line ---------------------- @@ -140,7 +140,7 @@ CCFLAGS += -D_GNU_SOURCE # Optimizations : don't compile debug versions with them CCFLAGS += -O6 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global -CCFLAGS += -fomit-frame-pointer +#CCFLAGS += -fomit-frame-pointer # Optimizations for x86 familiy ifeq ($(ARCH),X86) diff --git a/src/video_decoder/vdec_motion.c b/src/video_decoder/vdec_motion.c index 46a93e3f90..ebe5a203e9 100644 --- a/src/video_decoder/vdec_motion.c +++ b/src/video_decoder/vdec_motion.c @@ -274,14 +274,20 @@ static __inline__ void Motion420( /* Temporary variables to avoid recalculating things twice */ int i_source_offset, i_dest_offset, i_c_height, i_c_select; + i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1)) + + (p_mb->i_motion_l_y + i_offset + + (i_mv_y >> 1) + + b_source_field) + * p_mb->p_picture->i_width; + if( i_source_offset >= p_source->i_width * p_source->i_height ) + { + fprintf( stderr, "vdec error: bad motion vector\n" ); + return; + } + /* Luminance */ MotionComponent( /* source */ - p_source->p_y - + (p_mb->i_l_x + (i_mv_x >> 1)) - + (p_mb->i_motion_l_y + i_offset - + (i_mv_y >> 1) - + b_source_field) - * p_mb->p_picture->i_width, + p_source->p_y + i_source_offset, /* destination */ p_mb->p_picture->p_y + (p_mb->i_l_x) @@ -300,6 +306,12 @@ static __inline__ void Motion420( + ((i_mv_y/2) >> 1)) + b_source_field) * p_mb->p_picture->i_chroma_width; + if( i_source_offset >= (p_source->i_width * p_source->i_height) / 4 ) + { + fprintf( stderr, "vdec error: bad motion vector\n" ); + return; + } + i_dest_offset = (p_mb->i_c_x) + (p_mb->i_motion_c_y + b_dest_field) * p_mb->p_picture->i_chroma_width; @@ -345,6 +357,7 @@ static __inline__ void Motion422( boolean_t b_average /* (explicit) averaging of * several predictions */ ) { +#if 0 int i_source_offset, i_dest_offset, i_c_select; /* Luminance */ @@ -393,6 +406,7 @@ static __inline__ void Motion422( + i_dest_offset, 8, i_height, i_c_stride, p_mb->i_c_stride, i_c_select, b_average ); +#endif } /***************************************************************************** @@ -417,6 +431,7 @@ static __inline__ void Motion444( boolean_t b_average /* (explicit) averaging of * several predictions */ ) { +#if 0 int i_source_offset, i_dest_offset, i_select; i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1)) @@ -453,6 +468,7 @@ static __inline__ void Motion444( + i_dest_offset, 16, i_height, i_l_stride, p_mb->i_l_stride, i_select, b_average ); +#endif } /***************************************************************************** @@ -502,12 +518,12 @@ void vdec_MotionFieldField420( macroblock_t * p_mb ) void vdec_MotionFieldField422( macroblock_t * p_mb ) { - FIELDFIELD( Motion422 ) + //FIELDFIELD( Motion422 ) } void vdec_MotionFieldField444( macroblock_t * p_mb ) { - FIELDFIELD( Motion444 ) + //FIELDFIELD( Motion444 ) } /***************************************************************************** @@ -584,12 +600,12 @@ void vdec_MotionField16x8420( macroblock_t * p_mb ) void vdec_MotionField16x8422( macroblock_t * p_mb ) { - FIELD16X8( Motion422 ) + //FIELD16X8( Motion422 ) } void vdec_MotionField16x8444( macroblock_t * p_mb ) { - FIELD16X8( Motion444 ) + //FIELD16X8( Motion444 ) } /***************************************************************************** @@ -626,12 +642,12 @@ void vdec_MotionFieldDMV420( macroblock_t * p_mb ) void vdec_MotionFieldDMV422( macroblock_t * p_mb ) { - FIELDDMV( Motion422 ) + //FIELDDMV( Motion422 ) } void vdec_MotionFieldDMV444( macroblock_t * p_mb ) { - FIELDDMV( Motion444 ) + //FIELDDMV( Motion444 ) } /***************************************************************************** @@ -671,12 +687,12 @@ void vdec_MotionFrameFrame420( macroblock_t * p_mb ) void vdec_MotionFrameFrame422( macroblock_t * p_mb ) { - FRAMEFRAME( Motion422 ) + //FRAMEFRAME( Motion422 ) } void vdec_MotionFrameFrame444( macroblock_t * p_mb ) { - FRAMEFRAME( Motion444 ) + //FRAMEFRAME( Motion444 ) } /***************************************************************************** @@ -736,12 +752,12 @@ void vdec_MotionFrameField420( macroblock_t * p_mb ) void vdec_MotionFrameField422( macroblock_t * p_mb ) { - FRAMEFIELD( Motion422 ) + //FRAMEFIELD( Motion422 ) } void vdec_MotionFrameField444( macroblock_t * p_mb ) { - FRAMEFIELD( Motion444 ) + //FRAMEFIELD( Motion444 ) } /***************************************************************************** @@ -784,10 +800,10 @@ void vdec_MotionFrameDMV420( macroblock_t * p_mb ) void vdec_MotionFrameDMV422( macroblock_t * p_mb ) { - FRAMEDMV( Motion422 ) + //FRAMEDMV( Motion422 ) } void vdec_MotionFrameDMV444( macroblock_t * p_mb ) { - FRAMEDMV( Motion444 ) + //FRAMEDMV( Motion444 ) } diff --git a/src/video_decoder/video_decoder.c b/src/video_decoder/video_decoder.c index de2ae2310d..e33fbce84d 100644 --- a/src/video_decoder/video_decoder.c +++ b/src/video_decoder/video_decoder.c @@ -443,7 +443,14 @@ void vdec_DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb ) /* * Motion Compensation (ISO/IEC 13818-2 section 7.6) */ - p_mb->pf_motion( p_mb ); + if( p_mb->pf_motion == 0 ) + { + fprintf( stderr, "vdec error: pf_motion set to NULL\n" ); + } + else + { + p_mb->pf_motion( p_mb ); + } DECODEBLOCKS( AddBlock ) } diff --git a/src/video_parser/vpar_blocks.c b/src/video_parser/vpar_blocks.c index 395efb8343..1de428683b 100644 --- a/src/video_parser/vpar_blocks.c +++ b/src/video_parser/vpar_blocks.c @@ -1878,6 +1878,11 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar, do { + if( i_mb_address_save >= p_vpar->sequence.i_mb_size ) + { + p_vpar->picture.b_error = 1; + return; + } ParseMacroblock( p_vpar, pi_mb_address, i_mb_address_save, i_mb_base, b_mpeg2, i_coding_type, i_chroma_format, i_structure, diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index b2c61e74ea..c278b015c3 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -760,8 +760,16 @@ static void PictureHeader( vpar_thread_t * p_vpar ) else { /* Try to find an optimized function. */ - ppf_picture_data[p_vpar->picture.i_structure] - [p_vpar->picture.i_coding_type]( p_vpar, i_mb_base ); + if( ppf_picture_data[p_vpar->picture.i_structure][p_vpar->picture.i_coding_type] == NULL ) + { + fprintf( stderr, "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 ); + } } if( p_vpar->b_die || p_vpar->b_error )