Commit Graph

76476 Commits

Author SHA1 Message Date
Michael Niedermayer
9b6fac11da avformat/xmv: factor return check out of if/else
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 02:11:01 +01:00
Michael Niedermayer
973c3dba27 avcodec/mpeg12dec: Do not call show_bits() with invalid bits
Fixes assertion failure
Fixes: 63e50545709a6440d3d59f6426d58db9/signal_sigabrt_7ffff6ae7cc9_8189_3272a3010fd98ddf947c662bbde1ac13.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 00:56:52 +01:00
Michael Niedermayer
cea9eb9520 avcodec/dnxhddec: Make mb_scan_index a fixed length array
Fixes null pointer dereference
Fixes: 5c9d1a6f74a12763fc7c9dd7834022b9/signal_sigsegv_11f78d9_1461_ecee3c5e7205457498e79b3ffaf21d0c.mxf

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 00:15:21 +01:00
Michael Niedermayer
d4a731b84a avcodec/faxcompr: Add missing runs check in decode_uncompressed()
Fixes out of array access
Fixes: 54e488b9da4abbceaf405d6492515697/asan_heap-oob_32769b0_160_a8755eb08ee8f9579348501945a33955.TIF

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 21:36:14 +01:00
Michael Niedermayer
c9bfd6a8c3 libavutil/channel_layout: Check strtol*() for failure
Fixes assertion failure
Fixes: 4f5814bb15d2dda6fc18ef9791b13816/signal_sigabrt_7ffff6ae7cc9_65_7209d160d168b76f311be6cd64a548eb.wv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 19:28:19 +01:00
Michael Niedermayer
3692d859f4 avformat/mpegts: Only start probing data streams within probe_packets
Fixes assertion failure
Fixes: 4321db8ac331f5967ebfbfe80ce5eb78/signal_sigabrt_7ffff6ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 17:06:02 +01:00
Michael Niedermayer
93f30f825c avcodec/hevc_ps: Check chroma_format_idc
Fixes out of array access
Fixes: 24d05e8b84676799c735c9e27d97895e/asan_heap-oob_1b70f6a_2955_7c3652a7f370f9f3ef40642bc2c99bb2.bit

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 15:04:57 +01:00
Michael Niedermayer
a813cdda48 avcodec/truemotion1: Initialize mb_change_byte only when needed
Fixes out of array read
Fixes: d92114d8c2a019b8a6e50cd2a7301b54/asan_heap-oob_26bf563_60_1d3420277533de9dbf8aba3f93af346f.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 03:16:15 +01:00
Michael Niedermayer
a8b254e436 avcodec/ffv1dec: Print an error if the quant table count is invalid
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 01:31:52 +01:00
Michael Niedermayer
c665532820 avcodec/ffv1dec: Free tables on init failure
Fixes memleak
Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 01:31:52 +01:00
Michael Niedermayer
5745cf799a avcodec/ffv1dec: Check for 0 quant tables
Fixes assertion failure
Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 01:31:52 +01:00
Ganesh Ajjanagadde
9bec6d71a2 swresample/resample: speed up build_filter by 50%
This speeds up build_filter by ~ 50%. This gain should be pretty
consistent across all architectures and platforms.

Essentially, this relies on a observation that the filters have some
even/odd symmetry that may be exploited during the construction of the
polyphase filter bank. In particular, phases (scaled to [0, 1]) in [0.5, 1] are
easily derived from [0, 0.5] and expensive reevaluation of function
points are unnecessary. This requires some rather annoying even/odd
bookkeeping as can be seen from the patch.

I vaguely recall from signal processing theory more general symmetries allowing even greater
optimization of the construction. At a high level, "even functions"
correspond to 2, and one can imagine variations. Nevertheless, for the sake
of some generality and because of existing filters, this is all that is
being exploited.

Currently, this patch relies on phase_count being even or (trivially) 1,
though this is not an inherent limitation to the approach. This
assumption is safe as phase_count is 1 << phase_bits, and is hence a
power of two. There is no way for user API to set it to a nontrivial odd
number. This assumption has been placed as an assert in the code.

To repeat, this assumes even symmetry of the filters, which is the most common
way to get generalized linear phase anyway and is true of all currently
supported filters.

As a side note, accuracy should be identical or perhaps slightly better
due to this "forcing" filter symmetries leading to a better phase
characteristic. As before, I can't test this claim easily, though it may
be of interest.

Patch tested with FATE.

Sample benchmark (x86-64, Haswell, GNU/Linux):

test: swr-resample-dblp-44100-2626

new:
527376779 decicycles in build_filter(loop 1000),     256 runs,      0 skips
524361765 decicycles in build_filter(loop 1000),     512 runs,      0 skips
516552574 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

old:
974178658 decicycles in build_filter(loop 1000),     256 runs,      0 skips
972794408 decicycles in build_filter(loop 1000),     512 runs,      0 skips
954350046 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

Note that lower level optimizations are entirely possible, I focussed on
getting the high level semantics correct. In any case, this should
provide a good foundation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-04 17:05:57 -05:00
Michael Niedermayer
cc35f6f476 avcodec/mjpegdec: Reinitialize IDCT on BPP changes
Fixes misaligned access
Fixes: dc9262a469f6f315f74c087a7b3a7f35/signal_sigsegv_2e95bcd_9_9c0f9f4a9ba82aa9b3ab2b91ce4d5277.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 21:51:21 +01:00
Michael Niedermayer
d24888ef19 avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
Fixes: 04715144ba237443010554be0d05343f/asan_heap-oob_1eafc76_1737_c685b48041a563461839e4e7ab97abb8.jpg
Fixes out of array access

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 19:33:33 +01:00
Ganesh Ajjanagadde
fd0bf457b7 avcodec/aacsbr_template: replace qsort with AV_QSORT
When sbr->reset is set in encode_frame, a bunch of qsort calls might get made.
Thus, there is the potential of calling qsort whenever the spectral
contents change.

AV_QSORT is substantially faster due to the inlining of the comparison callback.
Thus, the increase in performance should be worth the increase in binary size.

Tested with FATE.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-04 08:15:24 -05:00
Michael Niedermayer
bc55cec57e avcodec/rawenc: Cast argument for av_image_copy_to_buffer() to const
Fixes: libavcodec/rawenc.c:64:40: warning: passing argument 3 of av_image_copy_to_buffer from incompatible pointer type [enabled by default]

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 04:41:22 +01:00
Michael Niedermayer
432c1f35f7 avcodec/libzvbi-teletextdec: Remove unused variable ret
Fixes: libavcodec/libzvbi-teletextdec.c:232:9: warning: unused variable ret [-Wunused-variable]

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 04:40:00 +01:00
Michael Niedermayer
f3867b0a4a avcodec/vdpau: Remove CONFIG_H263_VDPAU_HWACCEL
Fixes: libavcodec/vdpau.c:320:5: warning: "CONFIG_H263_VDPAU_HWACCEL" is not defined [-Wundef]

It was removed in d15adeacf3

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 04:30:19 +01:00
Bryan Huh
d917f25658 avformat/cache: Use int64_t to avoid int overflow in cache_read
Fixes an issue where an int64_t ffurl_seek return-value was being stored
in an int (32-bit) "r" variable, leading to integer overflow when seeking
into a large file (>2GB), and ultimately a "Failed to perform internal
seek" error mesage.

To test, try running `ffprobe 'cache:http://<something>'` on a file that
is ~3GB large, whose moov atom is at the end of the file

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 03:59:17 +01:00
Muhammad Faiz
6df2c94130 avfilter/showcqt: remove yuv offset
this makes draw_bar faster
slightly different result with old version

check result (with ~3 minutes audio file):
old:
    real    0m49.611s
    user    0m49.260s
    sys     0m0.073s
new:
    real    0m47.606s
    user    0m47.378s
    sys     0m0.068s
PSNR between old and new:
yuv444p PSNR
    y:109.519298 u:107.506485 v:104.746878
    average:106.816074 min:99.167305 max:inf
yuv422p PSNR
    y:109.519298 u:108.025801 v:104.489734
    average:107.279817 min:98.007467 max:inf
yuv420p PSNR
    y:109.519298 u:108.363875 v:105.290200
    average:108.261511 min:97.461812 max:inf

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-03 23:47:09 +01:00
Ganesh Ajjanagadde
92e483f8ed all: use FFDIFFSIGN to resolve possible undefined behavior in comparators
FFDIFFSIGN was created explicitly for this purpose, since the common
return a - b idiom is unsafe regarding overflow on signed integers. It
optimizes to branchless code on common compilers.

FFDIFFSIGN also has the subjective benefit of being easier to read due
to lack of ternary operators.

Tested with FATE.

Things not covered by this are unsigned integers, for which overflows
are well defined, and also places where overflow is clearly impossible,
e.g an instance where the a - b was being done on 24 bit values.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-03 16:28:30 -05:00
Ganesh Ajjanagadde
265f83fd35 avutil/common: add FFDIFFSIGN macro
This is of use for defining comparator callbacks. Common approaches like
return x-y are not safe due to the risks of overflow.
Furthermore, the (x > y) - (x < y) trick is optimized to branchless
code.
This also documents this macro accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-03 16:28:12 -05:00
Ganesh Ajjanagadde
03f5bcd921 avfilter/vf_rotate: correct log message
There seems to be some typos in the log messages that are fixed by this.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-03 16:22:33 -05:00
James Almer
a97f1e7bd0 fate: update fate-source ref file
Signed-off-by: James Almer <jamrial@gmail.com>
2015-11-03 15:05:32 -03:00
Paul B Mahol
cb7a00da21 avformat: add acm demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-03 12:26:09 +01:00
Paul B Mahol
c89e075d5a avcodec: add Interplay ACM decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-03 12:01:27 +01:00
Tobias Rapp
4746653466 avutil/file_open: avoid file handle inheritance on Windows
Avoids inheritance of file handles on Windows systems similar to the
O_CLOEXEC/FD_CLOEXEC flag on Linux.

Fixes file lock issues in Windows applications when a child process
is started with handle inheritance enabled (standard input/output
redirection) while a FFmpeg transcoding is running in the parent
process.

Links relevant to the subject:

https://msdn.microsoft.com/en-us/library/w7sa2b22.aspx

Describes the _wsopen() function and the O_NOINHERIT flag. File handles
opened by _wsopen() are inheritable by default.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx

Describes handle inheritance when creating new processes. Handle
inheritance must be enabled (bInheritHandles = TRUE) e.g. when you want
to pass handles for stdin/stdout via lpStartupInfo.

Signed-off-by: Tobias Rapp <t.rapp@noa-audio.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-02 17:40:49 +01:00
Derek Buitenhuis
9ae73d0644 hlsenc: Only write PAT/PMT once per segment
This saves a lot of muxing overhead, especially on lower bitrate
segments.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-02 14:35:28 +00:00
Ganesh Ajjanagadde
430f943e63 avfilter/vf_frei0r: use av_strtod instead of strtod for added flexibility
This converts the usage of strtod to av_strtod in order to unify and
make number parsing more consistent. This also adds support for SI
postfixes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-02 06:50:18 -05:00
Hendrik Leppkes
23dffc7b54 Merge commit '8161220eee152dad8b2ea9e2755c78c8e127f747'
* commit '8161220eee152dad8b2ea9e2755c78c8e127f747':
  h264_parser: Rename close() to h264_close()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:58:38 +01:00
Hendrik Leppkes
c1b712e078 Merge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78'
* commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78':
  w32pthreads: Map MemoryBarrier to __sync_synchronize on mingw

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:58:27 +01:00
Hendrik Leppkes
859c4ae402 Merge commit 'a0562e531723923b632684c7b51a9dd584bf534f'
* commit 'a0562e531723923b632684c7b51a9dd584bf534f':
  configure: Add a SONAME entry for the android target

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:58:16 +01:00
Hendrik Leppkes
d15adeacf3 Merge commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8'
* commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8':
  vdpau: remove dysfunctional H.263 support

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:58:01 +01:00
Hendrik Leppkes
b0b752334c Merge commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb'
* commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb':
  omadec: Fix position of opening parenthesis

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:55:13 +01:00
Hendrik Leppkes
3ff6d40cbc Merge commit 'b4a82e740743744136e07054525560351e4892ae'
* commit 'b4a82e740743744136e07054525560351e4892ae':
  h264: Print the complete user message

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:54:34 +01:00
Hendrik Leppkes
ed6d451d93 Merge commit '8487987b87a252963b27b6adfd82887ea5933918'
* commit '8487987b87a252963b27b6adfd82887ea5933918':
  h264: Print user data SEI under normal debug verbosity

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:53:55 +01:00
Hendrik Leppkes
1fc13a6269 Merge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'
* commit '1720791e36f9cc24c05efea5bb275ab52156ce50':
  png: read and write stereo3d frame side data information

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:50:35 +01:00
Hendrik Leppkes
6b5d6c93dd Merge commit '00b62968d079e63bf22028f253ac297292436ebe'
* commit '00b62968d079e63bf22028f253ac297292436ebe':
  os_support: Don't try to return the service name as a string in getnameinfo

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:43:50 +01:00
Hendrik Leppkes
9dc9b7e682 Merge commit '567ca142952c5be57e52c149c815dfe5d6ac6d41'
* commit '567ca142952c5be57e52c149c815dfe5d6ac6d41':
  configure: Add -D_CRT_NONSTDC_NO_WARNINGS when building with msvc

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:42:26 +01:00
Paul B Mahol
85a5cdb4fa avformat/segafilm: set video stream duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:06 +01:00
Paul B Mahol
0cb09b0511 avformat/segafilm: set audio stream duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:05 +01:00
Paul B Mahol
e6cccf9daa avformat/segafilm: implement seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:05 +01:00
Hendrik Leppkes
55abb94b7d avformat: unref packet after storing it in internal packet queue
Fixes a memory leak when using genpts
2015-11-02 09:03:56 +01:00
Hendrik Leppkes
b64fe49371 avformat: always unref the packet after parsing
This fixes a memory leak when side-data is present.
2015-11-02 09:03:56 +01:00
Paul B Mahol
83d20a6a7e avformat/ipmovie: add context to av_log()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 09:00:53 +01:00
Paul B Mahol
c293ef258c avformat/ipmovie: put video decoding_map_size into packet and use it in decoder
The size of decoding map can differ from one calculated
internally, producing artifacts while decoding video.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 08:44:05 +01:00
Timothy Gu
dee7440531 vf_boxblur: Templatize blur{8,16}
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-01 18:52:50 -08:00
Ganesh Ajjanagadde
c03044c86a avutil/eval: minor typo
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-01 19:35:01 -05:00
Diego Biurrun
8161220eee h264_parser: Rename close() to h264_close()
At least on AIX it conflicts with the close() libc function from unistd.h.
2015-11-01 14:52:01 +01:00
Timothy Gu
ee20354b29 pixblockdsp: Use AV_COPY128U for get_pixels_16_c
Before:
  15543 decicycles in get_pixels, 4193214 runs,   1090 skips
After:
   5713 decicycles in get_pixels, 8387564 runs,   1044 skips
2015-10-31 17:25:30 -07:00