From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8B9B740CD4 for ; Thu, 30 Dec 2021 09:55:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F23CB68AE3E; Thu, 30 Dec 2021 11:55:17 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 072C768A466 for ; Thu, 30 Dec 2021 11:55:12 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9A82F24017C; Thu, 30 Dec 2021 10:55:11 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id d5ny5iSJpj_k; Thu, 30 Dec 2021 10:55:10 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 6DBE6240179; Thu, 30 Dec 2021 10:55:10 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id DBA4016008E; Thu, 30 Dec 2021 10:55:09 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CAM7PR03MB6660DF244AE3C4B8392D76848F769=40AM7PR03MB?= =?utf-8?q?6660=2Eeurprd03=2Eprod=2Eoutlook=2Ecom=3E?= References: =?utf-8?q?=3CAM7PR03MB666072BE629D71EFF7053C138F769=40AM7PR03MB6?= =?utf-8?q?660=2Eeurprd03=2Eprod=2Eoutlook=2Ecom=3E_=3CAM7PR03MB6660DF244AE3?= =?utf-8?q?C4B8392D76848F769=40AM7PR03MB6660=2Eeurprd03=2Eprod=2Eoutlook=2Ec?= =?utf-8?q?om=3E?= Mail-Followup-To: FFmpeg development discussions and patches , Andreas Rheinhardt Date: Thu, 30 Dec 2021 10:55:09 +0100 Message-ID: <164085810972.2375.12352515367310682014@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 02/11] avcodec/raw: Reduce number of avpriv symbols 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Andreas Rheinhardt (2021-12-15 13:35:32) > libavcodec currently exports four avpriv symbols that deal with > PixelFormatTags: avpriv_get_raw_pix_fmt_tags, avpriv_find_pix_fmt, > avpriv_pix_fmt_bps_avi and avpriv_pix_fmt_bps_mov. The latter two are > lists of PixelFormatTags, the former returns such a list and the second > searches a list for a pixel format that matches a given fourcc; only > one of the aforementioned three lists is ever searched. > > Yet for avpriv_pix_fmt_bps_avi, avpriv_pix_fmt_bps_mov and > avpriv_find_pix_fmt the overhead of exporting these functions actually > exceeds the size of said objects (at least for ELF; the following numbers > are for x64 Ubuntu 20.10): > The code size of avpriv_find_pix_fmt is small (GCC 10.2 37B, Clang 11 41B), > yet exporting it adds a 20B string for the name alone to the exporting > as well as to each importing library; there is more: Four bytes in the > exporting libraries .gnu.hash; two bytes each for the exporting as well > as each importing libraries .gnu.version; 24B in the exporting as well > as each importing libraries .dynsym; 16B+24B for an entry in .plt as > well as the accompanying relocation entry in .rela.plt for each > importing library. > > The overhead for the lists is similar: The strings are 23B and the > .plt+.rela.plt pair is replaced by 8B+24B for an entry in .got and > a relocation entry in .rela.dyn. These lists have a size of 80 resp. > 72 bytes. > > Yet for ff_raw_pix_fmt_tags, exporting it is advantageous compared to > duplicating it into libavformat and potentially libavdevice. Therefore > this commit replaces all library uses of the four symbols with a single > function that is exported for shared builds. It has an enum parameter > to choose the desired list besides the parameter for the fourcc. New > lists can be supported with new enum values. > > Unfortunately, avpriv_get_raw_pix_fmt_tags could not be removed, as the > fourcc2pixfmt tool uses the table of raw pix fmts. No other user of this > function remains. > > Signed-off-by: Andreas Rheinhardt > --- > 1. It would make sense to deduplicate avpriv_pix_fmt_bps_(mov|avi) > size-wise if it is preferred to keep the lists accessible to users. > 2. One could handle the fourcc2pixfmt case in avpriv_pix_fmt_find(), > too, if one added another parameter (say count). In this case > avpriv_pix_fmt_find() will return the first pixfmt with the desired > fourcc if count is zero, the second one is count is 1 etc. (and > AV_PIX_FMT_NONE in case there is none any more). This would also make > this function more future-proof. Would it not be simpler to add a second function returning a pointer to the full table? Also, I would prefer making this completely public rather than avpriv. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".