[FFmpeg-devel] [PATCH] swscale/x86/rgb2_rgb: Empty MMX state in ff_shuffle_bytes_2103_mmxext

Michael Niedermayer michael at niedermayer.cc
Tue Aug 23 18:42:15 EEST 2022


On Mon, Aug 22, 2022 at 11:59:17PM +0200, Andreas Rheinhardt wrote:
> Andreas Rheinhardt:
> > Fixes FATE-failures with the the filter-2xbr filter-3xbr filter-4xbr
> > filter-ep2x filter-ep3x filter-hq2x filter-hq3x filter-hq4x
> > filter-paletteuse-bayer filter-paletteuse-bayer0
> > filter-paletteuse-nodither and filter-paletteuse-sierra2_4a tests
> > when using 32bit x86 with CPUFLAGS ranging from "mmx+mmxext" to
> > "mmx+mmxext+sse+sse2+sse3" (the relevant function is only overwritten
> > when using SSSE3).
> > 
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> > ---
> >  libswscale/x86/rgb_2_rgb.asm | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm
> > index c695c61d5c..76ca1eec03 100644
> > --- a/libswscale/x86/rgb_2_rgb.asm
> > +++ b/libswscale/x86/rgb_2_rgb.asm
> > @@ -104,6 +104,7 @@ jge .end
> >      jl .loop_simd
> >  
> >  .end:
> > +    emms
> >      RET
> >  
> >  ;------------------------------------------------------------------------------
> 
> I'd really love if someone with x86 assembly skills could look over this
> trivial patch and confirm whether it is indeed correct. All I currently
> know is that is works for me.

emms needs to be called between MMX and float code, as far outside of loops
as possible
that would suggest outside the for() loops in rgbToRgbWrapper() and any
other code using it. 

thats what we did and what is most efficient. One can make an argument that
emms must be called before returning to C code when its needed. That though
would imply also that all uses of emms_c() are wrong

Above assumes iam not missing something

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220823/e18a78e7/attachment.sig>


More information about the ffmpeg-devel mailing list