Browse Source

video-driver: Optimize enc o/p buffer size

Allocate YUV_size * 2 for <=360p

Change-Id: I5c7b4ad2d2accf40943e880562f96af2d7c81509
Signed-off-by: Priyanka Gujjula <[email protected]>
Priyanka Gujjula 3 years ago
parent
commit
a646e75752
2 changed files with 6 additions and 4 deletions
  1. 1 0
      driver/vidc/inc/msm_vidc_internal.h
  2. 5 4
      driver/vidc/src/msm_vidc_buffer.c

+ 1 - 0
driver/vidc/inc/msm_vidc_internal.h

@@ -107,6 +107,7 @@
 #endif
 
 #define BUFFER_ALIGNMENT_SIZE(x) x
+#define NUM_MBS_360P (((480 + 15) >> 4) * ((360 + 15) >> 4))
 #define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4))
 #define NUM_MBS_4k (((4096 + 15) >> 4) * ((2304 + 15) >> 4))
 #define MB_SIZE_IN_PIXEL (16 * 16)

+ 5 - 4
driver/vidc/src/msm_vidc_buffer.c

@@ -310,8 +310,9 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
 	f = &inst->fmts[OUTPUT_PORT];
 	/*
 	 * Encoder output size calculation: 32 Align width/height
-	 * For resolution < 720p : YUVsize * 4
-	 * For resolution > 720p & <= 4K : YUVsize / 2
+	 * For heic session : YUVsize * 2
+	 * For resolution <= 480x360p : YUVsize * 2
+	 * For resolution > 360p & <= 4K : YUVsize / 2
 	 * For resolution > 4k : YUVsize / 4
 	 * Initially frame_size = YUVsize * 2;
 	 */
@@ -325,8 +326,8 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
 	if (is_image_session(inst))
 		goto skip_calc;
 
-	if (mbs_per_frame < NUM_MBS_720P)
-		frame_size = frame_size << 1;
+	if (mbs_per_frame <= NUM_MBS_360P)
+		(void)frame_size; /* Default frame_size = YUVsize * 2 */
 	else if (mbs_per_frame <= NUM_MBS_4k)
 		frame_size = frame_size >> 2;
 	else