All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: linux-media@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>
Subject: qv4l2-bug / libv4lconvert API issue
Date: Thu, 27 Sep 2012 00:04:18 +0300	[thread overview]
Message-ID: <50636DD2.3070508@googlemail.com> (raw)

Hi,

I've noticed the following issues/bugs while playing with qv4l:
1.) with pac7302-webcams, only the RGB3 (RGB24) format is working. BGR3,
YU12 and YV12 are broken
2.) for upside-down-mounted devices with an entry in libv4lconvert,
automatic h/v-flipping doesn't work with some formats

I've been digging a bit deeper into the code and it seems that both
issues are caused by a problem with the libv4lconvert-API:
Besides image format conversion, function v4lconvert_convert() also does
the automatic image flipping and rotation (for devices with flags
V4LCONTROL_HFLIPPED, V4LCONTROL_VFLIPPED and V4LCONTROL_ROTATED_90_JPEG)
The problem is, that this function can be called multiple times for the
same frame, which then of course results in repeated flipping and
rotation...

And this is exactly what happens with qv4l2:
qv4l2 gets the frame from libv4l2, which calls v4lconvert_convert() in
v4l2_dequeue_and_convert() or v4l2_read_and_convert().
The retrieved frame has the requested format and is already flipped/rotated.
qv4l2 then calls v4lconvert_convert() again directly to convert the
frame to RGB24 for GUI-output and this is where things are going wrong.
In case of h/v-flip, the double conversion "only" equalizes the
V4LCONTROL_HFLIPPED, V4LCONTROL_VFLIPPED flags, but for rotated devices,
the image gets corrupted.

Sure, what qv4l2 does is a crazy. Applications usually request the
format needed for GUI-output directly from libv4l2.
Anyway, as long as it is valid to call libv4lconvert directly, we can
not assume that v4lconvert_convert() is called only one time.

At the moment, I see no possibility to fix this without changing the
libv4lconvert-API.
Thoughts ?

Regards,
Frank




             reply	other threads:[~2012-09-26 22:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 21:04 Frank Schäfer [this message]
2012-09-27 10:26 ` qv4l2-bug / libv4lconvert API issue Hans de Goede
2012-09-27 13:20   ` Frank Schäfer
2012-09-27 19:41     ` Hans de Goede
2012-09-28 17:09       ` Frank Schäfer
2012-09-30  9:54         ` Hans de Goede
2012-10-03 10:22           ` Frank Schäfer
2012-10-03 12:32             ` Hans Verkuil
2012-10-03 16:41               ` Frank Schäfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50636DD2.3070508@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.