Commit Graph

246 Commits

Author SHA1 Message Date
Michael Niedermayer 9aaadb1ee3 avutil/internal: Do not enable CHECKED with DEBUG
This avoids potential undefined behavior in debug mode while still allowing
developers which want to check for potential additional overflows to do so
by manually enabling this.

Reviewed-by: wm4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a44b3abb4c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-18 16:05:22 +02:00
Michael Niedermayer 2015c109ac Add CHECK/SUINT code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4614bf2caf)
(cherry picked from commit e8d4eacc07)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3f2a09a43f6fade53227804459e6babb1c7248b3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-16 16:00:21 +02:00
Ganesh Ajjanagadde db1a642cd2 all: move ff_exp10, ff_exp10f, ff_fast_powf to lavu/ffmath.h
The idea is to use ffmath.h for internal implementations of math functions.
Currently, it is used for variants of libm functions, but is by no means
limited to such things.

Note that this is not exported; use lavu/mathematics for such purposes.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
2016-03-22 10:15:31 -07:00
Ganesh Ajjanagadde bccc81dfa0 lavc/aacenc_utils: replace powf(x,y) by expf(logf(x), y)
This is ~2x faster for y not an integer on Haswell+GCC, and should
generally be faster due to the fact that anyway powf essentially does
this under the hood. Made an inline function in lavu/internal.h for this
purpose.

Note that there are some accuracy differences, that should generally be
negligible. In particular, FATE still passes on this platform.

Results in ~ 7% speedup in aac encoding with -march=native, Haswell+GCC.
before:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  6.05s user 0.06s system 104% cpu 5.821 total

after:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  5.67s user 0.03s system 105% cpu 5.416 total

This is also faster than an alternative approach that pulls in powf, gets rid of
the crufty NaN checks and other special cases, exploits knowledge about the intervals, etc.
This of course does not exclude smarter approaches; just suggests that
there would need to be significant work on this front of lower utility than
searches for hotspots elsewhere.

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
2016-03-18 07:47:25 -07:00
Michael Niedermayer b4f59beeb4 avutil/file: Move av_tempfile() to avutil/file_open ff_tempfile()
document the issue with av_tempfile()

Tested-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-12 02:08:34 +01:00
Hendrik Leppkes 4cf66a8193 Merge commit '50078c1c8070dd8d1c329e8117ff30ec72489039'
* commit '50078c1c8070dd8d1c329e8117ff30ec72489039':
  libavutil: move FFALIGN macro from common.h to macros.h

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 10:25:12 +01:00
Ganesh Ajjanagadde 11388b5a8f lavu/internal: add ff_exp10
Fast, reasonably accurate 10^x. Alternative of detection of libm exp10 at configure
time is not worth the trouble, since it is anyway not POSIX or ISO C,
and currently only the GNU libm has it. Furthermore, GNU libm's variant
is ~ 2x slower, and is ironically not correctly rounded (2 ulp off) to justify all
that slowdown.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-25 10:12:49 -08:00
Janne Grunau 50078c1c80 libavutil: move FFALIGN macro from common.h to macros.h
Include macros.h explicitly in common.h so that external code using
FFALIGN does not break. It was already implicitly included through
version.h. Include macros.h in lls.h and internal.h for FFALIGN.
lls.h was including common.h only for FFALIGN and internal.h was
missing the include for FFALIGN. `make checkheaders` did not catch it
because it's an internal header.
2015-12-14 16:16:55 +01:00
Timothy Gu 006d3e97fc cosmetics: Fix weird indentations 2015-12-07 10:43:43 -08:00
Michael Niedermayer 5c3dee7dad avutil: Move av_rint64_clip_* to internal.h
The function is renamed to ff_rint64_clip()

This should avoid build failures on VS2012
Feel free to changes this to a different solution

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-15 03:47:09 +01:00
Ganesh Ajjanagadde 31ed189d5c avutil/internal: add av_warn_unused_result to avpriv_open
The open syscall can obviously fail, and its return code needs to be
checked.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-16 17:18:21 -04:00
Hendrik Leppkes d83dd630a0 lavu: Drop FF_API_GET_CHANNEL_LAYOUT_COMPAT cruft
FATE refs changed to accomodate for the new default behavior of the function.
Numbers are now interpreted as a channel layout, instead of a number of channels.
2015-09-05 20:36:19 +02:00
Ronald S. Bultje 70a19c482a Move ff_dlog from lavc to lavu. 2015-08-18 09:46:49 -04:00
Andreas Cadhalpun 107e54c5bf avutil: add ff_reverse as av_reverse replacement
The table is used in libavutil/eval.c.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-08-12 00:14:14 +02:00
Chris Watkins 55e29ceec8 Put a space between string literals and macros.
When compiling libavutil/internal.h as C++11, clang warns that a space
is required between a string literal and an identifier. Put spaces
in concatenations of string literals and EXTERN_PREFIX.

Signed-off-by: Chris Watkins <watk@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-07 21:10:15 +02:00
Michael Niedermayer a4557b7a98 Merge commit 'a6f19d6a9f8d1e08653d9d77581e8c823f4955c2'
* commit 'a6f19d6a9f8d1e08653d9d77581e8c823f4955c2':
  configure: Support MSVC 2015

Conflicts:
	configure
	libavutil/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 20:39:38 +02:00
Luca Barbato a6f19d6a9f configure: Support MSVC 2015
The C runtime C99 compatibility had been improved a lot and it now
rejects some of the compatibility defines provided for the older
versions.

Many thanks to Ray for the time spent testing.

Bug-Id: 864
CC: libav-stable@libav.org
2015-06-08 13:27:49 +02:00
Michael Niedermayer 890b874889 avutil/internal: Suppress empty body warning from emms_c()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-06 15:56:32 +02:00
Peter Tissen 79f83523f7 configure: Make compilable with VS2015 (missing hunk)
This hunk was missing in the github pull request when i downloaded it,
but is needed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-06 22:45:56 +01:00
wm4 3e18dc235e avutil: move internal function out of public header
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-10 15:24:46 +01:00
Michael Niedermayer 0f931b29f7 Factorize avpriv_mirror() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-05 01:45:49 +01:00
Michael Niedermayer 932d8d790c Merge commit '277ff7f5dc134f1c2dfc4ea0ef3540340482e3d2'
* commit '277ff7f5dc134f1c2dfc4ea0ef3540340482e3d2':
  lavu: move internal define to the only places where it is used

Conflicts:
	libavcodec/h264_cabac.c
	libavutil/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 12:45:07 +01:00
Vittorio Giovara 277ff7f5dc lavu: move internal define to the only places where it is used 2014-11-24 01:30:14 +00:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer 22a0249deb Merge commit 'bb41115d56930b9f5d59e79dca254d1201246967'
* commit 'bb41115d56930b9f5d59e79dca254d1201246967':
  imgutils: Do not declare avpriv_set_systematic_pal2 in the public header

Conflicts:
	libavutil/internal.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 12:41:15 +02:00
Diego Biurrun bb41115d56 imgutils: Do not declare avpriv_set_systematic_pal2 in the public header 2014-08-04 02:52:33 -07:00
James Almer 25d5ea6d5a lavu: add LOCAL_ALIGNED_32
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-25 06:12:51 +02:00
Michael Niedermayer e148a5820d Merge remote-tracking branch 'cehoyos/master'
* cehoyos/master:
  Enable muxing ac-3 in caf.
  Use correct msvc type specifiers for ptrdiff_t and size_t.
  Fix vf_eq.c and vf_eq2.c compilation with !HAVE_6REGS.
  Fix libpostproc compilation with !HAVE_6REGS.
  Never write 0 as maximum bitrate for asf files.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-25 01:56:23 +02:00
Michael Niedermayer 06e664366a Merge commit 'a88e1d1c598e641eecd5d43730211d91c82787c6'
* commit 'a88e1d1c598e641eecd5d43730211d91c82787c6':
  lavu: add CHK_OFFS as AV_CHECK_OFFSET to check struct member offsets

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-25 00:55:40 +02:00
Janne Grunau a88e1d1c59 lavu: add CHK_OFFS as AV_CHECK_OFFSET to check struct member offsets 2014-04-24 18:28:26 +02:00
Carl Eugen Hoyos ced0d6c14d Use correct msvc type specifiers for ptrdiff_t and size_t.
The Windows runtime aborts if it finds %t or %z.
Fixes ticket #3472.

Reviewed-by: Ronald Bultje
2014-04-24 18:01:30 +02:00
Michael Niedermayer 47ec0b0b0f avutil/internal: add FF_ALLOC_ARRAY_OR_GOTO & FF_ALLOCZ_ARRAY_OR_GOTO
These are similar to the existing FF_ALLOCZ_OR_GOTO & FF_ALLOC_OR_GOTO

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-22 02:09:55 +02:00
Michael Niedermayer 3e6088f732 avutil/internal.h: add timer.h back
Without this a developer would have to add a include every time he
wants to benchmark some code, this is a moderate inconvenience.

This reverts the specific hunk from fb0c9d41d6

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-26 02:23:26 +01:00
Michael Niedermayer 965fa6b0d9 Merge commit 'fb0c9d41d685abb58575c5482ca33b8cd457c5ec'
* commit 'fb0c9d41d685abb58575c5482ca33b8cd457c5ec':
  avutil: remove timer.h include from internal.h

Conflicts:
	libavcodec/ffv1dec.c
	libavutil/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-26 01:54:55 +01:00
Janne Grunau fb0c9d41d6 avutil: remove timer.h include from internal.h
Added libavutil/timer.h include to all files with {START,STOP}_TIMER.
2014-01-25 21:50:20 +01:00
Michael Niedermayer 8e702bd3a8 Merge commit 'd64341e498fa46c6cf4c23d408177d7489559654'
* commit 'd64341e498fa46c6cf4c23d408177d7489559654':
  configure: Prefix libc-related variables with "libc_"

Conflicts:
	libavdevice/Makefile
	libavformat/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-09 20:52:14 +01:00
Diego Biurrun d64341e498 configure: Prefix libc-related variables with "libc_"
Simplifies host/target libc detection splitting.
2013-12-09 11:47:43 +01:00
Carl Eugen Hoyos 87eae03aac Support FF_DISABLE_DEPRECATION_WARNINGS with icc on Linux. 2013-10-21 13:49:30 +02:00
Stefano Sabatini d96e377c39 lavu/channel_layout: change av_get_channel_layout() behavior at the next bump
The new syntax is preferred since it allows backward syntax compatibility
with libswr when switching to the new option handling code with
AV_OPT_TYPE_CHANNEL_LAYOUT.

With the new parser the string:
1234

is interpreted as a channel layout mask, rather than as a number of
channels, and thus it's compatible with the current way to set a channel
layout as an integer (e.g. for the icl and ocl options) making use of
integer option values.

ff_get_channel_layout() with compat=0 will be used in the
AV_OPT_TYPE_CHANNEL handler code.

The user is encouraged to switch to the new forward compatible syntax,
which requires to put a trailing "c" when specifying a layout as a number
of channels.
2013-10-17 18:03:09 +02:00
Michael Niedermayer e1f74ad1f0 Merge commit '09f2581dc5edb3642858d69d9a70b67e249167e9'
* commit '09f2581dc5edb3642858d69d9a70b67e249167e9':
  msvc/icl: Use __declspec(deprecated)

Conflicts:
	configure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-20 15:51:27 +02:00
Alex Smith 09f2581dc5 msvc/icl: Use __declspec(deprecated)
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-20 14:40:06 +03:00
Michael Niedermayer b37ff488b8 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libavutil: Make avpriv_open a library-internal function on msvcrt

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-10 10:51:03 +02:00
Michael Niedermayer 09f1afc784 Merge commit '33237123c83bf4f8345e6ac889ad2e7dbd303d0e'
* commit '33237123c83bf4f8345e6ac889ad2e7dbd303d0e':
  libavutil: Enable the MSVC DLL symbol loading workaround in shared builds as well

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-10 10:24:33 +02:00
Reimar Döffinger d4db7c334b Integrate accessors.h header into internal.h
I have no idea why I added a separate header,
I think there is no good reason for it.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-08-10 07:56:42 +02:00
Martin Storsjö e743e7ae6e libavutil: Make avpriv_open a library-internal function on msvcrt
Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 00:53:33 +03:00
Martin Storsjö 33237123c8 libavutil: Enable the MSVC DLL symbol loading workaround in shared builds as well
This used to only be necessary in static builds (when using the
dynamically linked C runtime), since the _imp prefixed symbols do
exist when linking to the actual DLL. When building testprogs,
however, the current library (e.g. libavutil for some of the testprogs)
is linked statically.

This fixes make fate on DLL builds when using the dynamically
linked C runtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 00:53:25 +03:00
Michael Niedermayer 5f38317e59 Merge commit '869b04e89154cd92d2bcfdabcecbe3217864c099'
* commit '869b04e89154cd92d2bcfdabcecbe3217864c099':
  libavutil: add avpriv_open() to open files with close-on-exec flag

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 11:07:51 +02:00
Rémi Denis-Courmont 869b04e891 libavutil: add avpriv_open() to open files with close-on-exec flag
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-07 21:12:20 +02:00
Michael Niedermayer 85fc1a18ca Merge commit '3a7050ffed5ce061b114a11e4de4b77aba8efa0b'
* commit '3a7050ffed5ce061b114a11e4de4b77aba8efa0b':
  build: Add _Pragma macro to disable deprecated declaration warnings

Conflicts:
	configure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-03 09:27:37 +02:00