Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43cb7c32 authored by Fudong Zhang's avatar Fudong Zhang Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: support input crop feature for encoder

Support input crop feature for encoder

Change-Id: Ic7b5a273fc589b917b4b7672d67026cda7264941
parent ad091aa6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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;
	};
};
+9 −1
Original line number Diff line number Diff line
@@ -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 =
@@ -4649,6 +4651,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;