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

Commit ef486705 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 4e0a2b29 on remote branch

Change-Id: I18a4d2fb4508a917dd8750f9927750d66bf70078
parents a7472da2 4e0a2b29
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@
#define HFI_VENUS_HEIGHT_ALIGNMENT 32

#define SYSTEM_LAL_TILE10 192
#define NUM_MBS_480P (((640 + 15) >> 4) * ((480 + 15) >> 4))
#define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4))
#define NUM_MBS_4k (((4096 + 15) >> 4) * ((2304 + 15) >> 4))
#define MB_SIZE_IN_PIXEL (16 * 16)
@@ -491,16 +492,16 @@ int msm_vidc_get_num_ref_frames(struct msm_vidc_inst *inst)
		V4L2_CID_MPEG_VIDC_VIDEO_HEVC_MAX_HIER_CODING_LAYER);
	num_hp_layers = layer_ctrl->val;
	codec = get_v4l2_codec(inst);
	if (num_hp_layers > 0) {
	if (num_hp_layers > 1) {
		/* LTR and B - frame not supported with hybrid HP */
		if (inst->hybrid_hp)
			num_ref = (num_hp_layers - 1);
			num_ref = (num_hp_layers + 1) >> 1;
		else if (codec == V4L2_PIX_FMT_HEVC)
			num_ref = ((num_hp_layers + 1) / 2) + ltr_count;
		else if ((codec == V4L2_PIX_FMT_H264) && (num_hp_layers <= 4))
			num_ref = ((1 << (num_hp_layers - 1)) - 1) + ltr_count;
		else if ((codec == V4L2_PIX_FMT_H264) && (num_hp_layers < 4))
			num_ref = (num_hp_layers - 1) + ltr_count;
		else
			num_ref = ((num_hp_layers + 1) / 2) + ltr_count;
			num_ref = num_hp_layers + ltr_count;
	}
	return num_ref;
}
@@ -1019,8 +1020,9 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
	f = &inst->fmts[OUTPUT_PORT].v4l2_fmt;
	/*
	 * Encoder output size calculation: 32 Align width/height
	 * For resolution < 720p : YUVsize * 4
	 * For resolution > 720p & <= 4K : YUVsize / 2
	 * For CQ or heic session : YUVsize * 2
	 * For resolution <= 480p : YUVsize * 2
	 * For resolution > 480p & <= 4K : YUVsize / 2
	 * For resolution > 4k : YUVsize / 4
	 * Initially frame_size = YUVsize * 2;
	 */
@@ -1033,24 +1035,29 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
	mbs_per_frame = NUM_MBS_PER_FRAME(width, height);
	frame_size = (width * height * 3);

	if (mbs_per_frame < NUM_MBS_720P)
		frame_size = frame_size << 1;
	if (inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ ||
		is_grid_session(inst) || is_image_session(inst))
		goto calc_done;

	if (mbs_per_frame <= NUM_MBS_480P)
		goto calc_done; /* Default frame_size = YUVsize * 2 */
	else if (mbs_per_frame <= NUM_MBS_4k)
		frame_size = frame_size >> 2;
	else
		frame_size = frame_size >> 3;

	if ((inst->rc_type == RATE_CONTROL_OFF) ||
		(inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ))
	if (inst->rc_type == RATE_CONTROL_OFF)
		frame_size = frame_size << 1;

	if (inst->rc_type == RATE_CONTROL_LOSSLESS)
		frame_size = (width * height * 9) >> 2;

	/* multiply by 10/8 (1.25) to get size for 10 bit case */
	if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC)
	if (inst->core->platform_data->vpu_ver != VPU_VERSION_AR50_LITE &&
		f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC)
		frame_size = frame_size + (frame_size >> 2);

calc_done:
	return ALIGN(frame_size, SZ_4K);
}