video: driver: resolve some checker err

Resolve some static checker err.

Change-Id: I0aa1d8c905ac7fd1defa16dd28d4386465f09ff3
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
This commit is contained in:
Ankush Mitra
2023-06-06 11:44:28 +05:30
parent 400a782851
commit e1cb32c5de
9 changed files with 98 additions and 119 deletions

View File

@@ -118,7 +118,7 @@ static u32 bitrate_table_kalama_rec_fp[5][10] = {
#endif #endif
}; };
static u32 input_bitrate_fp = 0; static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */ /* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240; static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240;

View File

@@ -122,7 +122,7 @@ static u32 bitrate_table_pineapple_rec_fp[5][10] = {
#endif #endif
}; };
static u32 input_bitrate_fp = 0; static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */ /* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240; static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240;

View File

@@ -225,7 +225,7 @@ typedef HFI_U32 HFI_BOOL;
(buf_height = HFI_ALIGN(frame_height, min_buf_height_multiple)) (buf_height = HFI_ALIGN(frame_height, min_buf_height_multiple))
#define HFI_RGBA8888_CALC_BUF_SIZE(buf_size, stride, buf_height) \ #define HFI_RGBA8888_CALC_BUF_SIZE(buf_size, stride, buf_height) \
buf_size = (stride) * (buf_height) (buf_size = (stride) * (buf_height))
#define HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(buf_size, stride, \ #define HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(buf_size, stride, \
buf_height) \ buf_height) \
@@ -234,39 +234,41 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \ stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \ _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ (metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple) tile_width_in_pels), metadata_stride_multiple))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
metadata_buf_height = HFI_ALIGN(((frame_height + \ (metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \ (tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple) metadata_height_multiple))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\ (metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \ (tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple) metadata_stride_multiple))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
metadata_buf_height = HFI_ALIGN(((((frame_height + 1) >> 1) + \ (metadata_buf_height = HFI_ALIGN(((((frame_height + 1) >> 1) + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \ (tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple) metadata_height_multiple))
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ (buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096) HFI_ALIGNMENT_4096))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -497,8 +499,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -690,8 +691,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -874,8 +874,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (bitstream_size > (1280 * 720)) { \ else if (bitstream_size > (1280 * 720)) { \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
bitstream_size = (bitstream_size << 1);\ bitstream_size = (bitstream_size << 1);\
} \ } \
if ((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) { \ if ((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) { \
@@ -1004,8 +1003,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1026,8 +1024,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1067,10 +1064,10 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitbin_size = size_single_pipe * num_vpp_pipes; \ bitbin_size = size_single_pipe * num_vpp_pipes; \
_size = HFI_ALIGN(bitbin_size, VENUS_DMA_ALIGNMENT) * \ _size = HFI_ALIGN(bitbin_size, VENUS_DMA_ALIGNMENT) * \
total_bitbin_buffers + 512; \ total_bitbin_buffers + 512; \
} \ } else { \
else \
/* Avoid 512 Bytes allocation in case of 1Pipe HEVC Direct Mode*/ \ /* Avoid 512 Bytes allocation in case of 1Pipe HEVC Direct Mode*/ \
_size = 0; \ _size = 0; \
} \
} while (0) } while (0)
#define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \ #define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \
@@ -1411,8 +1408,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1451,8 +1447,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS2_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \ #define HFI_IRIS2_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \ stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \ _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ ((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)) tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
(metadata_buf_height = HFI_ALIGN(((frame_height + \ ((metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \ (tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple)) metadata_height_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\ ((metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \ (tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple)) metadata_stride_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
@@ -261,8 +263,8 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ ((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)) HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \ if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \ SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \ delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \ else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \ /* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
/* bitstream_size = 2 * yuv_size; */ \ /* 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)) \
@@ -1177,8 +1175,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
tile_count -= 1; \ tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \ last_tile_size = (tile_size + min_tile_size); \
} \ } \
} \ } else { \
else { \
tile_size = frame_width_coded; \ tile_size = frame_width_coded; \
tile_count = 1; \ tile_count = 1; \
last_tile_size = 0; \ last_tile_size = 0; \
@@ -1207,8 +1204,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
(mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \ (mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \ total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \ (slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \ } else { \
else { \
total_slice_count = (slice_count_per_tile * tile_count); \ total_slice_count = (slice_count_per_tile * tile_count); \
} \ } \
} while (0) } while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1737,8 +1731,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1777,8 +1770,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \ #define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \ stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \ _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ ((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)) tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
(metadata_buf_height = HFI_ALIGN(((frame_height + \ ((metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \ (tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple)) metadata_height_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\ ((metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \ (tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple)) metadata_stride_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ metadata_height_multiple, tile_height_in_pels) \
@@ -261,8 +263,8 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ ((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)) HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \ if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \ SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \ delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \ else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \ /* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
/* bitstream_size = 2 * yuv_size; */ \ /* 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)) \
@@ -1177,8 +1175,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
tile_count -= 1; \ tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \ last_tile_size = (tile_size + min_tile_size); \
} \ } \
} \ } else { \
else { \
tile_size = frame_width_coded; \ tile_size = frame_width_coded; \
tile_count = 1; \ tile_count = 1; \
last_tile_size = 0; \ last_tile_size = 0; \
@@ -1207,8 +1204,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
(mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \ (mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \ total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \ (slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \ } else { \
else { \
total_slice_count = (slice_count_per_tile * tile_count); \ total_slice_count = (slice_count_per_tile * tile_count); \
} \ } \
} while (0) } while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1739,8 +1733,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1779,8 +1772,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \ #define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)