From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 09/15] avformat/argo_cvg: Avoid relocations for ArgoCVGOverride Date: Sat, 23 Mar 2024 03:06:17 +0100 Message-ID: <GV1P250MB073749ED195F0F6BF6013D308F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <GV1P250MB07376CBB2E248FDF0C78CF8C8F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> The average length of the strings used here does not differ much from the length of the longest string; therefore it makes sense to use an array big enough for the longest string and not a pointer to a string. This also moves this array into .rodata (from .data.rel.ro). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavformat/argo_cvg.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c index 5db2a85dd8..03ae6fa59e 100644 --- a/libavformat/argo_cvg.c +++ b/libavformat/argo_cvg.c @@ -47,13 +47,6 @@ typedef struct ArgoCVGHeader { uint32_t reverb; /*< Reverb flag. */ } ArgoCVGHeader; -typedef struct ArgoCVGOverride { - const char *name; - ArgoCVGHeader header; - uint32_t checksum; - int sample_rate; -} ArgoCVGOverride; - typedef struct ArgoCVGDemuxContext { ArgoCVGHeader header; uint32_t checksum; @@ -72,12 +65,33 @@ typedef struct ArgoCVGMuxContext { #if CONFIG_ARGO_CVG_DEMUXER /* "Special" files that are played at a different rate. */ +// FILE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE) +#define OVERRIDE_FILES(FILE) \ + FILE(CRYS, 23592, 0, 1, 2495499, 88200) /* Beta */ \ + FILE(REDCRY88, 38280, 0, 1, 4134848, 88200) /* Beta */ \ + FILE(DANLOOP1, 54744, 1, 0, 5684641, 37800) /* Beta */ \ + FILE(PICKUP88, 12904, 0, 1, 1348091, 48000) /* Beta */ \ + FILE(SELECT1, 5080, 0, 1, 549987, 44100) /* Beta */ \ + +#define MAX_FILENAME_SIZE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE) \ + MAX_SIZE_BEFORE_ ## NAME, \ + MAX_SIZE_UNTIL_ ## NAME ## _MINUS1 = FFMAX(sizeof(#NAME ".CVG"), MAX_SIZE_BEFORE_ ## NAME) - 1, +enum { + OVERRIDE_FILES(MAX_FILENAME_SIZE) + MAX_OVERRIDE_FILENAME_SIZE +}; + +typedef struct ArgoCVGOverride { + const char name[MAX_OVERRIDE_FILENAME_SIZE]; + ArgoCVGHeader header; + uint32_t checksum; + int sample_rate; +} ArgoCVGOverride; + +#define FILE(NAME, SIZE, LOOP, REVERB, CHECKSUM, SAMPLE_RATE) \ + { #NAME ".CVG", { SIZE, LOOP, REVERB }, CHECKSUM, SAMPLE_RATE }, static const ArgoCVGOverride overrides[] = { - { "CRYS.CVG", { 23592, 0, 1 }, 2495499, 88200 }, /* Beta */ - { "REDCRY88.CVG", { 38280, 0, 1 }, 4134848, 88200 }, /* Beta */ - { "DANLOOP1.CVG", { 54744, 1, 0 }, 5684641, 37800 }, /* Beta */ - { "PICKUP88.CVG", { 12904, 0, 1 }, 1348091, 48000 }, /* Beta */ - { "SELECT1.CVG", { 5080, 0, 1 }, 549987, 44100 }, /* Beta */ + OVERRIDE_FILES(FILE) }; static int argo_cvg_probe(const AVProbeData *p) -- 2.40.1 _______________________________________________ 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".
next prev parent reply other threads:[~2024-03-23 2:07 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-23 2:03 [FFmpeg-devel] [PATCH 01/15] configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 02/15] avformat/hls: Don't access FFInputFormat.raw_codec_id Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 03/15] avformat/fitsdec: Don't use AVBPrint for temporary storage Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 04/15] avformat/g722: Inline constants Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 05/15] avformat/wvedec: Inline constant Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 06/15] avformat/fsb: Don't set data_offset manually Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 07/15] avformat/avr: Combine skips Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 08/15] avformat/wady: " Andreas Rheinhardt 2024-03-23 2:06 ` Andreas Rheinhardt [this message] 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 10/15] avformat/lafdec: Fix shadowing Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 11/15] avformat/cdg: Don't store avio_size() return value in int Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 12/15] avformat/pcmdec: Avoid av_freep(&(void*){NULL}) Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 13/15] avformat/pcmdec: Reindent after the previous commit Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 14/15] avformat/vqf: Return 0 on success in read_packet Andreas Rheinhardt 2024-03-23 2:06 ` [FFmpeg-devel] [PATCH 15/15] avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h Andreas Rheinhardt 2024-03-25 1:54 ` [FFmpeg-devel] [PATCH 01/15] configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers 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=GV1P250MB073749ED195F0F6BF6013D308F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \ --to=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