video-driver: Optimize enc o/p buffer size

Allocate YUV_size * 2 for <=360p

Change-Id: I5c7b4ad2d2accf40943e880562f96af2d7c81509
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
Cette révision appartient à :
Priyanka Gujjula
2021-11-22 12:16:50 +05:30
révisé par Govindaraj Rajagopal
Parent 0dec23c1bd
révision a646e75752
2 fichiers modifiés avec 6 ajouts et 4 suppressions

Voir le fichier

@@ -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)

Voir le fichier

@@ -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