video: driver: fix encoder output buffer size requirement

For some resolutions memory requirement was coming as 4 * yuv_size
and for CQ/RC_OFF it was 8 * yuv_size. With this fix it will be 
max 2 * yuv_size (+ 25% for 10 bit). Fix typo in 720P resolution check.

Change-Id: Ib5908f1eef8dca92dac46c5c195cd47ba28a4df4
Signed-off-by: Mahesh Kumar Sharma <quic_smahesh@quicinc.com>
This commit is contained in:
Mahesh Kumar Sharma
2022-08-01 15:19:43 -07:00
committed by Ashish Patil
parent ec161663ce
commit 7d00efc5dc

View File

@@ -1177,23 +1177,26 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
rc_type, is_ten_bit) \ rc_type, is_ten_bit) \
do \ do \
{ \ { \
HFI_U32 aligned_width, aligned_height, bitstream_size; \ HFI_U32 aligned_width, aligned_height, bitstream_size, yuv_size; \
aligned_width = HFI_ALIGN(frame_width, 32); \ aligned_width = HFI_ALIGN(frame_width, 32); \
aligned_height = HFI_ALIGN(frame_height, 32); \ aligned_height = HFI_ALIGN(frame_height, 32); \
bitstream_size = aligned_width * aligned_height * 3; \ bitstream_size = aligned_width * aligned_height * 3; \
yuv_size = (aligned_width * aligned_height * 3) >> 1; \
if (aligned_width * aligned_height > (4096 * 2176)) \ if (aligned_width * aligned_height > (4096 * 2176)) \
{ \ { \
/* bitstream_size = 0.25 * yuv_size; */ \
bitstream_size = (bitstream_size >> 3); \ bitstream_size = (bitstream_size >> 3); \
} \ } \
else if (bitstream_size > (1280 * 720)) \ else if (aligned_width * aligned_height > (1280 * 720)) \
{ \ { \
/* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } \
else \ else \
{ \ { \
bitstream_size = (bitstream_size << 1);\ /* bitstream_size = 2 * yuv_size; */ \
} \ } \
if ((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) \ if (((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) && (bitstream_size < yuv_size)) \
{ \ { \
bitstream_size = (bitstream_size << 1);\ bitstream_size = (bitstream_size << 1);\
} \ } \