Commit Graph

52 Commits

Author SHA1 Message Date
Andreas Rheinhardt d7a75d2163 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>
2022-01-04 13:16:49 +01:00
Andreas Rheinhardt 4c8d9b1d09 avcodec/ac3tab: Remove unused ff_eac3_default_chmap
Added in 0c79b1402a to use it
in a function that was never used and was itself removed in
676f1f533e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-24 08:47:11 +01:00
Andreas Rheinhardt d0d96674ec avcodec/ac3tab: Move ff_ac3_enc_channel_map to its only user
and make it static.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-20 14:46:25 +01:00
Lynne 9e05421dbe
ac3enc_fixed: drop unnecessary fixed-point DSP code 2021-01-14 01:44:20 +01:00
Andreas Rheinhardt 12a5e0409d avcodec/ac3_tab: Zero-terminate ff_ac3_sample_rate_tab
This is required to use it as an AVCodec.supported_samplerates array.
Adding the sentinel has been forgotten in 4679a474.
Without it e.g. the FATE-test ffmpeg-filter_complex_audio fails with ASAN.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-11 17:13:36 +02:00
Carl Eugen Hoyos 4679a474f0 lavc: Use supported_samplerates for Dolby Digital encoders.
Fixes ticket #8518.
2020-04-04 23:12:27 +02:00
Michael Niedermayer fe315feab5 avcodec/eac3dec: Check that channel_map does not contain more than EAC3_MAX_CHANNELS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-22 00:12:27 +02:00
James Almer 87865bf6c7 Merge commit 'abf1c058d1bd0ed1b820ea5e501a4484756f00b0'
* commit 'abf1c058d1bd0ed1b820ea5e501a4484756f00b0':
  msvc: Properly specify dllexport for data symbols shared across dll boundaries

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 11:29:16 -03:00
Martin Storsjö abf1c058d1 msvc: Properly specify dllexport for data symbols shared across dll boundaries
We currently only have exported data symbols within libavcodec, but
the concept is easy to extend to other libraries if necessary.
The attribute declaration needs to be in a private header though,
since we can't use CONFIG_SHARED in public installed headers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-08-31 14:22:06 +03:00
Ganesh Ajjanagadde 7b11eead1b avcodec/ac3: always use hardcoded tables
The table in question is a 253 byte one. In fact, it turns out that
dynamic generation of the table results in an increased binary size.

Code compiled with GCC 5.2.0, x86-64 (size in bytes), before and after
patch:
old: 62321064 libavcodec/libavcodec.so.57
new: 62320536 libavcodec/libavcodec.so.57

Thus, it always make sense to statically allocate this.

Tested with FATE with/without --enable-hardcoded-tables.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-30 18:29:57 -05:00
Michael Niedermayer b4f97d4a0e Merge commit '4b48201d4d9d57a2a1ecf8504bc928aff83cb99a'
* commit '4b48201d4d9d57a2a1ecf8504bc928aff83cb99a':
  ac3tab.h: #include the correct headers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-09 20:23:41 +01:00
Diego Biurrun 4b48201d4d ac3tab.h: #include the correct headers 2014-01-09 15:09:07 +01:00
Michael Niedermayer b0554fec04 Merge commit 'c0329748b04e1f175dad8c9c2ebf22a5e2dc5b72'
* commit 'c0329748b04e1f175dad8c9c2ebf22a5e2dc5b72':
  fate: add a dependency helper macro
  Add support for building shared libraries with MSVC
  avcodec: Rename avpriv_frame_rate_tab to ff_mpeg12_frame_rate_tab
  gxf: Add a local copy of the relevant parts of the frame rate table
  configure: Split out msvc as a separate target OS
  aviobuf: Remove a senseless ifdef in avio_seek

Conflicts:
	configure
	libavcodec/dirac.c
	libavcodec/mpeg12data.h
	libavcodec/mpeg12enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-19 13:29:24 +02:00
Martin Storsjö d66c52c2b3 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 14:26:15 +03:00
Michael Niedermayer e2cc39b609 Merge remote-tracking branch 'qatar/master'
* qatar/master: (40 commits)
  swf: check return values for av_get/new_packet().
  wavpack: Don't shift minclip/maxclip
  rtpenc: Expose the max packet size via an avoption
  rtpenc: Move max_packet_size to a context variable
  rtpenc: Add an option for not sending RTCP packets
  lavc: drop encode() support for video.
  snowenc: switch to encode2().
  snowenc: don't abuse input picture for storing information.
  a64multienc: switch to encode2().
  a64multienc: don't write into output buffer when there's no output.
  libxvid: switch to encode2().
  tiffenc: switch to encode2().
  tiffenc: properly forward error codes in encode_frame().
  lavc: drop libdirac encoder.
  gifenc: switch to encode2().
  libvpxenc: switch to encode2().
  flashsvenc: switch to encode2().
  Remove libpostproc.
  lcl: don't overwrite input memory.
  swscale: take first/lastline over/underflows into account for MMX.
  ...

Conflicts:
	.gitignore
	Makefile
	cmdutils.c
	configure
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/libdiracenc.c
	libavcodec/libxvidff.c
	libavcodec/qtrleenc.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavformat/mov.c
	libavformat/movenc.c
	libpostproc/Makefile
	libpostproc/postprocess.c
	libpostproc/postprocess.h
	libpostproc/postprocess_altivec_template.c
	libpostproc/postprocess_internal.h
	libpostproc/postprocess_template.c
	libswscale/swscale.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-24 02:57:18 +01:00
Justin Ruggles 3798205a77 mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
2012-02-22 20:07:02 -05:00
Michael Niedermayer 034fc7bf12 Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  configure: enable memalign_hack automatically when needed
  swscale: unbreak the build on non-x86 systems.
  swscale: remove if(bitexact) branch from functions.
  swscale: remove if(canMMX2BeUsed) conditional.
  swscale: remove swScale_{c,MMX,MMX2} duplication.
  swscale: use emms_c().
  Move emms_c() from libavcodec to libavutil.
  tiff: set palette in the context when specified in TIFF_PAL tag
  rtsp: use strtoul to parse rtptime and seq values.
  pgssubdec: fix incorrect colors.
  dvdsubdec: fix incorrect colors.
  ape: Allow demuxing of files with metadata tags.
  swscale: remove dead macro WRITEBGR24OLD.
  swscale: remove AMD3DNOW "optimizations".
  swscale: remove duplicate code in ppc/ subdirectory.
  swscale: remove duplicated x86/ functions.
  swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*.
  vsrc_buffer.h: add file doxy
  vsrc_buffer: tweak error message in init()
  msmpeg4: reindent.
  ...

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 06:32:45 +02:00
Justin Ruggles 7f3a7b5c40 ac3enc: add channel coupling support
Channel coupling is an optional AC-3 feature that increases quality by
combining high frequency information from multiple channels into a
single channel. The per-channel high frequency information is sent with
less accuracy in both the frequency and time domains. This allows more
bits to be used for lower frequencies while preserving enough
information to reconstruct the high frequencies.
2011-05-24 07:52:31 +02:00
Michael Niedermayer 445fdc0140 Merge remote-tracking branch 'newdev/master'
* newdev/master:
  ac3enc: move compute_mantissa_size() to ac3dsp
  ac3enc: move mant*_cnt and qmant*_ptr out of AC3EncodeContext
  Remove support for stripping executables
  ac3enc: NEON optimised float_to_fixed24
  ac3: move ff_ac3_bit_alloc_calc_bap to ac3dsp
  dfa: protect pointer range checks against overflows.
Duplicate:  mimic: implement multithreading.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-30 03:09:08 +02:00
Mans Rullgard 6d9f52b2cd ac3: move ff_ac3_bit_alloc_calc_bap to ac3dsp
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-29 19:31:45 +01:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Mans Rullgard 8169afdb15 ac3: remove ff_ac3_critical_band_size_tab[] external declaration
This fixes compilation broken by 6ed3b504f9

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 21c900129c)
2011-01-26 03:43:30 +01:00
Mans Rullgard 21c900129c ac3: remove ff_ac3_critical_band_size_tab[] external declaration
This fixes compilation broken by 6ed3b504f9

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-25 15:50:51 +00:00
Justin Ruggles dc7e07ac1f Add stereo rematrixing support to the AC-3 encoders.
This improves the audio quality significantly for stereo source with both the
fixed-point and floating-point AC-3 encoders.
Update acodec-ac3_fixed and seek-ac3_rm test references.

Originally committed as revision 26271 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-08 23:21:17 +00:00
Justin Ruggles e0b9f94b39 cosmetics: use some size macros in ac3tab.c/h
Originally committed as revision 25969 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-14 14:51:47 +00:00
Justin Ruggles bfeca7beb6 Add channel layout support to the AC-3 decoder and AC-3 parser.
Originally committed as revision 18622 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-19 15:05:32 +00:00
Justin Ruggles 95f3019a51 ac3dec: reorder output channels to SMPTE channel order
Originally committed as revision 18542 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-17 08:43:04 +00:00
Justin Ruggles a7c6e1171b ac3enc: reorder input channels to AC-3 channel order
Originally committed as revision 18540 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-17 08:39:11 +00:00
Diego Biurrun 406792e7b0 cosmetics: Remove pointless period after copyright statement non-sentences.
Originally committed as revision 16684 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-19 15:46:40 +00:00
Stefano Sabatini 987903826b Globally rename the header inclusion guard names.
Consistently apply this rule: the guard name is obtained from the
filename by stripping the leading "lib", converting '/' and '.'  to
'_' and uppercasing the resulting name. Guard names in the root
directory have to be prefixed by "FFMPEG_".

Originally committed as revision 15120 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-31 07:39:47 +00:00
Justin Ruggles 14b7062829 cosmetics: make all references to AC-3 capitalized and hyphenated
Originally committed as revision 14523 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-03 16:42:32 +00:00
Diego Biurrun 245976da2a Use full path for #includes from another directory.
Originally committed as revision 13098 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-05-09 11:56:36 +00:00
Bartlomiej Wolowiec 0c79b1402a add a ff_ac3_parse_header_full() which calls ff_ac3_parse_header()
and then reads the channel_map stuff

Originally committed as revision 12944 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-24 22:27:13 +00:00
Justin Ruggles 66ecf18e38 cosmetics: rename ac3 tables
Originally committed as revision 11193 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-12-09 03:21:33 +00:00
Diego Biurrun 5b21bdabe4 Add FFMPEG_ prefix to all multiple inclusion guards.
Originally committed as revision 10765 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-10-17 09:37:46 +00:00
Aurelien Jacobs cd53ae3a65 cosmetics: align
Originally committed as revision 8817 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-25 22:16:50 +00:00
Aurelien Jacobs 7adb10bedf move ac3 tables from a .h to a .c
Originally committed as revision 8816 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-25 22:12:51 +00:00
Justin Ruggles 495529f7df hardcode ff_ac3_frame_sizes table
Originally committed as revision 8435 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-03-18 04:53:21 +00:00
Justin Ruggles 050aa8b9bc remove redundancy in AC-3 parser by using common tables from ac3tab.h
Originally committed as revision 8318 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-03-11 02:13:05 +00:00
Justin Ruggles 4258a0a32a Remove common code from AC-3 encoder and utilize ac3.c.
Originally committed as revision 8306 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-03-09 13:57:42 +00:00
Diego Biurrun b78e7197a8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
and fix GPL/LGPL version mismatches.

Originally committed as revision 6577 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-10-07 15:30:46 +00:00
Diego Biurrun 04d7f60143 Add official LGPL license headers to the files that were missing them.
Originally committed as revision 6219 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-09-10 14:02:42 +00:00
Justin Ruggles 1df051e197 Fix 2 bit allocation bugs. One fix enables using a higher bandwidth code. The other fixes an issue with floorcod=7.
Originally committed as revision 6156 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-09-03 15:59:08 +00:00
Benjamin Larsson 6eb1427f0f Revert bad ac3enc commit, the commited code was bigger and slower.
Originally committed as revision 5327 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-04-28 14:19:11 +00:00
Benjamin Larsson 176c142abc Patch to generate the ac3 window, based on code by Justin Ruggles.
Originally committed as revision 5310 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-04-22 21:21:16 +00:00
Michael Niedermayer e027d0a81e switch ac3enc to av_crc
Originally committed as revision 5116 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-03-06 14:53:13 +00:00
Diego Biurrun 115329f160 COSMETICS: Remove all trailing whitespace.
Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunk
2005-12-17 18:14:38 +00:00
Alex Beregszaszi 0c2a9d56d4 make the tables static
Originally committed as revision 3255 to svn://svn.ffmpeg.org/ffmpeg/trunk
2004-06-26 10:08:49 +00:00
Michael Niedermayer 983e3246b7 per file doxy
Originally committed as revision 1634 to svn://svn.ffmpeg.org/ffmpeg/trunk
2003-03-06 11:32:04 +00:00
Zdenek Kabelac 0c1a9edad4 * UINTX -> uintx_t INTX -> intx_t
Originally committed as revision 1578 to svn://svn.ffmpeg.org/ffmpeg/trunk
2003-02-11 16:35:48 +00:00