ffmpeg.git
3 years agoavcodec/aacsbr: Use FLOAT_0
Michael Niedermayer [Sun, 8 Nov 2015 10:05:48 +0000 (11:05 +0100)]
avcodec/aacsbr: Use FLOAT_0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavutil/softfloat: FLOAT_0 should use MIN_EXP
Michael Niedermayer [Sun, 8 Nov 2015 02:04:33 +0000 (03:04 +0100)]
avutil/softfloat: FLOAT_0 should use MIN_EXP

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoAdd pixblockdsp checkasm tests
Timothy Gu [Sun, 1 Nov 2015 11:31:22 +0000 (03:31 -0800)]
Add pixblockdsp checkasm tests

3 years agopixblockdsp: x86: Condense diff_pixels_* to a shared macro
Timothy Gu [Sun, 1 Nov 2015 11:12:45 +0000 (03:12 -0800)]
pixblockdsp: x86: Condense diff_pixels_* to a shared macro

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/takdec: Use memove, avoid undefined memcpy() use
Michael Niedermayer [Sat, 7 Nov 2015 19:05:27 +0000 (20:05 +0100)]
avcodec/takdec: Use memove, avoid undefined memcpy() use

Fixes: e214333cbd94c91228e624ff39329ce6/asan_generic_4a5159_6412_96cda2530e80607210ab41ccae3d456d.tak

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agommaldec: correct package buffering accounting
wm4 [Fri, 6 Nov 2015 12:02:16 +0000 (13:02 +0100)]
mmaldec: correct package buffering accounting

The assert in ffmmal_stop_decoder() could trigger sometimes. The
packets_buffered counter was indeed not correctly maintained, and
packets were not subtracted from it if they were still in the waiting
queue.

For some reason, this happened especially with VC-1.

3 years agommaldec: add vc1 decoding support
wm4 [Fri, 6 Nov 2015 11:59:16 +0000 (12:59 +0100)]
mmaldec: add vc1 decoding support

3 years agolavfi/af_asyncts: remove looping on request_frame().
Nicolas George [Sat, 24 Oct 2015 14:01:22 +0000 (16:01 +0200)]
lavfi/af_asyncts: remove looping on request_frame().

3 years agolavfi/af_amix: mostly fix scheduling.
Nicolas George [Sat, 24 Oct 2015 13:19:11 +0000 (15:19 +0200)]
lavfi/af_amix: mostly fix scheduling.

3 years agolavfi/vf_framepack: fix scheduling.
Nicolas George [Thu, 22 Oct 2015 07:58:25 +0000 (09:58 +0200)]
lavfi/vf_framepack: fix scheduling.

3 years agolavfi/af_join: partially fix scheduling.
Nicolas George [Thu, 22 Oct 2015 07:56:11 +0000 (09:56 +0200)]
lavfi/af_join: partially fix scheduling.

3 years agolavfi/fifo: do not assume request_frame() returns a frame.
Nicolas George [Thu, 22 Oct 2015 07:57:34 +0000 (09:57 +0200)]
lavfi/fifo: do not assume request_frame() returns a frame.

3 years agolavfi/avf_concat: return immediately after requesting a frame on input.
Nicolas George [Fri, 23 Oct 2015 10:36:17 +0000 (12:36 +0200)]
lavfi/avf_concat: return immediately after requesting a frame on input.

3 years agolavfi: remove astreamsync.
Nicolas George [Sat, 24 Oct 2015 14:13:32 +0000 (16:13 +0200)]
lavfi: remove astreamsync.

It was only useful for very specific testing purposes
and appears to be currently partially broken.

3 years agolavu/opt: enhance printing durations.
Nicolas George [Mon, 26 Oct 2015 20:07:33 +0000 (21:07 +0100)]
lavu/opt: enhance printing durations.

Trim unneeded leading components and trailing zeros.
Move the formating code in a separate function.
Use the function also to format the default value, it was currently
printed as plain integer, inconsistent to the way it is parsed.

3 years agolavfi: add realtime filter.
Nicolas George [Sun, 25 Oct 2015 16:31:58 +0000 (17:31 +0100)]
lavfi: add realtime filter.

Similar to the -re option in ffmpeg that only works for input files.
Can be used at any place in the filter graph.

3 years agofate: add mpdecimate test.
Nicolas George [Sun, 25 Oct 2015 19:40:48 +0000 (20:40 +0100)]
fate: add mpdecimate test.

3 years agolavfi: add testsrc2 test source.
Nicolas George [Sun, 25 Oct 2015 15:31:00 +0000 (16:31 +0100)]
lavfi: add testsrc2 test source.

Similar to testsrc, but using drawutils and therefore
supporting a lot of pixel formats instead of just rgb24.
This allows using it as input for other tests without
requiring a format conversion.
It is also slightly faster than testsrc for some reason.

3 years agodoc/resampler: fix some trivial typos
Ganesh Ajjanagadde [Thu, 5 Nov 2015 03:37:10 +0000 (22:37 -0500)]
doc/resampler: fix some trivial typos

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavformat/segafilm: Only add index entries when the stream exists
Michael Niedermayer [Sat, 7 Nov 2015 12:35:10 +0000 (13:35 +0100)]
avformat/segafilm: Only add index entries when the stream exists

Fixes null pointer dereference
Fixes: cb02dfb163ac833c04cace3d7e35b160/signal_sigsegv_e55c49_6326_8f25619fc86a00b303c57b7778baf70a.cpk

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoapng: use correct size for output buffer
Andreas Cadhalpun [Fri, 6 Nov 2015 22:44:01 +0000 (23:44 +0100)]
apng: use correct size for output buffer

The buffer needs s->bpp bytes, at maximum currently 10.
Assert that s->bpp is not larger.

This fixes a stack buffer overflow.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agojvdec: avoid unsigned overflow in comparison
Andreas Cadhalpun [Fri, 6 Nov 2015 20:04:34 +0000 (21:04 +0100)]
jvdec: avoid unsigned overflow in comparison

The return type of strlen is size_t, i.e. unsigned, so if pd->buf_size
is 3, the right side overflows leading to a wrong result of the
comparison and subsequently a heap buffer overflow.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agohevc: extract SEI caption data
Will Kelleher [Fri, 6 Nov 2015 20:48:46 +0000 (14:48 -0600)]
hevc: extract SEI caption data

Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpeg2000dec: Clip all tile coordinates
Michael Niedermayer [Sat, 7 Nov 2015 01:16:11 +0000 (02:16 +0100)]
avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/microdvddec: Check for string end in 'P' case
Michael Niedermayer [Fri, 6 Nov 2015 21:24:23 +0000 (22:24 +0100)]
avcodec/microdvddec: Check for string end in 'P' case

Fixes out of array read
Fixes: a9502b60f4cecc19475382aee255f73c/asan_heap-oob_1e87fba_2548_a8ad47f6dde36644fe9cdc444d4632d0.sub

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agovp9_parser: allow superframes with a single frame.
Ronald S. Bultje [Fri, 6 Nov 2015 16:57:07 +0000 (11:57 -0500)]
vp9_parser: allow superframes with a single frame.

3 years agoavcodec/dirac_parser: Fix undefined memcpy() use
Michael Niedermayer [Fri, 6 Nov 2015 20:58:42 +0000 (21:58 +0100)]
avcodec/dirac_parser: Fix undefined memcpy() use

Fixes: 9d375e415486edd1a0c826f2307d89a4/asan_generic_4a5159_1577_faa333e83dacdd9e4dd322380aeed537.iss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavdevice/dshow_enummediatypes: check return of av_malloc
Ganesh Ajjanagadde [Mon, 26 Oct 2015 18:49:21 +0000 (14:49 -0400)]
avdevice/dshow_enummediatypes: check return of av_malloc

Untested.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoXMA1 and XMA2 stereo decoders
Paul B Mahol [Sun, 1 Nov 2015 12:15:36 +0000 (13:15 +0100)]
XMA1 and XMA2 stereo decoders

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoswresample/resample: speed up build_filter for Blackman-Nuttall filter
Ganesh Ajjanagadde [Thu, 5 Nov 2015 03:02:13 +0000 (22:02 -0500)]
swresample/resample: speed up build_filter for Blackman-Nuttall filter

This uses the trigonometric double and triple angle formulae to avoid
repeated (expensive) evaluation of libc's cos().

Sample benchmark (x86-64, Haswell, GNU/Linux)
test: fate-swr-resample-dblp-44100-2626
old:
1104466600 decicycles in build_filter(loop 1000),     256 runs,      0 skips
1096765286 decicycles in build_filter(loop 1000),     512 runs,      0 skips
1070479590 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

new:
588861423 decicycles in build_filter(loop 1000),     256 runs,      0 skips
591262754 decicycles in build_filter(loop 1000),     512 runs,      0 skips
577355145 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

This results in small differences with the old expression:
difference (worst case on [0, 2*M_PI]), argmax 0.008:
max diff (relative): 0.000000000000157289807188
blackman_old(0.008): 0.000363951585488813192382
blackman_new(0.008): 0.000363951585488755946507

These are judged to be insignificant for the performance gain. PSNR to
reference file is unchanged up to second decimal point for instance.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agompegtsenc: Implement writing of Opus trim_start/trim_end control values
Sebastian Dröge [Mon, 2 Nov 2015 07:06:19 +0000 (09:06 +0200)]
mpegtsenc: Implement writing of Opus trim_start/trim_end control values

Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agompegtsenc: Add support for muxing Opus in MPEG-TS
Sebastian Dröge [Thu, 5 Nov 2015 22:35:42 +0000 (23:35 +0100)]
mpegtsenc: Add support for muxing Opus in MPEG-TS

Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Previous version reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/xmv: Discard remainder of packet on error
Michael Niedermayer [Fri, 6 Nov 2015 01:13:36 +0000 (02:13 +0100)]
avformat/xmv: Discard remainder of packet on error

Fixes infinite loop
Fixes: 9c48ae2680c5f23bca3d20ff0f325fd8/asan_generic_4c254d_1374_993f1e5967dd6f844b8d72f978ce2a6c.pss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/xmv: factor return check out of if/else
Michael Niedermayer [Fri, 6 Nov 2015 01:11:01 +0000 (02:11 +0100)]
avformat/xmv: factor return check out of if/else

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg12dec: Do not call show_bits() with invalid bits
Michael Niedermayer [Thu, 5 Nov 2015 23:56:04 +0000 (00:56 +0100)]
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>
3 years agoavcodec/dnxhddec: Make mb_scan_index a fixed length array
Michael Niedermayer [Thu, 5 Nov 2015 22:04:48 +0000 (23:04 +0100)]
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>
3 years agoavcodec/faxcompr: Add missing runs check in decode_uncompressed()
Michael Niedermayer [Thu, 5 Nov 2015 20:35:23 +0000 (21:35 +0100)]
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>
3 years agolibavutil/channel_layout: Check strtol*() for failure
Michael Niedermayer [Thu, 5 Nov 2015 18:24:33 +0000 (19:24 +0100)]
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>
3 years agoavformat/mpegts: Only start probing data streams within probe_packets
Michael Niedermayer [Thu, 5 Nov 2015 16:04:37 +0000 (17:04 +0100)]
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>
3 years agoavcodec/hevc_ps: Check chroma_format_idc
Michael Niedermayer [Thu, 5 Nov 2015 13:52:33 +0000 (14:52 +0100)]
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>
3 years agoavcodec/truemotion1: Initialize mb_change_byte only when needed
Michael Niedermayer [Thu, 5 Nov 2015 02:15:24 +0000 (03:15 +0100)]
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>
3 years agoavcodec/ffv1dec: Print an error if the quant table count is invalid
Michael Niedermayer [Thu, 5 Nov 2015 00:25:50 +0000 (01:25 +0100)]
avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/ffv1dec: Free tables on init failure
Michael Niedermayer [Wed, 4 Nov 2015 23:40:09 +0000 (00:40 +0100)]
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>
3 years agoavcodec/ffv1dec: Check for 0 quant tables
Michael Niedermayer [Wed, 4 Nov 2015 23:36:59 +0000 (00:36 +0100)]
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>
3 years agoswresample/resample: speed up build_filter by 50%
Ganesh Ajjanagadde [Wed, 4 Nov 2015 01:08:12 +0000 (20:08 -0500)]
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>
3 years agoavcodec/mjpegdec: Reinitialize IDCT on BPP changes
Michael Niedermayer [Wed, 4 Nov 2015 20:27:04 +0000 (21:27 +0100)]
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>
3 years agoavcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
Michael Niedermayer [Wed, 4 Nov 2015 17:08:52 +0000 (18:08 +0100)]
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>
3 years agoavcodec/aacsbr_template: replace qsort with AV_QSORT
Ganesh Ajjanagadde [Wed, 28 Oct 2015 01:11:45 +0000 (21:11 -0400)]
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>
3 years agoavcodec/rawenc: Cast argument for av_image_copy_to_buffer() to const
Michael Niedermayer [Wed, 4 Nov 2015 03:41:22 +0000 (04:41 +0100)]
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>
3 years agoavcodec/libzvbi-teletextdec: Remove unused variable ret
Michael Niedermayer [Wed, 4 Nov 2015 03:38:58 +0000 (04:38 +0100)]
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>
3 years agoavcodec/vdpau: Remove CONFIG_H263_VDPAU_HWACCEL
Michael Niedermayer [Wed, 4 Nov 2015 03:29:22 +0000 (04:29 +0100)]
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 d15adeacf3e61cd8d2169c090bf06f6d8fc62f8b

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/cache: Use int64_t to avoid int overflow in cache_read
Bryan Huh [Mon, 2 Nov 2015 18:20:39 +0000 (10:20 -0800)]
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>
3 years agoavfilter/showcqt: remove yuv offset
Muhammad Faiz [Tue, 3 Nov 2015 15:01:55 +0000 (22:01 +0700)]
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>
3 years agoall: use FFDIFFSIGN to resolve possible undefined behavior in comparators
Ganesh Ajjanagadde [Sun, 1 Nov 2015 15:43:56 +0000 (10:43 -0500)]
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>
3 years agoavutil/common: add FFDIFFSIGN macro
Ganesh Ajjanagadde [Fri, 30 Oct 2015 18:21:15 +0000 (14:21 -0400)]
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>
3 years agoavfilter/vf_rotate: correct log message
Ganesh Ajjanagadde [Sat, 31 Oct 2015 04:38:30 +0000 (00:38 -0400)]
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>
3 years agofate: update fate-source ref file
James Almer [Tue, 3 Nov 2015 18:05:32 +0000 (15:05 -0300)]
fate: update fate-source ref file

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat: add acm demuxer
Paul B Mahol [Fri, 30 Oct 2015 16:45:33 +0000 (17:45 +0100)]
avformat: add acm demuxer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec: add Interplay ACM decoder
Paul B Mahol [Fri, 30 Oct 2015 17:15:22 +0000 (18:15 +0100)]
avcodec: add Interplay ACM decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavutil/file_open: avoid file handle inheritance on Windows
Tobias Rapp [Thu, 29 Oct 2015 08:11:37 +0000 (09:11 +0100)]
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>
3 years agohlsenc: Only write PAT/PMT once per segment
Derek Buitenhuis [Sun, 5 Apr 2015 18:28:38 +0000 (14:28 -0400)]
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>
3 years agoavfilter/vf_frei0r: use av_strtod instead of strtod for added flexibility
Ganesh Ajjanagadde [Sun, 1 Nov 2015 03:34:15 +0000 (23:34 -0400)]
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>
3 years agoMerge commit '8161220eee152dad8b2ea9e2755c78c8e127f747'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:38 +0000 (11:58 +0100)]
Merge commit '8161220eee152dad8b2ea9e2755c78c8e127f747'

* commit '8161220eee152dad8b2ea9e2755c78c8e127f747':
  h264_parser: Rename close() to h264_close()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:27 +0000 (11:58 +0100)]
Merge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78'

* commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78':
  w32pthreads: Map MemoryBarrier to __sync_synchronize on mingw

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit 'a0562e531723923b632684c7b51a9dd584bf534f'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:16 +0000 (11:58 +0100)]
Merge commit 'a0562e531723923b632684c7b51a9dd584bf534f'

* commit 'a0562e531723923b632684c7b51a9dd584bf534f':
  configure: Add a SONAME entry for the android target

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:01 +0000 (11:58 +0100)]
Merge commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8'

* commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8':
  vdpau: remove dysfunctional H.263 support

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb'
Hendrik Leppkes [Mon, 2 Nov 2015 10:55:13 +0000 (11:55 +0100)]
Merge commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb'

* commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb':
  omadec: Fix position of opening parenthesis

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit 'b4a82e740743744136e07054525560351e4892ae'
Hendrik Leppkes [Mon, 2 Nov 2015 10:54:34 +0000 (11:54 +0100)]
Merge commit 'b4a82e740743744136e07054525560351e4892ae'

* commit 'b4a82e740743744136e07054525560351e4892ae':
  h264: Print the complete user message

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit '8487987b87a252963b27b6adfd82887ea5933918'
Hendrik Leppkes [Mon, 2 Nov 2015 10:53:55 +0000 (11:53 +0100)]
Merge commit '8487987b87a252963b27b6adfd82887ea5933918'

* commit '8487987b87a252963b27b6adfd82887ea5933918':
  h264: Print user data SEI under normal debug verbosity

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'
Hendrik Leppkes [Mon, 2 Nov 2015 10:50:35 +0000 (11:50 +0100)]
Merge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'

* commit '1720791e36f9cc24c05efea5bb275ab52156ce50':
  png: read and write stereo3d frame side data information

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoMerge commit '00b62968d079e63bf22028f253ac297292436ebe'
Hendrik Leppkes [Mon, 2 Nov 2015 10:43:50 +0000 (11:43 +0100)]
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>
3 years agoMerge commit '567ca142952c5be57e52c149c815dfe5d6ac6d41'
Hendrik Leppkes [Mon, 2 Nov 2015 10:42:26 +0000 (11:42 +0100)]
Merge commit '567ca142952c5be57e52c149c815dfe5d6ac6d41'

* commit '567ca142952c5be57e52c149c815dfe5d6ac6d41':
  configure: Add -D_CRT_NONSTDC_NO_WARNINGS when building with msvc

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoavformat/segafilm: set video stream duration
Paul B Mahol [Fri, 30 Oct 2015 11:09:48 +0000 (12:09 +0100)]
avformat/segafilm: set video stream duration

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/segafilm: set audio stream duration
Paul B Mahol [Fri, 30 Oct 2015 11:07:44 +0000 (12:07 +0100)]
avformat/segafilm: set audio stream duration

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/segafilm: implement seeking
Paul B Mahol [Fri, 30 Oct 2015 11:07:13 +0000 (12:07 +0100)]
avformat/segafilm: implement seeking

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat: unref packet after storing it in internal packet queue
Hendrik Leppkes [Sun, 1 Nov 2015 10:08:42 +0000 (11:08 +0100)]
avformat: unref packet after storing it in internal packet queue

Fixes a memory leak when using genpts

3 years agoavformat: always unref the packet after parsing
Hendrik Leppkes [Sun, 1 Nov 2015 08:47:34 +0000 (09:47 +0100)]
avformat: always unref the packet after parsing

This fixes a memory leak when side-data is present.

3 years agoavformat/ipmovie: add context to av_log()
Paul B Mahol [Mon, 2 Nov 2015 08:00:53 +0000 (09:00 +0100)]
avformat/ipmovie: add context to av_log()

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/ipmovie: put video decoding_map_size into packet and use it in decoder
Paul B Mahol [Sun, 1 Nov 2015 16:02:26 +0000 (17:02 +0100)]
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>
3 years agovf_boxblur: Templatize blur{8,16}
Timothy Gu [Sun, 1 Nov 2015 18:20:58 +0000 (10:20 -0800)]
vf_boxblur: Templatize blur{8,16}

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavutil/eval: minor typo
Ganesh Ajjanagadde [Sun, 1 Nov 2015 03:34:15 +0000 (23:34 -0400)]
avutil/eval: minor typo

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoh264_parser: Rename close() to h264_close()
Diego Biurrun [Sat, 31 Oct 2015 16:21:25 +0000 (17:21 +0100)]
h264_parser: Rename close() to h264_close()

At least on AIX it conflicts with the close() libc function from unistd.h.

3 years agopixblockdsp: Use AV_COPY128U for get_pixels_16_c
Timothy Gu [Wed, 30 Sep 2015 01:34:28 +0000 (18:34 -0700)]
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

3 years agoavcodec/h264_slice: Disable slice threads if there are multiple access units in a...
Michael Niedermayer [Sat, 31 Oct 2015 20:36:00 +0000 (21:36 +0100)]
avcodec/h264_slice: Disable slice threads if there are multiple access units in a packet

Fixes null pointer dereference
Fixes Ticket4977

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/icecast: Initialize .str based default for AV_OPT_TYPE_STRING types
Michael Niedermayer [Sat, 31 Oct 2015 13:43:48 +0000 (14:43 +0100)]
avformat/icecast: Initialize .str based default for AV_OPT_TYPE_STRING types

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/http: Initialize .str based default for AV_OPT_TYPE_STRING types
Michael Niedermayer [Sat, 31 Oct 2015 13:42:29 +0000 (14:42 +0100)]
avformat/http: Initialize .str based default for AV_OPT_TYPE_STRING types

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libopenh264enc: use AV_OPT_TYPE_BOOL for allow_skip_frames option
Clément Bœsch [Sat, 31 Oct 2015 16:33:22 +0000 (17:33 +0100)]
avcodec/libopenh264enc: use AV_OPT_TYPE_BOOL for allow_skip_frames option

3 years agoavutil/x86/intmath: Add missing header.
Matt Oliver [Sat, 31 Oct 2015 15:00:41 +0000 (02:00 +1100)]
avutil/x86/intmath: Add missing header.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
3 years agoavcodec/nvenc: fix potential profile error when encoding yuv444p
Agatha Hu [Sat, 31 Oct 2015 15:00:39 +0000 (16:00 +0100)]
avcodec/nvenc: fix potential profile error when encoding yuv444p

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavutil/opencl_internal: add av_warn_unused_result
Ganesh Ajjanagadde [Sat, 31 Oct 2015 14:36:22 +0000 (10:36 -0400)]
avutil/opencl_internal: add av_warn_unused_result

clSetKernelArg can return an error due to lack of memory (for instance):
https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetKernelArg.html.
Thus this error must be propagated.

Currently should not trigger warnings, but adds robustness.
Untested.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavfilter/vf_deshake: replace qsort with AV_QSORT
Ganesh Ajjanagadde [Fri, 30 Oct 2015 23:07:13 +0000 (19:07 -0400)]
avfilter/vf_deshake: replace qsort with AV_QSORT

qsort is called indirectly in filter_frame, suggesting its performance
criticality. 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.

This optimization is just a low hanging fruit. The trac ticket 1430 is
a request for an improved deshake filter.

Sample benchmark (x86-64, Haswell, GNU/Linux):
File: original from https://trac.ffmpeg.org/ticket/1430
command: ffmpeg -stream_loop 8 -i file.webm -vf deshake=rx=64:ry=64 -f null -

Timer truncated at 1024 runs.
new:
28260 decicycles in qsort,       1 runs,      0 skips
35570 decicycles in qsort,       2 runs,      0 skips
39010 decicycles in qsort,       4 runs,      0 skips
46897 decicycles in qsort,       8 runs,      0 skips
40442 decicycles in qsort,      16 runs,      0 skips
41611 decicycles in qsort,      32 runs,      0 skips
40345 decicycles in qsort,      64 runs,      0 skips
38967 decicycles in qsort,     128 runs,      0 skips
38647 decicycles in qsort,     256 runs,      0 skips
40238 decicycles in qsort,     512 runs,      0 skips
39676 decicycles in qsort,    1024 runs,      0 skips

old:
1740280 decicycles in qsort,       1 runs,      0 skips
 923560 decicycles in qsort,       2 runs,      0 skips
 511330 decicycles in qsort,       4 runs,      0 skips
 309720 decicycles in qsort,       8 runs,      0 skips
 194900 decicycles in qsort,      16 runs,      0 skips
 142686 decicycles in qsort,      32 runs,      0 skips
 112516 decicycles in qsort,      64 runs,      0 skips
  98166 decicycles in qsort,     128 runs,      0 skips
  88147 decicycles in qsort,     256 runs,      0 skips
  88706 decicycles in qsort,     512 runs,      0 skips
  86783 decicycles in qsort,    1024 runs,      0 skips

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavutil/x86/intmath: Use tzcnt in place of bsf.
Matt Oliver [Wed, 28 Oct 2015 07:47:16 +0000 (18:47 +1100)]
avutil/x86/intmath: Use tzcnt in place of bsf.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
3 years agogdigrab: grab right desktop size if DPI in use, based on patch from Alexander Brotzge
Matt Oliver [Mon, 5 Oct 2015 09:00:37 +0000 (20:00 +1100)]
gdigrab: grab right desktop size if DPI in use, based on patch from Alexander Brotzge

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
3 years agoavutil/rational: use frexp rather than ad-hoc log to get floating point exponent
Ganesh Ajjanagadde [Thu, 29 Oct 2015 04:18:15 +0000 (00:18 -0400)]
avutil/rational: use frexp rather than ad-hoc log to get floating point exponent

This simplifies and cleans up the code.
Furthermore, it is much faster due to absence of the slow log computation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavdevice/caca: change AV_OPT_TYPE_STRING to set .str default
Michael Niedermayer [Sat, 31 Oct 2015 01:31:40 +0000 (02:31 +0100)]
avdevice/caca: change AV_OPT_TYPE_STRING to set .str default

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libopenh264enc: AV_OPT_TYPE_STRING should use .str default
Michael Niedermayer [Sat, 31 Oct 2015 01:29:01 +0000 (02:29 +0100)]
avcodec/libopenh264enc: AV_OPT_TYPE_STRING should use .str default

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libopenh264enc: Fix project name
Michael Niedermayer [Sat, 31 Oct 2015 01:21:58 +0000 (02:21 +0100)]
avcodec/libopenh264enc: Fix project name

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libopenh264enc: set .i64 for AV_OPT_TYPE_INT
Michael Niedermayer [Sat, 31 Oct 2015 01:20:53 +0000 (02:20 +0100)]
avcodec/libopenh264enc: set .i64 for AV_OPT_TYPE_INT

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/avf_showcqt: Replace all fmin* and fmax* by FFMIN/FFMAX
Michael Niedermayer [Fri, 30 Oct 2015 23:16:06 +0000 (00:16 +0100)]
avfilter/avf_showcqt: Replace all fmin* and fmax* by FFMIN/FFMAX

Should fix build on x86_32-msvc2012

The alternative of emulating fmin/fmax* turns out to be non trivial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/showcqt: fix dependency with avformat
Muhammad Faiz [Fri, 30 Oct 2015 16:35:02 +0000 (23:35 +0700)]
avfilter/showcqt: fix dependency with avformat

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>