History

media: v4l2-ctrl: add controls for long term reference.

Long Term Reference (LTR) frames are the frames that are encoded sometime in the past and stored in the DPB buffer list to be used as reference to encode future frames. This change adds controls to enable this feature.

Dikshita Agarwal committed 5 years ago

Commit f15c54c1 parent ddbcd0c3 files · +35 −0Browse files

Unified · Split

3 files
  1. Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +18 −0
  2. drivers/media/v4l2-core/v4l2-ctrls.c +14 −0
  3. include/uapi/linux/v4l2-controls.h +3 −0
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst+18−0
@@ -3427,3 +3427,21 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - · 3426 unmodified lines
34273427 so this has to come from client.
34283428 This is applicable to H264 and valid Range is from 0 to 63.
34293429 Source Rec. ITU-T H.264 (06/2019); G.7.4.1.1, G.8.8.1.
3430+
3431+``V4L2_CID_MPEG_VIDEO_LTR_COUNT (integer)``
3432+ Specifies the maximum number of Long Term Reference (LTR) frames at any
3433+ given time that the encoder can keep.
3434+ This is applicable to the H264 and HEVC encoders.
3435+
3436+``V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (integer)``
3437+ After setting this control the frame that will be queued next
3438+ will be marked as a Long Term Reference (LTR) frame
3439+ and given this LTR index which ranges from 0 to LTR_COUNT-1.
3440+ This is applicable to the H264 and HEVC encoders.
3441+ Source Rec. ITU-T H.264 (06/2019); Table 7.9
3442+
3443+``V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (bitmask)``
3444+ Specifies the Long Term Reference (LTR) frame(s) to be used for
3445+ encoding the next frame queued after setting this control.
3446+ This provides a bitmask which consists of bits [0, LTR_COUNT-1].
3447+ This is applicable to the H264 and HEVC encoders.
drivers/media/v4l2-core/v4l2-ctrls.c+14−0
@@ -961,6 +961,9 @@ const char *v4l2_ctrl_get_name(u32 id) · 960 unmodified lines
961961 case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return "Repeat Sequence Header";
962962 case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME: return "Force Key Frame";
963963 case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID: return "Base Layer Priority ID";
964+ case V4L2_CID_MPEG_VIDEO_LTR_COUNT: return "LTR Count";
965+ case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX: return "Frame LTR Index";
966+ case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES: return "Use LTR Frames";
964967 case V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS: return "MPEG-2 Slice Parameters";
965968 case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION: return "MPEG-2 Quantization Matrices";
966969 case V4L2_CID_FWHT_I_FRAME_QP: return "FWHT I-Frame QP Value";
@@ -1291,6 +1294,17 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, · 324 unmodified lines
12911294 case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY:
12921295 *type = V4L2_CTRL_TYPE_INTEGER;
12931296 break;
1297+ case V4L2_CID_MPEG_VIDEO_LTR_COUNT:
1298+ *type = V4L2_CTRL_TYPE_INTEGER;
1299+ break;
1300+ case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:
1301+ *type = V4L2_CTRL_TYPE_INTEGER;
1302+ *flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
1303+ break;
1304+ case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES:
1305+ *type = V4L2_CTRL_TYPE_BITMASK;
1306+ *flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
1307+ break;
12941308 case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME:
12951309 case V4L2_CID_PAN_RESET:
12961310 case V4L2_CID_TILT_RESET:
include/uapi/linux/v4l2-controls.h+3−0
@@ -429,6 +429,9 @@ enum v4l2_mpeg_video_multi_slice_mode { · 428 unmodified lines
429429 #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_CODEC_BASE+229)
430430 #define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID (V4L2_CID_CODEC_BASE+230)
431431 #define V4L2_CID_MPEG_VIDEO_AU_DELIMITER (V4L2_CID_CODEC_BASE+231)
432+#define V4L2_CID_MPEG_VIDEO_LTR_COUNT (V4L2_CID_CODEC_BASE+232)
433+#define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (V4L2_CID_CODEC_BASE+233)
434+#define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE+234)
432435
433436 /* CIDs for the MPEG-2 Part 2 (H.262) codec */
434437 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t