linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
@ 2012-09-04  5:37 Prabhakar Lad
  2012-09-04 19:12 ` Sakari Ailus
  0 siblings, 1 reply; 7+ messages in thread
From: Prabhakar Lad @ 2012-09-04  5:37 UTC (permalink / raw)
  To: LMML
  Cc: dlos, linux-kernel, Manjunath Hadli, Laurent Pinchart, linux-doc,
	Hans Verkuil, Sylwester Nawrocki, Lad, Prabhakar, Sakari Ailus,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

From: Lad, Prabhakar <prabhakar.lad@ti.com>

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Rob Landley <rob@landley.net>
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v4:
1: Aligned the description to fit appropriately in the
para tag, pointed by Sylwester.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   46 +++++++++++++++++++++++++-
 drivers/media/v4l2-core/v4l2-ctrls.c         |    9 +++++
 include/linux/videodev2.h                    |    5 +++
 3 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..ad873ea 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,51 @@ interface and may change in the future.</para>
 	    pixels / second.
 	    </entry>
 	  </row>
-	  <row><entry></entry></row>
+	  <row>
+	    <entry spanname="id"><constant>V4L2_CID_DPCM_PREDICTOR</constant></entry>
+	    <entry>menu</entry>
+	  </row>
+	  <row id="v4l2-dpcm-predictor">
+	    <entry spanname="descr"> Differential pulse-code modulation (DPCM) is a signal
+	    encoder that uses the baseline of pulse-code modulation (PCM) but adds some
+	    functionalities based on the prediction of the samples of the signal. The input
+	    can be an analog signal or a digital signal.
+
+	    <para>If the input is a continuous-time analog signal, it needs to be sampled
+	    first so that a discrete-time signal is the input to the DPCM encoder.</para>
+
+	    <para>Simple: take the values of two consecutive samples; if they are analog
+	    samples, quantize them; calculate the difference between the first one and the
+	    next; the output is the difference, and it can be further entropy coded.</para>
+
+	    <para>Advanced: instead of taking a difference relative to a previous input sample,
+	    take the difference relative to the output of a local model of the decoder process;
+	    in this option, the difference can be quantized, which allows a good way to
+	    incorporate a controlled loss in the encoding.</para>
+
+	    <para>Applying one of these two processes, short-term redundancy (positive correlation of
+	    nearby values) of the signal is eliminated; compression ratios on the order of 2 to 4
+	    can be achieved if differences are subsequently entropy coded, because the entropy of
+	    the difference signal is much smaller than that of the original discrete signal treated
+	    as independent samples.For more information about DPCM see <ulink
+	    url="http://en.wikipedia.org/wiki/Differential_pulse-code_modulation">Wikipedia</ulink>.</para>
+	    </entry>
+	  </row>
+	  <row>
+	    <entrytbl spanname="descr" cols="2">
+	      <tbody valign="top">
+	        <row>
+	         <entry><constant>V4L2_DPCM_PREDICTOR_SIMPLE</constant></entry>
+	          <entry>Predictor type is simple</entry>
+	        </row>
+	        <row>
+	          <entry><constant>V4L2_DPCM_PREDICTOR_ADVANCED</constant></entry>
+	          <entry>Predictor type is advanced</entry>
+	        </row>
+	      </tbody>
+	    </entrytbl>
+	  </row>
+	<row><entry></entry></row>
 	</tbody>
       </tgroup>
       </table>
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..2d7bc15 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 		"Gray",
 		NULL,
 	};
+	static const char * const dpcm_predictor[] = {
+		"Simple Predictor",
+		"Advanced Predictor",
+		NULL,
+	};
 
 	switch (id) {
 	case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 		return mpeg4_profile;
 	case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
 		return jpeg_chroma_subsampling;
+	case V4L2_CID_DPCM_PREDICTOR:
+		return dpcm_predictor;
 
 	default:
 		return NULL;
@@ -732,6 +739,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_IMAGE_PROC_CLASS:		return "Image Processing Controls";
 	case V4L2_CID_LINK_FREQ:		return "Link Frequency";
 	case V4L2_CID_PIXEL_RATE:		return "Pixel Rate";
+	case V4L2_CID_DPCM_PREDICTOR:		return "DPCM Predictor";
 
 	default:
 		return NULL;
@@ -832,6 +840,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_ISO_SENSITIVITY_AUTO:
 	case V4L2_CID_EXPOSURE_METERING:
 	case V4L2_CID_SCENE_MODE:
+	case V4L2_CID_DPCM_PREDICTOR:
 		*type = V4L2_CTRL_TYPE_MENU;
 		break;
 	case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6d6dfa7..ca9fb78 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2000,6 +2000,11 @@ enum v4l2_jpeg_chroma_subsampling {
 
 #define V4L2_CID_LINK_FREQ			(V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
 #define V4L2_CID_PIXEL_RATE			(V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
+#define V4L2_CID_DPCM_PREDICTOR			(V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
+enum v4l2_dpcm_predictor {
+	V4L2_DPCM_PREDICTOR_SIMPLE	= 0,
+	V4L2_DPCM_PREDICTOR_ADVANCED	= 1,
+};
 
 /*
  *	T U N I N G
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-04  5:37 [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor Prabhakar Lad
@ 2012-09-04 19:12 ` Sakari Ailus
  2012-09-05  5:10   ` Prabhakar Lad
  0 siblings, 1 reply; 7+ messages in thread
From: Sakari Ailus @ 2012-09-04 19:12 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: LMML, dlos, linux-kernel, Manjunath Hadli, Laurent Pinchart,
	linux-doc, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

Hi Prabhakar,

Thanks for the patch. I've got a few comments below.

On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:
> From: Lad, Prabhakar <prabhakar.lad@ti.com>
> 
> add V4L2_CID_DPCM_PREDICTOR control of type menu, which
> determines the dpcm predictor. The predictor can be either
> simple or advanced.
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Cc: Sakari Ailus <sakari.ailus@iki.fi>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Rob Landley <rob@landley.net>
> ---
> This patches has one checkpatch warning for line over
> 80 characters altough it can be avoided I have kept it
> for consistency.
> 
> Changes for v4:
> 1: Aligned the description to fit appropriately in the
> para tag, pointed by Sylwester.
> 
> Changes for v3:
> 1: Added better explanation for DPCM, pointed by Hans.
> 
> Changes for v2:
> 1: Added documentaion in controls.xml pointed by Sylwester.
> 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
>    pointed by Sakari.
> 
>  Documentation/DocBook/media/v4l/controls.xml |   46 +++++++++++++++++++++++++-
>  drivers/media/v4l2-core/v4l2-ctrls.c         |    9 +++++
>  include/linux/videodev2.h                    |    5 +++
>  3 files changed, 59 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
> index 93b9c68..ad873ea 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -4267,7 +4267,51 @@ interface and may change in the future.</para>
>  	    pixels / second.
>  	    </entry>
>  	  </row>
> -	  <row><entry></entry></row>
> +	  <row>
> +	    <entry spanname="id"><constant>V4L2_CID_DPCM_PREDICTOR</constant></entry>
> +	    <entry>menu</entry>
> +	  </row>
> +	  <row id="v4l2-dpcm-predictor">
> +	    <entry spanname="descr"> Differential pulse-code modulation (DPCM) is a signal
> +	    encoder that uses the baseline of pulse-code modulation (PCM) but adds some
> +	    functionalities based on the prediction of the samples of the signal. The input
> +	    can be an analog signal or a digital signal.
> +
> +	    <para>If the input is a continuous-time analog signal, it needs to be sampled
> +	    first so that a discrete-time signal is the input to the DPCM encoder.</para>
> +
> +	    <para>Simple: take the values of two consecutive samples; if they are analog
> +	    samples, quantize them; calculate the difference between the first one and the
> +	    next; the output is the difference, and it can be further entropy coded.</para>
> +
> +	    <para>Advanced: instead of taking a difference relative to a previous input sample,
> +	    take the difference relative to the output of a local model of the decoder process;
> +	    in this option, the difference can be quantized, which allows a good way to
> +	    incorporate a controlled loss in the encoding.</para>

This is directly from Wikipedia, isn't it?

What comes to the content, DPCM in the context of V4L2 media bus codes, as a
digital interface, is always digital. So there's no need to document it.
Entropy coding is also out of the question: the samples of the currently
defined formats are equal in size.

Another thing what I'm not sure is the definition of the simple and advanced
encoders. I've seen sensors that allow you to choose which one to use, but
the documentation hasn't stated what the actual implementation is. Does TI
documentation do so?

In V4L2 documentation we should state what is common in the hardware
documentation, and that is mostly limited to "simple" and "advanced". I
really don't know enough that I could say what the exact implamentation of
those two are in all of the cases.

I suggest we leave just a few words of the DPCM compression itself (roughly
the factual content of the first paragraph with the exception of the
reference to analogue signal) and a link to Wikipedia.

> +	    <para>Applying one of these two processes, short-term redundancy (positive correlation of
> +	    nearby values) of the signal is eliminated; compression ratios on the order of 2 to 4
> +	    can be achieved if differences are subsequently entropy coded, because the entropy of
> +	    the difference signal is much smaller than that of the original discrete signal treated
> +	    as independent samples.For more information about DPCM see <ulink
> +	    url="http://en.wikipedia.org/wiki/Differential_pulse-code_modulation">Wikipedia</ulink>.</para>
> +	    </entry>
> +	  </row>
> +	  <row>
> +	    <entrytbl spanname="descr" cols="2">
> +	      <tbody valign="top">
> +	        <row>
> +	         <entry><constant>V4L2_DPCM_PREDICTOR_SIMPLE</constant></entry>
> +	          <entry>Predictor type is simple</entry>
> +	        </row>
> +	        <row>
> +	          <entry><constant>V4L2_DPCM_PREDICTOR_ADVANCED</constant></entry>
> +	          <entry>Predictor type is advanced</entry>
> +	        </row>
> +	      </tbody>
> +	    </entrytbl>
> +	  </row>
> +	<row><entry></entry></row>
>  	</tbody>
>        </tgroup>
>        </table>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index b6a2ee7..2d7bc15 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>  		"Gray",
>  		NULL,
>  	};
> +	static const char * const dpcm_predictor[] = {
> +		"Simple Predictor",
> +		"Advanced Predictor",

As the control's name is already "DPCM Predictor", I think you can drop
" Predictor" from the menu items.

Kind regards,

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-04 19:12 ` Sakari Ailus
@ 2012-09-05  5:10   ` Prabhakar Lad
  2012-09-07 18:46     ` Sakari Ailus
  0 siblings, 1 reply; 7+ messages in thread
From: Prabhakar Lad @ 2012-09-05  5:10 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: LMML, dlos, linux-kernel, Manjunath Hadli, Laurent Pinchart,
	linux-doc, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

Hi Sakari,

Thanks for the review.

On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:
> Hi Prabhakar,
> 
> Thanks for the patch. I've got a few comments below.
> 
> On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:
>> From: Lad, Prabhakar <prabhakar.lad@ti.com>
>>
>> add V4L2_CID_DPCM_PREDICTOR control of type menu, which
>> determines the dpcm predictor. The predictor can be either
>> simple or advanced.
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
>> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
>> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Cc: Sakari Ailus <sakari.ailus@iki.fi>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>> Cc: Hans de Goede <hdegoede@redhat.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Rob Landley <rob@landley.net>
>> ---
>> This patches has one checkpatch warning for line over
>> 80 characters altough it can be avoided I have kept it
>> for consistency.
>>
>> Changes for v4:
>> 1: Aligned the description to fit appropriately in the
>> para tag, pointed by Sylwester.
>>
>> Changes for v3:
>> 1: Added better explanation for DPCM, pointed by Hans.
>>
>> Changes for v2:
>> 1: Added documentaion in controls.xml pointed by Sylwester.
>> 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
>>    pointed by Sakari.
>>
>>  Documentation/DocBook/media/v4l/controls.xml |   46 +++++++++++++++++++++++++-
>>  drivers/media/v4l2-core/v4l2-ctrls.c         |    9 +++++
>>  include/linux/videodev2.h                    |    5 +++
>>  3 files changed, 59 insertions(+), 1 deletions(-)
>>
>> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
>> index 93b9c68..ad873ea 100644
>> --- a/Documentation/DocBook/media/v4l/controls.xml
>> +++ b/Documentation/DocBook/media/v4l/controls.xml
>> @@ -4267,7 +4267,51 @@ interface and may change in the future.</para>
>>  	    pixels / second.
>>  	    </entry>
>>  	  </row>
>> -	  <row><entry></entry></row>
>> +	  <row>
>> +	    <entry spanname="id"><constant>V4L2_CID_DPCM_PREDICTOR</constant></entry>
>> +	    <entry>menu</entry>
>> +	  </row>
>> +	  <row id="v4l2-dpcm-predictor">
>> +	    <entry spanname="descr"> Differential pulse-code modulation (DPCM) is a signal
>> +	    encoder that uses the baseline of pulse-code modulation (PCM) but adds some
>> +	    functionalities based on the prediction of the samples of the signal. The input
>> +	    can be an analog signal or a digital signal.
>> +
>> +	    <para>If the input is a continuous-time analog signal, it needs to be sampled
>> +	    first so that a discrete-time signal is the input to the DPCM encoder.</para>
>> +
>> +	    <para>Simple: take the values of two consecutive samples; if they are analog
>> +	    samples, quantize them; calculate the difference between the first one and the
>> +	    next; the output is the difference, and it can be further entropy coded.</para>
>> +
>> +	    <para>Advanced: instead of taking a difference relative to a previous input sample,
>> +	    take the difference relative to the output of a local model of the decoder process;
>> +	    in this option, the difference can be quantized, which allows a good way to
>> +	    incorporate a controlled loss in the encoding.</para>
> 
> This is directly from Wikipedia, isn't it?
> 
Yes.

> What comes to the content, DPCM in the context of V4L2 media bus codes, as a
> digital interface, is always digital. So there's no need to document it.
> Entropy coding is also out of the question: the samples of the currently
> defined formats are equal in size.
> 
Ok.

> Another thing what I'm not sure is the definition of the simple and advanced
> encoders. I've seen sensors that allow you to choose which one to use, but
> the documentation hasn't stated what the actual implementation is. Does TI
> documentation do so?
> 
Couldn't find much apart from this 'The DPCM compression system uses two
different predictors; one is simple and the other is complex. Predictor1
is very simple, so the processing power and the memory requirements are
reduced with it (when the image quality is already high enough).
Predictor2 gives a slightly better prediction for pixel value and the
image quality can be improved with it.'

> In V4L2 documentation we should state what is common in the hardware
> documentation, and that is mostly limited to "simple" and "advanced". I
> really don't know enough that I could say what the exact implamentation of
> those two are in all of the cases.
> 
> I suggest we leave just a few words of the DPCM compression itself (roughly
> the factual content of the first paragraph with the exception of the
> reference to analogue signal) and a link to Wikipedia.
> 
Ok.

>> +	    <para>Applying one of these two processes, short-term redundancy (positive correlation of
>> +	    nearby values) of the signal is eliminated; compression ratios on the order of 2 to 4
>> +	    can be achieved if differences are subsequently entropy coded, because the entropy of
>> +	    the difference signal is much smaller than that of the original discrete signal treated
>> +	    as independent samples.For more information about DPCM see <ulink
>> +	    url="http://en.wikipedia.org/wiki/Differential_pulse-code_modulation">Wikipedia</ulink>.</para>
>> +	    </entry>
>> +	  </row>
>> +	  <row>
>> +	    <entrytbl spanname="descr" cols="2">
>> +	      <tbody valign="top">
>> +	        <row>
>> +	         <entry><constant>V4L2_DPCM_PREDICTOR_SIMPLE</constant></entry>
>> +	          <entry>Predictor type is simple</entry>
>> +	        </row>
>> +	        <row>
>> +	          <entry><constant>V4L2_DPCM_PREDICTOR_ADVANCED</constant></entry>
>> +	          <entry>Predictor type is advanced</entry>
>> +	        </row>
>> +	      </tbody>
>> +	    </entrytbl>
>> +	  </row>
>> +	<row><entry></entry></row>
>>  	</tbody>
>>        </tgroup>
>>        </table>
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
>> index b6a2ee7..2d7bc15 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
>> @@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>>  		"Gray",
>>  		NULL,
>>  	};
>> +	static const char * const dpcm_predictor[] = {
>> +		"Simple Predictor",
>> +		"Advanced Predictor",
> 
Ok.

Regards,
--Prabhakar Lad

> As the control's name is already "DPCM Predictor", I think you can drop
> " Predictor" from the menu items.
> 
> Kind regards,
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-05  5:10   ` Prabhakar Lad
@ 2012-09-07 18:46     ` Sakari Ailus
  2012-09-07 19:04       ` Prabhakar Lad
  2012-09-13  0:59       ` Laurent Pinchart
  0 siblings, 2 replies; 7+ messages in thread
From: Sakari Ailus @ 2012-09-07 18:46 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: LMML, dlos, linux-kernel, Manjunath Hadli, Laurent Pinchart,
	linux-doc, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

Hi Prabhakar,

Prabhakar Lad wrote:
> Hi Sakari,
>
> Thanks for the review.
>
> On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:
>> Hi Prabhakar,
>>
>> Thanks for the patch. I've got a few comments below.
>>
>> On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:
>>> From: Lad, Prabhakar <prabhakar.lad@ti.com>
>>>
>>> add V4L2_CID_DPCM_PREDICTOR control of type menu, which
>>> determines the dpcm predictor. The predictor can be either
>>> simple or advanced.
>>>
>>> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
>>> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
>>> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>>> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>>> Cc: Sakari Ailus <sakari.ailus@iki.fi>
>>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>>> Cc: Rob Landley <rob@landley.net>
>>> ---
>>> This patches has one checkpatch warning for line over
>>> 80 characters altough it can be avoided I have kept it
>>> for consistency.
>>>
>>> Changes for v4:
>>> 1: Aligned the description to fit appropriately in the
>>> para tag, pointed by Sylwester.
>>>
>>> Changes for v3:
>>> 1: Added better explanation for DPCM, pointed by Hans.
>>>
>>> Changes for v2:
>>> 1: Added documentaion in controls.xml pointed by Sylwester.
>>> 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
>>>     pointed by Sakari.
>>>
>>>   Documentation/DocBook/media/v4l/controls.xml |   46 +++++++++++++++++++++++++-
>>>   drivers/media/v4l2-core/v4l2-ctrls.c         |    9 +++++
>>>   include/linux/videodev2.h                    |    5 +++
>>>   3 files changed, 59 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
>>> index 93b9c68..ad873ea 100644
>>> --- a/Documentation/DocBook/media/v4l/controls.xml
>>> +++ b/Documentation/DocBook/media/v4l/controls.xml
>>> @@ -4267,7 +4267,51 @@ interface and may change in the future.</para>
>>>   	    pixels / second.
>>>   	    </entry>
>>>   	  </row>
>>> -	  <row><entry></entry></row>
>>> +	  <row>
>>> +	    <entry spanname="id"><constant>V4L2_CID_DPCM_PREDICTOR</constant></entry>
>>> +	    <entry>menu</entry>
>>> +	  </row>
>>> +	  <row id="v4l2-dpcm-predictor">
>>> +	    <entry spanname="descr"> Differential pulse-code modulation (DPCM) is a signal
>>> +	    encoder that uses the baseline of pulse-code modulation (PCM) but adds some
>>> +	    functionalities based on the prediction of the samples of the signal. The input
>>> +	    can be an analog signal or a digital signal.
>>> +
>>> +	    <para>If the input is a continuous-time analog signal, it needs to be sampled
>>> +	    first so that a discrete-time signal is the input to the DPCM encoder.</para>
>>> +
>>> +	    <para>Simple: take the values of two consecutive samples; if they are analog
>>> +	    samples, quantize them; calculate the difference between the first one and the
>>> +	    next; the output is the difference, and it can be further entropy coded.</para>
>>> +
>>> +	    <para>Advanced: instead of taking a difference relative to a previous input sample,
>>> +	    take the difference relative to the output of a local model of the decoder process;
>>> +	    in this option, the difference can be quantized, which allows a good way to
>>> +	    incorporate a controlled loss in the encoding.</para>
>>
>> This is directly from Wikipedia, isn't it?
>>
> Yes.
>
>> What comes to the content, DPCM in the context of V4L2 media bus codes, as a
>> digital interface, is always digital. So there's no need to document it.
>> Entropy coding is also out of the question: the samples of the currently
>> defined formats are equal in size.
>>
> Ok.

Could you replace the above with this text (with appropriate indentation 
etc.) while keeping the reference to Wikipedia?

------8<------
Differential pulse-code modulation (DPCM) compression can be used to 
compress the samples into fewer bits than they would otherwise require. 
This is done by calculating the difference between consecutive samples 
and outputting the difference which in average is much smaller than the 
values of the samples themselves since there is generally lots of 
correlation between adjacent pixels. In decompression the original 
samples are reconstructed. The process isn't lossless as the encoded 
sample size in bits is less than the original.

Formats using DPCM compression include <xref 
linkend="pixfmt-srggb10dpcm8" />.

This control is used to select the predictor used to encode the samples.

The main difference between the simple and the advanced predictors is 
image quality, with advanced predictor supposed to produce better 
quality images as a result. Simple predictor can be used e.g. for 
testing purposes.
------8<------

Kind regards,

-- 
Sakari Ailus
sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-07 18:46     ` Sakari Ailus
@ 2012-09-07 19:04       ` Prabhakar Lad
  2012-09-13  0:59       ` Laurent Pinchart
  1 sibling, 0 replies; 7+ messages in thread
From: Prabhakar Lad @ 2012-09-07 19:04 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Prabhakar Lad, LMML, dlos, linux-kernel, Manjunath Hadli,
	Laurent Pinchart, linux-doc, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

Hi Sakari,

On Sat, Sep 8, 2012 at 12:16 AM, Sakari Ailus <sakari.ailus@iki.fi> wrote:
> Hi Prabhakar,
>
>
> Prabhakar Lad wrote:
>>
>> Hi Sakari,
>>
>> Thanks for the review.
>>
>> On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:
>>>
>>> Hi Prabhakar,
>>>
>>> Thanks for the patch. I've got a few comments below.
>>>
>>> On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:
>>>>
>>>> From: Lad, Prabhakar <prabhakar.lad@ti.com>
>>>>
>>>> add V4L2_CID_DPCM_PREDICTOR control of type menu, which
>>>> determines the dpcm predictor. The predictor can be either
>>>> simple or advanced.
>>>>
>>>> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
>>>> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
>>>> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>>>> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>>>> Cc: Sakari Ailus <sakari.ailus@iki.fi>
>>>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>>>> Cc: Rob Landley <rob@landley.net>
>>>> ---
>>>> This patches has one checkpatch warning for line over
>>>> 80 characters altough it can be avoided I have kept it
>>>> for consistency.
>>>>
>>>> Changes for v4:
>>>> 1: Aligned the description to fit appropriately in the
>>>> para tag, pointed by Sylwester.
>>>>
>>>> Changes for v3:
>>>> 1: Added better explanation for DPCM, pointed by Hans.
>>>>
>>>> Changes for v2:
>>>> 1: Added documentaion in controls.xml pointed by Sylwester.
>>>> 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
>>>>     pointed by Sakari.
>>>>
>>>>   Documentation/DocBook/media/v4l/controls.xml |   46
>>>> +++++++++++++++++++++++++-
>>>>   drivers/media/v4l2-core/v4l2-ctrls.c         |    9 +++++
>>>>   include/linux/videodev2.h                    |    5 +++
>>>>   3 files changed, 59 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/Documentation/DocBook/media/v4l/controls.xml
>>>> b/Documentation/DocBook/media/v4l/controls.xml
>>>> index 93b9c68..ad873ea 100644
>>>> --- a/Documentation/DocBook/media/v4l/controls.xml
>>>> +++ b/Documentation/DocBook/media/v4l/controls.xml
>>>> @@ -4267,7 +4267,51 @@ interface and may change in the future.</para>
>>>>             pixels / second.
>>>>             </entry>
>>>>           </row>
>>>> -         <row><entry></entry></row>
>>>> +         <row>
>>>> +           <entry
>>>> spanname="id"><constant>V4L2_CID_DPCM_PREDICTOR</constant></entry>
>>>> +           <entry>menu</entry>
>>>> +         </row>
>>>> +         <row id="v4l2-dpcm-predictor">
>>>> +           <entry spanname="descr"> Differential pulse-code modulation
>>>> (DPCM) is a signal
>>>> +           encoder that uses the baseline of pulse-code modulation
>>>> (PCM) but adds some
>>>> +           functionalities based on the prediction of the samples of
>>>> the signal. The input
>>>> +           can be an analog signal or a digital signal.
>>>> +
>>>> +           <para>If the input is a continuous-time analog signal, it
>>>> needs to be sampled
>>>> +           first so that a discrete-time signal is the input to the
>>>> DPCM encoder.</para>
>>>> +
>>>> +           <para>Simple: take the values of two consecutive samples; if
>>>> they are analog
>>>> +           samples, quantize them; calculate the difference between the
>>>> first one and the
>>>> +           next; the output is the difference, and it can be further
>>>> entropy coded.</para>
>>>> +
>>>> +           <para>Advanced: instead of taking a difference relative to a
>>>> previous input sample,
>>>> +           take the difference relative to the output of a local model
>>>> of the decoder process;
>>>> +           in this option, the difference can be quantized, which
>>>> allows a good way to
>>>> +           incorporate a controlled loss in the encoding.</para>
>>>
>>>
>>> This is directly from Wikipedia, isn't it?
>>>
>> Yes.
>>
>>> What comes to the content, DPCM in the context of V4L2 media bus codes,
>>> as a
>>> digital interface, is always digital. So there's no need to document it.
>>> Entropy coding is also out of the question: the samples of the currently
>>> defined formats are equal in size.
>>>
>> Ok.
>
>
> Could you replace the above with this text (with appropriate indentation
> etc.) while keeping the reference to Wikipedia?
>
> ------8<------
> Differential pulse-code modulation (DPCM) compression can be used to
> compress the samples into fewer bits than they would otherwise require. This
> is done by calculating the difference between consecutive samples and
> outputting the difference which in average is much smaller than the values
> of the samples themselves since there is generally lots of correlation
> between adjacent pixels. In decompression the original samples are
> reconstructed. The process isn't lossless as the encoded sample size in bits
> is less than the original.
>
> Formats using DPCM compression include <xref linkend="pixfmt-srggb10dpcm8"
> />.
>
> This control is used to select the predictor used to encode the samples.
>
> The main difference between the simple and the advanced predictors is image
> quality, with advanced predictor supposed to produce better quality images
> as a result. Simple predictor can be used e.g. for testing purposes.
> ------8<------
>
Thanks for the definition. :)

Thanks and Regards,
--Prabhakar Lad

>
> Kind regards,
>
> --
> Sakari Ailus
> sakari.ailus@iki.fi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-07 18:46     ` Sakari Ailus
  2012-09-07 19:04       ` Prabhakar Lad
@ 2012-09-13  0:59       ` Laurent Pinchart
  2012-09-18 12:49         ` Prabhakar Lad
  1 sibling, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2012-09-13  0:59 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Prabhakar Lad, LMML, dlos, linux-kernel, Manjunath Hadli,
	linux-doc, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, Hans de Goede, Kyungmin Park, Rob Landley

Hi Sakari,

On Friday 07 September 2012 21:46:44 Sakari Ailus wrote:
> 
> Could you replace the above with this text (with appropriate indentation
> etc.) while keeping the reference to Wikipedia?
> 
> ------8<------
> Differential pulse-code modulation (DPCM) compression can be used to
> compress the samples into fewer bits than they would otherwise require.
> This is done by calculating the difference between consecutive samples
> and outputting the difference which in average is much smaller than the
> values of the samples themselves since there is generally lots of
> correlation between adjacent pixels. In decompression the original
> samples are reconstructed. The process isn't lossless as the encoded
> sample size in bits is less than the original.
> 
> Formats using DPCM compression include <xref
> linkend="pixfmt-srggb10dpcm8" />.
> 
> This control is used to select the predictor used to encode the samples.

If I remember correctly this control will be used on the receiver side on 
DaVinci, to decode pixels not encode them. How is the predictor used in that 
case ? Must it match the predictor used on the encoding side ? If so I expect 
documentation to be available somewhere.

The OMAP3 ISP supports both DPCM encoding and decoding, and documents the 
predictors as

"- The simple predictor

This predictor uses only the previous same color component value as a 
prediction value. Therefore, only two-pixel memory is required.

- The advanced predictor

This predictor uses four previous pixel values, when the prediction value is 
evaluated. This means that also the other color component values are used, 
when the prediction value has been defined."

It also states the the simple predictor is preferred for 10-8-10 conversion, 
and the advanced predictor for 10-7-10 and 10-6-10 conversion.

> The main difference between the simple and the advanced predictors is
> image quality, with advanced predictor supposed to produce better
> quality images as a result. Simple predictor can be used e.g. for
> testing purposes.
> ------8<------

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor
  2012-09-13  0:59       ` Laurent Pinchart
@ 2012-09-18 12:49         ` Prabhakar Lad
  0 siblings, 0 replies; 7+ messages in thread
From: Prabhakar Lad @ 2012-09-18 12:49 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Laurent Pinchart, dlos, Rob Landley, linux-doc, linux-kernel,
	Hans de Goede, Kyungmin Park, Hans Verkuil, Sylwester Nawrocki,
	Mauro Carvalho Chehab, LMML

Hi Sakari,

On Thu, Sep 13, 2012 at 6:29 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Sakari,
>
> On Friday 07 September 2012 21:46:44 Sakari Ailus wrote:
>>
>> Could you replace the above with this text (with appropriate indentation
>> etc.) while keeping the reference to Wikipedia?
>>
>> ------8<------
>> Differential pulse-code modulation (DPCM) compression can be used to
>> compress the samples into fewer bits than they would otherwise require.
>> This is done by calculating the difference between consecutive samples
>> and outputting the difference which in average is much smaller than the
>> values of the samples themselves since there is generally lots of
>> correlation between adjacent pixels. In decompression the original
>> samples are reconstructed. The process isn't lossless as the encoded
>> sample size in bits is less than the original.
>>
>> Formats using DPCM compression include <xref
>> linkend="pixfmt-srggb10dpcm8" />.
>>
>> This control is used to select the predictor used to encode the samples.
>
> If I remember correctly this control will be used on the receiver side on
> DaVinci, to decode pixels not encode them. How is the predictor used in that
> case ? Must it match the predictor used on the encoding side ? If so I expect
> documentation to be available somewhere.
>
> The OMAP3 ISP supports both DPCM encoding and decoding, and documents the
> predictors as
>
> "- The simple predictor
>
> This predictor uses only the previous same color component value as a
> prediction value. Therefore, only two-pixel memory is required.
>
> - The advanced predictor
>
> This predictor uses four previous pixel values, when the prediction value is
> evaluated. This means that also the other color component values are used,
> when the prediction value has been defined."
>
> It also states the the simple predictor is preferred for 10-8-10 conversion,
> and the advanced predictor for 10-7-10 and 10-6-10 conversion.
>
What do you suggest ?

Regards,
--Prabhakar Lad

>> The main difference between the simple and the advanced predictors is
>> image quality, with advanced predictor supposed to produce better
>> quality images as a result. Simple predictor can be used e.g. for
>> testing purposes.
>> ------8<------
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-18 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04  5:37 [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor Prabhakar Lad
2012-09-04 19:12 ` Sakari Ailus
2012-09-05  5:10   ` Prabhakar Lad
2012-09-07 18:46     ` Sakari Ailus
2012-09-07 19:04       ` Prabhakar Lad
2012-09-13  0:59       ` Laurent Pinchart
2012-09-18 12:49         ` Prabhakar Lad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).