ffmpeg.git
2 hours agoavcodec/h264: Declare the local variable decode_chroma as const. master
Wan-Teh Chang [Thu, 20 Jul 2017 17:31:19 +0000 (10:31 -0700)]
avcodec/h264: Declare the local variable decode_chroma as const.

ff_h264_decode_mb_cabac() and ff_h264_decode_mb_cavlc() are very long
functions. Declaring decode_chroma as const makes it clear the variable
doesn't change after initialization.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 hours agoavcodec/hevcdec: hevc_await_progress: declare |y| only if used.
Wan-Teh Chang [Thu, 20 Jul 2017 18:39:11 +0000 (11:39 -0700)]
avcodec/hevcdec: hevc_await_progress: declare |y| only if used.

hevc_await_progress() uses the variable |y| only inside the "if" block.
So |y| only needs to be declared and initialized in that block.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 hours agoavcodec/x86/cavsdsp: Delete #include "libavcodec/x86/idctdsp.h".
Wan-Teh Chang [Thu, 20 Jul 2017 17:44:03 +0000 (10:44 -0700)]
avcodec/x86/cavsdsp: Delete #include "libavcodec/x86/idctdsp.h".

This file already has #include "idctdsp.h", which is resolved to the
idctdsp.h header in the directory where this file resides by compilers.
Two other files in this directory, libavcodec/x86/idctdsp_init.c and
libavcodec/x86/xvididct_init.c, also rely on #include "idctdsp.h"
working this way.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
19 hours agoopus_rc: fix CDF encoding of zeroes
Rostislav Pehlivanov [Thu, 20 Jul 2017 06:33:33 +0000 (07:33 +0100)]
opus_rc: fix CDF encoding of zeroes

0th CDF value is where probabilities are.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
21 hours agofate: add libavdevice/reverse.c to fate-source
James Almer [Thu, 20 Jul 2017 04:59:43 +0000 (01:59 -0300)]
fate: add libavdevice/reverse.c to fate-source

23 hours agoavdevice: make ff_reverse available on shared builds
James Almer [Thu, 20 Jul 2017 03:30:19 +0000 (00:30 -0300)]
avdevice: make ff_reverse available on shared builds

Should fix compilation failures introduced by 9b937958907daaddade139c36ce33c6eac269631.

31 hours agoavfilter/af_astats: measure dynamic range
Paul B Mahol [Wed, 19 Jul 2017 18:44:14 +0000 (20:44 +0200)]
avfilter/af_astats: measure dynamic range

Signed-off-by: Paul B Mahol <onemda@gmail.com>
32 hours agoavcodec/dolby_e: use av_clip_uintp2()
James Almer [Wed, 19 Jul 2017 18:19:59 +0000 (15:19 -0300)]
avcodec/dolby_e: use av_clip_uintp2()

Fixes fate-source.

32 hours agoavfilter/af_astats: do not overwrite already set values when doing reset
Paul B Mahol [Wed, 19 Jul 2017 18:11:43 +0000 (20:11 +0200)]
avfilter/af_astats: do not overwrite already set values when doing reset

Signed-off-by: Paul B Mahol <onemda@gmail.com>
32 hours agoavfilter: Add blue and violet noise generation filters
George Boyle [Wed, 19 Jul 2017 13:11:44 +0000 (15:11 +0200)]
avfilter: Add blue and violet noise generation filters

For the blue and violet noise, I took the pink and brown noise
respectively and subtracted the offsets instead of adding them. When I
eyeball the frequency spectrum of the resulting outputs it looks correct
to me, i.e. the blue graph appears to be a mirror image of the pink, and
the same can be said of the violet and the brown. I did not do anything
else to confirm the correctness.

40 hours agoavformat: add SMPTE 337M demuxer
foo86 [Sat, 1 Jul 2017 14:06:27 +0000 (17:06 +0300)]
avformat: add SMPTE 337M demuxer

40 hours agoavcodec: add Dolby E decoder
foo86 [Sat, 1 Jul 2017 14:03:46 +0000 (17:03 +0300)]
avcodec: add Dolby E decoder

41 hours agoavfilter/pthread: use slice threading from avutil
Muhammad Faiz [Wed, 12 Jul 2017 00:16:33 +0000 (07:16 +0700)]
avfilter/pthread: use slice threading from avutil

Benchmark (with 2 cpus):
./ffmpeg -f rawvideo -s 1280x720 -t 1000 -i /dev/zero \
    -filter_threads $threads -vf transpose=clock -f null null
threads=2:
  old: 31.129s 31.446s 31.574s
  new: 29.602s 29.636s 29.656s
threads=3 (nb_threads = nb_cpus + 1 is bad choice at this situation):
  old: 40.132s 40.279s 40.279s
  new: 39.308s 39.570s 39.693s
threads=4:
  old: 31.306s 31.366s 31.654s
  new: 30.231s 30.360s 30.451s

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
41 hours agoavcodec/pthread_slice: use slice threading from avutil
Muhammad Faiz [Tue, 11 Jul 2017 23:58:07 +0000 (06:58 +0700)]
avcodec/pthread_slice: use slice threading from avutil

Also remove pthread_cond_broadcast(progress_cond) on uninit.
Broadcasting it is not required because workers are always
parked when they are not in thread_execute. So it is imposible
that a worker is waiting on progress_cond when uninitialized.

Benchmark:
./ffmpeg -threads $threads -thread_type slice -i 10slices.mp4 -f null null
threads=2:
  old: 70.212s 70.525s 70.877s
  new: 65.219s 65.377s 65.484s
threads=3:
  old: 65.086s 66.306s 66.409s
  new: 63.229s 65.026s 65.116s
threads=4:
  old: 60.993s 61.482s 62.123s
  new: 59.224s 59.441s 59.667s
threads=5:
  old: 57.576s 57.860s 58.832s
  new: 53.032s 53.948s 54.086s

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
41 hours agoavutil: merge slice threading implementation from avcodec and avfilter
Muhammad Faiz [Tue, 11 Jul 2017 23:42:23 +0000 (06:42 +0700)]
avutil: merge slice threading implementation from avcodec and avfilter

Rework it to improve performance. Now mutex is not shared by workers,
instead each worker has its own mutex and condition variable. This
reduces lock contention between workers. Also use atomic variable for
counter.

The interface also allows execute to run special function on main
thread, requested by Ronald.

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
42 hours agolibavformat/fifo: Fix initialization of underlying AVFormatContext
Jan Sebechlebsky [Mon, 3 Jul 2017 21:45:42 +0000 (23:45 +0200)]
libavformat/fifo: Fix initialization of underlying AVFormatContext

Muxers may want to directly access filename in stored in
AVFormatContext. For example in case of RTSP, the filename (url)
is used by the muxer to extract parameters of the connection.
These muxers will fail when used with fifo pseudo-muxer.

This commit fixes this issue by passing filename from AVFormatContext
of fifo pseudo-muxer to all AVFormatContext(s) of underlying muxers
during initialization.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
2 days agoavcodec/dca: avoid using bitstream reader in a non-standard way
foo86 [Mon, 10 Jul 2017 14:11:40 +0000 (17:11 +0300)]
avcodec/dca: avoid using bitstream reader in a non-standard way

Use proper get_bits.h functions instead of directly accessing index.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca_core: probe extension headers directly
foo86 [Mon, 10 Jul 2017 14:11:39 +0000 (17:11 +0300)]
avcodec/dca_core: probe extension headers directly

Avoid using bitstream reader in a non-standard way by directly accessing
index. Use bit shifting/masking operations instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca_parser: avoid use of magic values
foo86 [Mon, 10 Jul 2017 14:11:38 +0000 (17:11 +0300)]
avcodec/dca_parser: avoid use of magic values

Duration computation can be simplified because number of PCM blocks is
only allowed to be a multiple of 8.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca_parser: export profile information
foo86 [Mon, 10 Jul 2017 14:11:37 +0000 (17:11 +0300)]
avcodec/dca_parser: export profile information

Permits applications to access DTS profile information without having to
decode a frame.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavformat/dtsdec: switch to common frame header parsing function
foo86 [Mon, 10 Jul 2017 14:11:36 +0000 (17:11 +0300)]
avformat/dtsdec: switch to common frame header parsing function

This makes probing for regular DTS more strict because more header
fields are checked and values not supported by decoder are now rejected.

Also fixes an issue original code had with 14-bit streams: 96 bits of
header were expected, however only 84 bits were converted, which was not
enough to parse LFE flag.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca_parser: switch to common frame header parsing function
foo86 [Mon, 10 Jul 2017 14:11:35 +0000 (17:11 +0300)]
avcodec/dca_parser: switch to common frame header parsing function

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca_core: switch to common frame header parsing function
foo86 [Mon, 10 Jul 2017 14:11:34 +0000 (17:11 +0300)]
avcodec/dca_core: switch to common frame header parsing function

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec: add avpriv_dca_parse_core_frame_header()
foo86 [Mon, 10 Jul 2017 14:11:33 +0000 (17:11 +0300)]
avcodec: add avpriv_dca_parse_core_frame_header()

There are 3 different places where DCA core frame header is parsed:
decoder, parser and demuxer. Each one uses ad-hoc code. Add common core
frame header parsing function that will be used in all places.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca: move bits per sample array to dca.c
foo86 [Mon, 10 Jul 2017 14:11:32 +0000 (17:11 +0300)]
avcodec/dca: move bits per sample array to dca.c

It will be used by the parser. This change avoids unwanted parser
dependency on dcadata.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavcodec/dca: move some enumeration typedefs into headers
foo86 [Mon, 10 Jul 2017 14:11:31 +0000 (17:11 +0300)]
avcodec/dca: move some enumeration typedefs into headers

These values will be used by the parser. Prefix them with DCA_
appropriately.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agolavc/codec_desc: Mark some uncompressed codecs as lossless.
Carl Eugen Hoyos [Tue, 18 Jul 2017 23:55:21 +0000 (01:55 +0200)]
lavc/codec_desc: Mark some uncompressed codecs as lossless.

Fixes ticket #6526.

2 days agodoc: Fix names of VAAPI encoders
Mark Thompson [Tue, 18 Jul 2017 22:36:06 +0000 (23:36 +0100)]
doc: Fix names of VAAPI encoders

They were all reversed (oops).

2 days agopixdesc: Add a test for av_find_best_pix_fmt_of_2()
Mark Thompson [Thu, 6 Jul 2017 21:50:40 +0000 (22:50 +0100)]
pixdesc: Add a test for av_find_best_pix_fmt_of_2()

2 days agopixdesc: Improve scoring for opaque/unknown pixel formats
Mark Thompson [Thu, 6 Jul 2017 21:50:35 +0000 (22:50 +0100)]
pixdesc: Improve scoring for opaque/unknown pixel formats

Hardware pixel formats do not tell you anything about their actual
contents, but should still score higher than formats with completely
unknown properties, which in turn should score higher than invalid
formats.

Do not return an AVERROR code as a score.

Fixes a hang in libavfilter where format negotiation gets stuck in a
loop because AV_PIX_FMT_NONE scores more highly than all other
possibilities.

2 days agolavc/vaapi_encode_h265: Remove duplicate slice_segment_address.
Jun Zhao [Tue, 18 Jul 2017 04:01:09 +0000 (00:01 -0400)]
lavc/vaapi_encode_h265: Remove duplicate slice_segment_address.

the VAEncSliceParameterBufferHEVC in libva have support this field,
so remove the duplicate field in VAAPIEncodeH265MiscSliceParams.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2 days agoavcodec/htmlsubtitles: Be a bit more picky on syntax
Michael Niedermayer [Sat, 1 Jul 2017 22:09:42 +0000 (00:09 +0200)]
avcodec/htmlsubtitles: Be a bit more picky on syntax

This reduces the number of strstr() calls per byte
This diasalows empty tags like '< >' as well as '<' in tags like '<ab<cd<<ef>'

Fixes timeout
Fixes: 1817/clusterfuzz-testcase-minimized-5104230530547712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agoavcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined...
Michael Niedermayer [Sat, 15 Jul 2017 20:22:52 +0000 (22:22 +0200)]
avcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined shifts later

Fixes: runtime error: shift exponent 47 is too large for 32-bit type 'int'
Fixes: 2581/clusterfuzz-testcase-minimized-4681474395602944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agoopus: simplify coarse energy beta coefficients
Rostislav Pehlivanov [Tue, 18 Jul 2017 19:47:30 +0000 (20:47 +0100)]
opus: simplify coarse energy beta coefficients

Just put the subtraction in the table.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 days agoavdevice/decklink_dec: add support for receiving op47 teletext
Marton Balint [Sun, 18 Jun 2017 00:34:11 +0000 (02:34 +0200)]
avdevice/decklink_dec: add support for receiving op47 teletext

v2:
- use uint16_t instead of int to store 10-bit ancillary data
- fix ancillary line numbers for 1080p
- some comments and clarifications as requested by Aaron Levinson

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agoavdevice/decklink_dec: add support for decoding teletext from 10bit ancillary data
Marton Balint [Sat, 24 Jun 2017 14:57:18 +0000 (16:57 +0200)]
avdevice/decklink_dec: add support for decoding teletext from 10bit ancillary data

This also add supports for 4K DeckLink cards because they always output the
ancillary data in 10-bit.

v2:
- only try teletext decoding for 576i PAL mode
- some comments as requested by Aaron Levinson

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agolavc/jpeg2000dec: Read the sample aspect ratio from the jp2 resolution box.
Carl Eugen Hoyos [Tue, 2 May 2017 14:27:47 +0000 (16:27 +0200)]
lavc/jpeg2000dec: Read the sample aspect ratio from the jp2 resolution box.

2 days agoffprobe: reindent after previous commit
Clément Bœsch [Tue, 18 Jul 2017 08:24:55 +0000 (10:24 +0200)]
ffprobe: reindent after previous commit

2 days agoffprobe: add -(no)find_stream_info expert option
Clément Bœsch [Wed, 12 Jul 2017 09:06:53 +0000 (11:06 +0200)]
ffprobe: add -(no)find_stream_info expert option

2 days agoffplay: reindent after previous commit
Clément Bœsch [Tue, 18 Jul 2017 08:24:48 +0000 (10:24 +0200)]
ffplay: reindent after previous commit

2 days agoffplay: add -(no)find_stream_info expert option
Clément Bœsch [Wed, 12 Jul 2017 09:06:54 +0000 (11:06 +0200)]
ffplay: add -(no)find_stream_info expert option

2 days agoffmpeg: reindent after previous commit
Clément Bœsch [Tue, 18 Jul 2017 08:24:40 +0000 (10:24 +0200)]
ffmpeg: reindent after previous commit

2 days agoffmpeg: add -(no)find_stream_info expert option
Clément Bœsch [Wed, 12 Jul 2017 09:06:52 +0000 (11:06 +0200)]
ffmpeg: add -(no)find_stream_info expert option

2 days agoopusenc: remove unused variable
Rostislav Pehlivanov [Tue, 18 Jul 2017 03:12:59 +0000 (04:12 +0100)]
opusenc: remove unused variable

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
4 days agoconfigure: Fix libvmaf name
Matt Oliver [Sun, 16 Jul 2017 14:15:19 +0000 (00:15 +1000)]
configure: Fix libvmaf name

Fixes:
    fatal error: libvmaf.h: No such file or directory.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 days agowebmdashenc: Fix memory leak
Derek Buitenhuis [Fri, 14 Jul 2017 14:32:42 +0000 (15:32 +0100)]
webmdashenc: Fix memory leak

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 days agoavcodec/apedec: Fix integer overflow
Michael Niedermayer [Sun, 16 Jul 2017 12:57:20 +0000 (14:57 +0200)]
avcodec/apedec: Fix integer overflow

Fixes: out of array access
Fixes: PoC.ape and others

Found-by: Bingchang, Liu@VARAS of IIE
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavfilter: add LIBVMAF filter
Ashish Singh [Sat, 15 Jul 2017 16:42:33 +0000 (22:12 +0530)]
avfilter: add LIBVMAF filter

This one changes the previous vmaf patch to libvmaf to keep it separate from the
native implementation of vmaf inside ffmpeg later.

Signed-off-by: Ashish Singh <ashk43712@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
5 days agoavcodec/ffv1dec_template: Fix signed integer overflow
Michael Niedermayer [Sun, 16 Jul 2017 00:08:50 +0000 (02:08 +0200)]
avcodec/ffv1dec_template: Fix signed integer overflow

Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 2634/clusterfuzz-testcase-minimized-4540890636877824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoavcodec/aacdec_template: Fix undefined integer overflow in apply_tns()
Michael Niedermayer [Thu, 13 Jul 2017 22:45:29 +0000 (00:45 +0200)]
avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()

Fixes: runtime error: signed integer overflow: -2147483648 - 1202286525 cannot be represented in type 'int'
Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agofate: add sub-srt-badsyntax test
Michael Niedermayer [Tue, 11 Jul 2017 21:16:43 +0000 (23:16 +0200)]
fate: add sub-srt-badsyntax test

Based-on: srt sample by ubitux

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agohdsenc: Remove dead store
Derek Buitenhuis [Thu, 6 Jul 2017 17:41:44 +0000 (13:41 -0400)]
hdsenc: Remove dead store

This is apparently not supposed to error out anyway.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
6 days agoopusenc: use float_dsp for non-transient windowing
Rostislav Pehlivanov [Fri, 14 Jul 2017 03:50:07 +0000 (04:50 +0100)]
opusenc: use float_dsp for non-transient windowing

Also fixes transient windowing

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
7 days agoavutil/threadmessage: fix error return in case of av_fifo_alloc failure
Aleksandr Slobodeniuk [Wed, 12 Jul 2017 18:41:56 +0000 (21:41 +0300)]
avutil/threadmessage: fix error return in case of av_fifo_alloc failure

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 days agoavcodec: Add prefetch for mips
Kaustubh Raste [Wed, 12 Jul 2017 12:02:32 +0000 (17:32 +0530)]
avcodec: Add prefetch for mips

Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>
Reviewed-by: Manojkumar Bhosale <Manojkumar.Bhosale@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 days agox86/vf_limiter: make limiter functions work on x86_32
James Almer [Sat, 8 Jul 2017 14:33:54 +0000 (11:33 -0300)]
x86/vf_limiter: make limiter functions work on x86_32

Signed-off-by: James Almer <jamrial@gmail.com>
7 days agocheckasm: add hybrid_analysis_ileave and hybrid_synthesis_deint tests to aacpsdsp
James Almer [Thu, 6 Jul 2017 23:47:14 +0000 (20:47 -0300)]
checkasm: add hybrid_analysis_ileave and hybrid_synthesis_deint tests to aacpsdsp

Signed-off-by: James Almer <jamrial@gmail.com>
7 days agocheckasm: add a g722dsp test
James Almer [Wed, 5 Jul 2017 19:34:00 +0000 (16:34 -0300)]
checkasm: add a g722dsp test

Signed-off-by: James Almer <jamrial@gmail.com>
7 days agoopusenc: use float_dsp for transient mdcts
Rostislav Pehlivanov [Wed, 12 Jul 2017 03:49:21 +0000 (04:49 +0100)]
opusenc: use float_dsp for transient mdcts

vector_fmul_reverse requires padding the window at the front

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
7 days agomovenc: Add 'keywords' metadata
Kieran O'Leary [Mon, 10 Jul 2017 21:54:56 +0000 (22:54 +0100)]
movenc: Add 'keywords' metadata

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
7 days agoconfigure: use pkg-config for libgme, if available
Ricardo Constantino [Fri, 23 Jun 2017 00:53:37 +0000 (01:53 +0100)]
configure: use pkg-config for libgme, if available

The pkg-config file is relatively new (2013), so some distros might
not have it yet. And the -lstdc++ being required for the static lib
is only present since the last release in December 2016.

8 days agoavcodec/ivi: Use av_image_check_size2()
Michael Niedermayer [Wed, 12 Jul 2017 18:31:24 +0000 (20:31 +0200)]
avcodec/ivi: Use av_image_check_size2()

Fixes OOM
Fixes: 1514/clusterfuzz-testcase-minimized-6437666243477504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 days agoavcodec/magicyuv: Check that vlc len is not too large
Michael Niedermayer [Wed, 12 Jul 2017 15:25:16 +0000 (17:25 +0200)]
avcodec/magicyuv: Check that vlc len is not too large

Fixes: runtime error: shift exponent -95 is negative
Fixes: 2568/clusterfuzz-testcase-minimized-4926115716005888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 days agoavcodec/mjpegdec: Clip DC also on the negative side.
Michael Niedermayer [Wed, 12 Jul 2017 14:24:18 +0000 (16:24 +0200)]
avcodec/mjpegdec: Clip DC also on the negative side.

Fixes: runtime error: signed integer overflow: -16711425 + -2130772346 cannot be represented in type 'int'
Fixes: 2533/clusterfuzz-testcase-minimized-5372857678823424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 days agoavcodec/aacps (fixed point): Fix multiple signed integer overflows
Michael Niedermayer [Sun, 9 Jul 2017 13:19:18 +0000 (15:19 +0200)]
avcodec/aacps (fixed point): Fix multiple signed integer overflows

Fixes: runtime error: signed integer overflow: 1421978265 - -1810326882 cannot be represented in type 'int'
Fixes: 2527/clusterfuzz-testcase-minimized-5260915396050944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 days agopthread_frame: save the FF_DEBUG_THREADS option in PerThreadContext.
Wan-Teh Chang [Mon, 10 Jul 2017 17:24:59 +0000 (10:24 -0700)]
pthread_frame: save the FF_DEBUG_THREADS option in PerThreadContext.

Add the debug_threads boolean field to PerThreadContext. For
PerThreadContext *p, p->debug_threads records whether the
FF_DEBUG_THREADS bit is set in p->avctx->debug, and p->debug_threads and
p->avctx->debug are kept in sync. The debug_threads field is defined as
an atomic_int to allow atomic read by another thread in
ff_thread_await_progress().

This fixes the tsan warning that
2e664b9c1e73c80aab91070c1eb7676f04bdd12d attempted to fix:

WARNING: ThreadSanitizer: data race (pid=452658)
  Write of size 4 at 0x7b640003f4fc by main thread (mutexes: write M248499):
    #0 update_context_from_user [..]/libavcodec/pthread_frame.c:335:19 (5ab42bb1a6f4b068d7863dabe9b2bacc+0xe73859)
[..]
  Previous read of size 4 at 0x7b640003f4fc by thread T130 (mutexes: write M248502, write M248500):
    #0 ff_thread_await_progress [..]/libavcodec/pthread_frame.c:591:26 (5ab42bb1a6f4b068d7863dabe9b2bacc+0xe749a1)

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
9 days agoaacdec_template: fix non-power-of-two MDCT scale sign
Rostislav Pehlivanov [Wed, 12 Jul 2017 01:15:19 +0000 (02:15 +0100)]
aacdec_template: fix non-power-of-two MDCT scale sign

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 days agoopus_celt: normalize using mdct scale
Rostislav Pehlivanov [Tue, 11 Jul 2017 20:30:41 +0000 (21:30 +0100)]
opus_celt: normalize using mdct scale

Removes a per-sample divide in the IIR filter deemphasis filter.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 days agomdct15: remove redundant scale argument to imdct_half
Rostislav Pehlivanov [Tue, 11 Jul 2017 20:29:22 +0000 (21:29 +0100)]
mdct15: remove redundant scale argument to imdct_half

The only use of that argument was for Opus downmixing which is very rare
and better done after the mdcts.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 days agovideotoolbox: fix crash when decoding interlaced video with new API
wm4 [Tue, 11 Jul 2017 16:24:31 +0000 (18:24 +0200)]
videotoolbox: fix crash when decoding interlaced video with new API

9 days agoavcodec/rdft: remove sintable
Muhammad Faiz [Fri, 7 Jul 2017 07:43:39 +0000 (14:43 +0700)]
avcodec/rdft: remove sintable

It is redundant with costable. The first half of sintable is
identical with the second half of costable. The second half
of sintable is negative value of the first half of sintable.

The computation is changed to handle sign of sin values, in
C code and ARM assembly code.

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
10 days agoopus_rc: fix encoder desyncs on very low bitrates
Rostislav Pehlivanov [Mon, 10 Jul 2017 22:40:35 +0000 (23:40 +0100)]
opus_rc: fix encoder desyncs on very low bitrates

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
10 days agoopusenc: don't set avctx->cutoff
Rostislav Pehlivanov [Mon, 10 Jul 2017 22:43:53 +0000 (23:43 +0100)]
opusenc: don't set avctx->cutoff

Its only use is to adjust the aac psychoacoustic/filter system which
isn't used here.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
10 days agoopustab: comment ff_celt_tf_select
Rostislav Pehlivanov [Mon, 10 Jul 2017 22:39:56 +0000 (23:39 +0100)]
opustab: comment ff_celt_tf_select

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
10 days agoopus_celt: move postfilter taps table to the shared opustab.c file
Rostislav Pehlivanov [Mon, 10 Jul 2017 22:31:24 +0000 (23:31 +0100)]
opus_celt: move postfilter taps table to the shared opustab.c file

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
10 days agortspdec: Fix return error
Derek Buitenhuis [Thu, 6 Jul 2017 18:03:58 +0000 (14:03 -0400)]
rtspdec: Fix return error

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
10 days agodxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main
wm4 [Mon, 10 Jul 2017 13:59:38 +0000 (15:59 +0200)]
dxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main

This mode apparently does not support decoding of HEVC Main (8 bit).
With D3D11 and Intel drivers on Windows 10 I get green corruption, while
using DXVA2_ModeHEVC_VLD_Main works.

10 days agoavcodec/magicyuv: add 12 bit formats
Paul B Mahol [Sun, 9 Jul 2017 16:40:13 +0000 (18:40 +0200)]
avcodec/magicyuv: add 12 bit formats

Signed-off-by: Paul B Mahol <onemda@gmail.com>
10 days agoavcodec/magicyuv: make RLE table reading match reference
Paul B Mahol [Mon, 10 Jul 2017 09:47:42 +0000 (11:47 +0200)]
avcodec/magicyuv: make RLE table reading match reference

Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 days agoavformat/avio: Remove no-op code in url_find_protocol().
Wan-Teh Chang [Fri, 7 Jul 2017 02:18:50 +0000 (19:18 -0700)]
avformat/avio: Remove no-op code in url_find_protocol().

In url_find_protocol(), proto_str is either "file" or a string
consisting of only the characters in URL_SCHEME_CHARS, which does not
include ','. Therefore the strchr(proto_str, ',') call always returns
NULL.

Note: The code was added in commit
6161c41817f6e53abb3021d67ca0f19def682718.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
11 days agoavcodec/noise_bsf: add support for dropping packets
Marton Balint [Sat, 8 Jul 2017 10:37:59 +0000 (12:37 +0200)]
avcodec/noise_bsf: add support for dropping packets

Signed-off-by: Marton Balint <cus@passwd.hu>
12 days agoavcodec/ylc: Fix vlc of 31 bits
Michael Niedermayer [Sat, 8 Jul 2017 20:51:57 +0000 (22:51 +0200)]
avcodec/ylc: Fix vlc of 31 bits

Fixes: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 2515/clusterfuzz-testcase-minimized-6197200012967936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
12 days agoavcodec/sbrdsp_fixed: Fix integer overflow in sbr_hf_apply_noise()
Michael Niedermayer [Sun, 2 Jul 2017 01:30:54 +0000 (03:30 +0200)]
avcodec/sbrdsp_fixed: Fix integer overflow in sbr_hf_apply_noise()

Fixes: runtime error: signed integer overflow: -2049425300 + -117591631 cannot be represented in type 'int'
Fixes: part of 2096/clusterfuzz-testcase-minimized-4901566068817920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
12 days agolibswresample: check input to swr_convert_frame for NULL
hexpointer [Fri, 7 Jul 2017 09:54:47 +0000 (10:54 +0100)]
libswresample: check input to swr_convert_frame for NULL

When 'out' is an AVFrame that does not have buffers preallocated,
swr_convert_frame tries to allocate buffers of the right size. However
in calculating this size it failed to check for whether 'in' is NULL
(requesting that swr's internal buffers are to be flushed).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
12 days agoavfilter: add limiter filter
Paul B Mahol [Mon, 3 Jul 2017 15:42:03 +0000 (17:42 +0200)]
avfilter: add limiter filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 days agobitstream_filter: Add missing error check
Derek Buitenhuis [Thu, 6 Jul 2017 18:11:28 +0000 (14:11 -0400)]
bitstream_filter: Add missing error check

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoaf_amix: Add missing error check
Derek Buitenhuis [Thu, 6 Jul 2017 18:08:40 +0000 (14:08 -0400)]
af_amix: Add missing error check

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agortmpproto: Fix error return
Derek Buitenhuis [Thu, 6 Jul 2017 17:59:40 +0000 (13:59 -0400)]
rtmpproto: Fix error return

Mistake was added in 5840473890440dbe0bd2cce530ebb3d93e187ae6.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agocngenc: Remove dead store
Derek Buitenhuis [Thu, 6 Jul 2017 17:54:43 +0000 (13:54 -0400)]
cngenc: Remove dead store

ff_lpc_calc_ref_coeffs returns the order it is given and cannot return
in error.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoffmpeg_opt: Make get_timecode actually return errors
Derek Buitenhuis [Thu, 6 Jul 2017 17:52:42 +0000 (13:52 -0400)]
ffmpeg_opt: Make get_timecode actually return errors

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoopusdec: Remove dead code
Derek Buitenhuis [Thu, 6 Jul 2017 17:51:18 +0000 (13:51 -0400)]
opusdec: Remove dead code

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoscpr: Added missing error check
Derek Buitenhuis [Thu, 6 Jul 2017 17:47:42 +0000 (13:47 -0400)]
scpr: Added missing error check

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoaf_tempo: Add missing error check
Derek Buitenhuis [Thu, 6 Jul 2017 17:45:13 +0000 (13:45 -0400)]
af_tempo: Add missing error check

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agobitpacked: Remove dead store
Derek Buitenhuis [Thu, 6 Jul 2017 17:39:57 +0000 (13:39 -0400)]
bitpacked: Remove dead store

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agoavformat: remove obsolete commented-out DEBUG define
Tobias Rapp [Fri, 7 Jul 2017 07:43:22 +0000 (09:43 +0200)]
avformat: remove obsolete commented-out DEBUG define

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 days agolibavcodec/htmlsubtitles.c: make tags case-insensitive
DongHoon Kang [Fri, 16 Jun 2017 11:26:37 +0000 (20:26 +0900)]
libavcodec/htmlsubtitles.c: make tags case-insensitive

Signed-off-by: DongHoon Kang <nanuda.kang@gmail.com>
Signed-off-by: Clément Bœsch <u@pkh.me>
13 days agoavcodec/fft_template: use ff_thread_once on costable initialization
Muhammad Faiz [Wed, 5 Jul 2017 05:33:22 +0000 (12:33 +0700)]
avcodec/fft_template: use ff_thread_once on costable initialization

Make it thread-safe and avoid redundant initialization.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2 weeks agoavformat/hlsenc: Add missing error check
Derek Buitenhuis [Fri, 7 Jul 2017 02:08:18 +0000 (10:08 +0800)]
avformat/hlsenc: Add missing error check

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2 weeks agoavformat/hlsenc: add warn message when use both fmp4 and single_file
Steven Liu [Fri, 7 Jul 2017 02:05:54 +0000 (10:05 +0800)]
avformat/hlsenc: add warn message when use both fmp4 and single_file

have not implementation the fmp4 single file yet before this commit.

Suggested-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2 weeks agoffmpeg: Fix typos in the comment for decode() ("." vs. "->")
Wan-Teh Chang [Thu, 6 Jul 2017 16:42:24 +0000 (09:42 -0700)]
ffmpeg: Fix typos in the comment for decode() ("." vs. "->")

pkt is a pointer, so it should be dereferenced with the -> operator.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>