[FFmpeg-devel] [PATCH 00/41] Stop including superseded functions for x64

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Jun 20 14:16:54 EEST 2022


Andreas Rheinhardt:
> Andreas Rheinhardt:
>> x64 requires MMX, MMXEXT, SSE and SSE2; yet there is no shortage
>> of code like the following:
>>
>>     if (EXTERNAL_MMX(cpu_flags)) {
>>         c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_mmx;
>>     }
>>     if (EXTERNAL_SSE2(cpu_flags)) {
>>         c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_sse2;
>>     }
>>
>> Given that SSE2 is always present on x64, the only way
>> for the mmx version to be chosen in the above example
>> is if SSE2 has been disabled either at compile-time
>> or at runtime, i.e. it is never used unless one shoots
>> oneself in the foot.
>> This patchset therefore disables such functions for x64
>> by #if'ing them away; x86 has not been affected. This
>> saves about 140KB.
>>
>> (Another way to handle this would be to remove every function
>> that would be overridden if one had a processor capable of
>> MMX, MMXEXT, SSE and SSE2. x86 processors not fulfilling
>> this requirement (which are truely ancient nowadays)
>> would still work, but would be slower, i.e. they would be treated
>> as second-class citizens. This would have the advantage of
>> avoiding #ifs and would lighten x86 binaries of code that is
>> not used at all by the overwhelming majority of users.
>> I'll update this patchset if it is preferred to do it that way.)
>>
> 
> I have now implemented this other way mentioned above (i.e. removing
> stuff that is overridden if SSE2 is available altogether also for
> x86-32); the result can be seen here:
> https://github.com/mkver/FFmpeg/commits/mmx2
> I prefer this to the old version because of the reduced complexity which
> dwarfs the potential to slow down some ancient systems a bit (if these
> ancient systems use an up-to-date FFmpeg which is quite unlikely).
> Furthermore, some of the MMX scale functions that are removed are
> buggy/not bixexact. See
> https://github.com/mkver/FFmpeg/commit/c5513ad962100040601b5eba0042692a740ac50a
> (or shall I post these patches?)
> Is anyone against this removal?
> 

Given that no one was against removing these old functions, but several
people (on IRC) supported the idea I will go ahead and do it. I will
apply https://github.com/mkver/FFmpeg/commits/mmx3 (an updated and
extended version of the branch linked to above) in two days unless there
are objections.
(I can also send this to the mailing list if desired.)

- Andreas


More information about the ffmpeg-devel mailing list