From patchwork Mon Jun 10 13:23:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Kumar K X-Patchwork-Id: 2697551 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 92ADCDF264 for ; Mon, 10 Jun 2013 13:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727Ab3FJNC7 (ORCPT ); Mon, 10 Jun 2013 09:02:59 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:53840 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752354Ab3FJNC5 (ORCPT ); Mon, 10 Jun 2013 09:02:57 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MO6008ZSHKR1PP0@mailout2.samsung.com> for linux-media@vger.kernel.org; Mon, 10 Jun 2013 22:02:56 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 39.B2.29708.08EC5B15; Mon, 10 Jun 2013 22:02:56 +0900 (KST) X-AuditID: cbfee690-b7f6f6d00000740c-f8-51b5ce80408e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B2.AD.21068.08EC5B15; Mon, 10 Jun 2013 22:02:56 +0900 (KST) Received: from chromeserver-PowerEdge-T410.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MO600DO7HEHPR30@mmp1.samsung.com>; Mon, 10 Jun 2013 22:02:56 +0900 (KST) From: Arun Kumar K To: linux-media@vger.kernel.org Cc: k.debski@samsung.com, jtp.park@samsung.com, s.nawrocki@samsung.com, avnd.kiran@samsung.com, arunkk.samsung@gmail.com Subject: [PATCH 5/6] [media] V4L: Add VP8 encoder controls Date: Mon, 10 Jun 2013 18:53:05 +0530 Message-id: <1370870586-24141-6-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1370870586-24141-1-git-send-email-arun.kk@samsung.com> References: <1370870586-24141-1-git-send-email-arun.kk@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsWyRsSkVrfh3NZAg8b/ShYvNt5it3g5u4/Z 4sjaq0wWP15fYLPo2bCV1eLwm3ZWBzaPnbPusnv0bVnF6PF5k1wAcxSXTUpqTmZZapG+XQJX xrNHLUwFzeEVfefOMzUwnnPtYuTkkBAwkWj9u5MVwhaTuHBvPVsXIxeHkMBSRolTfZ/ZYIpm b1oAlVjEKLHg6h92kISQwGwmiQttbiA2m4CGxL0Tj8EmiQjISzzpvQHUwMHBLFAlcem2FkhY WMBK4vnfJ2CtLAKqEpPWLWEGsXkFnCW67r1lhNilKNH9bAJYK6eAi8S25ZwQm5wlTs/pgCpp Z5eYccEZYoyAxLfJh1hAyiUEZCU2HWCGKJGUOLjiBssERuEFjAyrGEVTC5ILipPSi0z0ihNz i0vz0vWS83M3MQJD+PS/ZxN2MN47YH2IMRlo3ERmKdHkfGAM5JXEGxqbGVmYmpgaG5lbmpEm rCTOq95iHSgkkJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qB0eH+5lT72D9XN++KFBIJ3R65MbLC VmibzEzPd0uPph5d9sW9lE3eeflCVpcfi51ePgk+vNBk5fS7J1POOMdf33z3rzHDzn/aBhNb NHNVMuuvFu2vzrKapVzjPFNI6a7o+fXHL6e4qPfffb7ofuqllrQ3QRe5BSUnPE/7NlvqxZ52 1rjmbEURPyWW4oxEQy3mouJEAPGSHhl3AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsVy+t9jAd2Gc1sDDW4tlLR4sfEWu8XL2X3M FkfWXmWy+PH6AptFz4atrBaH37SzOrB57Jx1l92jb8sqRo/Pm+QCmKMaGG0yUhNTUosUUvOS 81My89JtlbyD453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgBYrKZQl5pQChQISi4uV9O0w TQgNcdO1gGmM0PUNCYLrMTJAAwlrGDOePWphKmgOr+g7d56pgfGcaxcjJ4eEgInE7E0L2CBs MYkL99YD2VwcQgKLGCUWXP3DDpIQEpjNJHGhzQ3EZhPQkLh34jEriC0iIC/xpPcGUAMHB7NA lcSl21ogYWEBK4nnf5+AtbIIqEpMWreEGcTmFXCW6Lr3lhFil6JE97MJYK2cAi4S25ZzQmxy ljg9p4NxAiPvAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjBMfJMegfjqgaLQ4wCHIxK PLwPfm0JFGJNLCuuzD3EKMHBrCTCK7tla6AQb0piZVVqUX58UWlOavEhxmSgoyYyS4km5wPj N68k3tDYxNzU2NTSxMLEzJI0YSVx3oOt1oFCAumJJanZqakFqUUwW5g4OKUaGMNXf+1espDN Z8bhI1Vvp2ws2eP8sMCjXICVYWKJY5ugZMPrf7PmdjMmLo3wPbrDS+XturQn/hvCC7k+N8lL bgpskJI7rLN/y8Vs2akL09efbU3/Fe+/SzTzp/Xkf/Lvjv0O8L4hGnr8y5lFUY+6crM9vXSe haWXTT4aMVn8xh2R2of/rqjOb1FiKc5INNRiLipOBAB5wK+Z1QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch adds new V4L controls for VP8 encoding. Signed-off-by: Arun Kumar K Signed-off-by: Kiran AVND --- Documentation/DocBook/media/v4l/controls.xml | 145 ++++++++++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 38 +++++++ include/uapi/linux/v4l2-controls.h | 30 +++++- 3 files changed, 212 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 8d7a779..db614c7 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -4772,4 +4772,149 @@ defines possible values for de-emphasis. Here they are: + +
+ VPX Control Reference + + The VPX control class includes controls for encoding parameters + of VPx video codec. + + + VPX Control IDs + + + + + + + + + + + ID + Type + Description + + + + + + + + V4L2_CID_VPX_NUM_PARTITIONS  + enum v4l2_vp8_num_partitions + + The number of token partitions to use in VP8 encoder. +Possible values are: + + + + + + V4L2_VPX_1_PARTITION  + 1 coefficient partition + + + V4L2_VPX_2_PARTITIONS  + 2 partitions + + + V4L2_VPX_4_PARTITIONS  + 4 partitions + + + V4L2_VPX_8_PARTITIONS  + 8 partitions + + + + + + + + V4L2_CID_VPX_IMD_DISABLE_4X4  + boolean + + Setting this prevents intra 4x4 mode in the intra mode decision. + + + + + V4L2_CID_VPX_NUM_REF_FRAMES  + enum v4l2_vp8_num_ref_frames + + The number of reference pictures for encoding P frames. +Possible values are: + + + + + + V4L2_VPX_1_REF_FRAME  + Last encoded frame will be searched + + + V4L2_VPX_2_REF_FRAME  + Last encoded frame and the Golden frame will be searched + + + + + + + + V4L2_CID_VPX_FILTER_LEVEL  + integer + + Indicates the loop filter level. The adjustment of loop +filter level is done via a delta value against a baseline loop filter value. + + + + + V4L2_CID_VPX_FILTER_SHARPNESS  + integer + + This parameter affects the loop filter. Anything above +zero weakens the deblocking effect on loop filter. + + + + + V4L2_CID_VPX_GOLDEN_FRAME_REF_PERIOD  + integer + + Sets the refresh period for golden frame. + + + + + V4L2_CID_VPX_GOLDEN_FRAME_SEL  + enum v4l2_vp8_golden_frame_sel + + Selects the golden frame for encoding. +Possible values are: + + + + + + V4L2_VPX_GOLDEN_FRAME_USE_PREV  + Use the previous second frame as a golden frame + + + V4L2_VPX_GOLDEN_FRAME_USE_REF_PERIOD  + Use the previous specific frame indicated by V4L2_CID_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame + + + + + + + + +
+ +
+ diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index fccd08b..2cf17d4 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -456,6 +456,23 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "RGB full range (0-255)", NULL, }; + static const char * const vpx_num_partitions[] = { + "1 partition", + "2 partitions", + "4 partitions", + "8 partitions", + NULL, + }; + static const char * const vpx_num_ref_frames[] = { + "1 reference frame", + "2 reference frame", + NULL, + }; + static const char * const vpx_golden_frame_sel[] = { + "Use previous frame", + "Use frame indicated by GOLDEN_FRAME_REF_PERIOD", + NULL, + }; switch (id) { @@ -545,6 +562,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) case V4L2_CID_DV_TX_RGB_RANGE: case V4L2_CID_DV_RX_RGB_RANGE: return dv_rgb_range; + case V4L2_CID_VPX_NUM_PARTITIONS: + return vpx_num_partitions; + case V4L2_CID_VPX_NUM_REF_FRAMES: + return vpx_num_ref_frames; + case V4L2_CID_VPX_GOLDEN_FRAME_SEL: + return vpx_golden_frame_sel; default: return NULL; @@ -806,6 +829,17 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_FM_RX_CLASS: return "FM Radio Receiver Controls"; case V4L2_CID_TUNE_DEEMPHASIS: return "De-Emphasis"; case V4L2_CID_RDS_RECEPTION: return "RDS Reception"; + + /* VPX controls */ + case V4L2_CID_VPX_CLASS: return "VPX Encoder Controls"; + case V4L2_CID_VPX_NUM_PARTITIONS: return "VPX Number of partitions"; + case V4L2_CID_VPX_IMD_DISABLE_4X4: return "VPX Intra mode decision disable"; + case V4L2_CID_VPX_NUM_REF_FRAMES: return "VPX Number of reference pictures for P frames"; + case V4L2_CID_VPX_FILTER_LEVEL: return "VPX Loop filter level range"; + case V4L2_CID_VPX_FILTER_SHARPNESS: return "VPX Deblocking effect control"; + case V4L2_CID_VPX_GOLDEN_FRAME_REF_PERIOD: return "VPX Golden frame refresh period"; + case V4L2_CID_VPX_GOLDEN_FRAME_SEL: return "VPX Golden frame indicator"; + default: return NULL; } @@ -914,6 +948,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DV_RX_RGB_RANGE: case V4L2_CID_TEST_PATTERN: case V4L2_CID_TUNE_DEEMPHASIS: + case V4L2_CID_VPX_NUM_PARTITIONS: + case V4L2_CID_VPX_NUM_REF_FRAMES: + case V4L2_CID_VPX_GOLDEN_FRAME_SEL: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_LINK_FREQ: @@ -937,6 +974,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_IMAGE_PROC_CLASS: case V4L2_CID_DV_CLASS: case V4L2_CID_FM_RX_CLASS: + case V4L2_CID_VPX_CLASS: *type = V4L2_CTRL_TYPE_CTRL_CLASS; /* You can neither read not write these */ *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 69bd5bb..3d6649c 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -60,6 +60,7 @@ #define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ #define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ #define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* Digital Video controls */ +#define V4L2_CTRL_CLASS_VPX 0x00a20000 /* VPX-compression controls */ /* User-class control IDs */ @@ -818,7 +819,6 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2) #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) - /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) #define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1) @@ -853,4 +853,32 @@ enum v4l2_deemphasis { #define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) +/* VP-class control IDs */ + +#define V4L2_CID_VPX_BASE (V4L2_CTRL_CLASS_VPX | 0x900) +#define V4L2_CID_VPX_CLASS (V4L2_CTRL_CLASS_VPX | 1) + +/* VPX streams, specific to multiplexed streams */ +#define V4L2_CID_VPX_NUM_PARTITIONS (V4L2_CID_VPX_BASE+0) +enum v4l2_vp8_num_partitions { + V4L2_VPX_1_PARTITION = 0, + V4L2_VPX_2_PARTITIONS = (1 << 1), + V4L2_VPX_4_PARTITIONS = (1 << 2), + V4L2_VPX_8_PARTITIONS = (1 << 3), +}; +#define V4L2_CID_VPX_IMD_DISABLE_4X4 (V4L2_CID_VPX_BASE+1) +#define V4L2_CID_VPX_NUM_REF_FRAMES (V4L2_CID_VPX_BASE+2) +enum v4l2_vp8_num_ref_frames { + V4L2_VPX_1_REF_FRAME = 0, + V4L2_VPX_2_REF_FRAME = 1, +}; +#define V4L2_CID_VPX_FILTER_LEVEL (V4L2_CID_VPX_BASE+3) +#define V4L2_CID_VPX_FILTER_SHARPNESS (V4L2_CID_VPX_BASE+4) +#define V4L2_CID_VPX_GOLDEN_FRAME_REF_PERIOD (V4L2_CID_VPX_BASE+5) +#define V4L2_CID_VPX_GOLDEN_FRAME_SEL (V4L2_CID_VPX_BASE+6) +enum v4l2_vp8_golden_frame_sel { + V4L2_VPX_GOLDEN_FRAME_USE_PREV = 0, + V4L2_VPX_GOLDEN_FRAME_USE_REF_PERIOD = 1, +}; + #endif