From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 05/11] avcodec/dca: Unavpriv dca_sample_rates Date: Wed, 15 Dec 2021 13:35:35 +0100 Message-ID: <AM7PR03MB6660BBE8619F755781CF61608F769@AM7PR03MB6660.eurprd03.prod.outlook.com> (raw) In-Reply-To: <AM7PR03MB666072BE629D71EFF7053C138F769@AM7PR03MB6660.eurprd03.prod.outlook.com> Said table is 64 bytes long and exported so that it can be used both in libavcodec and libavformat. This commit stops doing so and instead duplicates it for shared builds, because the overhead of exporting the symbol is bigger than 64 bytes. It consists of the length of the name of the symbol (2x24 bytes), two entries in .dynsym (2x24 bytes), two entries for symbol version (2x2 bytes), one hash value in the exporting library (4 bytes) in addition to one entry in the importing library's .got and .rela.dyn (8 + 24 bytes). (The above numbers are for a Linux/GNU/Elf system; the numbers for other platforms may be different.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/Makefile | 8 +++++--- libavcodec/dca.c | 7 +------ libavcodec/dca.h | 4 +--- libavcodec/dca_core.c | 2 +- libavcodec/dca_parser.c | 2 +- libavcodec/dca_sample_rate_tab.c | 25 +++++++++++++++++++++++ libavcodec/dca_sample_rate_tab.h | 33 +++++++++++++++++++++++++++++++ libavformat/Makefile | 1 + libavformat/dca_sample_rate_tab.c | 25 +++++++++++++++++++++++ libavformat/spdifenc.c | 2 +- 10 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 libavcodec/dca_sample_rate_tab.c create mode 100644 libavcodec/dca_sample_rate_tab.h create mode 100644 libavformat/dca_sample_rate_tab.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 36a1a1a4de..e4a547ffaa 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -275,7 +275,8 @@ OBJS-$(CONFIG_CSCD_DECODER) += cscd.o OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \ dca_core.o dca_exss.o dca_xll.o dca_lbr.o \ - dcadsp.o dcadct.o synth_filter.o + dcadsp.o dcadct.o dca_sample_rate_tab.o \ + synth_filter.o OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dcadata.o dcahuff.o \ dcaadpcm.o OBJS-$(CONFIG_DDS_DECODER) += dds.o @@ -994,7 +995,6 @@ OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_SPDIF_MUXER) += dca.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o @@ -1003,6 +1003,7 @@ STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavfilter dependencies OBJS-$(CONFIG_ELBG_FILTER) += elbg.o @@ -1098,7 +1099,8 @@ OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o OBJS-$(CONFIG_CRI_PARSER) += cri_parser.o -OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o +OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o \ + dca_sample_rate_tab.o OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o dnxhddata.o OBJS-$(CONFIG_DOLBY_E_PARSER) += dolby_e_parser.o dolby_e_parse.o diff --git a/libavcodec/dca.c b/libavcodec/dca.c index b2152524a5..fb359b2ff3 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -33,11 +33,6 @@ #include "get_bits.h" #include "put_bits.h" -const uint32_t avpriv_dca_sample_rates[16] = { - 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, - 12000, 24000, 48000, 96000, 192000 -}; - const uint32_t ff_dca_sampling_freqs[16] = { 8000, 16000, 32000, 64000, 128000, 22050, 44100, 88200, 176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000, @@ -112,7 +107,7 @@ int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb) return DCA_PARSE_ERROR_AMODE; h->sr_code = get_bits(gb, 4); - if (!avpriv_dca_sample_rates[h->sr_code]) + if (!ff_dca_sample_rates[h->sr_code]) return DCA_PARSE_ERROR_SAMPLE_RATE; h->br_code = get_bits(gb, 5); diff --git a/libavcodec/dca.h b/libavcodec/dca.h index e96c589c02..6be975fdfa 100644 --- a/libavcodec/dca.h +++ b/libavcodec/dca.h @@ -32,7 +32,6 @@ #include "libavutil/intreadwrite.h" #include "get_bits.h" -#include "internal.h" #define DCA_CORE_FRAME_HEADER_SIZE 18 @@ -195,8 +194,7 @@ enum DCADownMixType { DCA_DMIX_TYPE_COUNT }; -extern av_export_avcodec const uint32_t avpriv_dca_sample_rates[16]; - +extern const uint32_t ff_dca_sample_rates[16]; extern const uint32_t ff_dca_sampling_freqs[16]; extern const uint8_t ff_dca_freq_ranges[16]; extern const uint8_t ff_dca_bits_per_sample[8]; diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c index f0a3c18d62..758e3447a6 100644 --- a/libavcodec/dca_core.c +++ b/libavcodec/dca_core.c @@ -129,7 +129,7 @@ static int parse_frame_header(DCACoreDecoder *s) s->npcmblocks = h.npcmblocks; s->frame_size = h.frame_size; s->audio_mode = h.audio_mode; - s->sample_rate = avpriv_dca_sample_rates[h.sr_code]; + s->sample_rate = ff_dca_sample_rates[h.sr_code]; s->bit_rate = ff_dca_bit_rates[h.br_code]; s->drc_present = h.drc_present; s->ts_present = h.ts_present; diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 8b5c354312..3148397b7d 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -267,7 +267,7 @@ static int dca_parse_params(DCAParseContext *pc1, const uint8_t *buf, return AVERROR_INVALIDDATA; *duration = h.npcmblocks * DCA_PCMBLOCK_SAMPLES; - *sample_rate = avpriv_dca_sample_rates[h.sr_code]; + *sample_rate = ff_dca_sample_rates[h.sr_code]; if (*profile != FF_PROFILE_UNKNOWN) return 0; diff --git a/libavcodec/dca_sample_rate_tab.c b/libavcodec/dca_sample_rate_tab.c new file mode 100644 index 0000000000..16ee04b1d2 --- /dev/null +++ b/libavcodec/dca_sample_rate_tab.c @@ -0,0 +1,25 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larsson + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "dca_sample_rate_tab.h" diff --git a/libavcodec/dca_sample_rate_tab.h b/libavcodec/dca_sample_rate_tab.h new file mode 100644 index 0000000000..93d9a13663 --- /dev/null +++ b/libavcodec/dca_sample_rate_tab.h @@ -0,0 +1,33 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larssonb + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DCA_SAMPLE_RATE_TAB_H +#define AVCODEC_DCA_SAMPLE_RATE_TAB_H +#include <stdint.h> + +const uint32_t ff_dca_sample_rates[16] = { + 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, + 12000, 24000, 48000, 96000, 192000 +}; +#endif diff --git a/libavformat/Makefile b/libavformat/Makefile index e30d34f924..8f05b8d83c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -682,6 +682,7 @@ SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o +SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavdevice dependencies OBJS-$(CONFIG_IEC61883_INDEV) += dv.o diff --git a/libavformat/dca_sample_rate_tab.c b/libavformat/dca_sample_rate_tab.c new file mode 100644 index 0000000000..ed2380b0cd --- /dev/null +++ b/libavformat/dca_sample_rate_tab.c @@ -0,0 +1,25 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larsson + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/dca_sample_rate_tab.h" diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index e8f54bff4b..3be89328df 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -263,7 +263,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) case DCA_SYNCWORD_CORE_BE: blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f; core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1; - sample_rate = avpriv_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; + sample_rate = ff_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; break; case DCA_SYNCWORD_CORE_LE: blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f; -- 2.32.0 _______________________________________________ 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:[~2021-12-15 12:37 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 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 ` Andreas Rheinhardt [this message] 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=AM7PR03MB6660BBE8619F755781CF61608F769@AM7PR03MB6660.eurprd03.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