From patchwork Wed Dec 30 23:31:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24703 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 3665B44A7BE for ; Thu, 31 Dec 2020 01:32:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1835168A9BB; Thu, 31 Dec 2020 01:32:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AE5668A5D7 for ; Thu, 31 Dec 2020 01:32:41 +0200 (EET) Received: by mail-ej1-f50.google.com with SMTP id d17so23634346ejy.9 for ; Wed, 30 Dec 2020 15:32:41 -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=S5lr5fx/evVZnj2A93vERr6s9PkYhCdgP4yX3FMgVzM=; b=iI/6WlUsYqGjVqrRXIR6IQWXfOq5mxpL7inksJx0k5WNcFeMnyH6t9Itf0iXEEBzT7 Feh5SzZH7oMhaVp++TcRNpQe9x7KAJJ7KiekAKWQozKj3chMKxgijRI2Jg4x36u85ra5 pV7dQiwFwuH3MOEZ9/I+M9ldmvCCi6+w+P6KSxnPwBJw3AsMahMFZIpV/NYrP2UOFhCC h0PCZ9IJ8CET1K7NtpEdrdj6dHFE0OG770wlErYZlia1hUp+KbLgrBUFRIT+++MrHuna mn96ag7K6eTbr3QwP7fQywlIBJGlTdEId3Ab71I5AZ0NGJnJDu4ej4vtnYXJvS83GdWt G8fw== 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=S5lr5fx/evVZnj2A93vERr6s9PkYhCdgP4yX3FMgVzM=; b=abJR/PRGS4cNZkqUgCsGemJNvcC4v1YwCLphZ9fzqNo+eW5epHFHrdNp6vSdXZv640 dou+TPuBA7OMLN/nOaMBuBAL+AcKGv8dj6XbtBo2i04ovprzMrRk95o4DqZeC54Q6h5A 90FW2dm2qk1AhWbkRko3svfopec0nCRYZXuTnqkw/pIR0lcIMOfamb54iRrO/EDlgUI8 EnKXsC3/b/TRogfohQgi8U6lDY4FOTP8M65T8cVL0NE4UWh70JjIC/cOTVLarHldyXb1 bcq2ctHqc03gn05Zo6mw/A2xHQTqhqPfv3qAvM7K08MX9UcXTQqExhN689RR1Yu6Nu4w QmfQ== X-Gm-Message-State: AOAM530Papt9IlGIzsy5RHHrVqwicxJqMsOrRmhyDdNa7vFudhGxQAUp OygJ0xktg9mUE3LS+jEW10Rv8JdS2yg= X-Google-Smtp-Source: ABdhPJzMHKshZkZbHkc2HtOfTQ665k/N408VLAdWMjdrvfxKUG5HMKCZmJlXPav0ePgqQTDekZsAAg== X-Received: by 2002:a17:906:b2d1:: with SMTP id cf17mr52265404ejb.281.1609371160431; Wed, 30 Dec 2020 15:32:40 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id u19sm19630409ejg.16.2020.12.30.15.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 15:32:39 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 31 Dec 2020 00:31:34 +0100 Message-Id: <20201230233157.1055287-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201230233157.1055287-1-andreas.rheinhardt@gmail.com> References: <20201230233157.1055287-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/30] avcodec/truemotion1data: Avoid indirection for delta-table init 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" Up until arrays of pointers to other arrays have been used, yet these other arrays all have the same number of elements and the same underlying type, so one can use an array of arrays. This also avoids relocations. Signed-off-by: Andreas Rheinhardt --- On 64bit systems it would also make sense to transform the fat tables. libavcodec/truemotion1data.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/truemotion1data.h b/libavcodec/truemotion1data.h index 3e581434e4..f432d87d08 100644 --- a/libavcodec/truemotion1data.h +++ b/libavcodec/truemotion1data.h @@ -29,25 +29,28 @@ #include /* Y delta tables, skinny and fat */ -static const int16_t ydt1[8] = { 0, -2, 2, -6, 6, -12, 12, -12 }; -static const int16_t ydt2[8] = { 0, -2, 4, -6, 8, -12, 12, -12 }; -static const int16_t ydt3[8] = { 4, -6, 20, -20, 46, -46, 94, -94 }; +static const int16_t ydts[][8] = { + { 0, -2, 2, -6, 6, -12, 12, -12 }, + { 0, -2, 4, -6, 8, -12, 12, -12 }, + { 4, -6, 20, -20, 46, -46, 94, -94 }, + { 0, -4, 4, -16, 16, -36, 36, -80 }, +}; static const int16_t fat_ydt3[8] = { 0, -15, 50, -50, 115, -115, 235, -235 }; -static const int16_t ydt4[8] = { 0, -4, 4, -16, 16, -36, 36, -80 }; /* NOTE: This table breaks the [+,-] pattern that the rest of the * tables maintain. Is this intentional? */ static const int16_t fat_ydt4[8] = { 0, 40, 80, -76, 160, -154, 236, -236 }; /* C delta tables, skinny and fat */ -static const int16_t cdt1[8] = { 0, -1, 1, -2, 3, -4, 5, -4 }; -static const int16_t cdt2[8] = { 0, -4, 3, -16, 20, -32, 36, -32 }; +static const int16_t cdts[][8] = { + { 0, -1, 1, -2, 3, -4, 5, -4 }, + { 0, -1, 1, -2, 3, -4, 5, -4 }, // Same as above + { 0, -4, 3, -16, 20, -32, 36, -32 }, + { 0, -2, 2, -8, 8, -18, 18, -40 }, +}; static const int16_t fat_cdt2[8] = { 0, -20, 15, -80, 100, -160, 180, -160 }; -static const int16_t cdt3[8] = { 0, -2, 2, -8, 8, -18, 18, -40 }; -/* all the delta tables to choose from, at all 4 delta levels */ -static const int16_t * const ydts[] = { ydt1, ydt2, ydt3, ydt4, NULL }; +/* Fat delta tables to choose from, at all 4 delta levels */ static const int16_t * const fat_ydts[] = { fat_ydt3, fat_ydt3, fat_ydt3, fat_ydt4, NULL }; -static const int16_t * const cdts[] = { cdt1, cdt1, cdt2, cdt3, NULL }; static const int16_t * const fat_cdts[] = { fat_cdt2, fat_cdt2, fat_cdt2, fat_ydt4, NULL }; static const uint8_t pc_tbl2[] = {