All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Risolia <luca.risolia@studio.unibo.it>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Sylwester Nawrocki <snjw23@gmail.com>,
	linux-media <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Jean-Francois Moine <moinejf@free.fr>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: [RFC] JPEG encoders control class
Date: Mon, 28 Nov 2011 19:48:28 +0100	[thread overview]
Message-ID: <4ED3D77C.2020109@studio.unibo.it> (raw)
In-Reply-To: <201111281320.30522.hverkuil@xs4all.nl>



Hans Verkuil ha scritto:
> On Saturday 12 November 2011 20:46:25 Sylwester Nawrocki wrote:
>> Hi all,
>>
>> This RFC is discussing the current support of JPEG encoders in V4L2 and
>> a proposal of new JPEG control class.
>>
>>
>> Motivation
>> ==========
>>
>> JPEG encoder control is also required at the sub-device level, but
>> currently there are only defined ioctls in regular V4L2 device API. It
>> doesn't seem to make sense for these current ioctls to be inherited by
>> sub-device nodes, since they're not generic enough, incomplete and rather
>> not compliant with JFIF JPEG standard [2], [3].
>>
>>
>> Current implementation
>> ======================
>>
>> Currently two ioctls are available [4]:
>>
>> #define VIDIOC_G_JPEGCOMP	 _IOR('V', 61, struct v4l2_jpegcompression)
>> #define VIDIOC_S_JPEGCOMP	 _IOW('V', 62, struct v4l2_jpegcompression)
>>
>> And the corresponding data structure is defined as:
>>
>> struct v4l2_jpegcompression {
>> 	int quality;
>>
>> 	int  APPn;              /* Number of APP segment to be written,
>> 				 * must be 0..15 */
>> 	int  APP_len;           /* Length of data in JPEG APPn segment */
>> 	char APP_data[60];      /* Data in the JPEG APPn segment. */
>>
>> 	int  COM_len;           /* Length of data in JPEG COM segment */
>> 	char COM_data[60];      /* Data in JPEG COM segment */
>>
>> 	__u32 jpeg_markers;     /* Which markers should go into the JPEG
>> 				 * output. Unless you exactly know what
>> 				 * you do, leave them untouched.
>> 				 * Inluding less markers will make the
>> 				 * resulting code smaller, but there will
>> 				 * be fewer applications which can read it.
>> 				 * The presence of the APP and COM marker
>> 				 * is influenced by APP_len and COM_len
>> 				 * ONLY, not by this property! */
>>
>> #define V4L2_JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
>> #define V4L2_JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
>> #define V4L2_JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
>> #define V4L2_JPEG_MARKER_COM (1<<6)    /* Comment segment */
>> #define V4L2_JPEG_MARKER_APP (1<<7)    /* App segment, driver will
>> 					* allways use APP0 */
>> };
>>
>>
>> What are the issues with such an implementation ?
>>
>> These ioctls don't allow to re-program the quantization and Huffman tables
>> (DQT, DHT). Additionally, the standard valid segment length for the
>> application defined APPn and the comment COM segment is 2...65535, while
>> currently this is limited to 60 bytes.
>>
>> Therefore APP_data and COM_data, rather than fixed size arrays, should be
>> pointers to a variable length buffer.
>>
>> Only two drivers upstream really use VIDIOC_[S/G]_JPEGCOMP ioctls for
>> anything more than compression quality query/control. It might make sense
>> to create separate control for image quality and to obsolete the
>> v4l2_jpegcompressin::quality field.
>>
>> Below is a brief review of usage of VIDIOC_[S/G]_JPEGCOMP ioctls in current
>> mainline drivers. Listed are parts of struct v4l2_jpegcompression used in
>> each case.
>>
>>
>> cpia2
>> -----
>>
>> vidioc_g_jpegcomp, vidioc_s_jpegcomp
>> - compression quality ignored, returns fixed value (80)
>> - uses APP_data/len, COM_data/len
>> - markers (only DHT can be disabled by the applications)
>>
>>
>> zoran
>> -----
>>
>> vidioc_g_jpegcomp, vidioc_s_jpegcomp
>> - compression quality, values 5...100, used only to calculate buffer size
>> - APP_data/len, COM_data/len
>> - markers field used to control inclusion of selected JPEG markers
>>   in the output buffer
>>
>>
>> et61x251, sn9c102, s2255drv.c
>> -----------------------------
> 
> Note that et61x251 and sn9c102 are going to be deprecated and removed at some
> time in the future (gspca will support these devices).

Has this been discussed yet? Also, last time I tried the gspca driver 
with a number of V4L2-compliant applications, it did not support at all 
or work well for all the sn9c1xx-based devices I have here, which are 
both controllers and sensors the manufacturer sent to me when developing 
the driver with their collaboration. I also don't understand why the 
gspca driver has been accepted in the mainline kernel in the first 
place, despite the fact the sn9c1xx has been present in the kernel since 
long time and already supported many devices at the time the gspca was 
submitted. Maybe it's better to remove the duplicate code form the gspca 
driver and add the different parts (if any) to the sn9c1xx.

Regards
Luca


  parent reply	other threads:[~2011-11-28 18:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-12 19:46 [RFC] JPEG encoders control class Sylwester Nawrocki
2011-11-26 18:43 ` Sakari Ailus
2011-11-26 20:59   ` Sylwester Nawrocki
2011-11-28 12:20 ` Hans Verkuil
2011-11-28 12:51   ` Sylwester Nawrocki
2011-11-28 18:48   ` Luca Risolia [this message]
2011-11-29 17:53     ` Jean-Francois Moine
2011-12-27 19:43 ` [RFC/PATCHv1 0/4] JPEG codecs " Sylwester Nawrocki
2011-12-27 19:43   ` [PATCH 1/4] V4L: Add JPEG compression " Sylwester Nawrocki
2011-12-30 21:42     ` Sakari Ailus
2011-12-31 11:54       ` Sylwester Nawrocki
2011-12-27 19:43   ` [PATCH 2/4] V4L: Add the JPEG compression control class documentation Sylwester Nawrocki
2011-12-27 19:43   ` [PATCH 3/4] gspca: sonixj: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support Sylwester Nawrocki
2011-12-27 19:43   ` [PATCH 4/4] gspca: zc3xx: " Sylwester Nawrocki
2012-01-06 18:14 ` [PATCH/RFC v2 0/4] JPEG codecs control class Sylwester Nawrocki
2012-01-06 18:14 ` [PATCH/RFC v2 1/4] V4L: Add JPEG compression " Sylwester Nawrocki
2012-01-06 18:14 ` [PATCH/RFC v2 2/4] V4L: Add JPEG compression control class documentation Sylwester Nawrocki
2012-01-06 18:14 ` [PATCH/RFC v2 3/4] gspca: sonixj: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support Sylwester Nawrocki
2012-01-14  8:47   ` Jean-Francois Moine
2012-01-14 17:42     ` Sylwester Nawrocki
2012-01-14 18:24       ` Jean-Francois Moine
2012-01-14 19:35         ` [PATCH/RFC v3 0/3] JPEG codecs control class Sylwester Nawrocki
2012-01-14 19:35           ` [PATCH/RFC v3 1/3] V4L: Add JPEG compression " Sylwester Nawrocki
2012-01-14 19:35           ` [PATCH/RFC v3 2/3] V4L: Add JPEG compression control class documentation Sylwester Nawrocki
2012-01-14 19:35           ` [PATCH/RFC v3 3/3] gspca: zc3xx: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support Sylwester Nawrocki
2012-01-14 19:53             ` [PATCH/RFC v4 " Sylwester Nawrocki
2012-01-21 14:45               ` Sylwester Nawrocki
2012-01-25 11:49                 ` Jean-Francois Moine
2012-01-14 20:07         ` [PATCH/RFC v2 3/4] gspca: sonixj: " Sylwester Nawrocki
2012-01-06 18:14 ` [PATCH/RFC v2 4/4] gspca: zc3xx: " Sylwester Nawrocki
2012-01-14  8:47   ` Jean-Francois Moine

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=4ED3D77C.2020109@studio.unibo.it \
    --to=luca.risolia@studio.unibo.it \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=moinejf@free.fr \
    --cc=snjw23@gmail.com \
    /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.