ffmpeg.git
2 years agoavcodec/takdec: Fix integer overflow in decode_subframe()
Michael Niedermayer [Thu, 27 Jul 2017 21:49:26 +0000 (23:49 +0200)]
avcodec/takdec: Fix integer overflow in decode_subframe()

Fixes: runtime error: signed integer overflow: -536870912 - 1972191120 cannot be represented in type 'int'
Fixes: 2711/clusterfuzz-testcase-minimized-4975142398590976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/rtmppkt: Convert ff_amf_get_field_value() to bytestream2
Michael Niedermayer [Fri, 28 Jul 2017 12:37:26 +0000 (14:37 +0200)]
avformat/rtmppkt: Convert ff_amf_get_field_value() to bytestream2

Fixes: out of array accesses

Found-by: JunDong Xie of Ant-financial Light-Year Security Lab
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/rtmppkt: Convert ff_amf_tag_size() to bytestream2
Michael Niedermayer [Fri, 28 Jul 2017 11:41:59 +0000 (13:41 +0200)]
avformat/rtmppkt: Convert ff_amf_tag_size() to bytestream2

Fixes: out of array accesses
Fixes: crash-9238fa9e8d4fde3beda1f279626f53812cb001cb-SEGV

Found-by: JunDong Xie of Ant-financial Light-Year Security Lab
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolibavcodec/mips: Improve avc dequant-idct luma dc msa function
Kaustubh Raste [Fri, 28 Jul 2017 08:42:06 +0000 (14:12 +0530)]
libavcodec/mips: Improve avc dequant-idct luma dc msa function

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>
2 years agoavcodec/diracdec: Fix integer overflow in signed multiplication in UNPACK_ARITH()
Michael Niedermayer [Wed, 26 Jul 2017 18:26:43 +0000 (20:26 +0200)]
avcodec/diracdec: Fix integer overflow in signed multiplication in UNPACK_ARITH()

Fixes: runtime error: signed integer overflow: 1073741823 * 4 cannot be represented in type 'int'
Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/pixlet: Simplify nbits computation
Michael Niedermayer [Wed, 26 Jul 2017 18:10:28 +0000 (20:10 +0200)]
avcodec/pixlet: Simplify nbits computation

Fixes multiple integer overflows
Fixes: runtime error: signed integer overflow: 1 + 2147483647 cannot be represented in type 'int'

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>
2 years agopthread_frame: revert 2e664b9c1e73c80aab91070c1eb7676f04bdd12d.
Wan-Teh Chang [Tue, 18 Jul 2017 16:11:09 +0000 (09:11 -0700)]
pthread_frame: revert 2e664b9c1e73c80aab91070c1eb7676f04bdd12d.

The patch does not fix the tsan warning it was intended to fix.
Reverting the patch moves the av_log() back to the outside of the lock.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2 years agoavcodec/h264_slice: don't sync default_ref[] between threads.
Wan-Teh Chang [Tue, 18 Jul 2017 23:34:40 +0000 (16:34 -0700)]
avcodec/h264_slice: don't sync default_ref[] between threads.

default_ref[] is unconditionally initialized in h264_initialise_ref_list()
(called from ff_h264_build_ref_list(), called from h264_slice_init()).

This fixes the following tsan warning when running fate-h264:

WARNING: ThreadSanitizer: data race (pid=31070)
  Write of size 8 at 0x7bbc000082a8 by thread T1 (mutexes: write M1628):
    #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5
(ffmpeg+0x10de9d)
    #1 h264_initialise_ref_list ffmpeg/libavcodec/h264_refs.c:214:29 (ffmpeg+0x1186b3f)
    #2 ff_h264_build_ref_list ffmpeg/libavcodec/h264_refs.c:306 (ffmpeg+0x1186b3f)
    #3 h264_slice_init ffmpeg/libavcodec/h264_slice.c:1900:11 (ffmpeg+0x1191149)
[..]
  Previous read of size 8 at 0x7bbc000082a8 by main thread (mutexes:
write M1630):
    #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5
(ffmpeg+0x10de9d)
    #1 ff_h264_update_thread_context ffmpeg/libavcodec/h264_slice.c:411:5 (ffmpeg+0x118b7dc)

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2 years agodoc/APIChanges: add missing entry for ICC Profile side data type.
James Almer [Thu, 27 Jul 2017 17:21:41 +0000 (14:21 -0300)]
doc/APIChanges: add missing entry for ICC Profile side data type.

2 years agoavcodec/dnxhdenc: enable frame threading
Paul B Mahol [Mon, 26 Jun 2017 07:22:58 +0000 (09:22 +0200)]
avcodec/dnxhdenc: enable frame threading

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agofate: update pixfmt_best test to check for endianness
Tobias Rapp [Tue, 25 Jul 2017 07:42:21 +0000 (09:42 +0200)]
fate: update pixfmt_best test to check for endianness

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2 years agoavcodec/dnxhddec: Move mb height check out of non hr branch
Michael Niedermayer [Wed, 26 Jul 2017 01:26:59 +0000 (03:26 +0200)]
avcodec/dnxhddec: Move mb height check out of non hr branch

Fixes: out of array access
Fixes: poc.dnxhd

Found-by: Bingchang, Liu@VARAS of IIE
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agopngdec: fix potential memory leak
Rostislav Pehlivanov [Wed, 26 Jul 2017 22:54:14 +0000 (23:54 +0100)]
pngdec: fix potential memory leak

Fixes CID1412026.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agoavcodec/jpeg2000dec: Fix h/vden typo
Michael Niedermayer [Wed, 26 Jul 2017 18:22:49 +0000 (20:22 +0200)]
avcodec/jpeg2000dec: Fix h/vden typo

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/s337m: fix potentially undefined pointer arithmetic
foo86 [Sat, 22 Jul 2017 14:27:28 +0000 (17:27 +0300)]
avformat/s337m: fix potentially undefined pointer arithmetic

Use integer position instead of pointer for loop variable. Also only
skip header fields after header has been fully validated.

2 years agoavcodec/dolby_e: fix potentially undefined pointer arithmetic
foo86 [Sat, 22 Jul 2017 14:19:25 +0000 (17:19 +0300)]
avcodec/dolby_e: fix potentially undefined pointer arithmetic

Avoid undefined behavior in skip_input() by checking that enough data is
available before incrementing input pointer.

Check return values of parse_key() and skip_input() and exit early with
error if there is not enough data.

2 years agoavcodec/dolby_e: add AV_CODEC_CAP_CHANNEL_CONF capability
foo86 [Sat, 22 Jul 2017 14:18:47 +0000 (17:18 +0300)]
avcodec/dolby_e: add AV_CODEC_CAP_CHANNEL_CONF capability

2 years agoavcodec/dolby_e: add 'f' suffixes to floating point literals
foo86 [Sat, 22 Jul 2017 14:13:04 +0000 (17:13 +0300)]
avcodec/dolby_e: add 'f' suffixes to floating point literals

2 years agolavc/htmlsubtitles: simplify 1-char tags case insensitive test
Clément Bœsch [Wed, 26 Jul 2017 17:56:28 +0000 (19:56 +0200)]
lavc/htmlsubtitles: simplify 1-char tags case insensitive test

2 years agoavcodec/jpeg2000dec: Fix division by zero in jp2_find_codestream()
Michael Niedermayer [Mon, 24 Jul 2017 14:43:24 +0000 (16:43 +0200)]
avcodec/jpeg2000dec: Fix division by zero in jp2_find_codestream()

Fixes: 2707/clusterfuzz-testcase-minimized-5179636394754048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/hevc_ps: fix integer overflow in log2_parallel_merge_level_minus2
Michael Niedermayer [Mon, 24 Jul 2017 13:48:37 +0000 (15:48 +0200)]
avcodec/hevc_ps: fix integer overflow in log2_parallel_merge_level_minus2

Fixes: runtime error: signed integer overflow: -2147483647 - 2 cannot be represented in type 'int'
Fixes: 2702/clusterfuzz-testcase-minimized-4511932591636480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/webp: add support for ICCP chunks
James Almer [Wed, 26 Jul 2017 04:28:35 +0000 (01:28 -0300)]
avcodec/webp: add support for ICCP chunks

Export the raw data as ICC Profile frame side data.

Reviwed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoffprobe: add support for ICC Profile frame side data
James Almer [Wed, 26 Jul 2017 03:42:51 +0000 (00:42 -0300)]
ffprobe: add support for ICC Profile frame side data

Print the name metadata entry and the buffer size.

Reviwed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavutil/frame: add ICC Profile to av_frame_side_data_name
James Almer [Wed, 26 Jul 2017 03:38:22 +0000 (00:38 -0300)]
avutil/frame: add ICC Profile to av_frame_side_data_name

Reviwed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavcodec/rdft: reorder calculation
Muhammad Faiz [Fri, 21 Jul 2017 23:52:45 +0000 (06:52 +0700)]
avcodec/rdft: reorder calculation

old:
 165188 decicycles in  rdft,   65536 runs,      0 skips
 165865 decicycles in irdft,   65536 runs,      0 skips
new:
 142487 decicycles in  rdft,   65536 runs,      0 skips
 141498 decicycles in irdft,   65536 runs,      0 skips

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2 years agoavformat/oggparsecelt: Do not re-allocate os->private
Michael Niedermayer [Tue, 25 Jul 2017 01:19:07 +0000 (03:19 +0200)]
avformat/oggparsecelt: Do not re-allocate os->private

Fixes: double free
Fixes: clusterfuzz-testcase-minimized-5080550145785856

Found-by: ClusterFuzz
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolibavcodec/mips: Optimize avc idct 4x4 for msa
Kaustubh Raste [Mon, 24 Jul 2017 12:41:53 +0000 (18:11 +0530)]
libavcodec/mips: Optimize avc idct 4x4 for msa

Removed memset call and improved performance.

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>
2 years agomdct15: simplify prereindexing and forward transform postrotation
Rostislav Pehlivanov [Tue, 25 Jul 2017 03:31:48 +0000 (04:31 +0100)]
mdct15: simplify prereindexing and forward transform postrotation

Equivalent.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agopngdec: decode and expose iCCP chunks as side data
Rostislav Pehlivanov [Thu, 20 Jul 2017 20:46:22 +0000 (21:46 +0100)]
pngdec: decode and expose iCCP chunks as side data

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agolavu/frame: add new side data type for ICC profiles
Rostislav Pehlivanov [Thu, 20 Jul 2017 20:46:21 +0000 (21:46 +0100)]
lavu/frame: add new side data type for ICC profiles

Many image formats support embedding of ICC profiles directly in
their bitstreams. Add a new side data type to allow exposing them to
API users.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agolavfi/testsrc2: fix completely transparent alpha.
Nicolas George [Thu, 20 Jul 2017 15:35:44 +0000 (17:35 +0200)]
lavfi/testsrc2: fix completely transparent alpha.

2 years agoavcodec/mpegvideo_enc: fix mixed declarations and code warning
James Almer [Tue, 25 Jul 2017 03:58:16 +0000 (00:58 -0300)]
avcodec/mpegvideo_enc: fix mixed declarations and code warning

2 years agoavformat/hlsenc: improve hls encrypt get key file operation
Steven Liu [Tue, 25 Jul 2017 02:31:29 +0000 (10:31 +0800)]
avformat/hlsenc: improve hls encrypt get key file operation

get key file only once time is ok, no need more times.
Ticket-id: #6545

Found-by: JohnPi
Signed-off-by: Steven Liu <lq@onvideo.cn>
2 years agoavcodec/ylc: Fix shift overflow
Michael Niedermayer [Sat, 22 Jul 2017 00:57:12 +0000 (02:57 +0200)]
avcodec/ylc: Fix shift overflow

Fixes: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 2698/clusterfuzz-testcase-minimized-4713541443518464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/aacps: Fix multiple integer overflow in map_val_34_to_20()
Michael Niedermayer [Fri, 21 Jul 2017 22:44:14 +0000 (00:44 +0200)]
avcodec/aacps: Fix multiple integer overflow in map_val_34_to_20()

Fixes: avcodec/aacps.c:511:40: runtime error: signed integer overflow: 1509077651 + 758068176 cannot be represented in type 'int'
Fixes: 2678/clusterfuzz-testcase-minimized-4702787684270080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolavf/movenc: support GPMF track (gpmd) remuxing
Clément Bœsch [Fri, 21 Jul 2017 08:30:19 +0000 (10:30 +0200)]
lavf/movenc: support GPMF track (gpmd) remuxing

See https://github.com/gopro/gpmf-parser for more information on the
data stream itself.

2 years agoavformat/hlsenc: fix hls fmp4 extention name bug
Steven Liu [Mon, 24 Jul 2017 11:55:19 +0000 (19:55 +0800)]
avformat/hlsenc: fix hls fmp4 extention name bug

ticket-id: #6541
when use hls fmp4 muxer, the extention name is not .m4s, this
code can fix it.

Found-by: JohnPi
Signed-off-by: Steven Liu <lq@onvideo.cn>
2 years agoavcodec/mpegvideo_enc: Use intra/inter scantable matching mb type in quantization
Michael Niedermayer [Mon, 19 Jun 2017 22:37:41 +0000 (00:37 +0200)]
avcodec/mpegvideo_enc: Use intra/inter scantable matching mb type in quantization

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/aacdec_fixed: fix: left shift of negative value -1
Michael Niedermayer [Sun, 23 Jul 2017 14:52:47 +0000 (16:52 +0200)]
avcodec/aacdec_fixed: fix: left shift of negative value -1

Fixes: 2699/clusterfuzz-testcase-minimized-5631303862976512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/dirac_vlc: Fix undefined shift
Michael Niedermayer [Tue, 18 Jul 2017 23:43:24 +0000 (01:43 +0200)]
avcodec/dirac_vlc: Fix undefined shift

Fixes: runtime error: shift exponent 64 is too large for 64-bit type 'residual' (aka 'unsigned long')
Fixes: 2674/clusterfuzz-testcase-minimized-4999700518273024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavfilter/w3fdif: do not write to line before start line
Muhammad Faiz [Sat, 22 Jul 2017 11:46:07 +0000 (18:46 +0700)]
avfilter/w3fdif: do not write to line before start line

That line has been written by previous job.
Fix tsan warning.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2 years agodoc/filters: typo in frei0r
Brice Waegeneire [Fri, 21 Jul 2017 22:09:29 +0000 (00:09 +0200)]
doc/filters: typo in frei0r

Signed-off-by: Brice Waegeneire <brice.wge@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/cfhd: Fix decoding regression due to height check
Vodyannikov Aleksandr [Fri, 21 Jul 2017 09:49:45 +0000 (11:49 +0200)]
avcodec/cfhd: Fix decoding regression due to height check

Fixes: Ticket6546

Regression since: 54aaadf648073149f1ac34f56cbde4e6c5aa22ef

Reviewed-by: Muhammad Faiz <mfcc64@gmail.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/dcaadpcm: fix use of uninitialized variable
foo86 [Sat, 22 Jul 2017 15:20:04 +0000 (18:20 +0300)]
avcodec/dcaadpcm: fix use of uninitialized variable

Fixes CID 1409924.

2 years agoavcodec/dcaadpcm: check for av_malloc() failure
foo86 [Sat, 22 Jul 2017 15:16:13 +0000 (18:16 +0300)]
avcodec/dcaadpcm: check for av_malloc() failure

Fixes CID 1409915.

2 years agopixdesc: Reindent after previous commit
Mark Thompson [Sat, 22 Jul 2017 20:51:41 +0000 (21:51 +0100)]
pixdesc: Reindent after previous commit

2 years agopixdesc: Explicitly handle invalid arguments to av_find_best_pix_fmt_of_2()
Mark Thompson [Sat, 22 Jul 2017 20:49:46 +0000 (21:49 +0100)]
pixdesc: Explicitly handle invalid arguments to av_find_best_pix_fmt_of_2()

2 years agoffprobe: Print color properties from show_frames
Vittorio Giovara [Thu, 20 Jul 2017 12:37:44 +0000 (14:37 +0200)]
ffprobe: Print color properties from show_frames

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agohevc: Make sure to update the current frame transfer characteristic
Vittorio Giovara [Thu, 20 Jul 2017 12:39:22 +0000 (14:39 +0200)]
hevc: Make sure to update the current frame transfer characteristic

Otherwise the first decoded frame will still be tagged with the
original transfer instead of the alternative one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agozscale: Factor out graph building
Vittorio Giovara [Thu, 6 Jul 2017 18:29:16 +0000 (14:29 -0400)]
zscale: Factor out graph building

2 years agozscale: Factor out format initialization
Vittorio Giovara [Thu, 6 Jul 2017 17:27:37 +0000 (13:27 -0400)]
zscale: Factor out format initialization

2 years agoavcodec/diracdec: Check dimensions which are closer to what is allocated in alloc_seq...
Michael Niedermayer [Tue, 18 Jul 2017 22:59:21 +0000 (00:59 +0200)]
avcodec/diracdec: Check dimensions which are closer to what is allocated in alloc_sequence_buffers()

Fixes OOM
Fixes: 2674/clusterfuzz-testcase-minimized-4999700518273024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agodoc: Add initial documentation explaining undefined behavior and SUINT
Michael Niedermayer [Sat, 15 Jul 2017 16:32:08 +0000 (18:32 +0200)]
doc: Add initial documentation explaining undefined behavior and SUINT

Requested-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolibavutil/mips: Updated msa generic macros
Kaustubh Raste [Fri, 21 Jul 2017 06:24:29 +0000 (11:54 +0530)]
libavutil/mips: Updated msa generic macros

Reduced msa load-store code.
Removed inline asm of GP load-store for 64 bit.
Updated variable names in GP load-store macros for naming consistency.
Corrected macro descriptions.

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>
2 years agoMAINTAINERS: add myself
foo86 [Fri, 21 Jul 2017 12:22:53 +0000 (15:22 +0300)]
MAINTAINERS: add myself

Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()
James Almer [Wed, 19 Jul 2017 04:53:22 +0000 (01:53 -0300)]
avcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()

This prevents potential ABI issues with GetBitContext.

Reviewed-by: foo86 <foobaz86@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavcodec/h264: Declare the local variable decode_chroma as const.
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 years 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 years 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>
2 years 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>
2 years 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

2 years 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.

2 years 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>
2 years 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.

2 years 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>
2 years 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.

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

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

2 years 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>
2 years 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>
2 years 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>
2 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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>