After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 166207 - [PATCH] [ffmpegcolorspace] AYUV->RGB is broken
[PATCH] [ffmpegcolorspace] AYUV->RGB is broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other Linux
: Normal normal
: 0.8.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-02-03 20:23 UTC by Gergely Nagy
Modified: 2005-02-25 08:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch fixing the problem (735 bytes, patch)
2005-02-16 08:52 UTC, Gergely Nagy
none Details | Review

Description Gergely Nagy 2005-02-03 20:23:17 UTC
Test case:

gst-launch videotestsrc ! alpha ! ffmpegcolorspace ! ximagesink

Result:

Observe that the picture is half the expected width (the rest being black), and
the colors are rather weird.

Expected result:

The normal videotestsrc result.

Workaround:

Converting to another YUV format, and then to RGB seems to fix the problem.

Eg, this works:

gst-launch videotestsrc ! alpha ! ffmpegcolorspace !
video/x-raw-yuv,format=(fourcc)AYUV ! ffmpegcolorspace ! ximagesink
Comment 1 Gergely Nagy 2005-02-03 20:24:21 UTC
Whops, sorry. AYUV in the second gst-launch pipeline should have been I420, or
nearly anything but AYUV.
Comment 2 Gergely Nagy 2005-02-16 08:46:38 UTC
I've done some digging, and found that in the AYUV->RGB555 case img_convert does
a temporary AYUV->RGBA32 conversion, and converts that to RGB555.

While doing this, it looks up the AYUV->RGBA32 from convert_table, and uses the
convert function specified therein. This function is ayuv4444_to_rgba32. Now,
for some weird reason, BPP and RGBA_OUT are defined as for RGB555 output instead
of RGBA32 (most probably due to the messy way imgconvert_template.h is included
around). This breaks the conversion badly.

Further investigation showed, that ayuv4444_to_rgba32 gets defined as soon as
the !defined(FMT_RGBA32) && defined(RGBA_OUT) conditions apply. Ie, at the time
of the first rgb definition in imgconvert.c.

The fix here is to only define ayuv4444_to_rgba32 when FMT_RGBA32 is defined.
This means splitting the large #if !defined(FMT_RGBA32) && defined(RGBA_OUT)
before ayuv4444_to_rgba32 into two. End it just before ayuv4444_to_rgba32, and
then do another condition: #if defined(FMT_RGBA32).

I'll attach a patch that does this, after some testing.
Comment 3 Gergely Nagy 2005-02-16 08:52:07 UTC
Created attachment 37529 [details] [review]
Patch fixing the problem

This does exactly what I outlined in my previous comment.

AYUV can get converted to RGBA32 and RGB24 only, all other RGB formats are
converted from one of these two. I tested both AYUV->RGBA32 and ->RGB24 and
they look correct, as does AYUV->RGBA32->RGB555.
Comment 4 Ronald Bultje 2005-02-25 08:41:36 UTC
Nice catch! Applied, thanks.