diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-03-09 12:15:35 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-04 13:16:50 +0100 |
commit | 33e6d57f01dd4742a2e25ac5fa072b487d9d02ce (patch) | |
tree | 460f428908cfa83ec5488643098a90f2a21204cd /libavcodec | |
parent | 49bf94536f059340eacd5430592e4216b29d0d20 (diff) | |
download | ffmpeg-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 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 16 | ||||
-rw-r--r-- | libavcodec/mp3_header_decompress_bsf.c | 5 | ||||
-rw-r--r-- | libavcodec/mpegaudiodata.c | 13 | ||||
-rw-r--r-- | libavcodec/mpegaudiodata.h | 5 | ||||
-rw-r--r-- | libavcodec/mpegaudiodecheader.c | 6 | ||||
-rw-r--r-- | libavcodec/mpegaudioenc_template.c | 8 | ||||
-rw-r--r-- | libavcodec/mpegaudiotabs.c | 22 | ||||
-rw-r--r-- | libavcodec/mpegaudiotabs.h | 39 |
8 files changed, 82 insertions, 32 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 63b4952eaf..5c045a15ea 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -123,7 +123,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_data.o \ mpegaudiodsp_fixed.o \ mpegaudiodsp_float.o -OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o +OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ @@ -474,9 +474,11 @@ OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc_float.o mpegaudio.o \ - mpegaudiodata.o mpegaudiodsp_data.o + mpegaudiodata.o mpegaudiodsp_data.o \ + mpegaudiotabs.o OBJS-$(CONFIG_MP2FIXED_ENCODER) += mpegaudioenc_fixed.o mpegaudio.o \ - mpegaudiodata.o mpegaudiodsp_data.o + mpegaudiodata.o mpegaudiodsp_data.o \ + mpegaudiotabs.o OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP3_MF_ENCODER) += mfenc.o mf_utils.o @@ -990,18 +992,18 @@ OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o SHLIBOBJS += log2_tab.o reverse.o # General libavformat dependencies -OBJS-$(CONFIG_ISO_MEDIA) += mpegaudiodata.o - OBJS-$(CONFIG_FITS_DEMUXER) += fits.o -OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o +STLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o \ mpeg4audio_sample_rates.o @@ -1171,7 +1173,7 @@ OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF) += mpeg4_unpack_bframes_bsf.o OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \ - mpegaudiodata.o + mpegaudiotabs.o OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index 44c174c21c..ebf6bde1c2 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -22,6 +22,7 @@ #include "libavutil/intreadwrite.h" #include "bsf.h" #include "bsf_internal.h" +#include "defs.h" #include "mpegaudiodecheader.h" #include "mpegaudiodata.h" @@ -67,10 +68,10 @@ static int mp3_header_decompress(AVBSFContext *ctx, AVPacket *out) goto fail; } - sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off + sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off for(bitrate_index=2; bitrate_index<30; bitrate_index++){ - frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; + frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); if(frame_size == buf_size + 4) break; diff --git a/libavcodec/mpegaudiodata.c b/libavcodec/mpegaudiodata.c index 0569281109..669590908f 100644 --- a/libavcodec/mpegaudiodata.c +++ b/libavcodec/mpegaudiodata.c @@ -26,19 +26,6 @@ #include "mpegaudiodata.h" - -const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = { - { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, - {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, - { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160} - } -}; - -const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 }; - /*******************************************************/ /* layer 2 tables */ diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index 0a425ef6a8..a4148a1ffe 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -31,14 +31,13 @@ #include "config.h" -#include "internal.h" #include "vlc.h" #define MODE_EXT_MS_STEREO 2 #define MODE_EXT_I_STEREO 1 -extern av_export_avcodec const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; -extern av_export_avcodec const uint16_t avpriv_mpa_freq_tab[3]; +extern const uint16_t ff_mpa_bitrate_tab[2][3][15]; +extern const uint16_t ff_mpa_freq_tab[3]; extern const int ff_mpa_sblimit_table[5]; extern const int ff_mpa_quant_steps[17]; extern const int ff_mpa_quant_bits[17]; diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c index 93c5f3d8f8..446a6e29d8 100644 --- a/libavcodec/mpegaudiodecheader.c +++ b/libavcodec/mpegaudiodecheader.c @@ -52,9 +52,9 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) s->layer = 4 - ((header >> 17) & 3); /* extract frequency */ sample_rate_index = (header >> 10) & 3; - if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) + if (sample_rate_index >= FF_ARRAY_ELEMS(ff_mpa_freq_tab)) sample_rate_index = 0; - sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); + sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); sample_rate_index += 3 * (s->lsf + mpeg25); s->sample_rate_index = sample_rate_index; s->error_protection = ((header >> 16) & 1) ^ 1; @@ -75,7 +75,7 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) s->nb_channels = 2; if (bitrate_index != 0) { - frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; + frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; s->bit_rate = frame_size * 1000; switch(s->layer) { case 1: diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c index 1df3cc704a..1ffd31f7cb 100644 --- a/libavcodec/mpegaudioenc_template.c +++ b/libavcodec/mpegaudioenc_template.c @@ -95,9 +95,9 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) /* encoding freq */ s->lsf = 0; for(i=0;i<3;i++) { - if (avpriv_mpa_freq_tab[i] == freq) + if (ff_mpa_freq_tab[i] == freq) break; - if ((avpriv_mpa_freq_tab[i] / 2) == freq) { + if ((ff_mpa_freq_tab[i] / 2) == freq) { s->lsf = 1; break; } @@ -110,12 +110,12 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) /* encoding bitrate & frequency */ for(i=1;i<15;i++) { - if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate) + if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate) break; } if (i == 15 && !avctx->bit_rate) { i = 14; - bitrate = avpriv_mpa_bitrate_tab[s->lsf][1][i]; + bitrate = ff_mpa_bitrate_tab[s->lsf][1][i]; avctx->bit_rate = bitrate * 1000; } if (i == 15){ diff --git a/libavcodec/mpegaudiotabs.c b/libavcodec/mpegaudiotabs.c new file mode 100644 index 0000000000..eaa380c808 --- /dev/null +++ b/libavcodec/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 "mpegaudiotabs.h" diff --git a/libavcodec/mpegaudiotabs.h b/libavcodec/mpegaudiotabs.h new file mode 100644 index 0000000000..671b83848d --- /dev/null +++ b/libavcodec/mpegaudiotabs.h @@ -0,0 +1,39 @@ +/* + * 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 + */ + +#ifndef AVCODEC_MPEGAUDIOTABS_H +#define AVCODEC_MPEGAUDIOTABS_H + +#include <stdint.h> + +const uint16_t ff_mpa_bitrate_tab[2][3][15] = { + { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, + { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, + { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, + { { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }, + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }, + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } + } +}; + +const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 }; + +#endif |