mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/ac3tab: Unavpriv ac3_channel_layout_tab
It is small (16 B) and therefore the overhead of exporting it more than outweighs the size savings from not having duplicated symbols: When the symbol is no longer avpriv, one saves twice the size of the string containing the symbols name (2x30 byte), two entries in .dynsym (24 bytes each on x64), one entry in the importing libraries .got and .rela.dyn (8 + 24 bytes on x64) and two entries for the symbol version (2 bytes each) and one hash value in the exporting library (4 bytes). (The exact numbers are of course different for other platforms (e.g. when using dlls), but given that the strings saved alone more than outweigh the array size it can be presumed that this is beneficial for all platforms.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
3d53cefb49
commit
d7a75d2163
@ -175,8 +175,10 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
||||
psymodel.o mpeg4audio.o kbdwin.o
|
||||
OBJS-$(CONFIG_AAC_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \
|
||||
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o \
|
||||
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
|
||||
ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o
|
||||
@ -992,7 +994,6 @@ OBJS-$(CONFIG_FITS_DEMUXER) += fits.o
|
||||
OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o
|
||||
@ -1001,6 +1002,8 @@ OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
|
||||
OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o
|
||||
|
||||
# libavformat dependencies for static builds
|
||||
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
|
||||
|
||||
@ -1087,7 +1090,8 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
|
||||
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
|
||||
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
|
||||
mpeg4audio.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
|
||||
ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
|
||||
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
|
||||
|
22
libavcodec/ac3_channel_layout_tab.c
Normal file
22
libavcodec/ac3_channel_layout_tab.c
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* AC-3 channel layout table
|
||||
* copyright (c) 2001 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 "ac3_channel_layout_tab.h"
|
41
libavcodec/ac3_channel_layout_tab.h
Normal file
41
libavcodec/ac3_channel_layout_tab.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* AC-3 channel layout table
|
||||
* copyright (c) 2001 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_AC3_CHANNEL_LAYOUT_TAB_H
|
||||
#define AVCODEC_AC3_CHANNEL_LAYOUT_TAB_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavutil/channel_layout.h"
|
||||
|
||||
/**
|
||||
* Map audio coding mode (acmod) to channel layout mask.
|
||||
*/
|
||||
const uint16_t ff_ac3_channel_layout_tab[8] = {
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_2_1,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_2_2,
|
||||
AV_CH_LAYOUT_5POINT0
|
||||
};
|
||||
#endif
|
@ -141,7 +141,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||
(hdr->num_blocks * 256);
|
||||
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
|
||||
}
|
||||
hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode];
|
||||
hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
|
||||
if (hdr->lfe_on)
|
||||
hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
|
@ -1616,7 +1616,7 @@ dependent_frame:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channels = s->out_channels;
|
||||
avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
avctx->channel_layout = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
if (s->output_mode & AC3_OUTPUT_LFEON)
|
||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
@ -1700,7 +1700,7 @@ skip:
|
||||
extended_channel_map[ch] = ch;
|
||||
|
||||
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
|
||||
uint64_t ich_layout = avpriv_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON];
|
||||
uint64_t ich_layout = ff_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON];
|
||||
int channel_map_size = ff_ac3_channels_tab[s->output_mode & ~AC3_OUTPUT_LFEON] + s->lfe_on;
|
||||
uint64_t channel_layout;
|
||||
int extend = 0;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "ac3dsp.h"
|
||||
#include "avcodec.h"
|
||||
#include "fft.h"
|
||||
#include "internal.h"
|
||||
#include "mathops.h"
|
||||
#include "me_cmp.h"
|
||||
#include "put_bits.h"
|
||||
|
@ -82,20 +82,6 @@ const uint8_t ff_ac3_channels_tab[8] = {
|
||||
2, 1, 2, 3, 3, 4, 4, 5
|
||||
};
|
||||
|
||||
/**
|
||||
* Map audio coding mode (acmod) to channel layout mask.
|
||||
*/
|
||||
const uint16_t avpriv_ac3_channel_layout_tab[8] = {
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_2_1,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_2_2,
|
||||
AV_CH_LAYOUT_5POINT0
|
||||
};
|
||||
|
||||
/**
|
||||
* Table to remap channels from AC-3 order to SMPTE order.
|
||||
* [channel_mode][lfe][ch]
|
||||
|
@ -24,13 +24,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/internal.h"
|
||||
#include "ac3.h"
|
||||
#include "internal.h"
|
||||
|
||||
extern const uint16_t ff_ac3_frame_size_tab[38][3];
|
||||
extern const uint8_t ff_ac3_channels_tab[8];
|
||||
extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
|
||||
extern const uint16_t ff_ac3_channel_layout_tab[8];
|
||||
extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
|
||||
extern const int ff_ac3_sample_rate_tab[];
|
||||
extern const uint16_t ff_ac3_bitrate_tab[19];
|
||||
|
@ -24,6 +24,8 @@
|
||||
* Tables taken directly from the E-AC-3 spec.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "eac3_data.h"
|
||||
#include "ac3.h"
|
||||
|
||||
|
@ -681,6 +681,8 @@ OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o
|
||||
|
||||
# Objects duplicated from other libraries for shared builds
|
||||
SHLIBOBJS += log2_tab.o
|
||||
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
|
||||
|
||||
|
22
libavformat/ac3_channel_layout_tab.c
Normal file
22
libavformat/ac3_channel_layout_tab.c
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* AC-3 channel layout table
|
||||
* copyright (c) 2001 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/ac3_channel_layout_tab.h"
|
@ -26,6 +26,8 @@
|
||||
* https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption
|
||||
*/
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
|
||||
#include "hls_sample_encryption.h"
|
||||
|
||||
#include "libavcodec/adts_header.h"
|
||||
@ -129,7 +131,7 @@ int ff_hls_senc_parse_audio_setup_info(AVStream *st, HLSAudioSetupInfo *info)
|
||||
|
||||
st->codecpar->sample_rate = eac3_sample_rate_tab[fscod];
|
||||
|
||||
st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
|
||||
st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod];
|
||||
if (lfeon)
|
||||
st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
|
@ -813,7 +813,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
acmod = (ac3info >> 11) & 0x7;
|
||||
lfeon = (ac3info >> 10) & 0x1;
|
||||
st->codecpar->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
|
||||
st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
|
||||
st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod];
|
||||
if (lfeon)
|
||||
st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
*ast = bsmod;
|
||||
@ -846,7 +846,7 @@ static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
bsmod = (eac3info >> 12) & 0x1f;
|
||||
acmod = (eac3info >> 9) & 0x7;
|
||||
lfeon = (eac3info >> 8) & 0x1;
|
||||
st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
|
||||
st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod];
|
||||
if (lfeon)
|
||||
st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout);
|
||||
|
Loading…
Reference in New Issue
Block a user