From patchwork Tue Nov 10 10:47:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23535 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 56CCD44AD0B for ; Tue, 10 Nov 2020 13:02:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3381A68BE9B; Tue, 10 Nov 2020 12:50:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7F6D68BEB5 for ; Tue, 10 Nov 2020 12:50:16 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id p8so11339424wrx.5 for ; Tue, 10 Nov 2020 02:50:16 -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=hjjsRFEpI2D6TeRT9TCV/vyITV7b4Iahbgr8buvjEbM=; b=eLaiKy1Fx9ArDn85izEXh2kl21GlhvPb7ue1uDctqMVUianqKpCvLgMVoJ5Z5snnBD Z/gP0ZZsMT9gYRehgWTgWOmbjUARS2fRC5LFkoP1TIgOIOHXrAgYBz4fLDA0TsEpBvIP NkTcv2OrmotN4kGggQ84QSy9fQbhxZtigUWZj+jYjXUgLCRHbycpR4kbjYTgIQCbuXBc J4+r3FFtJTsUMFj9ft0viwQ8W15Hbul/qCCMhgNqF454UB13VyezQjedkwFHNCE8SgIK j7KEsLYBf4/3+XpBBUEBHdGvs0M3kvSYWH3wnOUvhVC7A5W4yrXS7LfTznyVQAsxF2Cx bdGw== 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=hjjsRFEpI2D6TeRT9TCV/vyITV7b4Iahbgr8buvjEbM=; b=ht0Rcjj34JhN4unN0a+GqWkk0eh9EKgvCnxKL9v4PWkObXvaadEL/7a2OsrE8BCc4K sH4CmwAN6civCpXDYL6Qcp+ZB+n7luF+KWQOx/RXe5yCYOrPgi2lWdcZau+U+uN9uChT V2ASvx2nXAbHGdAKpJLIHWTsC/p6LVPjtWc+UOTAmKv/XXPXiS8N2/QJDZdMJ/pvyR2Q qV+8lEY0bfW703zL6+0WjFbD9DnleB5k4rWxl5cZtQd03aw8cWIsb5fTfPjWA0qAM54N ektqAbSESaJb14GXcaj3R5hRG1mY8k0d2YvXJiObwHo+OiGynPwPaKDufRTGPvqZ7QUA lYYg== X-Gm-Message-State: AOAM530QyKyuVcjHH0aknvlES5bhJ29MwtA2wJ9t4+jQEPygbFu8rfUq ag+p0gLcqxMdXKx1F2u49KLneXMoctg= X-Google-Smtp-Source: ABdhPJwQhjwqKcZZn86xaM91v/F7pBoXO9EdiB8NqmBG/pGULOEr9Joj/Ct7O/xYZ9JTOGYK0f/d3A== X-Received: by 2002:adf:e443:: with SMTP id t3mr23103422wrm.14.1605005415943; Tue, 10 Nov 2020 02:50:15 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l24sm2572543wmi.7.2020.11.10.02.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:50:15 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:47:54 +0100 Message-Id: <20201110104851.321029-58-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> References: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 057/114] avcodec/rv40: Avoid offset table when initializing static VLCs 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/rv40.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index 81e08af5f1..7ed599cd69 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -41,11 +41,6 @@ static VLC aic_top_vlc; static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM]; static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS]; -static const int16_t mode2_offs[] = { - 0, 614, 1222, 1794, 2410, 3014, 3586, 4202, 4792, 5382, 5966, 6542, - 7138, 7716, 8292, 8864, 9444, 10030, 10642, 11212, 11814 -}; - /** * Initialize all tables. */ @@ -72,7 +67,7 @@ static av_cold void rv40_init_tables(void) aic_mode1_vlc_bits[i], 1, 1, aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } - for(i = 0; i < AIC_MODE2_NUM; i++){ + for (unsigned i = 0, offset = 0; i < AIC_MODE2_NUM; i++){ uint16_t syms[AIC_MODE2_SIZE]; for (int j = 0; j < AIC_MODE2_SIZE; j++) { @@ -83,11 +78,12 @@ static av_cold void rv40_init_tables(void) else syms[j] = first | (second << 8); } - aic_mode2_vlc[i].table = &aic_mode2_table[mode2_offs[i]]; - aic_mode2_vlc[i].table_allocated = mode2_offs[i + 1] - mode2_offs[i]; + aic_mode2_vlc[i].table = &aic_mode2_table[offset]; + aic_mode2_vlc[i].table_allocated = FF_ARRAY_ELEMS(aic_mode2_table) - offset; ff_init_vlc_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE, aic_mode2_vlc_bits[i], 1, syms, 2, 2, 0, INIT_VLC_USE_NEW_STATIC); + offset += aic_mode2_vlc[i].table_size; } for(i = 0; i < NUM_PTYPE_VLCS; i++){ ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS];