From patchwork Fri Oct 28 14:48:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39031 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:85a8:b0:a2:d5a7:ad9d with SMTP id s40csp835601pzd; Fri, 28 Oct 2022 07:48:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eGxQwFyfCbhnoJ4AX0CeZKA2ah6RyaVyRqc1uHdpBvywBXfXeYZ8Hmqm0JUO7/6KNhwFS X-Received: by 2002:a17:907:2c74:b0:7a1:d333:f214 with SMTP id ib20-20020a1709072c7400b007a1d333f214mr29828944ejc.14.1666968499437; Fri, 28 Oct 2022 07:48:19 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u23-20020aa7d997000000b00461c8f80e34si4329096eds.53.2022.10.28.07.48.16; Fri, 28 Oct 2022 07:48:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=I5jJjSDO; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 34BAF68BCF5; Fri, 28 Oct 2022 17:48:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2038.outbound.protection.outlook.com [40.92.89.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E92E668BC1A for ; Fri, 28 Oct 2022 17:48:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d9a41+CUaeWk4+G7J70Y96WO8vvBvkyt/BRzgDm+nlwi+N4ZChEkTqU5G6jVFXvrRoCQdpq9EhnK1vfiq3dSZxcTQcfa9thrCxCFH7EMvm/4yPUp9yNY7q2vl153sf6GFRV4l65h4xPhD5GPgH7m8qkofTo3sxAabsTrNbk6vK4LFUmI9EQVUHZ5iTW2XWo/a6Sn5Ol1+Q3SDTJYN6uWnBxYsgaKCmfbRLKOM0mbnZQ8bgrjuC1IUbDSlFivv3/DaeT4JR59bP54HduJzSWYNLV+3Nd0rTxCSqmpCO0erJxyMxNk2ZXl5ZMcDGV3gYHm8lc3Vn4wxkzZZzRT7dMB2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mxeEXncAD2i6U74JJWw30jnM8WdPqT7uNNMyviSAGw4=; b=HHRXJISaSroYDOZcrtPEnyg/IHK0Zp9ZSOb2injNVbOX8maAIZSNZUUCaF+dAzY3UU/IE2ZOZrwC/0Ckvjd7Cqq02SKKSyHCMSZ6foolDCn7jH+jp4XwNhA8ks6lY0sqFjochyLR88B/WgBK1V2iyi8p1PHS1y8eY50hoAJrFlflE0IxS3MF9KCKAagiVLW/XD1cP5oIr9Fpqm+3mXYTdjnV0/H4Iib5BasHTofhJukDz1Kvl3RLmiSYxzZP+xAoW/q9tRntku9VHBqVBGbJEo9HtcBbauyCzwi127RssR6Q3h/mE4O3m1/03CFtLogLaq1nmS/GhZZwTINQ3sdM5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mxeEXncAD2i6U74JJWw30jnM8WdPqT7uNNMyviSAGw4=; b=I5jJjSDOiYK8e4c8H1Cthi96HgxRuTWHQ8xjwdvs2Th2bnEsKSgIc6EOxcjS37puqtDkQEQ2cN+ZQUqPNRtkKnChrIc87bq48PjZ5y/zOga2jtKGnnIGLsRzZye5SKwki26aUO5rzYb2ziTzl9WOy1o6nEhl6bq3bFdxWbWaGZHpp0k0GHkni0rpXV7YMqIqkn/8oHd8FWSQEC36ev+CUXkKVqOhr+t0fZiZvTVsDeWDKtoCBI/EDCw2rUjPg+UCUzCu3u74VkOLxIiWreE2uFIryxbTklY+WmHEmZhSZxDehV+BYoPx7S/R20ailI0y7svxFOABDhgyHG/glsiJAA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DB4P250MB0982.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3f6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Fri, 28 Oct 2022 14:48:04 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%9]) with mapi id 15.20.5709.015; Fri, 28 Oct 2022 14:48:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Oct 2022 16:48:05 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [yiS+W25iS/akY2LtgLSoUOUlRZuZA9W35MkD88tvTkI=] X-ClientProxiedBy: AS9PR07CA0050.eurprd07.prod.outlook.com (2603:10a6:20b:46b::8) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221028144810.1518205-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DB4P250MB0982:EE_ X-MS-Office365-Filtering-Correlation-Id: d0ab5e6c-0545-464b-0955-08dab8f36b7f X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmponRFq0U3/v5vCEJI3BD4xNG7rsFxdXAaU+kTYAU9QZMESJd1OZpRmzr54zloiv89TazEuMrMqSYwtVFc+OHwvrr9Q7rJSNb4XDKV7uqT8f2D737ngxLGq/0sOVIv5F40HGZrYBL1DWXHYbw0MBaGlPudZZOVq+V2QxtYmyPwcpE/WhoSpfw0n2IGLckK2T5f4AYyd3/woqfe8knuvZhUlm+N4hNAGR7xnsWSKOavebD1G+mjf4GVQyZS3XdJRgsmmlkdlR2IPrAQt1VVWzhk0EwhEExUls+DrQDN7a6eUod6h4bTKYzCyIadkhPJgPFtVkpjOd/Y48dSCddYw+b0V1smRy3YLL4Ag84BhbjqSQKgav/EusYRak2DM9Tu+WU/Yf6T6YZ3ULRJkTm+LDepggRSeVRNrk2+Q4y9kIkPeFuinPbfDvKLUIb0SUpX7uZ1i8Coz4pGQtDR12hFVFrdikfSI0aQsOXbbstWQyLgUoxbZXCaY0kvfF65LqtvcSqq6Aky1rP7h+lShrWPEVHCQ49ccrdB7o3E0rypy7DQzvV3M+LT+kcESL4tbjCSlKS43qCQmkmg9vXLdFNq2Nqdbf+Fv0bAqGUQrYLSmyweKdGDDPnf12uKf0wE6R7pPB9GCtgxqrRWDrPbdK9hdNGHTQsmwSQ0OcxP7VseBAnKCXyXoXC1xAYXjmElW7TTQQQWrfvsvMx1HNE2zJQcN9eoorhgWYFjcQIlJB29wt8hcXdJG6oUdIsiQNFsZQInahc4= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TZgV9tCBJ5uPW9DVbHXzbgD0M++AVYl7RV+n7hVmz5ObYI16PQ/dCw0321sosozXwJ+343lV+9OmydIAPHBZyME+38/kRdbgWPUiHRMjEqG9csBzIuOqHm49CVkSkudHWpTuETlISpwxrNxDDvUEZkpQ50CoLVmFMJ2yPEJsxrzjnjZYnCjC29GmYTgYrQRuK3VMokVHhHGh4oF4esym/9R5jMCdd3bTKWwWaXXFFU4T/7PFTaB0OI7KNLyTYUxIA5o18enDt0ad6IvuLr/uRXc47Mq3DkR12SgOts1ZZXWPH6bg5gDkakO4Ehracq3VUTewYpgL7/nhmgLGdRC2JqXl+rbVJ4fdKKtsAWRENLx2T86L9h/4lL4NO3Zg0QmBHfIZeNsCXftKVPyU309r5uL4a1FeFsAMdVeGlf9/1JXw/aPtfRQkQpu8T3BU+xFWaozvTictdDttfRyVwcgupbUSjp/YkZcOmcGOFvVwNClzY+ILMK8JnL3lyGkIanCPD+Ljrj/3/SeL3lBCovUimHb5Gzjn8MGxfTY78QAc3N7MSFC81BsyYlVWIGXrrofph1mpvkSAt2y/i3U5owPmqCDfTQIm98+B/hZbr+pPoUCCDqZt1gH+hbl9Bm0ZzrodypfZdN65Fq2wJeiedxS+gPVVmMzo8O46ls6vSe1JY4fXC3H3lj/y57R8g4a0xCMg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7Ak5/FqI5dyA6SVxychsldErr0S0xN7XFq30vPNx7coNH2eaaWQd7zRihZgkOEU+5CqL4xFO/kaAM+TsqDeihdL5pT9zGH1r/7JUKxTYoSHFhg7N9+uAv89jKLqQDybr/KScSv9psEYG2UUT70/BS6GwNIHj78kHNO8m3sASf3prlV61z5lD4XnEwSBEoxwupjyh8nJFZ8tICpz2GxLkrhsIRTh/GvGde779XG916zy5r8AQFU9xDCgYgcTC7wvVS3Zru7dI7VMxK0W7C93XWLvLa/n77EpcwjTbJxSgeT8JPjUSRun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id: d0ab5e6c-0545-464b-0955-08dab8f36b7f X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 14:48:04.8428 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4P250MB0982 Subject: [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: G0Lp0285acy+ These tables are only accessed in ff_set_qscale() which only accesses values 1..31 as well as in encode_picture() in mpegvideo_enc.c, accessing the value with index 8. So make these tables smaller. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideodata.c | 32 ++++---------------------------- libavcodec/mpegvideodata.h | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c index da0638e052..b98e90cf43 100644 --- a/libavcodec/mpegvideodata.c +++ b/libavcodec/mpegvideodata.c @@ -30,46 +30,22 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { 56, 64, 72, 80, 88, 96, 104, 112, }; -const uint8_t ff_mpeg1_dc_scale_table[128] = { - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +const uint8_t ff_mpeg1_dc_scale_table[32] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -static const uint8_t mpeg2_dc_scale_table1[128] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +static const uint8_t mpeg2_dc_scale_table1[32] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; -static const uint8_t mpeg2_dc_scale_table2[128] = { - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +static const uint8_t mpeg2_dc_scale_table2[32] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; -static const uint8_t mpeg2_dc_scale_table3[128] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +static const uint8_t mpeg2_dc_scale_table3[32] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index 14f4806d66..cf783ef31c 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -25,7 +25,7 @@ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_mpeg1_dc_scale_table[128]; +extern const uint8_t ff_mpeg1_dc_scale_table[32]; extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; extern const uint8_t ff_mpeg2_non_linear_qscale[32];