From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753036Ab2IDFi7 (ORCPT ); Tue, 4 Sep 2012 01:38:59 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:60390 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751285Ab2IDFi5 (ORCPT ); Tue, 4 Sep 2012 01:38:57 -0400 From: Prabhakar Lad To: LMML CC: dlos , , Manjunath Hadli , Laurent Pinchart , , Hans Verkuil , Sylwester Nawrocki , "Lad, Prabhakar" , Sakari Ailus , Mauro Carvalho Chehab , Hans de Goede , Kyungmin Park , Rob Landley Subject: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor Date: Tue, 4 Sep 2012 11:07:52 +0530 Message-ID: <1346737072-24341-1-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad, Prabhakar 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 Signed-off-by: Manjunath Hadli Acked-by: Hans Verkuil Reviewed-by: Sylwester Nawrocki Cc: Sakari Ailus Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Hans de Goede Cc: Kyungmin Park Cc: Rob Landley --- 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. pixels / second. - + + V4L2_CID_DPCM_PREDICTOR + menu + + + 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. + + 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. + + 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. + + 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. + + 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 Wikipedia. + + + + + + + V4L2_DPCM_PREDICTOR_SIMPLE + Predictor type is simple + + + V4L2_DPCM_PREDICTOR_ADVANCED + Predictor type is advanced + + + + + 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