From d9ceba876f5f9e6de84274f4bf8d9570552e66b6 Mon Sep 17 00:00:00 2001 From: Shi Zhongbo Date: Thu, 27 Jun 2019 16:20:36 +0800 Subject: [PATCH] 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 --- msm/vidc/msm_vidc_buffer_calculations.c | 4 +++- msm/vidc/msm_vidc_clocks.c | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index 1e0fed51998c..ec524b6bc804 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -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; diff --git a/msm/vidc/msm_vidc_clocks.c b/msm/vidc/msm_vidc_clocks.c index 809acafadf5d..76ab755bacb8 100644 --- a/msm/vidc/msm_vidc_clocks.c +++ b/msm/vidc/msm_vidc_clocks.c @@ -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;