Merge "msm: vidc: Fix MBs per frame to derive slices per frame"
diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c
index b68e83d..02c924a 100644
--- a/msm/vidc/msm_venc.c
+++ b/msm/vidc/msm_venc.c
@@ -3208,6 +3208,10 @@
/* Update Slice Config */
mb_per_frame = NUM_MBS_PER_FRAME(output_height, output_width);
+ if (codec == V4L2_PIX_FMT_HEVC)
+ mb_per_frame =
+ NUM_MBS_PER_FRAME_HEVC(output_height, output_width);
+
mbps = NUM_MBS_PER_SEC(output_height, output_width, fps);
if (slice_mode == HFI_MULTI_SLICE_BY_MB_COUNT) {
diff --git a/msm/vidc/msm_vidc_internal.h b/msm/vidc/msm_vidc_internal.h
index bf1ec79..7bdcb88 100644
--- a/msm/vidc/msm_vidc_internal.h
+++ b/msm/vidc/msm_vidc_internal.h
@@ -79,6 +79,9 @@
#define NUM_MBS_PER_FRAME(__height, __width) \
((ALIGN(__height, 16) / 16) * (ALIGN(__width, 16) / 16))
+#define NUM_MBS_PER_FRAME_HEVC(__height, __width) \
+ ((ALIGN(__height, 32) / 32) * (ALIGN(__width, 32) / 32))
+
#define call_core_op(c, op, ...) \
(((c) && (c)->core_ops && (c)->core_ops->op) ? \
((c)->core_ops->op(__VA_ARGS__)) : 0)