From: Hans Verkuil <hverkuil@xs4all.nl>
To: Nick Dyer <nick.dyer@itdev.co.uk>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Benson Leung <bleung@chromium.org>,
Alan Bowens <Alan.Bowens@atmel.com>,
Javier Martinez Canillas <javier@osg.samsung.com>,
Chris Healy <cphealy@gmail.com>,
Henrik Rydberg <rydberg@bitmath.org>,
Andrew Duggan <aduggan@synaptics.com>,
James Chen <james.chen@emc.com.tw>, Dudley Du <dudl@cypress.com>,
Andrew de los Reyes <adlr@chromium.org>,
sheckylin@chromium.org, Peter Hutterer <peter.hutterer@who-t.net>,
Florian Echtler <floe@butterbrot.org>,
mchehab@osg.samsung.com
Subject: Re: [PATCH v2 2/8] [media] Add signed 16-bit pixel format
Date: Fri, 27 May 2016 15:18:30 +0200 [thread overview]
Message-ID: <57484926.9040109@xs4all.nl> (raw)
In-Reply-To: <82b68931-0da1-bd26-87c1-1cd9e2296f71@itdev.co.uk>
On 05/27/2016 02:52 PM, Nick Dyer wrote:
> On 27/05/2016 13:38, Hans Verkuil wrote:
>> On 05/04/2016 07:07 PM, Nick Dyer wrote:
>>> + <refname><constant>V4L2_PIX_FMT_YS16</constant></refname>
>>> + <refpurpose>Grey-scale image</refpurpose>
>>> + </refnamediv>
>>> + <refsect1>
>>> + <title>Description</title>
>>> +
>>> + <para>This is a signed grey-scale image with a depth of 16 bits per
>>> +pixel. The most significant byte is stored at higher memory addresses
>>> +(little-endian).</para>
>>
>> I'm not sure this should be described in terms of grey-scale, since negative
>> values make no sense for that. How are these values supposed to be interpreted
>> if you want to display them? -32768 == black and 32767 is white?
>
> We have written a utility to display this data and it is able to display
> the values mapped to grayscale or color:
> https://github.com/ndyer/heatmap/blob/master/src/display.c#L44
>
> An example of the output is here:
> https://www.youtube.com/watch?v=Uj4T6fUCySw
>
> The data is intrinsically signed because that's how the low level touch
> controller treats it. I'm happy to change it to "Signed image" if you think
> that would be better.
A V4L2_PIX_FMT_ definition must specify the format unambiguously. So it is not
enough to just say that the data is a signed 16 bit value, you need to document
exactly how it should be interpreted. Looking at the code it seems that the
signed values are within a certain range and are normalized to 0-max by this line:
ssize_t gray = (data[i] - cfg->min) * max / (cfg->max - cfg->min);
Are the min/max values defined by the hardware? Because in that case this pixel
format has to be a hardware-specific define (e.g. V4L2_PIX_FMT_FOO_S16).
Only if the min/max values are -32768 and 32767 can you really use YS16 (not sure
yet about that name, but that's another issue).
Regards,
Hans
next prev parent reply other threads:[~2016-05-27 13:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 17:07 [PATCH v2 0/8] Input: atmel_mxt_ts - output raw touch diagnostic data via V4L Nick Dyer
2016-05-04 17:07 ` [PATCH v2 1/8] Input: atmel_mxt_ts - add support for T37 diagnostic data Nick Dyer
2016-05-04 17:07 ` [PATCH v2 2/8] [media] Add signed 16-bit pixel format Nick Dyer
2016-05-27 12:38 ` Hans Verkuil
2016-05-27 12:52 ` Nick Dyer
2016-05-27 13:18 ` Hans Verkuil [this message]
2016-05-27 13:31 ` Nick Dyer
2016-05-04 17:07 ` [PATCH v2 3/8] [media] v4l2-core: Add VFL_TYPE_TOUCH_SENSOR Nick Dyer
2016-05-04 17:07 ` [PATCH v2 4/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device Nick Dyer
2016-05-27 12:54 ` Hans Verkuil
2016-06-01 16:22 ` Nick Dyer
2016-05-04 17:07 ` [PATCH v2 5/8] Input: atmel_mxt_ts - read touchscreen size Nick Dyer
2016-05-04 17:07 ` [PATCH v2 6/8] Input: atmel_mxt_ts - handle diagnostic data orientation Nick Dyer
2016-05-04 17:07 ` [PATCH v2 7/8] Input: atmel_mxt_ts - add diagnostic data support for mXT1386 Nick Dyer
2016-05-04 17:07 ` [PATCH v2 8/8] Input: atmel_mxt_ts - add support for reference data Nick Dyer
2016-05-27 12:56 ` Hans Verkuil
2016-05-13 15:17 ` [PATCH v2 0/8] Input: atmel_mxt_ts - output raw touch diagnostic data via V4L Nick Dyer
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=57484926.9040109@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=Alan.Bowens@atmel.com \
--cc=adlr@chromium.org \
--cc=aduggan@synaptics.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bleung@chromium.org \
--cc=cphealy@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dudl@cypress.com \
--cc=floe@butterbrot.org \
--cc=james.chen@emc.com.tw \
--cc=javier@osg.samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=nick.dyer@itdev.co.uk \
--cc=peter.hutterer@who-t.net \
--cc=rydberg@bitmath.org \
--cc=sheckylin@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox