[FFmpeg-devel] [PATCH 09/13] avcodec/svq1dec: clear MMX state after MB decode loop

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Mon Oct 24 22:47:54 EEST 2016

On 24.10.2016 21:34, wm4 wrote:
> On Mon, 24 Oct 2016 21:19:46 +0200
> Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> wrote:
>> On 24.10.2016 16:14, Ronald S. Bultje wrote:
>>> On Mon, Oct 24, 2016 at 8:47 AM, wm4 <nfxjfg at googlemail.com> wrote:  
>>>> The next safest assumption is that it's fine as long as we explicitly
>>>> don't use floating point or call external functions that aren't
>>>> MMX-aware. This would mean calling any libc functions or user callbacks
>>>> (including indirectly through e.g. av_log) is not fine.  
>> This is probably OK in practice and likely has a significant performance
>> benefit.
> Seems like it.
> The compiler still could generate code using the FPU state at any
> point, though, unless maybe there is an inline asm block. No function
> can put the FPU into MMX mode, because any MMX using function must have
> called emms before returning. Consequently, only compiler-known
> intrinsics or opaque inline asm block could clobber the FPU state. The
> latter because the compiler doesn't inspect asm blocks.

I agree. However, I think that this is currently only a theoretical
issue. At least I'm not aware of this causing problems with a real compiler.

Best regards,

More information about the ffmpeg-devel mailing list