瀏覽代碼

fix[enc_roi]: Fix cu_map init in vepu_54x_roi

Change-Id: Icdc9c44778ce3ecbf9234ffe4294aff8ffd4165d
Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
Yanjun Liao 8 月之前
父節點
當前提交
12cf338dff
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      utils/mpp_enc_roi_utils.c

+ 10 - 1
utils/mpp_enc_roi_utils.c

@@ -673,6 +673,8 @@ MPP_RET mpp_enc_roi_init(MppEncRoiCtx *ctx, RK_U32 w, RK_U32 h, MppCodingType ty
     case ROI_TYPE_1 : {
         RK_S32 mb_w = MPP_ALIGN(impl->w, 16) / 16;
         RK_S32 mb_h = MPP_ALIGN(impl->h, 16) / 16;
+        RK_U32 ctu_w = MPP_ALIGN(impl->w, 64) / 64;
+        RK_U32 ctu_h  = MPP_ALIGN(impl->w, 64) / 64;
         RK_S32 stride_h = MPP_ALIGN(mb_w, 4);
         RK_S32 stride_v = MPP_ALIGN(mb_h, 4);
 
@@ -690,7 +692,14 @@ MPP_RET mpp_enc_roi_init(MppEncRoiCtx *ctx, RK_U32 w, RK_U32 h, MppCodingType ty
         /* create tmp buffer for hevc */
         if (type == MPP_VIDEO_CodingHEVC) {
             impl->tmp = mpp_malloc(Vepu541RoiCfg, stride_h * stride_v);
-            if (!impl->tmp)
+            impl->cu_map  = mpp_calloc(RK_U8, ctu_w * ctu_h);
+            impl->cu_size = ctu_w * ctu_h;
+            if (!impl->tmp || !impl->cu_map)
+                goto done;
+        } else {
+            impl->cu_map   = mpp_calloc(RK_U8, mb_w * mb_h);
+            impl->cu_size  = mb_w * mb_h;
+            if (!impl->cu_map)
                 goto done;
         }