1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-02 22:43:22 +02:00
Commit Graph

79 Commits

Author SHA1 Message Date
Stefano Sabatini
e3984166a4 lavu/mem: add av_dynarray2_add()
Based on a patch by Clément Bœsch.

See thread:
From: Clément Bœsch <ubitux@gmail.com>
Subject: [FFmpeg-devel] [PATCH 1/5] lavu: add av_dynarray_alloc_elem().
Date: Sun, 14 Apr 2013 03:07:54 +0200
2013-05-13 13:52:31 +02:00
Stefano Sabatini
84be806982 lavu: define FF_MEMORY_POISON and use it
Allow single-place definition of constant used to fill poisoned memory.
2013-05-13 13:52:26 +02:00
Stefano Sabatini
ee9794ed20 lavu/mem: fix potential int overflow and crash in av_dynarray_add()
Also extend documentation accordingly.
2013-05-08 01:39:12 +02:00
Michael Niedermayer
89b5039ff2 avutil/mem: add av_memdup()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-02 13:44:05 +02:00
Stefano Sabatini
1c1a2d1319 lavu/mem: remove redundant comment from av_dynarray_add()
The function is documented in mem.h.
2013-04-27 20:34:10 +02:00
Fabrizio Gennari
91b747ac78 mem: Fix usage of memalign() on DJGPP.
Credits to Khusraw of bttr-software.de forum.
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2013-03-10 11:12:56 +01:00
Michael Niedermayer
4ba35194a9 Merge commit 'f935aca44c674d30e3ed940ef73bbad1228a5855'
* commit 'f935aca44c674d30e3ed940ef73bbad1228a5855':
  av_memcpy_backptr: avoid an infinite loop for back = 0
  4xm: check the return value of read_huffman_tables().

Conflicts:
	libavcodec/4xm.c
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-24 12:22:51 +01:00
Anton Khirnov
f935aca44c av_memcpy_backptr: avoid an infinite loop for back = 0
CC:libav-stable@libav.org
2013-02-23 09:16:15 +01:00
Michael Niedermayer
2c21d34ea4 avutil/mem: do a small set of checks for memalign hack before freeing.
These can detect some kinds of memory and or pointer corruptions

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-22 20:42:33 +01:00
Michael Niedermayer
58f30175e1 mem: minor simplification of the alignment hack code
Idea-by: wanzhang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-14 05:36:22 +01:00
Michael Niedermayer
99efd59626 Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
  Remove pointless #undefs of previously forbidden functions.
  fate: Add dependencies for bmp, cdxl, dfa, mp3

Conflicts:
	doc/examples/muxing.c
	libavfilter/filtfmts.c
	libavutil/des.c
	libavutil/eval.c
	libavutil/log.c
	libavutil/parseutils.c
	tests/fate/mp3.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-05 13:34:45 +01:00
Anton Khirnov
cb45553f57 Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
Michael Niedermayer
25ca8aef54 Merge commit '4a606c830ae664013cea33800094d4d0f4ec62da'
* commit '4a606c830ae664013cea33800094d4d0f4ec62da':
  av_memcpy_backptr: optimise some special cases
  mpegvideo: simplify dxy calculation in hpel_motion()
  build: add rules to generate preprocessed source files

Conflicts:
	Makefile
	libavutil/mem.c
	library.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-23 13:30:51 +01:00
Mans Rullgard
4a606c830a av_memcpy_backptr: optimise some special cases
- Add special cases for offsets of 2, 3, or 4 bytes.  This means the
  offset is always >4 in the generic case, allowing 32-bit copies to
  be used there.
- Don't use memcpy() for sizes less than 16 bytes.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-11-23 12:04:17 +00:00
Michael Niedermayer
aa604e8e33 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avutil: Make LZO decoder code configure-time selectable
  avutil: Move memcpy_backptr() to mem.c
  configure: detect parisc64 automatically
  configure: detect ppc64 automatically
  configure: detect mips64 automatically
  configure: generalise 64-bit test
  smoothstreamingenc: Don't assume streams start from timestamp 0

Conflicts:
	configure
	libavutil/Makefile
	libavutil/lzo.c
	libavutil/lzo.h
	libavutil/mem.c
	libavutil/mem.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 13:15:58 +02:00
Diego Biurrun
5bac2d0c30 avutil: Move memcpy_backptr() to mem.c
The function is used elsewhere and does not belong with the LZO code.
2012-10-25 11:36:57 +02:00
Michael Niedermayer
6912e7a008 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  configure: Group math functions into a separate variable
  avutil/mem: K&R formatting cosmetics
  avutil/lzo: K&R formatting cosmetics

Conflicts:
	configure
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-20 13:18:59 +02:00
Diego Biurrun
5532cf3178 avutil/mem: K&R formatting cosmetics 2012-10-20 02:34:29 +02:00
Martin Storsjö
620b1e7e98 mem: Don't abort on av_malloc(0) in debug mode
This makes the behaviour consistent between debug and release mode.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 11:37:03 +03:00
Clément Bœsch
7c84e7d337 mem: heap memory poisoning.
Enable it by default with FATE.
limitation: not random, and not supported with realloc.
2012-07-02 21:02:15 +02:00
Michael Niedermayer
cabbd271a5 Merge remote-tracking branch 'qatar/master'
* qatar/master: (24 commits)
  flvdec: remove incomplete, disabled seeking code
  mem: add support for _aligned_malloc() as found on Windows
  lavc: Extend the documentation for avcodec_init_packet
  flvdec: remove incomplete, disabled seeking code
  http: replace atoll() with strtoll()
  mpegts: remove unused/incomplete/broken seeking code
  af_amix: allow float planar sample format as input
  af_amix: use AVFloatDSPContext.vector_fmac_scalar()
  float_dsp: add x86-optimized functions for vector_fmac_scalar()
  float_dsp: Move vector_fmac_scalar() from libavcodec to libavutil
  lavr: Add x86-optimized function for flt to s32 conversion
  lavr: Add x86-optimized function for flt to s16 conversion
  lavr: Add x86-optimized functions for s32 to flt conversion
  lavr: Add x86-optimized functions for s32 to s16 conversion
  lavr: Add x86-optimized functions for s16 to flt conversion
  lavr: Add x86-optimized function for s16 to s32 conversion
  rtpenc: Support packetizing iLBC
  rtpdec: Add a depacketizer for iLBC
  Implement the iLBC storage file format
  mov: Support muxing/demuxing iLBC
  ...

Conflicts:
	Changelog
	configure
	libavcodec/avcodec.h
	libavcodec/dsputil.c
	libavcodec/version.h
	libavformat/movenc.c
	libavformat/mpegts.c
	libavformat/version.h
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-19 20:53:27 +02:00
Ronald S. Bultje
be1a839ca6 mem: add support for _aligned_malloc() as found on Windows
The check uses check_func_header, since this function is
conditionally available depending on the targeted MSVCRT
version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-19 10:08:00 +03:00
Reimar Döffinger
1a65d50ee7 mem.c: fix wrong comment.
Overwriting the av_malloc etc. functions is not easily
possible anymore, even for systems that support overriding
symbols in shared libraries in principle.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-04-16 22:13:12 +02:00
Martin Storsjö
14f063d294 mem: Consistently return NULL for av_malloc(0)
Plain POSIX malloc(0) is allowed to return either NULL or a
non-NULL pointer. The calling code should be ready to handle
a NULL return as a correct return (instead of a failure) if the size
to allocate was 0 - this makes sure the condition is handled
in a consistent way across platforms.

This also avoids calling posix_memalign(&ptr, 32, 0) on OS X,
which returns an invalid pointer (a non-NULL pointer that causes
crashes when passed to av_free).

Abort in debug mode, to help track down issues related to
incorrect handling of this case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-10 11:56:42 +03:00
Michael Niedermayer
c065255bba Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacenc: Fix LONG_START windowing.
  aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
  avplay: use the correct array size for stride.
  lavc: extend doxy for avcodec_alloc_context3().
  APIchanges: mention avcodec_alloc_context()/2/3
  avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS.
  aacsbr: ARM NEON optimised sbrdsp functions
  aacsbr: align some arrays
  aacsbr: move some simdable loops to function pointers
  cosmetics: Remove extra newlines at EOF

Conflicts:
	libavcodec/utils.c
	libavfilter/formats.c
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-29 00:34:59 +01:00
Alex Converse
7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Michael Niedermayer
5a8e994287 mem: add av_max_alloc() to limit the maximum amount that may be allocated in one piece
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-25 18:55:43 +01:00
Hanspeter Niederstrasser
bed04e2b03 Correct use of OSX to Mac OS X and properly format yasm providers on Mac OS X
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-11 03:00:30 +01:00
Michael Niedermayer
fc11927890 mem: fix memalign hack av_realloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-11 22:03:19 +02:00
Nicolas George
5cd754bca2 Introduce av_realloc_f.
av_realloc_f helps avoiding memory-leaks in typical uses of realloc.

Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-28 18:13:52 +02:00
Laurent Aimar
ccecab4a0d Add av_calloc() helper.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-25 00:55:25 +02:00
Michael Niedermayer
a39bd458a0 mem: Trying to workaround posix_memalign() bug on OSX
This patch is based on a patch by John Stebbins

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-07 03:17:42 +02:00
Stefano Sabatini
6b4c0be558 mem: define the MAX_MALLOC_SIZE constant and use it in place of INT_MAX
This makes re-dimensionating the constant simpler, since now it is
defined only in one place.
2011-05-24 00:41:14 +02:00
Ivan Kalvachev
518cdff81f Fix posix_memalign() usage when libavutil is compiled outside FFmpeg.
To use posix_memalign() "#define _XOPEN_SOURCE 600" have to be defined.
FFmpeg configure defines it from the command line through config.mak,
but when libavutil is used outside of FFmpeg the define is missing.

Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-12 17:35:30 +02:00
Michael Niedermayer
08675bb399 mem: Choose alignment at compile time depending on AVX enabledness.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 03:15:42 +02:00
Michael Niedermayer
c8981edd90 Only add 1 byte to av_malloc(0) when it actually returned NULL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-07 16:21:54 +02:00
Michael Niedermayer
91ff05f6ac Make av_realloc(0) behave like our av_malloc(0)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-07 16:21:47 +02:00
Michael Niedermayer
ffb5a0d533 Merge commit '85770f2a2651497861ed938efcd0df3696ff5e45'
* commit '85770f2a2651497861ed938efcd0df3696ff5e45':
  AVOptions: make default_val a union, as proposed in AVOption2.
  Move ff_dynarray_add to lavu and make it public.
  lavf: remove duplicate assignment in avformat_alloc_context.
  lavf: use designated initializers for AVClasses.
  options: simplify av_find_opt by using av_next_option.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-01 00:26:05 +02:00
Anton Khirnov
35ceaa7376 Move ff_dynarray_add to lavu and make it public. 2011-04-29 17:34:56 +02:00
Michael Niedermayer
5a36783bc4 Fix all malloc(0) issues
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-29 02:17:38 +02:00
Michael Niedermayer
d7e5aebae7 Merge remote branch 'qatar/master'
* qatar/master: (23 commits)
  ac3enc: correct the flipped sign in the ac3_fixed encoder
  Eliminate pointless '#if 1' statements without matching '#else'.
  Add AVX FFT implementation.
  Increase alignment of av_malloc() as needed by AVX ASM.
  Update x86inc.asm from x264 to allow AVX emulation using SSE and MMX.
  mjpeg: Detect overreads in mjpeg_decode_scan() and error out.
  documentation: extend documentation for ffmpeg -aspect option
  APIChanges: update commit hashes for recent additions.
  lavc: deprecate FF_*_TYPE macros in favor of AV_PICTURE_TYPE_* enums
  aac: add headers needed for log2f()
  lavc: remove FF_API_MB_Q cruft
  lavc: remove FF_API_RATE_EMU cruft
  lavc: remove FF_API_HURRY_UP cruft
  pad: make the filter parametric
  vsrc_movie: add key_frame and pict_type.
  vsrc_movie: fix leak in request_frame()
  lavfi: add key_frame and pict_type to AVFilterBufferRefVideo.
  vsrc_buffer: add sample_aspect_ratio fields to arguments.
  lavfi: add fieldorder filter
  scale: make the filter parametric
  ...

Conflicts:
	Changelog
	doc/filters.texi
	ffmpeg.c
	libavcodec/ac3dec.h
	libavcodec/dsputil.c
	libavfilter/avfilter.h
	libavfilter/vf_scale.c
	libavfilter/vf_yadif.c
	libavfilter/vsrc_buffer.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-27 03:51:04 +02:00
Vitor Sessak
13dfce3d44 Increase alignment of av_malloc() as needed by AVX ASM.
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-04-26 18:18:22 +02:00
Michael Niedermayer
efb5fa79f5 Merge remote branch 'qatar/master'
* qatar/master: (37 commits)
  In avcodec_open(), set return code to an error value only when an error occurs instead of unconditionally at the start of the function.
  lavc: remove reference to opt.h from Makefile.
  prefer avio_check() over url_exist()
  avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
  lavu: remove misc disabled cruft
  lavu: remove FF_API_OLD_IMAGE_NAMES cruft
NOT PULLED  lavu: remove FF_API_OLD_EVAL_NAMES cruft
  lavc: remove misc disabled cruft.
  lavc: remove the FF_API_INOFFICIAL cruft.
  lavc: remove the FF_API_SET_STRING_OLD cruft.
  lavc: remove the FF_API_USE_LPC cruft.
  lavc: remove the FF_API_SUBTITLE_OLD cruft.
  lavc: remove the FF_API_VIDEO_OLD cruft.
  lavc: remove the FF_API_AUDIO_OLD cruft.
  lavc: remove the FF_API_OPT_SHOW cruft.
  lavc: remove the FF_API_MM_FLAGS cruft.
  lavf: remove misc disabled cruft.
  lavf: remove FF_API_INDEX_BUILT cruft
  lavf: remove FF_API_URL_CLASS cruft.
  lavf: remove FF_API_SYMVER cruft
  ...

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-20 04:48:23 +02:00
Anton Khirnov
490a022d86 lavu: remove misc disabled cruft 2011-04-19 19:04:28 +02: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
Clément Bœsch
0c8eb72ec5 Avoid pointless check before calling free
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit dc75d6dbf2)
2011-02-04 03:10:10 +01:00
Clément Bœsch
dc75d6dbf2 Avoid pointless check before calling free
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-03 01:36:00 +00:00
Michael Niedermayer
b47541c7a3 Change the argument of memory allocation functions from unsigned int to size_t
with the next major bump in libavutil.

Originally committed as revision 25871 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-04 04:00:12 +00:00
Diego Biurrun
ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Måns Rullgård
4ae406856f Add --malloc-prefix to apply a prefix to malloc, free etc
This makes it easy to use a replacement allocator instead of the
system default one.

Originally committed as revision 21509 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-28 13:06:31 +00:00