aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2012-02-02 18:17:54 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 07:37:44 -0400
commitc643ee135190389e03cffd80e762c9c71dc9a165 (patch)
treedbd22fb0fe7c816f1b8595bbd01605ea43f624e7
parent8c9d236ec64f1f1e7764385e7b5eae88eec7c02b (diff)
[media] v4l: Image processing control class
Add control class for image processing controls. The control class deals with controls processing image, for example digital gain or noise filtering, which can be present in any part of the pipeline. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--Documentation/DocBook/media/v4l/controls.xml82
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml6
-rw-r--r--drivers/media/video/v4l2-ctrls.c14
-rw-r--r--include/linux/videodev2.h8
4 files changed, 109 insertions, 1 deletions
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index 43cd4958c9e8..662127447aa6 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3685,4 +3685,86 @@ interface and may change in the future.</para>
3685 3685
3686 </section> 3686 </section>
3687 3687
3688 <section id="image-process-controls">
3689 <title>Image Process Control Reference</title>
3690
3691 <note>
3692 <title>Experimental</title>
3693
3694 <para>This is an <link
3695 linkend="experimental">experimental</link> interface and may
3696 change in the future.</para>
3697 </note>
3698
3699 <para>
3700 The Image Source control class is intended for low-level control of
3701 image processing functions. Unlike
3702 <constant>V4L2_CID_IMAGE_SOURCE_CLASS</constant>, the controls in
3703 this class affect processing the image, and do not control capturing
3704 of it.
3705 </para>
3706
3707 <table pgwide="1" frame="none" id="image-process-control-id">
3708 <title>Image Source Control IDs</title>
3709
3710 <tgroup cols="4">
3711 <colspec colname="c1" colwidth="1*" />
3712 <colspec colname="c2" colwidth="6*" />
3713 <colspec colname="c3" colwidth="2*" />
3714 <colspec colname="c4" colwidth="6*" />
3715 <spanspec namest="c1" nameend="c2" spanname="id" />
3716 <spanspec namest="c2" nameend="c4" spanname="descr" />
3717 <thead>
3718 <row>
3719 <entry spanname="id" align="left">ID</entry>
3720 <entry align="left">Type</entry>
3721 </row><row rowsep="1"><entry spanname="descr" align="left">Description</entry>
3722 </row>
3723 </thead>
3724 <tbody valign="top">
3725 <row><entry></entry></row>
3726 <row>
3727 <entry spanname="id"><constant>V4L2_CID_IMAGE_PROC_CLASS</constant></entry>
3728 <entry>class</entry>
3729 </row>
3730 <row>
3731 <entry spanname="descr">The IMAGE_PROC class descriptor.</entry>
3732 </row>
3733 <row>
3734 <entry spanname="id"><constant>V4L2_CID_LINK_FREQ</constant></entry>
3735 <entry>integer menu</entry>
3736 </row>
3737 <row>
3738 <entry spanname="descr">Data bus frequency. Together with the
3739 media bus pixel code, bus type (clock cycles per sample), the
3740 data bus frequency defines the pixel rate
3741 (<constant>V4L2_CID_PIXEL_RATE</constant>) in the
3742 pixel array (or possibly elsewhere, if the device is not an
3743 image sensor). The frame rate can be calculated from the pixel
3744 clock, image width and height and horizontal and vertical
3745 blanking. While the pixel rate control may be defined elsewhere
3746 than in the subdev containing the pixel array, the frame rate
3747 cannot be obtained from that information. This is because only
3748 on the pixel array it can be assumed that the vertical and
3749 horizontal blanking information is exact: no other blanking is
3750 allowed in the pixel array. The selection of frame rate is
3751 performed by selecting the desired horizontal and vertical
3752 blanking. The unit of this control is Hz. </entry>
3753 </row>
3754 <row>
3755 <entry spanname="id"><constant>V4L2_CID_PIXEL_RATE</constant></entry>
3756 <entry>64-bit integer</entry>
3757 </row>
3758 <row>
3759 <entry spanname="descr">Pixel rate in the source pads of
3760 the subdev. This control is read-only and its unit is
3761 pixels / second.
3762 </entry>
3763 </row>
3764 <row><entry></entry></row>
3765 </tbody>
3766 </tgroup>
3767 </table>
3768
3769 </section>
3688</section> 3770</section>
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
index f2d2ec3f0e31..0a4b90fcf2da 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
@@ -278,6 +278,12 @@ These controls are described in <xref
278 source controls. These controls are described in <xref 278 source controls. These controls are described in <xref
279 linkend="image-source-controls" />.</entry> 279 linkend="image-source-controls" />.</entry>
280 </row> 280 </row>
281 <row>
282 <entry><constant>V4L2_CTRL_CLASS_IMAGE_PROC</constant></entry>
283 <entry>0x9f0000</entry> <entry>The class containing image
284 processing controls. These controls are described in <xref
285 linkend="image-process-controls" />.</entry>
286 </row>
281 </tbody> 287 </tbody>
282 </tgroup> 288 </tgroup>
283 </table> 289 </table>
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 7a2f855d4e21..edb2a6a066ca 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -650,6 +650,11 @@ const char *v4l2_ctrl_get_name(u32 id)
650 case V4L2_CID_HBLANK: return "Horizontal Blanking"; 650 case V4L2_CID_HBLANK: return "Horizontal Blanking";
651 case V4L2_CID_ANALOGUE_GAIN: return "Analogue Gain"; 651 case V4L2_CID_ANALOGUE_GAIN: return "Analogue Gain";
652 652
653 /* Image processing controls */
654 case V4L2_CID_IMAGE_PROC_CLASS: return "Image Processing Controls";
655 case V4L2_CID_LINK_FREQ: return "Link Frequency";
656 case V4L2_CID_PIXEL_RATE: return "Pixel Rate";
657
653 default: 658 default:
654 return NULL; 659 return NULL;
655 } 660 }
@@ -741,6 +746,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
741 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: 746 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
742 *type = V4L2_CTRL_TYPE_MENU; 747 *type = V4L2_CTRL_TYPE_MENU;
743 break; 748 break;
749 case V4L2_CID_LINK_FREQ:
750 *type = V4L2_CTRL_TYPE_INTEGER_MENU;
751 break;
744 case V4L2_CID_RDS_TX_PS_NAME: 752 case V4L2_CID_RDS_TX_PS_NAME:
745 case V4L2_CID_RDS_TX_RADIO_TEXT: 753 case V4L2_CID_RDS_TX_RADIO_TEXT:
746 *type = V4L2_CTRL_TYPE_STRING; 754 *type = V4L2_CTRL_TYPE_STRING;
@@ -752,6 +760,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
752 case V4L2_CID_FLASH_CLASS: 760 case V4L2_CID_FLASH_CLASS:
753 case V4L2_CID_JPEG_CLASS: 761 case V4L2_CID_JPEG_CLASS:
754 case V4L2_CID_IMAGE_SOURCE_CLASS: 762 case V4L2_CID_IMAGE_SOURCE_CLASS:
763 case V4L2_CID_IMAGE_PROC_CLASS:
755 *type = V4L2_CTRL_TYPE_CTRL_CLASS; 764 *type = V4L2_CTRL_TYPE_CTRL_CLASS;
756 /* You can neither read not write these */ 765 /* You can neither read not write these */
757 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; 766 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -775,8 +784,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
775 break; 784 break;
776 case V4L2_CID_MPEG_VIDEO_DEC_FRAME: 785 case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
777 case V4L2_CID_MPEG_VIDEO_DEC_PTS: 786 case V4L2_CID_MPEG_VIDEO_DEC_PTS:
787 *flags |= V4L2_CTRL_FLAG_VOLATILE;
788 /* Fall through */
789 case V4L2_CID_PIXEL_RATE:
778 *type = V4L2_CTRL_TYPE_INTEGER64; 790 *type = V4L2_CTRL_TYPE_INTEGER64;
779 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE; 791 *flags |= V4L2_CTRL_FLAG_READ_ONLY;
780 *min = *max = *step = *def = 0; 792 *min = *max = *step = *def = 0;
781 break; 793 break;
782 default: 794 default:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3cd13b2faab5..0ae6eb2fb1f3 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1140,6 +1140,7 @@ struct v4l2_ext_controls {
1140#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1140#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1141#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ 1141#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1142#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ 1142#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
1143#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
1143 1144
1144#define V4L2_CTRL_ID_MASK (0x0fffffff) 1145#define V4L2_CTRL_ID_MASK (0x0fffffff)
1145#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1146#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1797,6 +1798,13 @@ enum v4l2_jpeg_chroma_subsampling {
1797#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2) 1798#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
1798#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3) 1799#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
1799 1800
1801/* Image processing controls */
1802#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
1803#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
1804
1805#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
1806#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
1807
1800/* 1808/*
1801 * T U N I N G 1809 * T U N I N G
1802 */ 1810 */