Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
Hi Pawel, Thank you for the patch. On Friday 30 August 2013 11:17:15 Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. In addition to the comments already sent by Hans, Kamil and Sylwester, I'll just point out that documentation is needed. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; + case V4L2_CID_ENCODER_NUM_GDR_FRAMES: return Encoder, number of GDR frames; + case V4L2_CID_ENCODER_LTR_BUFFER_CONTROL: return Encoder, LTR buffer control; + case V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE: return Encoder, LTR buffer trust mode; + case V4L2_CID_ENCODER_LTR_PICTURE_POSITION: return Encoder, LTR picture position; + case V4L2_CID_ENCODER_LTR_PICTURE_MODE: return Encoder, LTR picture mode; + case V4L2_CID_ENCODER_LTR_VALIDATION: return Encoder, LTR validation; + case V4L2_CID_ENCODER_MIN_QP: return Encoder, minimum QP param; + case V4L2_CID_ENCODER_MAX_QP: return Encoder, maximum QP param; + case V4L2_CID_ENCODER_SYNC_FRAME_INTERVAL: return Encoder, sync frame interval; + case V4L2_CID_ENCODER_ERROR_RESILIENCY: return Encoder, error resiliency; + case V4L2_CID_ENCODER_TEMPORAL_LAYER_ENABLE: return Encoder, temporal layer enable; + + case V4L2_CID_ENCODER_VP8_SLICE_MODE: return Encoder, VP8 slice mode; + case V4L2_CID_ENCODER_VP8_SYNC_FRAME_TYPE: return Encoder, VP8 sync frame type; + case V4L2_CID_ENCODER_VP8_DCT_PARTS_PER_FRAME: return Encoder, VP8, DCT partitions per frame; + + case V4L2_CID_ENCODER_H264_PROFILE_TOOLSET: return Encoder, H.264 profile and toolset; + case V4L2_CID_ENCODER_H264_LEVEL_IDC_LIMIT: return Encoder, H.264 level IDC limit; + case V4L2_CID_ENCODER_H264_SEI_PAYLOAD_TYPE: return Encoder, H.264 SEI payload type; + case V4L2_CID_ENCODER_H264_LAYER_PRIORITY: return Encoder, H.264 layer priority; + /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ case V4L2_CID_FM_TX_CLASS: return FM Radio Modulator Controls; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 083bb5a..ef3a30d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -729,6 +729,37 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +/* Controls found in UVC 1.5 encoding cameras */ +#define V4L2_CID_ENCODER_MIN_FRAME_INTERVAL (V4L2_CID_CAMERA_CLASS_BASE+32) +#define V4L2_CID_ENCODER_RATE_CONTROL_MODE (V4L2_CID_CAMERA_CLASS_BASE+33) +#define V4L2_CID_ENCODER_AVERAGE_BITRATE (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_CID_ENCODER_CPB_SIZE(V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_ENCODER_PEAK_BIT_RATE (V4L2_CID_CAMERA_CLASS_BASE+36) +#define V4L2_CID_ENCODER_QP_PARAM_I (V4L2_CID_CAMERA_CLASS_BASE+37) +#define V4L2_CID_ENCODER_QP_PARAM_P (V4L2_CID_CAMERA_CLASS_BASE+38) +#define V4L2_CID_ENCODER_QP_PARAM_BG (V4L2_CID_CAMERA_CLASS_BASE+39) +#define V4L2_CID_ENCODER_NUM_GDR_FRAMES (V4L2_CID_CAMERA_CLASS_BASE+40) +#define V4L2_CID_ENCODER_LTR_BUFFER_CONTROL (V4L2_CID_CAMERA_CLASS_BASE+41) +#define V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE(V4L2_CID_CAMERA_CLASS_BASE+42) +#define V4L2_CID_ENCODER_LTR_PICTURE_POSITION (V4L2_CID_CAMERA_CLASS_BASE+43) +#define V4L2_CID_ENCODER_LTR_PICTURE_MODE(V4L2_CID_CAMERA_CLASS_BASE+44) +#define V4L2_CID_ENCODER_LTR_VALIDATION (V4L2_CID_CAMERA_CLASS_BASE+45) +#define V4L2_CID_ENCODER_MIN_QP (V4L2_CID_CAMERA_CLASS_BASE+46)
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On Tue, Sep 10, 2013 at 6:17 PM, Hans Verkuil hverk...@xs4all.nl wrote: On Mon 9 September 2013 11:09:57 Sylwester Nawrocki wrote: On 09/09/2013 11:00 AM, Kamil Debski wrote: [...] We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. We had a discussion about this on linux-media mailing list. It can be found here: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/32606 In short, it is a mix of two reasons: one - the valid range is different for different formats and second - implementing controls which have different min/max values depending on format was not easy. Hmm, these seem pretty vague reasons. And since some time we have support for dynamic control range update [1]. I don't think we should change this. We chose to go with separate controls, and we should stick with that. We might do it differently today, but it's not a big deal. I guess I can't reuse MPEG controls as you suggested then. But I could either create a new VPX class, or keep these ones in camera class and create separate VPX class later for codecs. It's technically possible for UVC to have different constraints on some controls though, even if the codec is the same, potentially creating more confusion... Regards, Hans On the one hand I am thinking that now, when we have more codecs, it would be better to have a single control, on the other hand what about backward compatibility? Is there a graceful way to merge H263 and H264 QP controls? [1] https://patchwork.linuxtv.org/patch/16436/ -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
Hi Pawel, On 09/12/2013 03:10 AM, Pawel Osciak wrote: On Tue, Sep 10, 2013 at 6:17 PM, Hans Verkuil hverk...@xs4all.nl wrote: On Mon 9 September 2013 11:09:57 Sylwester Nawrocki wrote: On 09/09/2013 11:00 AM, Kamil Debski wrote: [...] We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. We had a discussion about this on linux-media mailing list. It can be found here: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/32606 In short, it is a mix of two reasons: one - the valid range is different for different formats and second - implementing controls which have different min/max values depending on format was not easy. Hmm, these seem pretty vague reasons. And since some time we have support for dynamic control range update [1]. I don't think we should change this. We chose to go with separate controls, and we should stick with that. We might do it differently today, but it's not a big deal. I guess I can't reuse MPEG controls as you suggested then. Sure you can. Just call it V4L2_CID_MPEG_VIDEO_VPX_MIN_QP etc. The name 'MPEG' was an unfortunate choice, it should have been 'CODEC'. And in fact in the spec it's now known as the Codec Control Class. The QP settings are most definitely codec controls, not camera or vpx controls. But I could either create a new VPX class, or keep these ones in camera class and create separate VPX class later for codecs. It's technically possible for UVC to have different constraints on some controls though, even if the codec is the same, potentially creating more confusion... That's nothing new for uvc and there isn't anything you can do about it. I don't think this will cause problems in practice. Regards, Hans Regards, Hans On the one hand I am thinking that now, when we have more codecs, it would be better to have a single control, on the other hand what about backward compatibility? Is there a graceful way to merge H263 and H264 QP controls? [1] https://patchwork.linuxtv.org/patch/16436/ -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On Mon 9 September 2013 11:09:57 Sylwester Nawrocki wrote: On 09/09/2013 11:00 AM, Kamil Debski wrote: [...] We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. We had a discussion about this on linux-media mailing list. It can be found here: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/32606 In short, it is a mix of two reasons: one - the valid range is different for different formats and second - implementing controls which have different min/max values depending on format was not easy. Hmm, these seem pretty vague reasons. And since some time we have support for dynamic control range update [1]. I don't think we should change this. We chose to go with separate controls, and we should stick with that. We might do it differently today, but it's not a big deal. Regards, Hans On the one hand I am thinking that now, when we have more codecs, it would be better to have a single control, on the other hand what about backward compatibility? Is there a graceful way to merge H263 and H264 QP controls? [1] https://patchwork.linuxtv.org/patch/16436/ -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On 09/09/2013 05:48 AM, Pawel Osciak wrote: Hi Hans, Thanks for the comments, one question inline. On Fri, Aug 30, 2013 at 3:48 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 08/30/2013 04:17 AM, Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; A lot of these exist already. E.g. V4L2_CID_MPEG_VIDEO_MPEG4_I/P/B_FRAME_QP. Samsung added support for many of these parameters for their MFC encoder (including VP8 support) so you should use them as well. As mentioned in v4l2-controls.h the MPEG part of the control name is historical. Interpret it as 'CODEC', not MPEG. We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On Mon, Sep 9, 2013 at 4:52 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 09/09/2013 05:48 AM, Pawel Osciak wrote: Hi Hans, Thanks for the comments, one question inline. On Fri, Aug 30, 2013 at 3:48 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 08/30/2013 04:17 AM, Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; A lot of these exist already. E.g. V4L2_CID_MPEG_VIDEO_MPEG4_I/P/B_FRAME_QP. Samsung added support for many of these parameters for their MFC encoder (including VP8 support) so you should use them as well. As mentioned in v4l2-controls.h the MPEG part of the control name is historical. Interpret it as 'CODEC', not MPEG. We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v1 16/19] v4l: Add encoding camera controls.
Hi, From: Pawel Osciak [mailto:posc...@chromium.org] Sent: Monday, September 09, 2013 9:59 AM On Mon, Sep 9, 2013 at 4:52 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 09/09/2013 05:48 AM, Pawel Osciak wrote: Hi Hans, Thanks for the comments, one question inline. On Fri, Aug 30, 2013 at 3:48 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 08/30/2013 04:17 AM, Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; A lot of these exist already. E.g. V4L2_CID_MPEG_VIDEO_MPEG4_I/P/B_FRAME_QP. Samsung added support for many of these parameters for their MFC encoder (including VP8 support) so you should use them as well. As mentioned in v4l2-controls.h the MPEG part of the control name is historical. Interpret it as 'CODEC', not MPEG. We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. We had a discussion about this on linux-media mailing list. It can be found here: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/326 06 In short, it is a mix of two reasons: one - the valid range is different for different formats and second - implementing controls which have different min/max values depending on format was not easy. On the one hand I am thinking that now, when we have more codecs, it would be better to have a single control, on the other hand what about backward compatibility? Is there a graceful way to merge H263 and H264 QP controls? Best wishes, Kamil -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On 09/09/2013 11:00 AM, Kamil Debski wrote: [...] We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? I can't quite remember the details, so I've CCed Kamil since he added those controls. At least the H264 QP controls are different from the others as they have a different range. What's the range for VP8? Yes, it differs, 0-127. But I feel this is pretty unfortunate, is it a good idea to multiply controls to have one per format when they have different ranges depending on the selected format in general? Perhaps a custom handler would be better? I'm not sure why the H263/MPEG4 controls weren't unified: it might be that since the H264 range was different we decided to split it up per codec. But I seem to remember that there was another reason as well. We had a discussion about this on linux-media mailing list. It can be found here: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/32606 In short, it is a mix of two reasons: one - the valid range is different for different formats and second - implementing controls which have different min/max values depending on format was not easy. Hmm, these seem pretty vague reasons. And since some time we have support for dynamic control range update [1]. On the one hand I am thinking that now, when we have more codecs, it would be better to have a single control, on the other hand what about backward compatibility? Is there a graceful way to merge H263 and H264 QP controls? [1] https://patchwork.linuxtv.org/patch/16436/ -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
Hi Hans, Thanks for the comments, one question inline. On Fri, Aug 30, 2013 at 3:48 PM, Hans Verkuil hverk...@xs4all.nl wrote: On 08/30/2013 04:17 AM, Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; A lot of these exist already. E.g. V4L2_CID_MPEG_VIDEO_MPEG4_I/P/B_FRAME_QP. Samsung added support for many of these parameters for their MFC encoder (including VP8 support) so you should use them as well. As mentioned in v4l2-controls.h the MPEG part of the control name is historical. Interpret it as 'CODEC', not MPEG. We have QP controls separately for H264, H263 and MPEG4. Why is that? Which one should I use for VP8? Shouldn't we unify them instead? + case V4L2_CID_ENCODER_NUM_GDR_FRAMES: return Encoder, number of GDR frames; + case V4L2_CID_ENCODER_LTR_BUFFER_CONTROL: return Encoder, LTR buffer control; + case V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE: return Encoder, LTR buffer trust mode; + case V4L2_CID_ENCODER_LTR_PICTURE_POSITION: return Encoder, LTR picture position; + case V4L2_CID_ENCODER_LTR_PICTURE_MODE: return Encoder, LTR picture mode; + case V4L2_CID_ENCODER_LTR_VALIDATION: return Encoder, LTR validation; + case V4L2_CID_ENCODER_MIN_QP: return Encoder, minimum QP param; + case V4L2_CID_ENCODER_MAX_QP: return Encoder, maximum QP param; + case V4L2_CID_ENCODER_SYNC_FRAME_INTERVAL: return Encoder, sync frame interval; + case V4L2_CID_ENCODER_ERROR_RESILIENCY: return Encoder, error resiliency; + case V4L2_CID_ENCODER_TEMPORAL_LAYER_ENABLE: return Encoder, temporal layer enable; + + case V4L2_CID_ENCODER_VP8_SLICE_MODE: return Encoder, VP8 slice mode; + case V4L2_CID_ENCODER_VP8_SYNC_FRAME_TYPE: return Encoder, VP8 sync frame type; + case V4L2_CID_ENCODER_VP8_DCT_PARTS_PER_FRAME: return Encoder, VP8, DCT partitions per frame; + + case V4L2_CID_ENCODER_H264_PROFILE_TOOLSET: return Encoder, H.264 profile and toolset; + case V4L2_CID_ENCODER_H264_LEVEL_IDC_LIMIT: return Encoder, H.264 level IDC limit; + case V4L2_CID_ENCODER_H264_SEI_PAYLOAD_TYPE: return Encoder, H.264 SEI payload type; + case V4L2_CID_ENCODER_H264_LAYER_PRIORITY: return Encoder, H.264 layer priority; + /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ case V4L2_CID_FM_TX_CLASS: return FM Radio Modulator Controls; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 083bb5a..ef3a30d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -729,6 +729,37 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +/* Controls found in UVC 1.5 encoding cameras */ +#define V4L2_CID_ENCODER_MIN_FRAME_INTERVAL (V4L2_CID_CAMERA_CLASS_BASE+32) +#define V4L2_CID_ENCODER_RATE_CONTROL_MODE (V4L2_CID_CAMERA_CLASS_BASE+33) +#define V4L2_CID_ENCODER_AVERAGE_BITRATE (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_CID_ENCODER_CPB_SIZE(V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_ENCODER_PEAK_BIT_RATE (V4L2_CID_CAMERA_CLASS_BASE+36) +#define V4L2_CID_ENCODER_QP_PARAM_I (V4L2_CID_CAMERA_CLASS_BASE+37) +#define V4L2_CID_ENCODER_QP_PARAM_P (V4L2_CID_CAMERA_CLASS_BASE+38) +#define V4L2_CID_ENCODER_QP_PARAM_BG (V4L2_CID_CAMERA_CLASS_BASE+39) +#define V4L2_CID_ENCODER_NUM_GDR_FRAMES (V4L2_CID_CAMERA_CLASS_BASE+40) +#define V4L2_CID_ENCODER_LTR_BUFFER_CONTROL
Re: [PATCH v1 16/19] v4l: Add encoding camera controls.
On 08/30/2013 04:17 AM, Pawel Osciak wrote: Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; A lot of these exist already. E.g. V4L2_CID_MPEG_VIDEO_MPEG4_I/P/B_FRAME_QP. Samsung added support for many of these parameters for their MFC encoder (including VP8 support) so you should use them as well. As mentioned in v4l2-controls.h the MPEG part of the control name is historical. Interpret it as 'CODEC', not MPEG. + case V4L2_CID_ENCODER_NUM_GDR_FRAMES: return Encoder, number of GDR frames; + case V4L2_CID_ENCODER_LTR_BUFFER_CONTROL: return Encoder, LTR buffer control; + case V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE: return Encoder, LTR buffer trust mode; + case V4L2_CID_ENCODER_LTR_PICTURE_POSITION: return Encoder, LTR picture position; + case V4L2_CID_ENCODER_LTR_PICTURE_MODE: return Encoder, LTR picture mode; + case V4L2_CID_ENCODER_LTR_VALIDATION: return Encoder, LTR validation; + case V4L2_CID_ENCODER_MIN_QP: return Encoder, minimum QP param; + case V4L2_CID_ENCODER_MAX_QP: return Encoder, maximum QP param; + case V4L2_CID_ENCODER_SYNC_FRAME_INTERVAL: return Encoder, sync frame interval; + case V4L2_CID_ENCODER_ERROR_RESILIENCY: return Encoder, error resiliency; + case V4L2_CID_ENCODER_TEMPORAL_LAYER_ENABLE: return Encoder, temporal layer enable; + + case V4L2_CID_ENCODER_VP8_SLICE_MODE: return Encoder, VP8 slice mode; + case V4L2_CID_ENCODER_VP8_SYNC_FRAME_TYPE: return Encoder, VP8 sync frame type; + case V4L2_CID_ENCODER_VP8_DCT_PARTS_PER_FRAME: return Encoder, VP8, DCT partitions per frame; + + case V4L2_CID_ENCODER_H264_PROFILE_TOOLSET: return Encoder, H.264 profile and toolset; + case V4L2_CID_ENCODER_H264_LEVEL_IDC_LIMIT: return Encoder, H.264 level IDC limit; + case V4L2_CID_ENCODER_H264_SEI_PAYLOAD_TYPE: return Encoder, H.264 SEI payload type; + case V4L2_CID_ENCODER_H264_LAYER_PRIORITY: return Encoder, H.264 layer priority; + /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ case V4L2_CID_FM_TX_CLASS: return FM Radio Modulator Controls; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 083bb5a..ef3a30d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -729,6 +729,37 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +/* Controls found in UVC 1.5 encoding cameras */ +#define V4L2_CID_ENCODER_MIN_FRAME_INTERVAL (V4L2_CID_CAMERA_CLASS_BASE+32) +#define V4L2_CID_ENCODER_RATE_CONTROL_MODE (V4L2_CID_CAMERA_CLASS_BASE+33) +#define V4L2_CID_ENCODER_AVERAGE_BITRATE (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_CID_ENCODER_CPB_SIZE(V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_ENCODER_PEAK_BIT_RATE (V4L2_CID_CAMERA_CLASS_BASE+36) +#define V4L2_CID_ENCODER_QP_PARAM_I (V4L2_CID_CAMERA_CLASS_BASE+37) +#define V4L2_CID_ENCODER_QP_PARAM_P (V4L2_CID_CAMERA_CLASS_BASE+38) +#define V4L2_CID_ENCODER_QP_PARAM_BG (V4L2_CID_CAMERA_CLASS_BASE+39) +#define V4L2_CID_ENCODER_NUM_GDR_FRAMES (V4L2_CID_CAMERA_CLASS_BASE+40) +#define V4L2_CID_ENCODER_LTR_BUFFER_CONTROL (V4L2_CID_CAMERA_CLASS_BASE+41) +#define V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE (V4L2_CID_CAMERA_CLASS_BASE+42) +#define V4L2_CID_ENCODER_LTR_PICTURE_POSITION (V4L2_CID_CAMERA_CLASS_BASE+43) +#define V4L2_CID_ENCODER_LTR_PICTURE_MODE
[PATCH v1 16/19] v4l: Add encoding camera controls.
Add defines for controls found in UVC 1.5 encoding cameras. Signed-off-by: Pawel Osciak posc...@chromium.org --- drivers/media/v4l2-core/v4l2-ctrls.c | 29 + include/uapi/linux/v4l2-controls.h | 31 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c3f0803..0b3a632 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -781,6 +781,35 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status; case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range; + case V4L2_CID_ENCODER_MIN_FRAME_INTERVAL: return Encoder, min. frame interval; + case V4L2_CID_ENCODER_RATE_CONTROL_MODE: return Encoder, rate control mode; + case V4L2_CID_ENCODER_AVERAGE_BITRATE: return Encoder, average bitrate; + case V4L2_CID_ENCODER_CPB_SIZE: return Encoder, CPB size; + case V4L2_CID_ENCODER_PEAK_BIT_RATE:return Encoder, peak bit rate; + case V4L2_CID_ENCODER_QP_PARAM_I: return Encoder, QP param for I frames; + case V4L2_CID_ENCODER_QP_PARAM_P: return Encoder, QP param for P frames; + case V4L2_CID_ENCODER_QP_PARAM_BG: return Encoder, QP param for B/G frames; + case V4L2_CID_ENCODER_NUM_GDR_FRAMES: return Encoder, number of GDR frames; + case V4L2_CID_ENCODER_LTR_BUFFER_CONTROL: return Encoder, LTR buffer control; + case V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE: return Encoder, LTR buffer trust mode; + case V4L2_CID_ENCODER_LTR_PICTURE_POSITION: return Encoder, LTR picture position; + case V4L2_CID_ENCODER_LTR_PICTURE_MODE: return Encoder, LTR picture mode; + case V4L2_CID_ENCODER_LTR_VALIDATION: return Encoder, LTR validation; + case V4L2_CID_ENCODER_MIN_QP: return Encoder, minimum QP param; + case V4L2_CID_ENCODER_MAX_QP: return Encoder, maximum QP param; + case V4L2_CID_ENCODER_SYNC_FRAME_INTERVAL: return Encoder, sync frame interval; + case V4L2_CID_ENCODER_ERROR_RESILIENCY: return Encoder, error resiliency; + case V4L2_CID_ENCODER_TEMPORAL_LAYER_ENABLE: return Encoder, temporal layer enable; + + case V4L2_CID_ENCODER_VP8_SLICE_MODE: return Encoder, VP8 slice mode; + case V4L2_CID_ENCODER_VP8_SYNC_FRAME_TYPE: return Encoder, VP8 sync frame type; + case V4L2_CID_ENCODER_VP8_DCT_PARTS_PER_FRAME: return Encoder, VP8, DCT partitions per frame; + + case V4L2_CID_ENCODER_H264_PROFILE_TOOLSET: return Encoder, H.264 profile and toolset; + case V4L2_CID_ENCODER_H264_LEVEL_IDC_LIMIT: return Encoder, H.264 level IDC limit; + case V4L2_CID_ENCODER_H264_SEI_PAYLOAD_TYPE: return Encoder, H.264 SEI payload type; + case V4L2_CID_ENCODER_H264_LAYER_PRIORITY: return Encoder, H.264 layer priority; + /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ case V4L2_CID_FM_TX_CLASS: return FM Radio Modulator Controls; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 083bb5a..ef3a30d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -729,6 +729,37 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +/* Controls found in UVC 1.5 encoding cameras */ +#define V4L2_CID_ENCODER_MIN_FRAME_INTERVAL(V4L2_CID_CAMERA_CLASS_BASE+32) +#define V4L2_CID_ENCODER_RATE_CONTROL_MODE (V4L2_CID_CAMERA_CLASS_BASE+33) +#define V4L2_CID_ENCODER_AVERAGE_BITRATE (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_CID_ENCODER_CPB_SIZE (V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_ENCODER_PEAK_BIT_RATE (V4L2_CID_CAMERA_CLASS_BASE+36) +#define V4L2_CID_ENCODER_QP_PARAM_I(V4L2_CID_CAMERA_CLASS_BASE+37) +#define V4L2_CID_ENCODER_QP_PARAM_P(V4L2_CID_CAMERA_CLASS_BASE+38) +#define V4L2_CID_ENCODER_QP_PARAM_BG (V4L2_CID_CAMERA_CLASS_BASE+39) +#define V4L2_CID_ENCODER_NUM_GDR_FRAMES (V4L2_CID_CAMERA_CLASS_BASE+40) +#define V4L2_CID_ENCODER_LTR_BUFFER_CONTROL(V4L2_CID_CAMERA_CLASS_BASE+41) +#define V4L2_CID_ENCODER_LTR_BUFFER_TRUST_MODE (V4L2_CID_CAMERA_CLASS_BASE+42) +#define V4L2_CID_ENCODER_LTR_PICTURE_POSITION (V4L2_CID_CAMERA_CLASS_BASE+43) +#define V4L2_CID_ENCODER_LTR_PICTURE_MODE (V4L2_CID_CAMERA_CLASS_BASE+44) +#define V4L2_CID_ENCODER_LTR_VALIDATION (V4L2_CID_CAMERA_CLASS_BASE+45) +#define V4L2_CID_ENCODER_MIN_QP (V4L2_CID_CAMERA_CLASS_BASE+46) +#define V4L2_CID_ENCODER_MAX_QP (V4L2_CID_CAMERA_CLASS_BASE+47) +#define V4L2_CID_ENCODER_SYNC_FRAME_INTERVAL (V4L2_CID_CAMERA_CLASS_BASE+48) +#define V4L2_CID_ENCODER_ERROR_RESILIENCY