Merge "msm: vidc: optimize HEIC output buffer calc for encoder"
This commit is contained in:
commit
a25b3ff7e8
@ -982,6 +982,7 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
|
|||||||
f = &inst->fmts[OUTPUT_PORT].v4l2_fmt;
|
f = &inst->fmts[OUTPUT_PORT].v4l2_fmt;
|
||||||
/*
|
/*
|
||||||
* Encoder output size calculation: 32 Align width/height
|
* Encoder output size calculation: 32 Align width/height
|
||||||
|
* For CQ or heic session : YUVsize * 2
|
||||||
* For resolution < 720p : YUVsize * 4
|
* For resolution < 720p : YUVsize * 4
|
||||||
* For resolution > 720p & <= 4K : YUVsize / 2
|
* For resolution > 720p & <= 4K : YUVsize / 2
|
||||||
* For resolution > 4k : YUVsize / 4
|
* For resolution > 4k : YUVsize / 4
|
||||||
@ -996,6 +997,10 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
|
|||||||
mbs_per_frame = NUM_MBS_PER_FRAME(width, height);
|
mbs_per_frame = NUM_MBS_PER_FRAME(width, height);
|
||||||
frame_size = (width * height * 3);
|
frame_size = (width * height * 3);
|
||||||
|
|
||||||
|
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_720P)
|
if (mbs_per_frame < NUM_MBS_720P)
|
||||||
frame_size = frame_size << 1;
|
frame_size = frame_size << 1;
|
||||||
else if (mbs_per_frame <= NUM_MBS_4k)
|
else if (mbs_per_frame <= NUM_MBS_4k)
|
||||||
@ -1003,17 +1008,19 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
|
|||||||
else
|
else
|
||||||
frame_size = frame_size >> 3;
|
frame_size = frame_size >> 3;
|
||||||
|
|
||||||
if ((inst->rc_type == RATE_CONTROL_OFF) ||
|
if (inst->rc_type == RATE_CONTROL_OFF)
|
||||||
(inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ))
|
|
||||||
frame_size = frame_size << 1;
|
frame_size = frame_size << 1;
|
||||||
|
|
||||||
if (inst->rc_type == RATE_CONTROL_LOSSLESS)
|
if (inst->rc_type == RATE_CONTROL_LOSSLESS)
|
||||||
frame_size = (width * height * 9) >> 2;
|
frame_size = (width * height * 9) >> 2;
|
||||||
|
|
||||||
/* multiply by 10/8 (1.25) to get size for 10 bit case */
|
/* 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);
|
frame_size = frame_size + (frame_size >> 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
calc_done:
|
||||||
return ALIGN(frame_size, SZ_4K);
|
return ALIGN(frame_size, SZ_4K);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user