[FFmpeg-devel] [PATCH 1/2] libswscale/x86/yuv2rgb: Change inline assembly into nasm code

Fu, Ting ting.fu at intel.com
Mon Dec 2 05:16:41 EET 2019



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Michael Niedermayer
> Sent: Friday, November 29, 2019 05:33 AM
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] libswscale/x86/yuv2rgb: Change inline
> assembly into nasm code
> 
> On Thu, Nov 28, 2019 at 02:07:07PM +0800, Ting Fu wrote:
> > Signed-off-by: Ting Fu <ting.fu at intel.com>
> > ---
> >  libswscale/x86/Makefile           |   1 +
> >  libswscale/x86/swscale.c          |  16 +-
> >  libswscale/x86/yuv2rgb.c          |  81 ++----
> >  libswscale/x86/yuv2rgb_template.c | 441 ++++++------------------------
> >  libswscale/x86/yuv_2_rgb.asm      | 270 ++++++++++++++++++
> >  5 files changed, 394 insertions(+), 415 deletions(-)  create mode
> > 100644 libswscale/x86/yuv_2_rgb.asm
> 
> This changes the output, i presume that is unintentional
> 
> ./ffmpeg -cpuflags 0 -i matrixbench_mpeg2.mpg -t 1 -vf
> format=yuv420p,format=rgb565le -an -f framecrc -
> 
> 0,          0,          0,        1,   829440, 0x1bd78b86
> 0,          1,          1,        1,   829440, 0x85910b33
> ...
> vs.
> 0,          0,          0,        1,   829440, 0x31f4a2bd
> 0,          1,          1,        1,   829440, 0xf0c66218
> ...
> 
> 

Hi Michael,

This unexpected change is because of the missing verify of current SIMD support.
So, when cpuflag=0, ffmpeg used mmx code to compute as default.
I added if (EXTERNAL_XXX(cpu_flags)) to verify the SIMD in libswscale/x86/yuv2rgb.c.

Thank you again
Ting Fu

> 
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle


More information about the ffmpeg-devel mailing list