From 16435160197c5eaf1f55a0f413cdcb257777168b Mon Sep 17 00:00:00 2001 From: "kp5.choi@samsung.com" Date: Mon, 12 May 2025 12:12:00 +0900 Subject: [PATCH 1/3] restrict odd width encoding Signed-off-by: kp5.choi@samsung.com --- inc/oapv.h | 3 ++- src/oapv_param.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/oapv.h b/inc/oapv.h index 0480df5..8271f65 100644 --- a/inc/oapv.h +++ b/inc/oapv.h @@ -85,8 +85,9 @@ extern "C" { #define OAPV_ERR_MALFORMED_BITSTREAM (-202) #define OAPV_ERR_OUT_OF_BS_BUF (-203) /* too small bitstream buffer */ #define OAPV_ERR_NOT_FOUND (-204) -#define OAPV_ERR_FAILED_SYSCALL (-301) /* failed system call */ +#define OAPV_ERR_FAILED_SYSCALL (-301) /* failed system call */ #define OAPV_ERR_INVALID_LEVEL (-401) +#define OAPV_ERR_INVALID_WIDTH (-405) /* invalid width (like odd) */ #define OAPV_ERR_UNKNOWN (-32767) /* unknown error */ /* return value checking */ diff --git a/src/oapv_param.c b/src/oapv_param.c index cc62d1a..e4b3488 100644 --- a/src/oapv_param.c +++ b/src/oapv_param.c @@ -476,6 +476,9 @@ int oapve_param_update(oapve_ctx_t* ctx) int ret = OAPV_OK; int min_num_tiles = OAPV_MAX_TILES; for (int i = 0; i < ctx->cdesc.max_num_frms; i++) { + if(ctx->cdesc.param[i].w & 0x1) { // check width restriction + return OAPV_ERR_INVALID_WIDTH; // odd width is not spec-out + } ret = enc_update_param_tile(ctx, &ctx->cdesc.param[i]); oapv_assert_rv(ret == OAPV_OK, ret); int num_tiles = oapv_div_round_up(ctx->w, ctx->cdesc.param[i].tile_w) * oapv_div_round_up(ctx->h, ctx->cdesc.param[i].tile_h); From 2305fc96e4b77d9b60cc84212b8f7ef07f8a25be Mon Sep 17 00:00:00 2001 From: Neeraj Gadgil Date: Mon, 12 May 2025 11:20:39 +0530 Subject: [PATCH 2/3] restrict odd width with 422 subsampling Signed-off-by: Neeraj Gadgil --- src/oapv_param.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oapv_param.c b/src/oapv_param.c index e4b3488..e5684d8 100644 --- a/src/oapv_param.c +++ b/src/oapv_param.c @@ -476,7 +476,7 @@ int oapve_param_update(oapve_ctx_t* ctx) int ret = OAPV_OK; int min_num_tiles = OAPV_MAX_TILES; for (int i = 0; i < ctx->cdesc.max_num_frms; i++) { - if(ctx->cdesc.param[i].w & 0x1) { // check width restriction + if(ctx->cdesc.param[i].csp == 2 && ctx->cdesc.param[i].w & 0x1) { // check width restriction for 422 return OAPV_ERR_INVALID_WIDTH; // odd width is not spec-out } ret = enc_update_param_tile(ctx, &ctx->cdesc.param[i]); From 46d0036bd5827ed143548ebfbc8b1e9538002852 Mon Sep 17 00:00:00 2001 From: Neeraj Gadgil Date: Mon, 12 May 2025 12:51:04 +0530 Subject: [PATCH 3/3] added new error code to restrict width in decoder Signed-off-by: Neeraj Gadgil --- src/oapv_vlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oapv_vlc.c b/src/oapv_vlc.c index c9aab77..e021e94 100644 --- a/src/oapv_vlc.c +++ b/src/oapv_vlc.c @@ -702,7 +702,7 @@ int oapvd_vlc_frame_info(oapv_bs_t *bs, oapv_fi_t *fi) // check frame width in case of 422 format. if(fi->chroma_format_idc == 2) { // frame_width should be multiple of 2 - oapv_assert_rv((fi->frame_width & 0x1) == 0, OAPV_ERR_MALFORMED_BITSTREAM); + oapv_assert_rv((fi->frame_width & 0x1) == 0, OAPV_ERR_INVALID_WIDTH); } return OAPV_OK;