ffmpeg/libavcodec/mpegaudiodata.h

86 lines
2.6 KiB
C
Raw Permalink Normal View History

/*
* 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
*/
/**
* @file
* mpeg audio layer common tables.
*/
#ifndef AVCODEC_MPEGAUDIODATA_H
#define AVCODEC_MPEGAUDIODATA_H
#include <stdint.h>
#include "config.h"
#include "libavutil/attributes_internal.h"
#include "vlc.h"
Add support for building shared libraries with MSVC This requires the makedef perl script by Derek, from the c89-to-c99 repo. That scripts produces a .def file, listing the symbols to be exported, based on the gcc version scripts and the built object files. To properly load non-function symbols from DLL files, the data symbol declarations need to have the attribute __declspec(dllimport) when building the calling code. (On mingw, the linker can fix this up automatically, which is why it has not been an issue so far. If this attribute is omitted, linking actually succeeds, but reads from the table will not produce the desired results at runtime.) MSVC seems to manage to link DLLs (and run properly) even if this attribute is present while building the library itself (which normally isn't recommended) - other object files in the same library manage to link to the symbol (with a small warning at link time, like "warning LNK4049: locally defined symbol _avpriv_mpa_bitrate_tab imported" - it doesn't seem to be possible to squelch this warning), and the definition of the tables themselves produce a warning that can be squelched ("warning C4273: 'avpriv_mpa_bitrate_tab' : inconsistent dll linkage, see previous definition of 'avpriv_mpa_bitrate_tab'). In this setup, mingw isn't able to link object files that refer to data symbols with __declspec(dllimport) without those symbols actually being linked via a DLL (linking avcodec.dll ends up with errors like "undefined reference to `__imp__avpriv_mpa_freq_tab'"). The dllimport declspec isn't needed at all in mingw, so we simply choose not to declare it for other compilers than MSVC that requires it. (If ICL support later requires it, the condition can be extended later to include both of them.) This also implies that code that is built to link to a certain library as a DLL can't link to the same library as a static library. Therefore, we only allow building either static or shared but not both at the same time. (That is, static libraries as such can be, and actually are, built - this is used for linking the test tools to internal symbols in the libraries - but e.g. libavformat built to link to libavcodec as a DLL cannot link statically to libavcodec.) Also, linking to DLLs is slightly different from linking to shared libraries on other platforms. DLLs use a thing called import libraries, which is basically a stub library allowing the linker to know which symbols exist in the DLL and what name the DLL will have at runtime. In mingw/gcc, the import library is usually named libfoo.dll.a, which goes next to a static library named libfoo.a. This allows gcc to pick the dynamic one, if available, from the normal -lfoo switches, just as it does for libfoo.a vs libfoo.so on Unix. On MSVC however, you need to literally specify the name of the import library instead of the static library. Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 10:53:19 +02:00
#define MODE_EXT_MS_STEREO 2
#define MODE_EXT_I_STEREO 1
FF_VISIBILITY_PUSH_HIDDEN
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];
extern const unsigned char * const ff_mpa_alloc_tables[5];
#define TABLE_4_3_SIZE ((8191 + 16)*4)
#if CONFIG_HARDCODED_TABLES
extern const int8_t ff_table_4_3_exp [TABLE_4_3_SIZE];
extern const uint32_t ff_table_4_3_value[TABLE_4_3_SIZE];
#else
extern int8_t ff_table_4_3_exp [TABLE_4_3_SIZE];
extern uint32_t ff_table_4_3_value[TABLE_4_3_SIZE];
#endif
/* VLCs for decoding layer 3 huffman tables */
extern const VLCElem *ff_huff_vlc[16];
extern VLC ff_huff_quad_vlc[2];
/* layer3 scale factor size */
extern const uint8_t ff_slen_table[2][16];
/* number of lsf scale factors for a given size */
extern const uint8_t ff_lsf_nsf_table[6][3][4];
extern const uint8_t ff_mpa_huff_data[32][2];
/* band size tables */
extern const uint8_t ff_band_size_long[9][22];
extern const uint8_t ff_band_size_short[9][13];
/* computed from ff_band_size_long */
extern uint16_t ff_band_index_long[9][23];
extern int16_t *const ff_division_tabs[4];
/* lower 2 bits: modulo 3, higher bits: shift */
extern uint16_t ff_scale_factor_modshift[64];
extern const uint8_t ff_mpa_pretab[2][22];
/* Initialize tables shared between the fixed and
* floating point MPEG audio decoders. */
void ff_mpegaudiodec_common_init_static(void);
FF_VISIBILITY_POP_HIDDEN
#endif /* AVCODEC_MPEGAUDIODATA_H */