video: driver: Optimize HEVC Bin buffer allocation

Optimize HEVC Bin buffer allocation by allocating 25% additional
bitstream buffer size for 10 bit HEVC usecase and avoiding the
extra memory allocation for 8 bit usecases.

Change-Id: Iebbedf43e80fad852807349cbe7f70cf7a632a73
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
This commit is contained in:
Mihir Ganu
2022-06-02 10:59:49 -07:00
parent 12c5ef4768
commit ec484c856b
2 changed files with 13 additions and 11 deletions

View File

@@ -1360,7 +1360,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} while (0)
#define SIZE_BIN_BITSTREAM_ENC(_size, rc_type, frame_width, frame_height, \
work_mode, lcu_size) \
work_mode, lcu_size, profile) \
do \
{ \
HFI_U32 size_aligned_width = 0, size_aligned_height = 0; \
@@ -1391,7 +1391,8 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
{ \
bitstream_size_eval >>= 2; \
} \
if (lcu_size == 32) \
if (profile == HFI_H265_PROFILE_MAIN_10 || \
profile == HFI_H265_PROFILE_MAIN_10_STILL_PICTURE) \
{ \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \
@@ -1443,13 +1444,13 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} while (0)
#define HFI_BUFFER_BIN_ENC(_size, rc_type, frame_width, frame_height, lcu_size, \
work_mode, num_vpp_pipes) \
work_mode, num_vpp_pipes, profile) \
do \
{ \
HFI_U32 bitstream_size = 0, total_bitbin_buffers = 0, \
size_single_pipe = 0, bitbin_size = 0; \
SIZE_BIN_BITSTREAM_ENC(bitstream_size, rc_type, frame_width, \
frame_height, work_mode, lcu_size); \
frame_height, work_mode, lcu_size, profile); \
if (work_mode == HFI_WORKMODE_2) \
{ \
total_bitbin_buffers = 3; \
@@ -1478,19 +1479,19 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} while (0)
#define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \
work_mode, num_vpp_pipes) \
work_mode, num_vpp_pipes, profile) \
do \
{ \
HFI_BUFFER_BIN_ENC(_size, rc_type, frame_width, frame_height, 16, \
work_mode, num_vpp_pipes); \
work_mode, num_vpp_pipes, profile); \
} while (0)
#define HFI_BUFFER_BIN_H265E(_size, rc_type, frame_width, frame_height, \
work_mode, num_vpp_pipes) \
work_mode, num_vpp_pipes, profile) \
do \
{ \
HFI_BUFFER_BIN_ENC(_size, rc_type, frame_width, frame_height, 32,\
work_mode, num_vpp_pipes); \
work_mode, num_vpp_pipes, profile); \
} while (0)
#define SIZE_ENC_SLICE_INFO_BUF(num_lcu_in_frame) HFI_ALIGN((256 + \

View File

@@ -314,7 +314,7 @@ static u32 msm_vidc_encoder_bin_size_iris3(struct msm_vidc_inst *inst)
{
struct msm_vidc_core *core;
u32 size = 0;
u32 width, height, num_vpp_pipes, stage;
u32 width, height, num_vpp_pipes, stage, profile;
struct v4l2_format *f;
if (!inst || !inst->core || !inst->capabilities) {
@@ -331,13 +331,14 @@ static u32 msm_vidc_encoder_bin_size_iris3(struct msm_vidc_inst *inst)
f = &inst->fmts[OUTPUT_PORT];
width = f->fmt.pix_mp.width;
height = f->fmt.pix_mp.height;
profile = inst->capabilities->cap[PROFILE].value;
if (inst->codec == MSM_VIDC_H264)
HFI_BUFFER_BIN_H264E(size, inst->hfi_rc_type, width,
height, stage, num_vpp_pipes);
height, stage, num_vpp_pipes, profile);
else if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC)
HFI_BUFFER_BIN_H265E(size, inst->hfi_rc_type, width,
height, stage, num_vpp_pipes);
height, stage, num_vpp_pipes, profile);
i_vpr_l(inst, "%s: size %d\n", __func__, size);
return size;