From 9523c81879715de7ec67a89e926eaeaa68c3abf7 Mon Sep 17 00:00:00 2001 From: Alpha Lin Date: Fri, 24 Jul 2020 15:35:21 +0800 Subject: [PATCH] [IEP] remove warnings during iep2 library build. Signed-off-by: Alpha Lin Change-Id: I5f0d8ae75350d0401f28a1945c9dc1397bbd626d --- mpp/vproc/iep/iep.cpp | 1 + mpp/vproc/iep2/iep2.c | 1 + mpp/vproc/iep2/iep2_osd.c | 8 ++++---- mpp/vproc/iep2/iep2_pd.c | 8 ++++---- mpp/vproc/inc/iep_common.h | 1 + mpp/vproc/mpp_vproc_dev.cpp | 7 ++++++- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/mpp/vproc/iep/iep.cpp b/mpp/vproc/iep/iep.cpp index 3abf3bc3..de1e5b2a 100644 --- a/mpp/vproc/iep/iep.cpp +++ b/mpp/vproc/iep/iep.cpp @@ -624,6 +624,7 @@ static iep_com_ops iep_ops = { .init = iep_init, .deinit = iep_deinit, .control = iep_control, + .release = NULL }; iep_com_ctx* rockchip_iep_api_alloc_ctx(void) diff --git a/mpp/vproc/iep2/iep2.c b/mpp/vproc/iep2/iep2.c index defc2806..06846f44 100644 --- a/mpp/vproc/iep2/iep2.c +++ b/mpp/vproc/iep2/iep2.c @@ -455,6 +455,7 @@ static iep_com_ops iep2_ops = { .init = iep2_init, .deinit = iep2_deinit, .control = iep2_control, + .release = NULL, }; iep_com_ctx* rockchip_iep2_api_alloc_ctx(void) diff --git a/mpp/vproc/iep2/iep2_osd.c b/mpp/vproc/iep2/iep2_osd.c index 9f954534..8901c364 100644 --- a/mpp/vproc/iep2/iep2_osd.c +++ b/mpp/vproc/iep2/iep2_osd.c @@ -26,7 +26,7 @@ #include "iep2_api.h" -void iep2_sort(uint32_t bin[], int map[], int size) +void iep2_sort(uint32_t bin[], uint32_t map[], int size) { int i, m, n; uint32_t *dat = malloc(size * sizeof(uint32_t)); @@ -62,7 +62,7 @@ static int iep2_osd_check(int8_t *mv, int w, int sx, int ex, int sy, int ey, { /* (28 + 27) * 4 + 1 */ uint32_t hist[221]; - int map[221]; + uint32_t map[221]; int total = (ey - sy + 1) * (ex - sx + 1); int non_zero = 0; int domin = 0; @@ -73,7 +73,7 @@ static int iep2_osd_check(int8_t *mv, int w, int sx, int ex, int sy, int ey, for (i = sy; i <= ey; ++i) { for (j = sx; j <= ex; ++j) { int8_t v = mv[i * w + j]; - int idx = v + 28 * 4; + uint32_t idx = v + 28 * 4; if (idx >= MPP_ARRAY_ELEMS(hist)) { mpp_log("invalid mv at (%d, %d)\n", j, i); @@ -90,7 +90,7 @@ static int iep2_osd_check(int8_t *mv, int w, int sx, int ex, int sy, int ey, domin = hist[map[0]]; if (map[0] + 1 < MPP_ARRAY_ELEMS(hist)) domin += hist[map[0] + 1]; - if (map[0] - 1 >= 0) + if (map[0] >= 1) domin += hist[map[0] - 1]; printf("total tiles in current osd: %d, non-zero %d\n", diff --git a/mpp/vproc/iep2/iep2_pd.c b/mpp/vproc/iep2/iep2_pd.c index f2a98a92..101b50af 100644 --- a/mpp/vproc/iep2/iep2_pd.c +++ b/mpp/vproc/iep2/iep2_pd.c @@ -79,7 +79,7 @@ void iep2_check_pd(struct iep2_api_ctx *ctx) int ff00b = (ctx->output.dect_ff_cur_bcnt << 5) / bdiff; int nz = ctx->output.dect_ff_nz + 1; int f = ctx->output.dect_ff_comb_f; - int i, j; + size_t i, j; pd_inf->spatial[idx] = RKMIN(ff00t, ff00b); pd_inf->temporal[idx] = (tcnt < 32) | ((bcnt < 32) << 1); @@ -109,8 +109,8 @@ void iep2_check_pd(struct iep2_api_ctx *ctx) pd_inf->fcoeff[4]); if (pd_inf->pdtype != PD_TYPES_UNKNOWN && pd_inf->step != -1) { - int i = (int)pd_inf->pdtype; - int type = pd_table[i][(pd_inf->step + 1) % 5]; + int n = (int)pd_inf->pdtype; + int type = pd_table[n][(pd_inf->step + 1) % 5]; if ((type == PD_TS && !(tcnt < 32)) || (type == PD_BS && !(bcnt < 32))) { @@ -208,7 +208,7 @@ int iep2_pd_get_output(struct iep2_pd_info *pd_inf) case PD_TYPES_2_3_3_2: switch (step) { case 2: - PD_COMP_FLAG_NON; + flag = PD_COMP_FLAG_NON; break; } break; diff --git a/mpp/vproc/inc/iep_common.h b/mpp/vproc/inc/iep_common.h index 03a82061..18783361 100644 --- a/mpp/vproc/inc/iep_common.h +++ b/mpp/vproc/inc/iep_common.h @@ -110,6 +110,7 @@ typedef struct iep_com_ctx_t { struct dev_compatible { const char *compatible; iep_com_ctx* (*get)(void); + void (*put)(iep_com_ctx *ctx); int ver; }; diff --git a/mpp/vproc/mpp_vproc_dev.cpp b/mpp/vproc/mpp_vproc_dev.cpp index 0bcce517..2afe00ba 100644 --- a/mpp/vproc/mpp_vproc_dev.cpp +++ b/mpp/vproc/mpp_vproc_dev.cpp @@ -26,11 +26,13 @@ struct dev_compatible dev_comp[] = { { .compatible = "/dev/iep", .get = rockchip_iep_api_alloc_ctx, + .put = rockchip_iep_api_release_ctx, .ver = 1, }, { .compatible = "/dev/mpp_service", .get = rockchip_iep2_api_alloc_ctx, + .put = rockchip_iep2_api_release_ctx, .ver = 2, }, }; @@ -46,6 +48,8 @@ iep_com_ctx* get_iep_ctx() ctx->ver = dev_comp[i].ver; mpp_log("device %s select in vproc\n", dev_comp[i].compatible); + ctx->ops->release = dev_comp[i].put; + return ctx; } } @@ -55,6 +59,7 @@ iep_com_ctx* get_iep_ctx() void put_iep_ctx(iep_com_ctx *ictx) { - ictx->ops->release(ictx); + if (ictx->ops->release) + ictx->ops->release(ictx); }