avcodec/dca: Unavpriv dca_sample_rates

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>
This commit is contained in:
Andreas Rheinhardt 2021-02-09 21:16:18 +01:00
parent d7a75d2163
commit 3afb41655e
10 changed files with 94 additions and 15 deletions

View File

@ -276,7 +276,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
@ -997,7 +998,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
@ -1006,6 +1006,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
@ -1101,7 +1102,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

View File

@ -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);

View File

@ -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];

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -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

View File

@ -685,6 +685,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

View File

@ -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"

View File

@ -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;