Merge "msm: vidc: support input crop feature for encoder"

This commit is contained in:
qctecmdr 2021-08-03 18:16:38 -07:00 committed by Gerrit - the friendly Code Review server
commit 1d97a50965
2 changed files with 22 additions and 1 deletions

View File

@ -117,6 +117,7 @@ enum v4l2_mpeg_vidc_extradata {
EXTRADATA_ENC_INPUT_HDR10PLUS = 8,
EXTRADATA_ENC_INPUT_CVP = 16,
EXTRADATA_ENC_FRAME_QP = 32,
EXTRADATA_ENC_INPUT_CROP = 64,
};
#define V4L2_CID_MPEG_VIDC_VIDEO_VUI_TIMING_INFO \
(V4L2_CID_MPEG_MSM_VIDC_BASE + 19)
@ -328,6 +329,17 @@ struct msm_vidc_aspect_ratio_payload {
__u32 aspect_height;
};
#define MSM_VIDC_EXTRADATA_INPUT_CROP 0x0700000E
struct msm_vidc_input_crop_payload {
__u32 size;
__u32 version;
__u32 port_index;
__u32 left;
__u32 top;
__u32 width;
__u32 height;
};
struct msm_vidc_misr_info {
__u32 misr_set;
__u32 misr_dpb_luma[8];
@ -356,6 +368,7 @@ struct msm_vidc_output_crop_payload {
struct msm_vidc_extradata_index {
__u32 type;
union {
struct msm_vidc_input_crop_payload input_crop;
struct msm_vidc_aspect_ratio_payload aspect_ratio;
};
};

View File

@ -522,6 +522,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
.minimum = EXTRADATA_NONE,
.maximum = EXTRADATA_ADVANCED | EXTRADATA_ENC_INPUT_ROI |
EXTRADATA_ENC_INPUT_HDR10PLUS |
EXTRADATA_ENC_INPUT_CROP |
EXTRADATA_ENC_INPUT_CVP | EXTRADATA_ENC_FRAME_QP,
.default_value = EXTRADATA_NONE,
.menu_skip_mask = 0,
@ -1787,7 +1788,8 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
inst->prop.extradata_ctrls |= ctrl->val;
if ((inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_ROI) ||
(inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_HDR10PLUS)) {
(inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_HDR10PLUS) ||
(inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CROP)) {
f = &inst->fmts[INPUT_PORT].v4l2_fmt;
f->fmt.pix_mp.num_planes = 2;
f->fmt.pix_mp.plane_fmt[1].sizeimage =
@ -4656,6 +4658,12 @@ int msm_venc_set_extradata(struct msm_vidc_inst *inst)
}
}
if (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CROP) {
// Enable Input Crop Extradata
msm_comm_set_index_extradata(inst, MSM_VIDC_EXTRADATA_INPUT_CROP, 0x1);
s_vpr_l(inst->sid, "%s: enable input crop encoding\n", __func__);
}
if(!msm_vidc_cvp_usage)
inst->prop.extradata_ctrls &= ~EXTRADATA_ENC_INPUT_CVP;