[FFmpeg-devel] [PATCH] Fix ffmpeg crash on G3 based computers introduced with revision 10637

Patrice Bensoussan patrice.bensoussan
Sat Feb 9 13:41:47 CET 2008


On 9 Feb 2008, at 12:22, Reimar D?ffinger wrote:

> Hello,
> On Sat, Feb 09, 2008 at 12:11:01PM +0000, Patrice Bensoussan wrote:
>> It seems that ffmpeg is trying to use altivec on PowerPC G3  
>> although it's
>> not available. This was introduced with revision 10637. Here is a  
>> patch to
>> fix the issue.
>>
>> Patrice
>>
>
>> Index: libavcodec/mpegvideo.c
>> ===================================================================
>> --- libavcodec/mpegvideo.c	(revision 11880)
>> +++ libavcodec/mpegvideo.c	(working copy)
>> @@ -61,6 +61,10 @@
>> extern void XVMC_decode_mb(MpegEncContext *s);
>> #endif
>>
>> +#ifdef HAVE_ALTIVEC
>> +extern int has_altivec(void);
>> +#endif
>
> That #ifdef is pointless.

No need to compile code which doesn't need to be. This should only be  
available if compiling with altivec support.

>
>
>> @@ -152,7 +156,8 @@
>> #elif defined(ARCH_ARMV4L)
>>     MPV_common_init_armv4l(s);
>> #elif defined(HAVE_ALTIVEC)
>> -    MPV_common_init_altivec(s);
>> +    if ( has_altivec() )
>> +        MPV_common_init_altivec(s);
>
> And IMO this check belongs into the MPV_common_init_altivec, if for no
> other reason than that there are different levels of altivec support  
> and
> it's easier to add checks with finer granularity in that function than
> here.
>

This is the place  where the check was and it has been removed. Plus,  
I disagree. _altivec specific functions should never be
called if altivec is not available. has_altivec() doesn't check the  
level of altivec support but if we have altivec support with the CPU.

Patrice






More information about the ffmpeg-devel mailing list