YV12 & IYVY-overlay bug with --enable-nasm (or D_ASM_BLIT)

Hi,

I make self v4l player on SDL v1.2.8 / Linux 2.4 /
and found subj bug.

BUG conditional:

  1. ./configure … --enable-nasm …
  2. driver x11 and fbdev with bpp 16
  3. for test may be use
    $ cd SDL-1.2.8/test/
    $ make
    $ ./testoverlay2 -format YV12

BUG treatment:

  1. ./configure … --disable-nasm …

I am not ASM-code specialist (absolute dumb:) ->
therefore can`t self understend with whith problem.–
Best regard,
Andrey nik-a at mail dot ru

Hi,

I make self v4l player on SDL v1.2.8 / Linux 2.4 /
and found subj bug.

BUG conditional:

  1. ./configure … --enable-nasm …
  2. driver x11 and fbdev with bpp 16
  3. for test may be use
    $ cd SDL-1.2.8/test/
    $ make
    $ ./testoverlay2 -format YV12

What problem do you have when doing this ?
Do you get an error of some kind or an error message ?

Stephane

Stephane Marchesin wrote:

Hi,

I make self v4l player on SDL v1.2.8 / Linux 2.4 /
and found subj bug.

BUG conditional:

  1. ./configure … --enable-nasm …
  2. driver x11 and fbdev with bpp 16
  3. for test may be use
    $ cd SDL-1.2.8/test/
    $ make
    $ ./testoverlay2 -format YV12

What problem do you have when doing this ?
Do you get an error of some kind or an error message ?

Stephane

Hi Stephane.

Problem:
If compile SDL with --enable-nasm options (compile with ASM and MMX
code) -
func. SDL_DisplayYUVOverlay(YV12 or IYUV format) success worked (no error),
but OUTPUT PICTURE HAS BAD COLOR.

If overlay format 16bit, ie YUV2 - all right, bug found on only 12bit
planar YUV format.

If compile SDL with --disable-nasm options (compile without ASM and MMX
code) - all right.

For example you can try ‘testoverlay2 -format YV12’ application from SDL
source.–
Best regard.
Andrey.

Andrey Nikitin wrote:

Stephane Marchesin wrote:

Hi,

I make self v4l player on SDL v1.2.8 / Linux 2.4 /
and found subj bug.

BUG conditional:

  1. ./configure … --enable-nasm …
  2. driver x11 and fbdev with bpp 16
  3. for test may be use
    $ cd SDL-1.2.8/test/
    $ make
    $ ./testoverlay2 -format YV12

What problem do you have when doing this ?
Do you get an error of some kind or an error message ?

Stephane

Hi Stephane.

Problem:
If compile SDL with --enable-nasm options (compile with ASM and MMX
code) -
func. SDL_DisplayYUVOverlay(YV12 or IYUV format) success worked (no
error),
but OUTPUT PICTURE HAS BAD COLOR.

If overlay format 16bit, ie YUV2 - all right, bug found on only 12bit
planar YUV format.

If compile SDL with --disable-nasm options (compile without ASM and
MMX code) - all right.

For example you can try ‘testoverlay2 -format YV12’ application from
SDL source.

Ah, well, I’m probably the culprit for this breakage.
Does it work if you revert to an older version of
SDL12/src/video/SDL_yuv_mmx.c like these :
http://www.libsdl.org/cgi/cvsweb.cgi/~checkout~/SDL12/src/video/SDL_yuv_mmx.c?rev=1.9&content-type=text/plain
http://www.libsdl.org/cgi/cvsweb.cgi/~checkout~/SDL12/src/video/SDL_yuv_mmx.c?rev=1.8&content-type=text/plain

Stephane

Stephane Marchesin wrote:

Andrey Nikitin wrote:

Stephane Marchesin wrote:

Hi,

I make self v4l player on SDL v1.2.8 / Linux 2.4 /
and found subj bug.

BUG conditional:

  1. ./configure … --enable-nasm …
  2. driver x11 and fbdev with bpp 16
  3. for test may be use
    $ cd SDL-1.2.8/test/
    $ make
    $ ./testoverlay2 -format YV12

What problem do you have when doing this ?
Do you get an error of some kind or an error message ?

Stephane

Hi Stephane.

Problem:
If compile SDL with --enable-nasm options (compile with ASM and MMX
code) -
func. SDL_DisplayYUVOverlay(YV12 or IYUV format) success worked (no
error),
but OUTPUT PICTURE HAS BAD COLOR.

If overlay format 16bit, ie YUV2 - all right, bug found on only 12bit
planar YUV format.

If compile SDL with --disable-nasm options (compile without ASM and
MMX code) - all right.

For example you can try ‘testoverlay2 -format YV12’ application from
SDL source.

Ah, well, I’m probably the culprit for this breakage.
Does it work if you revert to an older version of
SDL12/src/video/SDL_yuv_mmx.c like these :
http://www.libsdl.org/cgi/cvsweb.cgi/~checkout~/SDL12/src/video/SDL_yuv_mmx.c?rev=1.9&content-type=text/plain

http://www.libsdl.org/cgi/cvsweb.cgi/~checkout~/SDL12/src/video/SDL_yuv_mmx.c?rev=1.8&content-type=text/plain

Stephane

SDL_yuv_mmx.c?rev=1.8 i’m have in my current SDL-1.2.8 (not CVS)

I changed SDL_yuv_mmx.c (1.8) on SDL_yuv_mmx.c?rev=1.9
Result: nothing changed.

( NASM version 0.98.38, gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) )

!!! FOUND NEW INTERESTING THING:
FBDEV and X11 - has different result for
SDL_DisplayYUVOverlay()===============================================================
X11 1280x1024 at 16

./testoverlay -format YV12 - Ok
./testoverlay -format IYUV - Ok, but SLOW

./testoverlay2 -format YV12 - Ok
./testoverlay2 -format IYUV - Bad color picture

===============================================================
fbdev 1024x768 at 16

./testoverlay -format YV12 - Ok
./testoverlay -format IYUV - Ok

./testoverlay2 -format YV12 - Bad color picture
./testoverlay2 -format IYUV - Bad color picture, but good view shape
contour

Result: SDL has different ASM(MMX) code for X11 and FBDEV driver.
Different Endian (LE, BE) for x11 and fbdev?? or … ??

I think that only developers of SDL drivers can solve this problem.

For “fast” video4linux TV-video players application more importance has
support 4.2.0 (YV12 or IYUV)
format in graphics lib.

My solve problem: configure & compile SDL with --disable-nasm,
but if use fullscreen mode with soft scale - CPU usage = 50%.

May be ASM MMX BLIT for YV12(IYUV) for FBDEV problem will be solve in
next SDLlib version.

I began to use SLDlib after DirectFB.
DirectFB does not realy supports (YV12 or IYUV) surface.
I.m.h.o SDLlib is fast good stable graphics lib for Linux.

More thanks, Stephane.


Best regard.
Andrey.

Andrey Nikitin wrote:

SDL_yuv_mmx.c?rev=1.8 i’m have in my current SDL-1.2.8 (not CVS)

I changed SDL_yuv_mmx.c (1.8) on SDL_yuv_mmx.c?rev=1.9
Result: nothing changed.

( NASM version 0.98.38, gcc (GCC) 3.2.2 20030222 (Red Hat Linux
3.2.2-5) )

!!! FOUND NEW INTERESTING THING:
FBDEV and X11 - has different result for
SDL_DisplayYUVOverlay()

===============================================================
X11 1280x1024 at 16

./testoverlay -format YV12 - Ok
./testoverlay -format IYUV - Ok, but SLOW

./testoverlay2 -format YV12 - Ok
./testoverlay2 -format IYUV - Bad color picture

Ok, that one is broken here too (SDL 1.2.7 & 1.2.8).
Looks like it has been broken for some time…

Stephane

Hello, Andrey!

AN> ===============================================================
AN> X11 1280x1024 at 16
AN> ===============================================================
AN> ./testoverlay -format YV12 - Ok
AN> ./testoverlay -format IYUV - Ok, but SLOW

AN> ./testoverlay2 -format YV12 - Ok
AN> ./testoverlay2 -format IYUV - Bad color picture

YV12 and IYUV overlay modes is plane modes (not packed). SDL assumes by
defaul that overlay->pixels[0] is Y component, overlay->pixels[1] is U
component and overlay->pixels[2] is V component, i.e. pure YUV planes layout
scheme, but many grpahics drivers provides YV12 and IYUV in the different
planes layout scheme, for example YVU (radeon drivers AFAIK) and it’s
causing the similar problem under many platforms and GUIs.

In my testoverlay2 example I have used the code of the RGB to YUV
transformation from testoverlay example.

AN> I think that only developers of SDL drivers can solve this problem.

There can be only one solution - in SDL internals check for platform and
specific video driver to swap the U and V planes when driver need it. But
looks like it is one more problem :slight_smile:

With best regards, Mike Gorchak. E-mail: @Mike_Gorchak

AN> ===============================================================
AN> X11 1280x1024 at 16
AN> ===============================================================
AN> ./testoverlay -format YV12 - Ok
AN> ./testoverlay -format IYUV - Ok, but SLOW

AN> ./testoverlay2 -format YV12 - Ok
AN> ./testoverlay2 -format IYUV - Bad color picture

YV12 and IYUV overlay modes is plane modes (not packed). SDL assumes by
defaul that overlay->pixels[0] is Y component, overlay->pixels[1] is U
component and overlay->pixels[2] is V component, i.e. pure YUV planes
layout
scheme, but many grpahics drivers provides YV12 and IYUV in the different
planes layout scheme, for example YVU (radeon drivers AFAIK) and it’s
causing the similar problem under many platforms and GUIs.

In my testoverlay2 example I have used the code of the RGB to YUV
transformation from testoverlay example.

AN> I think that only developers of SDL drivers can solve this problem.

There can be only one solution - in SDL internals check for platform and
specific video driver to swap the U and V planes when driver need it. But
looks like it is one more problem :slight_smile:

With best regards, Mike Gorchak. E-mail: lestat at i.com.ua

Hi, Mike.

Swap U and Y plane - good simple solution on X11 driver, BUT:

||||Task: Display YV12||/||IYUV on SDL:FBDEV with MMX code (–enable-nasm)
||
||||fbdev:
||||||||SDL_DisplayYUVOverlay (MMX,|| YV12|| || ||IYUV ||) - Bad colors
picture.||

NO ASM MMX SDLlib good work on both X11 and FBDEV driver for both YV12
and IYUV format.
=> MMX SDLlib code for FBDEV YV12||/||IYUV has bug.

NO ASM MMX SDLlib good work on both X11 and FBDEV driver for both YV12
and IYUV format.
=> MMX SDLlib code for FBDEV YV12||/||IYUV has bug.

Do you have a patch?

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Hi,

we have been using libsdl for a long time with our
ffmpeg-based video toolkit (see http://vitooki.sourceforge.net).
However, since version 1.2.7 we cannot use the default
libsdl-packages (shipped with recent Linux distributions like
SuSE 9.3, for instance) due to
the already reported problem with the YUV Overlay.

So, currently the only solution for us is to download the source-code,
configure with “–disable-nasm” and self-compile, which results
in a slow executable and requires additional effort for our users! :frowning:

Please can anybody tell me when this bug will be fixed?

Thanks in advance!

Best regards,
Klaus

Hi,

we have been using libsdl for a long time with our
ffmpeg-based video toolkit (see http://vitooki.sourceforge.net).
However, since version 1.2.7 we cannot use the default
libsdl-packages (shipped with recent Linux distributions like
SuSE 9.3, for instance) due to
the already reported problem with the YUV Overlay.

What was this reported problem? I don’t remember seeing the bug report.

Thanks,
-Sam Lantinga, Software Engineer, Blizzard Entertainment