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

Commit c8e77b2f authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Introducing CBR_CFR upto 720p@30fps"

parents 9e3ffd7c fb447725
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -918,11 +918,19 @@ int msm_vidc_set_internal_config(struct msm_vidc_inst *inst)
			(void *)&rc_mode);
	}

	output_height = inst->prop.height[CAPTURE_PORT];
	output_width = inst->prop.width[CAPTURE_PORT];
	fps = inst->prop.fps;
	mbps = NUM_MBS_PER_SEC(output_height, output_width, fps);
	if ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ||
		 rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR) &&
		(codec != V4L2_PIX_FMT_VP8)) {
		if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR &&
		    mbps < CBR_MB_LIMIT)
			hrd_buf_size.vbv_hdr_buf_size = 500;
		else
			hrd_buf_size.vbv_hdr_buf_size = 1000;
		dprintk(VIDC_DBG, "Enable cbr+ hdr_buf_size %d :\n",
		dprintk(VIDC_DBG, "Enable hdr_buf_size %d :\n",
				hrd_buf_size.vbv_hdr_buf_size);
		rc = call_hfi_op(hdev, session_set_property,
			(void *)inst->session, HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE,
@@ -942,13 +950,8 @@ int msm_vidc_set_internal_config(struct msm_vidc_inst *inst)

	if ((codec == V4L2_PIX_FMT_H264 || codec == V4L2_PIX_FMT_HEVC) &&
		slice_mode != V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE) {

		output_height = inst->prop.height[CAPTURE_PORT];
		output_width = inst->prop.width[CAPTURE_PORT];
		fps = inst->prop.fps;
		bitrate = inst->clk_data.bitrate;
		mb_per_frame = NUM_MBS_PER_FRAME(output_height, output_width);
		mbps = NUM_MBS_PER_SEC(output_height, output_width, fps);

		if (rc_mode != V4L2_MPEG_VIDEO_BITRATE_MODE_RC_OFF &&
			rc_mode != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR &&
+10 −1
Original line number Diff line number Diff line
@@ -1189,6 +1189,7 @@ int msm_vidc_decide_work_route(struct msm_vidc_inst *inst)
	} else if (inst->session_type == MSM_VIDC_ENCODER) {
		u32 slice_mode = 0;
		u32 rc_mode = 0;
		u32 output_width, output_height, fps, mbps;

		switch (inst->fmts[CAPTURE_PORT].fourcc) {
		case V4L2_PIX_FMT_VP8:
@@ -1206,9 +1207,16 @@ int msm_vidc_decide_work_route(struct msm_vidc_inst *inst)
		}
		slice_mode =  msm_comm_g_ctrl_for_id(inst,
				V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE);
		output_height = inst->prop.height[CAPTURE_PORT];
		output_width = inst->prop.width[CAPTURE_PORT];
		fps = inst->prop.fps;
		mbps = NUM_MBS_PER_SEC(output_height, output_width, fps);
		if (slice_mode ==
			V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES) {
			V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES ||
			(rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR &&
			mbps < CBR_MB_LIMIT)) {
			pdata.video_work_route = 1;
			dprintk(VIDC_DBG, "Configured work route = 1");
		}
	} else {
		return -EINVAL;
@@ -1311,6 +1319,7 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst)

	if (inst->clk_data.low_latency_mode) {
		pdata.video_work_mode = VIDC_WORK_MODE_1;
		dprintk(VIDC_DBG, "Configured work mode = 1");
		goto decision_done;
	}

+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#define DEFAULT_FRAME_QUALITY 80
#define FRAME_QUALITY_STEP 1
#define HEIC_GRID_DIMENSION 512
#define CBR_MB_LIMIT                           (1280*720/256*30)

struct vb2_buf_entry {
	struct list_head list;