[PATCH v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@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@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
Cc: HeungJun Kim riverful@samsung.com
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

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 |   48 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +++
 3 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..f704218 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,53 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
+   entrymenu/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.
+
+   paraIf 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
+
+   paraSimple: 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
+
+   paraAdvanced: 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
+
+   paraApplying 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
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/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 

Re: [PATCH v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Hans Verkuil
On Mon September 3 2012 09:20:51 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@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@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.
 
 Changes for v3:
 1: Added better explanation for DPCM, pointed by Hans.

Much better!

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

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 |   48 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 61 insertions(+), 1 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..f704218 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,53 @@ interface and may change in the future./para
   pixels / second.
   /entry
 /row
 -   rowentry/entry/row
 +   row
 + entry 
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 + entrymenu/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.
 +
 + paraIf 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
 +
 + paraSimple: 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
 +
 + paraAdvanced: 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
 +
 + paraApplying 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
 +  entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
 +   entryPredictor type is simple/entry
 + /row
 + row
 +   
 entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
 +   entryPredictor type is advanced/entry
 + /row
 +   /tbody
 + /entrytbl
 +   /row
 + rowentry/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;
  

Re: [PATCH v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Sylwester Nawrocki
On 09/03/2012 09:20 AM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@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@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com

Looks good.

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com

 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.
 
 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 |   48 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 61 insertions(+), 1 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..f704218 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,53 @@ interface and may change in the future./para
   pixels / second.
   /entry
 /row
 -   rowentry/entry/row
 +   row
 + entry 
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 + entrymenu/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.
 +
 + paraIf 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

nit: this whole paragraph could fit in 2 lines.

 +
 + paraSimple: 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
 +
 + paraAdvanced: 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
 +
 + paraApplying 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
 +  entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
 +   entryPredictor type is simple/entry
 + /row
 + row
 +   
 entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
 +   entryPredictor type is advanced/entry
 + /row
 +   /tbody
 + /entrytbl
 +   /row
 + rowentry/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)
  

Re: [PATCH v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Prabhakar Lad
Hi Sylwester,

Thanks for the review.

On Monday 03 September 2012 02:51 PM, Sylwester Nawrocki wrote:
 On 09/03/2012 09:20 AM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@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@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com
 
 Looks good.
 
 Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
 
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 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 |   48 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 61 insertions(+), 1 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..f704218 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,53 @@ interface and may change in the future./para
  pixels / second.
  /entry
/row
 -  rowentry/entry/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 +entrymenu/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.
 +
 +paraIf 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
 
 nit: this whole paragraph could fit in 2 lines.
 
thanks for the catch ,I'll post a v4 fixing this.

Thanks and Regards,
--Prabhakar Lad

 +
 +paraSimple: 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
 +
 +paraAdvanced: 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
 +
 +paraApplying 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
 + entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
 +  entryPredictor type is simple/entry
 +/row
 +row
 +  
 entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
 +  entryPredictor type is advanced/entry
 +/row
 +  /tbody
 +/entrytbl
 +  /row
 +rowentry/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,
 +};