From 33269e39e7de30f7a3903f31422a3b567fec762c Mon Sep 17 00:00:00 2001 From: Hongjin Li Date: Tue, 4 Jan 2022 15:41:11 +0800 Subject: [PATCH] [mpp_dec]: Fix the problem of read data error For data with sizes of 5120x7160 and 8000x8000, the required buffer size was calculated incorrectly during the encoding process, which caused the requested buffer to be too large, resulting in drm exceptions. Therefore, the method of calculating data has been modified. Signed-off-by: Hongjin Li Change-Id: I519a76687118d568cf57e7d3d54a150e9019285c --- test/mpi_enc_test.c | 16 +++++++++++++--- utils/mpi_enc_utils.c | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/mpi_enc_test.c b/test/mpi_enc_test.c index b4aa3749..71f05080 100644 --- a/test/mpi_enc_test.c +++ b/test/mpi_enc_test.c @@ -208,14 +208,24 @@ MPP_RET test_ctx_init(MpiEncMultiCtxInfo *info) case MPP_FMT_YUV422_UYVY : case MPP_FMT_YUV422_VYUY : case MPP_FMT_YUV422P : - case MPP_FMT_YUV422SP : + case MPP_FMT_YUV422SP : { + p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64) * 2; + } break; case MPP_FMT_RGB444 : case MPP_FMT_BGR444 : case MPP_FMT_RGB555 : case MPP_FMT_BGR555 : case MPP_FMT_RGB565 : - case MPP_FMT_BGR565 : { - p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64) * 2; + case MPP_FMT_BGR565 : + case MPP_FMT_RGB888 : + case MPP_FMT_BGR888 : + case MPP_FMT_RGB101010 : + case MPP_FMT_BGR101010 : + case MPP_FMT_ARGB8888 : + case MPP_FMT_ABGR8888 : + case MPP_FMT_BGRA8888 : + case MPP_FMT_RGBA8888 : { + p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64); } break; default: { diff --git a/utils/mpi_enc_utils.c b/utils/mpi_enc_utils.c index eda8a29f..ecdd4790 100644 --- a/utils/mpi_enc_utils.c +++ b/utils/mpi_enc_utils.c @@ -213,7 +213,7 @@ RK_S32 mpi_enc_opt_f(void *ctx, const char *next) /* decimal value, use atoi */ format = (MppFrameFormat)atoi(next); } - if (MPP_FRAME_FMT_IS_LE(format) && + if (MPP_FRAME_FMT_IS_BE(format) && (MPP_FRAME_FMT_IS_YUV(format) || MPP_FRAME_FMT_IS_RGB(format))) { cmd->format = format; return 1;