From patchwork Thu Dec 10 11:16:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24473 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 D315544AF7C for ; Thu, 10 Dec 2020 13:18:54 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B11DB689BDB; Thu, 10 Dec 2020 13:18:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB0176800C9 for ; Thu, 10 Dec 2020 13:18:47 +0200 (EET) Received: by mail-wm1-f68.google.com with SMTP id a6so4307933wmc.2 for ; Thu, 10 Dec 2020 03:18:47 -0800 (PST) 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:reply-to :mime-version:content-transfer-encoding; bh=ohJt37Z3EU+p2KIphI4efR4oE9DLtCkDfa187X2HsKE=; b=rBbuUFzd1o2lNLe4ra5DIX4EH35MERfXpO//yweXP8nL+f7n2LvRx81SJpAf/FeW6c QOuFfgxgWJEr8QeSIvGqhAIcJUYV8EChFqF1/xnciC05Tq2eemsXCqzTJfius/0EvLFp oMFajqMpHgG12B8/QS4lr2AmVqg1K/IaydVirXeql1TsueJdEPBZiRj6oqNCHINHeP82 N4xdHUSOa/L517KmTHe74d/RPCZuDWn5YvDeSWGK6kKjybLhIHJ8sjxBl+O3x5SgE9KW ta0y2eYVsWfaEFyRflonhantwX33gK+CxjeN0yYbdS5ypW/SCHBAuxmjUQ44AGyiyyDZ y+VQ== 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:reply-to:mime-version:content-transfer-encoding; bh=ohJt37Z3EU+p2KIphI4efR4oE9DLtCkDfa187X2HsKE=; b=ahhNL53ifAMTzURlXaorfFkE8zzp7eAwSXZ8jnv3J2tb7uSUjvi0KoFQRX58PUVZ6/ jdYDkE0EAvveeWmZP/6eZIb8zV76d0tQWtgMTVyQAAu/OKsFp3mPiivwhnNliAXtox2x mpPLGA1DV9iKYqyHdPuAGQhdLMxM/u3yV0n8ybnp47bELx7kzA+nSiJei5bS78oDVqDy hdwE0CbssHZ09Z+2BRd0E0cW2jDTjvIjIUYlrmXaz690IxX7Dp81+W4OlY/2MJZ5ROCP Msmj64ySVymeB7vR3q3x/Icu/cllwEMUPBkh/VDLFhZspe0g6aEaErTUHFcpxVyTyddb 4ddA== X-Gm-Message-State: AOAM532EwdzhbwmGjJF8eQf4KKc8cGFWskt47fs9314cS/l8f8kuxafQ SgScDx7scg7D07iFekiVJ4G+fKzOTWQveA== X-Google-Smtp-Source: ABdhPJz8wumPelzDLDMm0idHIyRTNEvUdGqLbkz4AinQilZaDdH6Jav6ofWmxCCkSjHfthbLaE73VQ== X-Received: by 2002:a1c:a344:: with SMTP id m65mr7541435wme.108.1607599127043; Thu, 10 Dec 2020 03:18:47 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id s133sm8942330wmf.38.2020.12.10.03.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 03:18:46 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Dec 2020 12:16:20 +0100 Message-Id: <20201210111657.2276739-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201210111657.2276739-1-andreas.rheinhardt@gmail.com> References: <20201210111657.2276739-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/39] avcodec/mpeg12: Don't initialize encoder-only parts of RLTable 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" ff_mpeg12_init_vlcs() currently initializes index_run, max_level and max_run of ff_rl_mpeg1/2; yet the only user of these fields is the MPEG-1/2 encoder which already initializes these tables on its own. So remove the initializations in ff_mpeg12_init_vlcs(); this also simplifies making ff_mpeg12_init_vlcs() thread-safe. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12.c | 4 ---- libavcodec/mpeg12.h | 2 -- libavcodec/mpeg12enc.c | 6 ++++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index e4f007aec5..b4ef41e12d 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -41,8 +41,6 @@ #include "bytestream.h" #include "thread.h" -uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; - static const uint8_t table_mb_ptype[7][2] = { { 3, 5 }, // 0x01 MB_INTRA { 1, 2 }, // 0x02 MB_PAT @@ -163,8 +161,6 @@ av_cold void ff_mpeg12_init_vlcs(void) INIT_VLC_STATIC(&ff_mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1, 64); - ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); - ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); INIT_2D_VLC_RL(ff_rl_mpeg1, 680, 0); INIT_2D_VLC_RL(ff_rl_mpeg2, 674, 0); diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h index 345d473d3a..76fc0bf955 100644 --- a/libavcodec/mpeg12.h +++ b/libavcodec/mpeg12.h @@ -25,8 +25,6 @@ #include "mpeg12vlc.h" #include "mpegvideo.h" -extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; - void ff_mpeg12_common_init(MpegEncContext *s); #define INIT_2D_VLC_RL(rl, static_size, flags)\ diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index ac4af19ae7..05fd8c0e00 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -1037,8 +1037,10 @@ void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64], static av_cold void mpeg12_encode_init_static(void) { - ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); - ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); + static uint8_t mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; + + ff_rl_init(&ff_rl_mpeg1, mpeg12_static_rl_table_store[0]); + ff_rl_init(&ff_rl_mpeg2, mpeg12_static_rl_table_store[1]); for (int i = 0; i < 64; i++) { mpeg1_max_level[0][i] = ff_rl_mpeg1.max_level[0][i];