From patchwork Thu May 28 13:57:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 19929 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 7822544A156 for ; Thu, 28 May 2020 16:57:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 629D868AE2D; Thu, 28 May 2020 16:57:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2787B68AD24 for ; Thu, 28 May 2020 16:57:41 +0300 (EEST) Received: by mail-pj1-f68.google.com with SMTP id a45so720734pje.1 for ; Thu, 28 May 2020 06:57:41 -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=+zSOW68MrqU0qm2HSHBQQ//cMeSZydTOvPLCLrKl6Eo=; b=t96E2xiOYe5ZfHzmP8gHIblnAZZqI5o35BFJ0UiQ6fOsRd/o31J3JlSwTkbjwGJE04 lHETAtAcQIF974aUH8CTU0fMX/fk/6oO+1yj8aHwXHNZiCSxK/AqMp+nY80ac0kY2d4p Xv3mJcZHlnr3T/wqjq9CH/hhAju1pVZmeuvcYT6sl2Q3AjGyrw2vmBdESivNoEhIQ7f7 7ByHXbjDXQUlWBaoV6j8aSH/AvP0IhJVzQgruD2AIQprtV2lN46DIjSGwsANLWNlB86n hsXu5nHnNDkraB66ucsD1O6CGIHJXLTIe4cjpNx56ixkq+xWyjT5XOT55/BSokpQyWyt N6AQ== 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=+zSOW68MrqU0qm2HSHBQQ//cMeSZydTOvPLCLrKl6Eo=; b=eNlQjUa+8lj6tiWyyzEAwqd3HA7n3uEEJfiG2yL7GHRVHWX2mnPWgrfnTzwy6Ieo4j V0ckZ4XJIrCVHg3ibuvqCOxRRCTJCqFy8zM3NGn6YLMeaIgehNTtzL052GMb7Waw4Y9g ETFEgBxuPzzG6RDHThao37OIb2RFCCU4N+z25nkRzom8i9EhzHbLzqNDq6XSTnoNRKSY EMclbOF7DHBmx9X2MAPRaphcMpF3EealurQ+fYk8oxjNk9IC0LTDgVBLgm6hFso/L9PL BuuAxrPvZ4oYO2Odh5BVZKP1d/Tv22gSz4DCJ76zYlFrskrUY5NIaQxi+y9r+kbmbJ7X tGiw== X-Gm-Message-State: AOAM531EExGSSpCMvXurZR/px+Pl+v80POXTcCwtzaXeiGZP4RY6TVVi hbsYHFl1jM2no/ZHhHUtFI8zUiH4 X-Google-Smtp-Source: ABdhPJzlfBe18aFnsE5+mxziyhRDbVI+Uv55bysIaTQvDxA6Wwed1r8AcKuw8tq4RvafdL/xwj91AA== X-Received: by 2002:a17:90b:88d:: with SMTP id bj13mr3677197pjb.133.1590674259242; Thu, 28 May 2020 06:57:39 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x11sm1412118pfm.196.2020.05.28.06.57.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2020 06:57:38 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 21:57:25 +0800 Message-Id: <1590674250-32571-2-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 2/7] avcodec/h264dec: store count of slice_table_base with local variable 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 7c7a63c..b03e6ed 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -182,6 +182,7 @@ int ff_h264_alloc_tables(H264Context *h) { const int big_mb_num = h->mb_stride * (h->mb_height + 1); const int row_mb_num = 2*h->mb_stride*FFMAX(h->nb_slice_ctx, 1); + const int slice_tsize = big_mb_num + h->mb_stride; int x, y; FF_ALLOCZ_ARRAY_OR_GOTO(h->avctx, h->intra4x4_pred_mode, @@ -191,7 +192,7 @@ int ff_h264_alloc_tables(H264Context *h) FF_ALLOCZ_OR_GOTO(h->avctx, h->non_zero_count, big_mb_num * 48 * sizeof(uint8_t), fail) FF_ALLOCZ_OR_GOTO(h->avctx, h->slice_table_base, - (big_mb_num + h->mb_stride) * sizeof(*h->slice_table_base), fail) + slice_tsize * sizeof(*h->slice_table_base), fail) FF_ALLOCZ_OR_GOTO(h->avctx, h->cbp_table, big_mb_num * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(h->avctx, h->chroma_pred_mode_table, @@ -209,7 +210,7 @@ int ff_h264_alloc_tables(H264Context *h) big_mb_num * sizeof(uint8_t), fail) memset(h->slice_table_base, -1, - (big_mb_num + h->mb_stride) * sizeof(*h->slice_table_base)); + slice_tsize * sizeof(*h->slice_table_base)); h->slice_table = h->slice_table_base + h->mb_stride * 2 + 1; FF_ALLOCZ_OR_GOTO(h->avctx, h->mb2b_xy,