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

Commit 22313542 authored by Vaibhav Deshu Venkatesh's avatar Vaibhav Deshu Venkatesh
Browse files

msm: vidc: Update bit depth correctly for encoder



Update bit depth in set format for encoder and use this
update information later when required. Encoder output
size is also adjusted for 10bit cases. For lower QP
the current size is not enough.

Change-Id: Ia82d7ad60030d5051fab07074ff8d2b62473765d
Signed-off-by: default avatarVaibhav Deshu Venkatesh <vdeshuve@codeaurora.org>
parent 06c28b5d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1280,6 +1280,13 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			VENUS_Y_STRIDE(color_format, f->fmt.pix_mp.width);
		mplane->plane_fmt[0].reserved[0] =
			VENUS_Y_SCANLINES(color_format, f->fmt.pix_mp.height);
		inst->bit_depth = MSM_VIDC_BIT_DEPTH_8;
		if ((f->fmt.pix_mp.pixelformat ==
			V4L2_PIX_FMT_NV12_TP10_UBWC) ||
			(f->fmt.pix_mp.pixelformat ==
			V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS)) {
			inst->bit_depth = MSM_VIDC_BIT_DEPTH_10;
		}

		rc = msm_vidc_check_session_supported(inst);
		if (rc) {
+7 −5
Original line number Diff line number Diff line
@@ -479,7 +479,6 @@ int msm_vidc_get_encoder_internal_buffer_sizes(struct msm_vidc_inst *inst)
	u32 width, height, i, num_ref;
	bool is_tenbit = false;
	int num_bframes;
	u32 inp_fmt;
	struct v4l2_ctrl *bframe;
	struct v4l2_format *f;

@@ -518,10 +517,7 @@ int msm_vidc_get_encoder_internal_buffer_sizes(struct msm_vidc_inst *inst)
	}

	num_ref = msm_vidc_get_num_ref_frames(inst);
	inp_fmt = f->fmt.pix_mp.pixelformat;
	if ((inp_fmt == V4L2_PIX_FMT_NV12_TP10_UBWC) ||
		(inp_fmt == V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS))
		is_tenbit = true;
	is_tenbit = (inst->bit_depth == MSM_VIDC_BIT_DEPTH_10);

	for (i = 0; i < HAL_BUFFER_MAX; i++) {
		struct hal_buffer_requirements *curr_req;
@@ -846,6 +842,12 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
	if (inst->rc_type == RATE_CONTROL_LOSSLESS)
		frame_size = (width * height * 6);

	/* For 10-bit cases size = size * 1.25 */
	if (inst->bit_depth == MSM_VIDC_BIT_DEPTH_10) {
		frame_size *= 5;
		frame_size /= 4;
	}

	return ALIGN(frame_size, SZ_4K);
}