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 521392 - Proposed patches for bayer2rgb encoding
Proposed patches for bayer2rgb encoding
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-03-09 15:27 UTC by William M. Brack
Modified: 2008-04-17 18:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patches to videotestsrc.c and gstbayer2rgb.c to change to BGGR (6.27 KB, patch)
2008-03-09 15:28 UTC, William M. Brack
none Details | Review
Trivial patch to change bayer output to BGGR format (1.04 KB, patch)
2008-03-12 00:14 UTC, William M. Brack
none Details | Review
Patch for gstbayer2rgb.c for interpolated BGGR format (21.02 KB, patch)
2008-03-12 00:15 UTC, William M. Brack
none Details | Review

Description William M. Brack 2008-03-09 15:27:22 UTC
I wanted to use this plugin for decoding the data produced by a v4l2 camera (a very cheap USB model) and found it didn't work. When I looked into the code, I found that reason it wasn't working was because the routine assumed a format of RGGB, but the (standard) output from v4l2 is BGGR.  Additionally, the conversion being done did not include any interpolation, and there were several areas which were not really a "finished product".

On the first point (format), I spent some time searching the internet to find out what common formats were used for streaming (video) data.  The conclusion I came to was that the v4l2 format V4L2_PIX_FMT_SBGGR8 is the only one with any common usage.  The v4l2 project has assigned a fourcc code of BA81 for this.

In order to allow gstreamer to properly handle this format, I am attaching a .tgz file containing two proposed patches.  The first is a trivial patch to videotestsrc.c which changes its output for this format, as well as the fourcc code which it produces.  The second is a very substantial patch to gstbayer2rgb.c which replaces all of the previous conversion logic with routines to transform with interpolation.  There are a large number of comments within the patched code to describe what I (think I) am doing.  The code is not particularly clever or efficient, but it seems to be working well, and has been extensively tested with a combination of gdb and valgrind using test data from my patched version of videotestsrc, as well as with my (cheap) camera.  In view of the fact that this format is certainly not widely used, and it is unlikely that the transformation efficiency will be a constraint, I didn't feel it would be worthwhile to spend more time improving that.  I also cleaned up all of the areas of the routine which I found questionable, and added the ability to produce a wide variety of RGB formats.

If others feel that some improvement is needed, or other features really should be added, I would be happy to do any further work that is required.  Otherwise, I feel the enclosed patch is a substantial improvement to the existing code, and would urge that it be adopted.
Comment 1 William M. Brack 2008-03-09 15:28:53 UTC
Created attachment 106910 [details] [review]
patches to videotestsrc.c and gstbayer2rgb.c to change to BGGR
Comment 2 David Schleef 2008-03-11 20:43:53 UTC
The attachment is just garbage.  Could you try that again?
Comment 3 William M. Brack 2008-03-12 00:14:39 UTC
Created attachment 107107 [details] [review]
Trivial patch to change bayer output to BGGR format
Comment 4 William M. Brack 2008-03-12 00:15:37 UTC
Created attachment 107108 [details] [review]
Patch for gstbayer2rgb.c for interpolated BGGR format
Comment 5 David Schleef 2008-03-14 17:37:24 UTC
Both applied, thanks.