aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-09 12:15:35 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 13:16:50 +0100
commit33e6d57f01dd4742a2e25ac5fa072b487d9d02ce (patch)
tree460f428908cfa83ec5488643098a90f2a21204cd /libavformat
parent49bf94536f059340eacd5430592e4216b29d0d20 (diff)
downloadffmpeg-33e6d57f01dd4742a2e25ac5fa072b487d9d02ce.tar.gz
avcodec/mpegaudiodata: Unavpriv mpa_bitrate and mpa_frequency tabs
These arrays have a size of 180 resp. six bytes. This does not make it worthwhile to export them due to the overhead this occurs; for x64 Elf/Linux/GNU: 2x2B version, 2x24B .dynsym, 24B .rela.dyn, 8B .got, 4B hash + twice the size of the name (here 20+23B). Therefore these symbols are unavprived and duplicated for shared builds. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile3
-rw-r--r--libavformat/isom.c2
-rw-r--r--libavformat/mp3enc.c8
-rw-r--r--libavformat/mpegaudiotabs.c22
-rw-r--r--libavformat/nutenc.c4
5 files changed, 32 insertions, 7 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6482f247b6..892189d66a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -681,11 +681,14 @@ OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o
# Objects duplicated from other libraries for shared builds
SHLIBOBJS += log2_tab.o
+SHLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o
SHLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o
SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o
SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o
SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
+SHLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o
SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o
+SHLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o
SHLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o
SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o \
mpeg4audio_sample_rates.o
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 300ba927c2..015c82e1bb 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -362,7 +362,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
return ret;
st->codecpar->channels = cfg.channels;
if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
- st->codecpar->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index];
+ st->codecpar->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
else if (cfg.ext_sample_rate)
st->codecpar->sample_rate = cfg.ext_sample_rate;
else
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 5728ef30be..0ffc79c025 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -159,8 +159,8 @@ static int mp3_write_xing(AVFormatContext *s)
if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) || !mp3->write_xing)
return 0;
- for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) {
- const uint16_t base_freq = avpriv_mpa_freq_tab[i];
+ for (i = 0; i < FF_ARRAY_ELEMS(ff_mpa_freq_tab); i++) {
+ const uint16_t base_freq = ff_mpa_freq_tab[i];
if (par->sample_rate == base_freq) ver = 0x3; // MPEG 1
else if (par->sample_rate == base_freq / 2) ver = 0x2; // MPEG 2
@@ -170,7 +170,7 @@ static int mp3_write_xing(AVFormatContext *s)
srate_idx = i;
break;
}
- if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
+ if (i == FF_ARRAY_ELEMS(ff_mpa_freq_tab)) {
av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing header.\n");
return -1;
}
@@ -190,7 +190,7 @@ static int mp3_write_xing(AVFormatContext *s)
header |= channels << 6;
for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) {
- int bit_rate = 1000 * avpriv_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx];
+ int bit_rate = 1000 * ff_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx];
int error = FFABS(bit_rate - par->bit_rate);
if (error < best_bitrate_error) {
diff --git a/libavformat/mpegaudiotabs.c b/libavformat/mpegaudiotabs.c
new file mode 100644
index 0000000000..41ac76e21b
--- /dev/null
+++ b/libavformat/mpegaudiotabs.c
@@ -0,0 +1,22 @@
+/*
+ * MPEG Audio common tables
+ * copyright (c) 2002 Fabrice Bellard
+ *
+ * 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/mpegaudiotabs.h"
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 7977980935..585ce953ca 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -70,11 +70,11 @@ static int find_expected_header(AVCodecParameters *p, int size, int key_frame,
else if (sample_rate < (44100 + 48000) / 2) sample_rate_index = 0;
else sample_rate_index = 1;
- sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
+ sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
for (bitrate_index = 2; bitrate_index < 30; bitrate_index++) {
frame_size =
- avpriv_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1];
+ ff_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1];
frame_size = (frame_size * 144000) / (sample_rate << lsf) +
(bitrate_index & 1);