[media] V4L: Add JPEG compression control class
The V4L2_CID_JPEG_CLASS control class is intended to expose various adjustable parameters of JPEG encoders and decoders. Following controls are defined: - V4L2_CID_JPEG_CHROMA_SUBSAMPLING, - V4L2_CID_JPEG_RESTART_INTERVAL, - V4L2_CID_JPEG_COMPRESSION_QUALITY, - V4L2_CID_JPEG_ACTIVE_MARKER. This covers only a part of relevant standard specifications. More controls should be added in future if required. The purpose of V4L2_CID_JPEG_CLASS class is also to replace some functionality covered by VIDIOC_S/G_JPEGCOMP ioctls, i.e. the JPEG markers presence and compression quality control. The applications and drivers should switch from the ioctl to control based API, as described in the subsequent patches for the Media API DocBook. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
e8ca6d20a6
commit
c7361ae1e7
|
@ -362,6 +362,16 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
|
|||
NULL,
|
||||
};
|
||||
|
||||
static const char * const jpeg_chroma_subsampling[] = {
|
||||
"4:4:4",
|
||||
"4:2:2",
|
||||
"4:2:0",
|
||||
"4:1:1",
|
||||
"4:1:0",
|
||||
"Gray",
|
||||
NULL,
|
||||
};
|
||||
|
||||
switch (id) {
|
||||
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
|
||||
return mpeg_audio_sampling_freq;
|
||||
|
@ -426,6 +436,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
|
|||
return mpeg_mpeg4_level;
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
|
||||
return mpeg4_profile;
|
||||
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
|
||||
return jpeg_chroma_subsampling;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -623,6 +636,14 @@ const char *v4l2_ctrl_get_name(u32 id)
|
|||
case V4L2_CID_FLASH_CHARGE: return "Charge";
|
||||
case V4L2_CID_FLASH_READY: return "Ready to Strobe";
|
||||
|
||||
/* JPEG encoder controls */
|
||||
/* Keep the order of the 'case's the same as in videodev2.h! */
|
||||
case V4L2_CID_JPEG_CLASS: return "JPEG Compression Controls";
|
||||
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: return "Chroma Subsampling";
|
||||
case V4L2_CID_JPEG_RESTART_INTERVAL: return "Restart Interval";
|
||||
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
|
||||
case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -711,6 +732,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
|||
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
|
||||
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
|
||||
*type = V4L2_CTRL_TYPE_MENU;
|
||||
break;
|
||||
case V4L2_CID_RDS_TX_PS_NAME:
|
||||
|
@ -722,6 +744,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
|||
case V4L2_CID_MPEG_CLASS:
|
||||
case V4L2_CID_FM_TX_CLASS:
|
||||
case V4L2_CID_FLASH_CLASS:
|
||||
case V4L2_CID_JPEG_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;
|
||||
|
@ -735,6 +758,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
|||
*max = 0xFFFFFF;
|
||||
break;
|
||||
case V4L2_CID_FLASH_FAULT:
|
||||
case V4L2_CID_JPEG_ACTIVE_MARKER:
|
||||
*type = V4L2_CTRL_TYPE_BITMASK;
|
||||
break;
|
||||
case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
|
||||
|
|
|
@ -1136,6 +1136,7 @@ struct v4l2_ext_controls {
|
|||
#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
|
||||
#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
|
||||
#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
|
||||
#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
|
||||
|
||||
#define V4L2_CTRL_ID_MASK (0x0fffffff)
|
||||
#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
|
||||
|
@ -1758,6 +1759,29 @@ enum v4l2_flash_strobe_source {
|
|||
#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
|
||||
#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
|
||||
|
||||
/* JPEG-class control IDs defined by V4L2 */
|
||||
#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
|
||||
#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
|
||||
|
||||
#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
|
||||
enum v4l2_jpeg_chroma_subsampling {
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
|
||||
V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
|
||||
};
|
||||
#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
|
||||
#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
|
||||
|
||||
#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
|
||||
#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
|
||||
|
||||
/*
|
||||
* T U N I N G
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue