From patchwork Thu May 28 13:57:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 19931 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1846944A156 for ; Thu, 28 May 2020 16:57:52 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0514D68AEB7; Thu, 28 May 2020 16:57:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7126868AD85 for ; Thu, 28 May 2020 16:57:44 +0300 (EEST) Received: by mail-pj1-f66.google.com with SMTP id ci23so3134074pjb.5 for ; Thu, 28 May 2020 06:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ay+lK7B+JQJq68Ut5XxHUzdu3hzvybNz8lHfe3Vsxhg=; b=RCW426FLctwYFSklycyrKEnQI1biHtVgnpWSGx8o8EHwdOlWN8EXL+COo4TfP1kNJD YE94ce4L8AlVY+cLU27mQ4unrhf0TEf2q/L73NJ8ilxECuArXRyKRAZsmCunXoLM1VFU l7CbQwBp0kHJ2dX5XV49zXk8dp7Q6a5WbPiEfJXvgv8rAcn4UPFwmY3uxAcm1hjxKpm7 SC5i+g134AawIDumqhJcybZe4hxZ0GTFAXXmh2iB2ThLvpB5XeXGafarPxKiYmAMhZ0k bCkA/76jaM9gMiuGR0I7kIqJUYknNOd/Fh/5Vrsn9Iq75rtq5tRV0hgN5ELia56kqrWc vZdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ay+lK7B+JQJq68Ut5XxHUzdu3hzvybNz8lHfe3Vsxhg=; b=k+v2l8gx8DVEQHxO+4BTJxtLXPtW7iiUaiHqYfK3NFln7ainAMAWJr19ogw7YLs+lW 4l4XgQ5n36XGEZ+3LrO/TgHcrrEaFLtU6F4c3Bt4GSFGxb5jWeypAvdjIHRXfzhw1NQC e6iixrqSlPfYlz4Pm1ps5fQ+qTf0xsnClOZdJiupn5HVfLYfsFEGSyiyGBX3D4VbyQSB E6Z6BsTZ7141ThRRtPbnfqB4vq9Y5NI2zf44dFTMgfIgdX2/O4DMcLHS85XbXR39Wtb8 7RldezOpfB0nrBXAZlrDpbvDV6OrFqq5G9P7C9A0F8EgH0EjyhNQaTpY8X8wunQ+j/nj acsg== X-Gm-Message-State: AOAM533L2i/QvbHZR1dAxZCPmiha2DhzD8gEe4gSgXiAFC+4G50bcj/w YH9e7bOSjabld7VXBmPdv4QYFZHb X-Google-Smtp-Source: ABdhPJw6cC2eCTBd2dOlfW8DmUNJ70wXdqFtIGefJnKFTe5H5ujE5f6q7NtneXd0AJHtrh3Q7S5j8A== X-Received: by 2002:a17:90a:d17:: with SMTP id t23mr4040391pja.77.1590674262471; Thu, 28 May 2020 06:57:42 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x11sm1412118pfm.196.2020.05.28.06.57.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2020 06:57:41 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 21:57:27 +0800 Message-Id: <1590674250-32571-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590674250-32571-1-git-send-email-lance.lmwang@gmail.com> References: <1590674250-32571-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/7] avcodec/h264dec: prefer to use variable instead of type for sizeof X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/h264dec.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 974d324..d5b3df3 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -185,17 +185,17 @@ int ff_h264_alloc_tables(H264Context *h) const int slice_tsize = big_mb_num + h->mb_stride; int x, y; - if (!(h->intra4x4_pred_mode = av_mallocz_array(row_mb_num * 8, sizeof(uint8_t))) || - !(h->non_zero_count = av_mallocz_array(big_mb_num * 48, sizeof(uint8_t))) || + if (!(h->intra4x4_pred_mode = av_mallocz_array(row_mb_num * 8, sizeof(*h->intra4x4_pred_mode))) || + !(h->non_zero_count = av_mallocz_array(big_mb_num * 48, sizeof(*h->non_zero_count))) || !(h->slice_table_base = av_mallocz_array(slice_tsize, sizeof(*h->slice_table_base))) || - !(h->cbp_table = av_mallocz_array(big_mb_num, sizeof(uint16_t))) || - !(h->chroma_pred_mode_table = av_mallocz_array(big_mb_num, sizeof(uint8_t))) || - !(h->mvd_table[0] = av_mallocz_array(row_mb_num * 8, sizeof(uint8_t))) || - !(h->mvd_table[1] = av_mallocz_array(row_mb_num * 8, sizeof(uint8_t))) || - !(h->direct_table = av_mallocz_array(big_mb_num * 4, sizeof(uint8_t))) || - !(h->list_counts = av_mallocz_array(big_mb_num, sizeof(uint8_t))) || - !(h->mb2b_xy = av_mallocz_array(big_mb_num, sizeof(uint32_t))) || - !(h->mb2br_xy = av_mallocz_array(big_mb_num, sizeof(uint32_t)))) + !(h->cbp_table = av_mallocz_array(big_mb_num, sizeof(*h->cbp_table))) || + !(h->chroma_pred_mode_table = av_mallocz_array(big_mb_num, sizeof(*h->chroma_pred_mode_table))) || + !(h->mvd_table[0] = av_mallocz_array(row_mb_num * 8, sizeof(*h->mvd_table[0]))) || + !(h->mvd_table[1] = av_mallocz_array(row_mb_num * 8, sizeof(*h->mvd_table[1]))) || + !(h->direct_table = av_mallocz_array(big_mb_num * 4, sizeof(*h->direct_table))) || + !(h->list_counts = av_mallocz_array(big_mb_num, sizeof(*h->list_counts))) || + !(h->mb2b_xy = av_mallocz_array(big_mb_num, sizeof(*h->mb2b_xy))) || + !(h->mb2br_xy = av_mallocz_array(big_mb_num, sizeof(*h->mb2br_xy)))) return AVERROR(ENOMEM); h->slice_ctx[0].intra4x4_pred_mode = h->intra4x4_pred_mode; h->slice_ctx[0].mvd_table[0] = h->mvd_table[0]; @@ -252,10 +252,10 @@ int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl) er->b8_stride = h->mb_width * 2 + 1; // error resilience code looks cleaner with this - if (!(er->mb_index2xy = av_mallocz_array(h->mb_num + 1, sizeof(int))) || - !(er->error_status_table = av_mallocz_array(mb_array_size, sizeof(uint8_t))) || - !(er->er_temp_buffer = av_mallocz_array(h->mb_height * h->mb_stride + 1, sizeof(int))) || - !(sl->dc_val_base = av_mallocz_array(yc_size, sizeof(int16_t)))) + if (!(er->mb_index2xy = av_mallocz_array(h->mb_num + 1, sizeof(*er->mb_index2xy))) || + !(er->error_status_table = av_mallocz_array(mb_array_size, sizeof(*er->error_status_table))) || + !(er->er_temp_buffer = av_mallocz_array(h->mb_height * h->mb_stride + 1, sizeof(*er->er_temp_buffer))) || + !(sl->dc_val_base = av_mallocz_array(yc_size, sizeof(*sl->dc_val_base)))) return AVERROR(ENOMEM); // ff_h264_free_tables will clean up for us for (y = 0; y < h->mb_height; y++)