[vepu541_common]: Fix ROI cfg random value

Flush roi buf to default cfg when ROI region is invaid

Change-Id: I7a6b8373db947657c8eff9a0e7458b215a82e17a
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
This commit is contained in:
sayon.chen
2020-08-18 11:00:15 +08:00
committed by Herman Chen
parent fbcaa0e9f6
commit 16e26697e0

View File

@@ -327,6 +327,17 @@ MPP_RET vepu541_set_roi(void *buf, MppEncROICfg *roi, RK_S32 w, RK_S32 h)
goto DONE;
}
cfg.force_intra = 0;
cfg.reserved = 0;
cfg.qp_area_idx = 0;
cfg.qp_area_en = 1;
cfg.qp_adj = 0;
cfg.qp_adj_mode = 0;
/* step 1. reset all the config */
for (i = 0; i < stride_h * stride_v; i++, ptr++)
memcpy(ptr, &cfg, sizeof(cfg));
if (w <= 0 || h <= 0) {
mpp_err_f("invalid size [%d:%d]\n", w, h);
goto DONE;
@@ -363,17 +374,6 @@ MPP_RET vepu541_set_roi(void *buf, MppEncROICfg *roi, RK_S32 w, RK_S32 h)
}
}
cfg.force_intra = 0;
cfg.reserved = 0;
cfg.qp_area_idx = 0;
cfg.qp_area_en = 1;
cfg.qp_adj = 0;
cfg.qp_adj_mode = 0;
/* step 1. reset all the config */
for (i = 0; i < stride_h * stride_v; i++, ptr++)
memcpy(ptr, &cfg, sizeof(cfg));
region = roi->regions;
/* step 2. setup region for top to bottom */
for (i = 0; i < (RK_S32)roi->number; i++, region++) {