Skip to content

Commit bfee75f

Browse files
Mansur Alisha Shaikmchehab
authored andcommitted
media: venus: venc: add support for V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM control
Add support for V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM control for H264 high profile and constrained high profile. Signed-off-by: Mansur Alisha Shaik <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f7a3d3d commit bfee75f

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

drivers/media/platform/qcom/venus/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ struct venc_controls {
234234
u32 h264_loop_filter_mode;
235235
s32 h264_loop_filter_alpha;
236236
s32 h264_loop_filter_beta;
237+
u32 h264_8x8_transform;
237238

238239
u32 hevc_i_qp;
239240
u32 hevc_p_qp;

drivers/media/platform/qcom/venus/hfi_cmds.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,14 @@ pkt_session_set_property_4xx(struct hfi_session_set_property_pkt *pkt,
12391239
break;
12401240
}
12411241

1242+
case HFI_PROPERTY_PARAM_VENC_H264_TRANSFORM_8X8: {
1243+
struct hfi_h264_8x8_transform *in = pdata, *tm = prop_data;
1244+
1245+
tm->enable_type = in->enable_type;
1246+
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*tm);
1247+
break;
1248+
}
1249+
12421250
case HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE:
12431251
case HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER:
12441252
case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE:

drivers/media/platform/qcom/venus/hfi_helper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@
507507
#define HFI_PROPERTY_PARAM_VENC_MAX_NUM_B_FRAMES 0x2005020
508508
#define HFI_PROPERTY_PARAM_VENC_H264_VUI_BITSTREAM_RESTRC 0x2005021
509509
#define HFI_PROPERTY_PARAM_VENC_PRESERVE_TEXT_QUALITY 0x2005023
510+
#define HFI_PROPERTY_PARAM_VENC_H264_TRANSFORM_8X8 0x2005025
510511
#define HFI_PROPERTY_PARAM_VENC_HIER_P_MAX_NUM_ENH_LAYER 0x2005026
511512
#define HFI_PROPERTY_PARAM_VENC_DISABLE_RC_TIMESTAMP 0x2005027
512513
#define HFI_PROPERTY_PARAM_VENC_INITIAL_QP 0x2005028
@@ -562,6 +563,10 @@ struct hfi_bitrate {
562563
u32 layer_id;
563564
};
564565

566+
struct hfi_h264_8x8_transform {
567+
u32 enable_type;
568+
};
569+
565570
#define HFI_CAPABILITY_FRAME_WIDTH 0x01
566571
#define HFI_CAPABILITY_FRAME_HEIGHT 0x02
567572
#define HFI_CAPABILITY_MBS_PER_FRAME 0x03

drivers/media/platform/qcom/venus/venc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ static int venc_set_properties(struct venus_inst *inst)
570570
struct hfi_h264_vui_timing_info info;
571571
struct hfi_h264_entropy_control entropy;
572572
struct hfi_h264_db_control deblock;
573+
struct hfi_h264_8x8_transform h264_transform;
573574

574575
ptype = HFI_PROPERTY_PARAM_VENC_H264_VUI_TIMING_INFO;
575576
info.enable = 1;
@@ -600,6 +601,17 @@ static int venc_set_properties(struct venus_inst *inst)
600601
ret = hfi_session_set_property(inst, ptype, &deblock);
601602
if (ret)
602603
return ret;
604+
605+
ptype = HFI_PROPERTY_PARAM_VENC_H264_TRANSFORM_8X8;
606+
h264_transform.enable_type = 0;
607+
if (ctr->profile.h264 == HFI_H264_PROFILE_HIGH ||
608+
ctr->profile.h264 == HFI_H264_PROFILE_CONSTRAINED_HIGH)
609+
h264_transform.enable_type = ctr->h264_8x8_transform;
610+
611+
ret = hfi_session_set_property(inst, ptype, &h264_transform);
612+
if (ret)
613+
return ret;
614+
603615
}
604616

605617
if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 ||

drivers/media/platform/qcom/venus/venc_ctrls.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,25 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
319319
case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD:
320320
ctr->intra_refresh_period = ctrl->val;
321321
break;
322+
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
323+
if (ctr->profile.h264 != HFI_H264_PROFILE_HIGH &&
324+
ctr->profile.h264 != HFI_H264_PROFILE_CONSTRAINED_HIGH)
325+
return -EINVAL;
326+
327+
/*
328+
* In video firmware, 8x8 transform is supported only for
329+
* high profile(HP) and constrained high profile(CHP).
330+
* If client wants to disable 8x8 transform for HP/CHP,
331+
* it is better to set profile as main profile(MP).
332+
* Because there is no difference between HP and MP
333+
* if we disable 8x8 transform for HP.
334+
*/
335+
336+
if (ctrl->val == 0)
337+
return -EINVAL;
338+
339+
ctr->h264_8x8_transform = ctrl->val;
340+
break;
322341
default:
323342
return -EINVAL;
324343
}
@@ -334,7 +353,7 @@ int venc_ctrl_init(struct venus_inst *inst)
334353
{
335354
int ret;
336355

337-
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 57);
356+
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 58);
338357
if (ret)
339358
return ret;
340359

@@ -437,6 +456,9 @@ int venc_ctrl_init(struct venus_inst *inst)
437456
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
438457
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP, 1, 51, 1, 1);
439458

459+
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
460+
V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, 0, 1, 1, 0);
461+
440462
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
441463
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP, 1, 51, 1, 1);
442464

0 commit comments

Comments
 (0)