msm: vidc: refinements for lossless encoding

1. Refine work mode to 2 and disable low latency by default;
2. Refine output buffer size to (width * height) * 9 / 4;
3. Double scratch buffer size for lossless encoding;

Change-Id: If298b9fc63fc2329f02dcfcef5e4fd0667d3e8e6
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
This commit is contained in:
Shi Zhongbo 2019-06-27 16:20:36 +08:00
commit d9ceba876f
2 changed files with 6 additions and 6 deletions

View file

@ -891,7 +891,7 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst)
frame_size = frame_size << 1;
if (inst->rc_type == RATE_CONTROL_LOSSLESS)
frame_size = (width * height * 6);
frame_size = (width * height * 9) >> 2;
/*
* In case of opaque color format bitdepth will be known
@ -1300,6 +1300,8 @@ static inline u32 calculate_enc_scratch_size(struct msm_vidc_inst *inst,
bitbin_size = ALIGN(bitstream_size, VENUS_DMA_ALIGNMENT);
}
size_singlePipe = bitbin_size / 2;
if (inst->rc_type == RATE_CONTROL_LOSSLESS)
size_singlePipe <<= 1;
size_singlePipe = ALIGN(size_singlePipe, VENUS_DMA_ALIGNMENT);
sao_bin_buffer_size = (64 * (((width + BUFFER_ALIGNMENT_SIZE(32)) *
(height + BUFFER_ALIGNMENT_SIZE(32))) >> 10)) + 384;

View file

@ -1514,11 +1514,9 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst *inst)
/* For WORK_MODE_1, set Low Latency mode by default */
latency.enable = true;
}
if (inst->rc_type == RATE_CONTROL_LOSSLESS &&
out_f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_H264) {
dprintk(VIDC_HIGH,
"Set work mode to low latency for AVC lossless encoding.");
latency.enable = true;
if (inst->rc_type == RATE_CONTROL_LOSSLESS) {
pdata.video_work_mode = HFI_WORKMODE_2;
latency.enable = false;
}
} else {
return -EINVAL;