Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: Re: [FFmpeg-devel] [PATCH 02/11] avcodec/raw: Reduce number of avpriv symbols
Date: Thu, 30 Dec 2021 10:55:09 +0100
Message-ID: <164085810972.2375.12352515367310682014@lain.red.khirnov.net> (raw)
In-Reply-To: =?utf-8?q?=3CAM7PR03MB6660DF244AE3C4B8392D76848F769=40AM7PR03MB?= =?utf-8?q?6660=2Eeurprd03=2Eprod=2Eoutlook=2Ecom=3E?=

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 <andreas.rheinhardt@outlook.com>
> ---
> 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".

         reply	other threads:[~2021-12-30  9:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 12:29 [FFmpeg-devel] [PATCH 01/11] avcodec/Makefile: Remove superfluous avformat->DNXHD dependencies Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 02/11] avcodec/raw: Reduce number of avpriv symbols Andreas Rheinhardt
2021-12-20 15:03   ` Andreas Rheinhardt
2021-12-30  9:55   ` Anton Khirnov [this message]
2022-01-03  5:33     ` Andreas Rheinhardt
2022-01-03 10:38   ` Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 03/11] Makefile: Redo duplicating object files in shared builds Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 04/11] avcodec/ac3tab: Unavpriv ac3_channel_layout_tab Andreas Rheinhardt
2021-12-30 10:12   ` Anton Khirnov
2021-12-31 13:28     ` Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 05/11] avcodec/dca: Unavpriv dca_sample_rates Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 06/11] avcodec/jpegtables: Unavpriv MJPEG-tables Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 07/11] configure, avcodec/Makefile: Add new mpeg4audio CONFIG_EXTRA group Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 08/11] avcodec/mpeg4audio: Unavpriv and deduplicate mpeg4audio_sample_rates Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 09/11] avcodec/mpegaudiodata: Unavpriv mpa_bitrate and mpa_frequency tabs Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 10/11] avcodec/internal: Remove unused av_export_avcodec Andreas Rheinhardt
2021-12-15 12:35 ` [FFmpeg-devel] [PATCH 11/11] avcodec/utils: Unavpriv avpriv_toupper4() Andreas Rheinhardt
2021-12-16  1:29 ` [FFmpeg-devel] [PATCH 12/15] avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary references Andreas Rheinhardt
2021-12-16  1:29 ` [FFmpeg-devel] [PATCH 13/15] avformat/mux, mxfenc: Don't use sizeof(AVPacket) Andreas Rheinhardt
2021-12-21 13:52   ` Tomas Härdin
2021-12-16  1:29 ` [FFmpeg-devel] [PATCH 14/15] avcodec/packet_internal: Add proper PacketList struct Andreas Rheinhardt
2021-12-16  1:29 ` [FFmpeg-devel] [PATCH 15/15] avformat/movenc: Use dedicated pointer for access to MOVTrack Andreas Rheinhardt
2021-12-17 22:52 ` [FFmpeg-devel] [PATCH 01/11] avcodec/Makefile: Remove superfluous avformat->DNXHD dependencies Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164085810972.2375.12352515367310682014@lain.red.khirnov.net \
    --to=anton@khirnov.net \
    --cc=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git