[FFmpeg-devel] yuv420_bgr24_mmxext conversion taking significant time

Adrian Tong adriantong1024 at gmail.com
Tue Jun 11 19:25:29 EEST 2019


On Mon, 10 Jun 2019 at 23:02, Lauri Kasanen <cand at gmx.com> wrote:

> On Mon, 10 Jun 2019 17:42:00 -0700
> Adrian Tong <adriantong1024 at gmail.com> wrote:
>
> > I have been trying to implement yuv420_to_bgr24 using SSE2 instruction. I
> > ran into the case where the output of C implemented yuv420_to_bgr24 has
> > slightly different resulting bgr24 image from MMX implemented
> > yuv420_to_bgr24. Is this expected behavior ?
>
> Yes, some of the MMX implementations choose speed over accuracy, I ran
> to that myself when doing PPC versions. For a SSE version, if an
> accurate version is fast enough, please try to match the C version.
> Otherwise try to match MMX.
>

Thanks for confirming, Lauri. I am reading the MMX code for YUV420 to
BGR24, I am a little bit confused by it. Particularly, we shift left by 3
bits (multiply by 8) for better precision. How does this increase precision
?

Also, the conversion formula has some floating point numbers as
coefficient, But we are doing integer type multiplication here.

https://github.com/FFmpeg/FFmpeg/blob/master/libswscale/x86/yuv2rgb_template.c#L92

Thanks
- Adrian


>
> - Lauri
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list