From patchwork Sat Dec 25 06:06:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32906 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8686000iog; Fri, 24 Dec 2021 22:06:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhgC2GpIFXcaaDY+eb1/Uu2Ml+No27szq0qVtlSi7sWS1ktzOGmF7WHRgTKjYcLxjAh2X/ X-Received: by 2002:a17:906:c1c2:: with SMTP id bw2mr7596784ejb.499.1640412414352; Fri, 24 Dec 2021 22:06:54 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fy1si174440ejc.625.2021.12.24.22.06.54; Fri, 24 Dec 2021 22:06:54 -0800 (PST) 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=kS0wQDrv; 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 A57A468B0D1; Sat, 25 Dec 2021 08:06:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2105.outbound.protection.outlook.com [40.92.91.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9337368B037 for ; Sat, 25 Dec 2021 08:06:36 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WtYWxPJl35+tV5sQ7DRAdd57vi4u/EomEZGZwSO9Usk1CVB0j1ICBaj5zJC7rBtX0OpyVAXoTNVCykCJ9fTDCgJHSOar2mx5hwMRQjAsfYHSHXMEoxZGBmNO65f5z8L/5VPnJGJVXZvW4/PWk3sFy1FcVaIfaK44HJAq6qdnWYdVirCzzel7xsRDiOEwpycZQrArAp67lIksXawgrUQ48j6yfi62OixHJWxTOKlNoLaRKvc/LGmCISvMhz7KP2Hd3ozR0gapuKktNWwvDDMFejLmLreVtMl8NWMp++pHUYQbXCdIAvSwsGKv8enYF33INYokqJTRy31JaEExzR+rhg== 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=UUkkVq2g3BHvQnHwIgkMe4RLqIuIeRpKFcACBvTCnxA=; b=f2rcy4mXATJoojqzhDazZMbDhUT8uH30AjSvhTzkWYqyY8pIpLMFXePAefaPXqsMeffaWYUYKGhvZNZCqJeFxszWNfySPn73PLRgQzHON7LgCJc1d3KA3vj7iGYDod4Yh7L9C8oV8E9gwnKrQYTFnR9NJjW8LftoN4+1pQ/khXffQFWrxq7EXPFUGT3ck6o5+iM6gJdroMT8vnmtWat4SWrtIwRSolmxfSeOJBLIjaVIHW1Hj9kDyqyqELUF36qsOjS5y2HibDI+WvoYfSA9xyrr7tLHrbI8pGCmoE6LYkLjOESyiHl+ukDSwMYAuF/tlGz0CyAMyYwo6ZHQn0ordA== 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=UUkkVq2g3BHvQnHwIgkMe4RLqIuIeRpKFcACBvTCnxA=; b=kS0wQDrvNgbQPAgh8NJjqsnmnxr2yri+kG0HyduIXKTYIx4AmUQ2k7QFig+oy9l+hgjKIYjCehCB1StP9aDN6Rf2RqRisLgvBW07BxqyguX8OvtJPBnkKFE8GGTuabVoyDMlwUOSYq5Km4wf1C+mEr1iW4QBDprSbvdVNr+clXxef+UvJqNl77atzEXqEaOeGn5EOcw0aHOm1Qu/BvIvZzJX7Mwp//4lAueVVcMOg1KOnBFFTlpjLpNoqb9bsuvoopt9CFrsugNAVdhmD6wthE71EEnd63ijpf8pUxFqwaEofpoPwsVoBBn1DFZh7VmIMXGz86My2EfNm2TsPb8ppg== Received: from DBAPR03MB6664.eurprd03.prod.outlook.com (2603:10a6:10:17d::22) by DBBPR03MB5445.eurprd03.prod.outlook.com (2603:10a6:10:dc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Sat, 25 Dec 2021 06:06:31 +0000 Received: from DBAPR03MB6664.eurprd03.prod.outlook.com ([fe80::8c52:d93a:8d07:9f77]) by DBAPR03MB6664.eurprd03.prod.outlook.com ([fe80::8c52:d93a:8d07:9f77%6]) with mapi id 15.20.4823.021; Sat, 25 Dec 2021 06:06:31 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 25 Dec 2021 07:06:14 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [ZO5PfvvZ9CclUKvNeMGCsk2jb+6IsEH7] X-ClientProxiedBy: AM3PR05CA0135.eurprd05.prod.outlook.com (2603:10a6:207:3::13) To DBAPR03MB6664.eurprd03.prod.outlook.com (2603:10a6:10:17d::22) X-Microsoft-Original-Message-ID: <20211225060614.2345147-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25b714aa-9bab-4bdb-59ac-08d9c76cb23c X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlhjadYyK+ePWStyXeZJo2lNLge5dmtruAVHrq+iQACQOHWmg5lb310QMIdnSTGPSCWJ29yddJREGieza+0+UJJLTEESER2U/j0w/B7qzktRxVCZ/FdZ/jRuljkAj6Cm7AOwIOhaicvjj/Z4/8/Kq73HR95D1CUjl11i7dF5W0L9wTy3r7VlZy3BZdy/ls5Sx+1WjoxGDWh1Qea+eZS2su0QEbZw5o2TnDViLu1s8F1nyc9jXcLzHH4YNSYmSEylV2lpTeJnQdTU6kVEVtCIwvFfbkF5OQo/9LrH7zmzW+tQghlUPoABi7jDZOMWR5HXjsMkmtSnvTeMO+i2Gdc3LxssOGiAWq1mCS2X+mc0JBRo0JfN7ijOspqkTM2Shp8IOMiLgOXucL+C87OpHRLq5Qt8cBV5LvGQYf/EZ51pzy79+FgOU3lq0FylHZ0GAvKddG/FinmDkYzAqcYS7Bl0kzxH4lDU/mk8fPfeom3JWXLyXkwf7K9LkLXccewdPcTJXVidO/dE29Jymbsk4ZWmNWI3hUH07Rd/f/4+rKyjhS9+Wr9tIQf6ppcAhscVF6VgRY8lZzTABd16Y4uVLYAeAEUx9b0jDvnaf9ZT2pUkKPlXZzN83wc1mmte9pQ2vvdCd+A2RgYlh1imsURMm5ONqZT7QURUVZEflVPS335mhr2f6pigLiU6CdgjE1UB21vRaFyuWIUQUKF2o= X-MS-TrafficTypeDiagnostic: DBBPR03MB5445:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y2u9t5MepwqZv/ZzYNazNRyKfz7N7Yy6L0ZViW6PixSJWP51jFETPbeCl5I2gYwg0LJu66mq9oR6ZUsQXWSTvqZ7E+Er2NwnKbDqHRmAiwFbrqCbNViCUWGvo0M+r1qhG4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7G6dyj8+lHEmggGVvDnS7c7axkUZ6BLbpfvz7NnkEFgi8wLgQHpicW4oKWDvGzwXPv9Daoh0AKEmkiMreUP58h24qvWT3+yA+KsuCBkTR00wlqJUrbBUGscb7iMpiJRKCIOqcxu056AvTPBLTfxFLtdrFPXy4Bs5T5Q/UTcBSzEc67XCGIc20jmpUV6nh2Z6WqceoNQrHTswJZdRTH7CYXx1Fi4tpBSiG8q74F+Av1cHlsZqlaMZOKmlv4Er3ntw4CtLLPK0fnwNf7KbB6XM40hy4zCSCIdatCoWZWGGg/3Dxv3JacXuKkAQ0HHMFvnG3k0g31iNCA40jamxrWYJ+0Skqcelpr46i6kOEBTYEoqTBCok7BhlfklQF3Y8yBbgED3T60OByPOcJufijO8rS7Wu1tVZnvPWng+ejdeeSpXXw5me1iL/gBr+6RWL2SDAkQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25b714aa-9bab-4bdb-59ac-08d9c76cb23c X-MS-Exchange-CrossTenant-AuthSource: DBAPR03MB6664.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2021 06:06:31.2830 (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: DBBPR03MB5445 Subject: [FFmpeg-devel] [PATCH 39/39] avcodec/mpeg12enc: Inline constants 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: a2J2pTUl+dY8 Signed-off-by: Andreas Rheinhardt --- For a long time, ff_mpeg1_init_uni_ac_vlc() has only been used to create MPEG-1/2 tables and therefore some values (namely the number of elements) have been inlined; yet nowadays this function is also used for speedhq whose number of elements differs. So it seems to me that one should uninline this value in ff_mpeg1_init_uni_ac_vlc. libavcodec/mpeg12enc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 97d497d619..e28aa809d2 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -621,10 +621,8 @@ static inline void put_mb_modes(MpegEncContext *s, int n, int bits, static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) { if (val == 0) { - /* zero vector */ - put_bits(&s->pb, - ff_mpeg12_mbMotionVectorTable[0][1], - ff_mpeg12_mbMotionVectorTable[0][0]); + /* zero vector, corresponds to ff_mpeg12_mbMotionVectorTable[0] */ + put_bits(&s->pb, 1, 0x01); } else { int code, sign, bits; int bit_size = f_or_b_code - 1; @@ -746,8 +744,10 @@ next_coef: put_bits(&s->pb, table_vlc[code][1] + 1, (table_vlc[code][0] << 1) + sign); } else { - /* escape seems to be pretty rare <5% so I do not optimize it */ - put_bits(&s->pb, table_vlc[111][1], table_vlc[111][0]); + /* Escape seems to be pretty rare <5% so I do not optimize it; + * the following value is the common escape value for both + * possible tables (i.e. table_vlc[111]). */ + put_bits(&s->pb, 6, 0x01); /* escape: only clip in this case */ put_bits(&s->pb, 6, run); if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO) { @@ -1097,7 +1097,7 @@ static av_cold void mpeg12_encode_init_static(void) int len; if (mv == 0) { - len = ff_mpeg12_mbMotionVectorTable[0][1]; + len = 1; /* ff_mpeg12_mbMotionVectorTable[0][1] */ } else { int val, bit_size, code; @@ -1112,7 +1112,7 @@ static av_cold void mpeg12_encode_init_static(void) len = ff_mpeg12_mbMotionVectorTable[code][1] + 1 + bit_size; else - len = ff_mpeg12_mbMotionVectorTable[16][1] + + len = 10 /* ff_mpeg12_mbMotionVectorTable[16][1] */ + 2 + bit_size; }