ffmpeg.git
6 months agoavcodec/mips: [loongson] optimize memset in h264dsp.
Shiyou Yin [Fri, 31 Aug 2018 13:57:23 +0000 (21:57 +0800)]
avcodec/mips: [loongson] optimize memset in h264dsp.

Optimized memset with mmi in following functions:
1. ff_h264_add_pixels4_8_mmi.
2. ff_h264_idct_add_8_mmi.
3. ff_h264_idct8_add_8_mmi.

This optimization improved h264 decoding performance about 1.3%(tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/mips: [loongson] reoptimize h264_chroma_mc8_mmi v2.
Shiyou Yin [Fri, 31 Aug 2018 13:56:05 +0000 (21:56 +0800)]
avcodec/mips: [loongson] reoptimize h264_chroma_mc8_mmi v2.

Reoptimize function ff_put_h264_chroma_mc8_mmi and ff_avg_h264_chroma_mc8_mmi.
Performance of h264 decoding improved about 5%(from 69fps to 73fps, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/mips: [loongson] reoptimize simple idct with mmi.
Shiyou Yin [Fri, 31 Aug 2018 13:41:49 +0000 (21:41 +0800)]
avcodec/mips: [loongson] reoptimize simple idct with mmi.

Performance of mpeg4 decoding improved about 23%(from 128fps to 158fps, tested on loongson 3A3000).
Reoptimized following functions with mmi.
1. ff_simple_idct_put_8_mmi
2. ff_simple_idct_add_8_mmi
3. ff_simple_idct_8_mmi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/libsrt: add pkt_size parameter to libsrt
Marton Balint [Sat, 1 Sep 2018 17:02:47 +0000 (19:02 +0200)]
avformat/libsrt: add pkt_size parameter to libsrt

Also make sure we set the URL context max packet size accordingly.

Based on a patch by Tudor Suciu <tudor.suciu@gmail.com>

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoffplay: do not drain existing filters when seeking
Marton Balint [Sat, 25 Aug 2018 18:42:55 +0000 (20:42 +0200)]
ffplay: do not drain existing filters when seeking

After a seek we drop all frames from the filter anyway. Audio filters already
had a similar approach.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavformat/mov: Error on too large stsd entry counts.
Dale Curtis [Thu, 30 Aug 2018 22:18:25 +0000 (15:18 -0700)]
avformat/mov: Error on too large stsd entry counts.

Entries are always at least 8 bytes per the parsing code, so if we
see an impossible entry count avoid massive allocations. This is
similar to an existing check in mov_read_stsc().

Since ff_mov_read_stsd_entries() does eof checks, an alternative
approach could be to clamp the entry count to atom.size / 8.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoexamples: Fix use of AV_CODEC_FLAG_GLOBAL_HEADER
Michael Bunk [Thu, 30 Aug 2018 06:56:19 +0000 (08:56 +0200)]
examples: Fix use of AV_CODEC_FLAG_GLOBAL_HEADER

AV_CODEC_FLAG_GLOBAL_HEADER should be set before calling avcodec_open2() to have any effect.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/scpr: refactor repeated code into decode_units()
Paul B Mahol [Sat, 1 Sep 2018 10:38:17 +0000 (12:38 +0200)]
avcodec/scpr: refactor repeated code into decode_units()

6 months agoavcodec/dnxhdenc: stop leaking memory when initalization fails
Paul B Mahol [Thu, 30 Aug 2018 09:35:07 +0000 (11:35 +0200)]
avcodec/dnxhdenc: stop leaking memory when initalization fails

Fixes #6593.

6 months agofate: add 10-bit test for hue video filter
Tobias Rapp [Fri, 3 Aug 2018 09:29:50 +0000 (11:29 +0200)]
fate: add 10-bit test for hue video filter

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
6 months agolavc/pthread: use THREAD_SAFE_CALLBACKS() to simplifx more code
Jun Zhao [Sat, 11 Aug 2018 09:15:39 +0000 (17:15 +0800)]
lavc/pthread: use THREAD_SAFE_CALLBACKS() to simplifx more code

use THREAD_SAFE_CALLBACKS() to simplifx more code

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoconfigure: <fflib>_deps: validate, reduce sensitivity
Avi Halachmi (:avih) [Tue, 28 Aug 2018 14:14:55 +0000 (17:14 +0300)]
configure: <fflib>_deps: validate, reduce sensitivity

- Allow to add deps in any order rather than "in linking order".
- Expand deps chains as required rather than just once.
- Validate that there are no cycles.
- Validate that [after expansion] deps are limited to other fflibs.
- Remove expectation for a specific output order of unique().

Previously when adding items to <fflib>_deps, developers were
required to add them in linking order. This can be awkward and
bug-prone, especially when a list is not empty, e.g. when adding
conditional deps.

It also implicitly expected unique() to keep the last instance of
recurring items such that these lists maintain their linking order
after removing duplicate items.

This patch mainly allows to add deps in any order by keeping just
one master list in linking order, and then reordering all the
<fflib>_deps lists to align with the master list order.

This master list is LIBRARY_LIST itself, where otherwise its order
doesn't matter.

The patch also removes a limit where these deps lists were expanded
only once. This could have resulted in incomplete expanded lists,
or forcing devs to add already-deducable deps to avoid this issue.

Note: it is possible to deduce the master list order automatically
from the deps lists, but in this case it's probably not worth the
added complexity, even if minor. Maintaining one list should be OK.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agotests/ref/fate/pixelutils: Add a newline.
Carl Eugen Hoyos [Wed, 29 Aug 2018 21:26:01 +0000 (23:26 +0200)]
tests/ref/fate/pixelutils: Add a newline.

Fixes fate-pixelutils on aix.

6 months agolavc/v4l2_m2m_enc: Add missing braces around initializers.
Carl Eugen Hoyos [Thu, 30 Aug 2018 22:43:17 +0000 (00:43 +0200)]
lavc/v4l2_m2m_enc: Add missing braces around initializers.

Fixes the following warnings:
libavcodec/v4l2_m2m_enc.c:51:12: warning: missing braces around initializer
libavcodec/v4l2_m2m_enc.c:71:12: warning: missing braces around initializer

6 months agoavcodec/get_bits: actually make cached reader correctly disabled
James Almer [Thu, 30 Aug 2018 20:36:55 +0000 (22:36 +0200)]
avcodec/get_bits: actually make cached reader correctly disabled

6 months agoavfilter/vf_frei0r: Remove duplicate }, fix build
Michael Niedermayer [Thu, 30 Aug 2018 15:09:23 +0000 (17:09 +0200)]
avfilter/vf_frei0r: Remove duplicate }, fix build

Fixes regression from a3c6b7ff5903b8a044e30edaaa0de00e70517538

Reported-by: qq2225936589
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/utvideodec: use cached bitstream reader everywhere except on x86_32
Paul B Mahol [Tue, 3 Apr 2018 11:32:07 +0000 (13:32 +0200)]
avcodec/utvideodec: use cached bitstream reader everywhere except on x86_32

From 100x real-time decoding to 138x real-time decoding for 320x240 video.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 months agodoc/libav-merge: bitstream reader is now merged
Paul B Mahol [Fri, 7 Jul 2017 18:47:08 +0000 (20:47 +0200)]
doc/libav-merge: bitstream reader is now merged

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 months agoavcodec/get_bits: add cached bitstream reader
Paul B Mahol [Fri, 7 Jul 2017 14:56:10 +0000 (16:56 +0200)]
avcodec/get_bits: add cached bitstream reader

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 months agofrei0r: handle string params
Raphael Graf [Wed, 29 Aug 2018 10:29:16 +0000 (12:29 +0200)]
frei0r: handle string params

This is needed for some of the frei0r filters (facebl0r and facedetect) which accept string parameters.

Fixes the issue described here:
http://www.ffmpeg-archive.org/Unable-to-set-ffmpeg-frei0r-facedetect-filter-parameter-td4680190.html

Signed-off-by: Raphael Graf <r@undefined.ch>
6 months agoavcodec/scpr: error out if run length is <= 0
Paul B Mahol [Wed, 29 Aug 2018 21:11:45 +0000 (23:11 +0200)]
avcodec/scpr: error out if run length is <= 0

6 months agoavformat/dashdec: Add a re-entrance check point after an interrupt operation
Colin NG [Wed, 29 Aug 2018 08:28:03 +0000 (16:28 +0800)]
avformat/dashdec: Add a re-entrance check point after an interrupt operation

6 months agoavformat/dashdec: Fix calc_cur_seg_no if availability_start_time not
Jacek Jendrzej [Wed, 29 Aug 2018 07:20:00 +0000 (15:20 +0800)]
avformat/dashdec: Fix calc_cur_seg_no if availability_start_time not

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoffmpeg: add correct field for raw pts in -progress report
Gyan Doshi [Sun, 5 Aug 2018 07:04:21 +0000 (12:34 +0530)]
ffmpeg: add correct field for raw pts in -progress report

PTS is in microseconds, so correct field name is out_time_us.

Old field out_time_ms kept for now - will be removed after a suitable transition
period.

Fixes #7345

6 months agoatrac9dec: clean up code slightly
Rostislav Pehlivanov [Tue, 28 Aug 2018 03:25:35 +0000 (04:25 +0100)]
atrac9dec: clean up code slightly

Just remove some dead variable assignments, unneeded variables and
change the FFMAX order to something more readable. Still identical.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
6 months agoatrac9dec: implement LFE channel decoding
Rostislav Pehlivanov [Mon, 27 Aug 2018 22:15:08 +0000 (23:15 +0100)]
atrac9dec: implement LFE channel decoding

Much simpler than regular decoding, does allow for 5.1 and 7.1
streams to be decoded without desync.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
6 months agoatrac9dec: relax gradient value requirements
Rostislav Pehlivanov [Mon, 27 Aug 2018 22:12:36 +0000 (23:12 +0100)]
atrac9dec: relax gradient value requirements

Unlike the range, the gradient start value does not have to be lower
than the end value.
Does allow more files to be correctly decoded without errors.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
6 months agoconfigure: [loongson] revert no-expensive-optimizations
Shiyou Yin [Fri, 24 Aug 2018 09:22:12 +0000 (17:22 +0800)]
configure: [loongson] revert no-expensive-optimizations

Add gcc version check before add -fno-expensive-optimizations flag.
Only when gcc version is lower than 5.3.0, this flag is needed.
More bug info see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67736
https://gcc.gnu.org/ml/gcc-patches/2012-05/msg00401.html

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec: add WinCAM Motion Video decoder
Paul B Mahol [Sat, 25 Aug 2018 16:51:37 +0000 (18:51 +0200)]
avcodec: add WinCAM Motion Video decoder

6 months agoavcodec: add MatchWare Screen Capture Codec
Paul B Mahol [Fri, 24 Aug 2018 15:01:00 +0000 (17:01 +0200)]
avcodec: add MatchWare Screen Capture Codec

6 months agovaapi_encode: Factorise out adding global parameters
Mark Thompson [Wed, 22 Aug 2018 23:44:41 +0000 (00:44 +0100)]
vaapi_encode: Factorise out adding global parameters

6 months agovaapi_encode: Remove common priv_data and options fields
Mark Thompson [Wed, 22 Aug 2018 23:44:40 +0000 (00:44 +0100)]
vaapi_encode: Remove common priv_data and options fields

The codec-specific context now contains both the common context and the
codec-specific options directly.

6 months agovaapi_encode_vp9: Move options and common structures into context
Mark Thompson [Wed, 22 Aug 2018 23:44:39 +0000 (00:44 +0100)]
vaapi_encode_vp9: Move options and common structures into context

6 months agovaapi_encode_vp8: Move options and common structures into context
Mark Thompson [Wed, 22 Aug 2018 23:44:38 +0000 (00:44 +0100)]
vaapi_encode_vp8: Move options and common structures into context

6 months agovaapi_encode_mpeg2: Move common structure into context
Mark Thompson [Wed, 22 Aug 2018 23:44:37 +0000 (00:44 +0100)]
vaapi_encode_mpeg2: Move common structure into context

6 months agovaapi_encode_mjpeg: Move common structure into context
Mark Thompson [Wed, 22 Aug 2018 23:44:36 +0000 (00:44 +0100)]
vaapi_encode_mjpeg: Move common structure into context

6 months agovaapi_encode_h265: Move options and common structures into context
Mark Thompson [Wed, 22 Aug 2018 23:44:35 +0000 (00:44 +0100)]
vaapi_encode_h265: Move options and common structures into context

Matching previous commit for H.264.

6 months agovaapi_encode_h264: Move options and common structures into context
Mark Thompson [Wed, 22 Aug 2018 23:44:34 +0000 (00:44 +0100)]
vaapi_encode_h264: Move options and common structures into context

This will make it easier to support options in common between different
encoders.  It also cleans up some of the field naming.

6 months agoconfigure: speed up check_deps()
Avi Halachmi (:avih) [Sun, 5 Aug 2018 03:16:44 +0000 (06:16 +0300)]
configure: speed up check_deps()

x4 - x25 faster.

check_deps() recursively enables/disables components, and its loop is
iterated nearly 6000 times. It's particularly slow in bash - currently
consuming more than 50% of configure runtime, and about 20% with other
shells.

This commit applies few local optimizations, most effective first:
- Use $1 $2 ... instead of pushvar/popvar, and same at enable_deep*
- Abort early in one notable case - empty deps, to avoid costly no-op.
- Smaller changes which do add up:
  - Handle ${cfg}_checking locally instead of via enable[d]/disable
  - ${cfg}_checking: test done before inprogress - x2 faster in 50%+
  - one eval instead of several at the empty-deps early abort path.

- The "actual work" part is unmodified - just its surroundings.

Biggest speedups (relative and absolute) are observed with bash.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Tested-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
Tested-by: Dave Yeo <daveryeo@telus.net>
Tested-by: Reino Wijnsma <rwijnsma@xs4all.nl>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoconfigure: speed up print_enabled_components()
Avi Halachmi (:avih) [Mon, 30 Jul 2018 19:48:04 +0000 (22:48 +0300)]
configure: speed up print_enabled_components()

x4 - x10 faster.

Inside print_enabled components, the filter_list case invokes sed
about 350 times to parse the same source file and extract different
info for each arg. This is never instant, and on systems where fork is
slow (notably MSYS2/Cygwin on windows) it takes many seconds.

Change it to use sed once on the source file and set env vars with the
parse results, then use these results inside the loop.

Additionally, the cases of indev_list and outdev_list are very
infrequent, but nevertheless they're faster, and arguably cleaner, with
shell parameter substitutions than with command substitutions.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Tested-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
Tested-by: Dave Yeo <daveryeo@telus.net>
Tested-by: Reino Wijnsma <rwijnsma@xs4all.nl>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoconfigure: speed up flatten_extralibs_wrapper()
Avi Halachmi (:avih) [Mon, 30 Jul 2018 19:39:15 +0000 (22:39 +0300)]
configure: speed up flatten_extralibs_wrapper()

x50 - x200 faster.

Currently configure spends 50-70% of its runtime inside a single
function: flatten_extralibs[_wrapper] - which does string processing.

During its run, nearly 20K command substitutions (subshells) are used,
including its callees unique() and resolve(), which is the reason
for its lengthy run.

This commit avoids all subshells during its execution, speeding it up
by about two orders of magnitude, and reducing the overall configure
runtime by 50-70% .

resolve() is rewritten to avoid subshells, and in unique() and
flatten_extralibs() we "inline" the filter[_out] functionality.

Note that logically, "unique" functionality has more than one possible
output (depending on which of the recurring items is kept). As it
turns out, other parts expect the last recurring item to be kept
(which was the original behavior of uniqie()). This patch preservs
its output order.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Tested-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
Tested-by: Dave Yeo <daveryeo@telus.net>
Tested-by: Reino Wijnsma <rwijnsma@xs4all.nl>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolavc/encode: fix frame_number double-counted
Zhong Li [Thu, 28 Jun 2018 09:01:46 +0000 (17:01 +0800)]
lavc/encode: fix frame_number double-counted

Encoder frame_number may be double-counted if some frames are cached and then flushed.
Take qsv encoder (some frames are cached firsty for asynchronism) as example,
./ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv -i in.mp4 -vframes 100 -c:v h264_qsv out.mp4
frame_number passed to encoder is double-counted and larger than the accurate value.
Libx264 encoding with B frames can also reproduce it.

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 months agoavcodec/proresdec2: add frame threading support
Paul B Mahol [Wed, 22 Aug 2018 16:46:51 +0000 (18:46 +0200)]
avcodec/proresdec2: add frame threading support

6 months agoavcodec/mscc: fix several bugs
Paul B Mahol [Sat, 22 Apr 2017 13:51:52 +0000 (15:51 +0200)]
avcodec/mscc: fix several bugs

Fixes #6342.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 months agolavfi/avf_concat: switch to activate.
Nicolas George [Fri, 10 Aug 2018 20:58:46 +0000 (22:58 +0200)]
lavfi/avf_concat: switch to activate.

Fix trac ticket #7351.

6 months agompeg4video: Add Studio DPCM support
Kieran Kunhya [Sun, 19 Aug 2018 01:31:42 +0000 (02:31 +0100)]
mpeg4video: Add Studio DPCM support

6 months agoavformat/mpegts: add missing null pointer checks in ff_parse_mpeg2_descriptor()
Michael Niedermayer [Thu, 16 Aug 2018 11:33:40 +0000 (13:33 +0200)]
avformat/mpegts: add missing null pointer checks in ff_parse_mpeg2_descriptor()

Fixes: null pointer dereference
Fixes: wtv-crash-75fa58662ded1c1d349f3d1df89394fd690cf92f

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/hq_hqa: Check remaining input bits in hqa_decode_mb()
Michael Niedermayer [Mon, 20 Aug 2018 20:53:32 +0000 (22:53 +0200)]
avcodec/hq_hqa: Check remaining input bits in hqa_decode_mb()

Fixes: Timeout
Fixes: 9634/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-6267852259590144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/vb: Check for end of bytestream before reading blocktype
Michael Niedermayer [Mon, 20 Aug 2018 20:19:23 +0000 (22:19 +0200)]
avcodec/vb: Check for end of bytestream before reading blocktype

Fixes: Timeout
Fixes: 9601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VB_fuzzer-4550228702134272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/snowdec: Fix integer overflow with motion vector residual
Michael Niedermayer [Mon, 20 Aug 2018 18:15:19 +0000 (20:15 +0200)]
avcodec/snowdec: Fix integer overflow with motion vector residual

Fixes: signed integer overflow: -19818 + -2147483648 cannot be represented in type 'int'
Fixes: 9545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-4928769537081344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoallcodecs: reorder ff_bitpacked_decoder
Rostislav Pehlivanov [Sat, 25 Aug 2018 17:36:16 +0000 (18:36 +0100)]
allcodecs: reorder ff_bitpacked_decoder

Needs to be in alphabetical order.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
6 months agoavcodec/mpeg4videodec: Fix slice end detection in mpeg4_decode_studio_mb()
Michael Niedermayer [Sun, 19 Aug 2018 08:15:53 +0000 (10:15 +0200)]
avcodec/mpeg4videodec: Fix slice end detection in mpeg4_decode_studio_mb()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/utils: document allocation requirement of extradata
Timo Rothenpieler [Fri, 24 Aug 2018 17:57:42 +0000 (19:57 +0200)]
avcodec/utils: document allocation requirement of extradata

6 months agodoc/examples/vaapi_transcode: re-licensed to MIT-license.
Jun Zhao [Sat, 25 Aug 2018 14:06:39 +0000 (22:06 +0800)]
doc/examples/vaapi_transcode: re-licensed to MIT-license.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agodoc/examples/vaapi_encode: re-licensed to MIT-license.
Jun Zhao [Sat, 25 Aug 2018 14:05:36 +0000 (22:05 +0800)]
doc/examples/vaapi_encode: re-licensed to MIT-license.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agodoc/examples/hw_decode: re-licensed to MIT-license.
Jun Zhao [Sat, 25 Aug 2018 14:03:14 +0000 (22:03 +0800)]
doc/examples/hw_decode: re-licensed to MIT-license.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoavcodec/prosumer: fix some minor issues
Paul B Mahol [Fri, 24 Aug 2018 19:33:01 +0000 (21:33 +0200)]
avcodec/prosumer: fix some minor issues

6 months agoavcodec: add Brooktree ProSumer Video decoder
Paul B Mahol [Thu, 16 Aug 2018 11:25:51 +0000 (13:25 +0200)]
avcodec: add Brooktree ProSumer Video decoder

6 months agoavformat/movenc: implicitly enable negative CTS offsets for ismv
Jan Ekström [Wed, 25 Jul 2018 23:51:38 +0000 (02:51 +0300)]
avformat/movenc: implicitly enable negative CTS offsets for ismv

ISMV lacks any sort of edit list support, as well as tfxd is
effectively the PTS of the fragment for most intents and purposes.

Thus, if b-frames are requested without negative CTS offsets you
end up with N frames' worth of delay (tfxd PTS plus the CTS offset
of the first sample). Negative CTS offsets enable the first sample
to have CTS=DTS, and thus a/v desync due to b-frame reorder delay
is avoided.

6 months agoavformat/flvdec: don't propagate empty extradata
James Almer [Fri, 24 Aug 2018 02:50:28 +0000 (23:50 -0300)]
avformat/flvdec: don't propagate empty extradata

Fixes ticket #7379

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavformat/movenc: support Opus packets with more than 60ms of audio when writing the...
James Almer [Thu, 23 Aug 2018 20:48:58 +0000 (17:48 -0300)]
avformat/movenc: support Opus packets with more than 60ms of audio when writing the Sample Group Description

Since libopus 1.2, packets of sizes 80ms, 100ms and 120ms are allowed.

Fixes assertion failures when trying to mux such streams.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavcodec/libopusenc: support encoding packets of sizes bigger than 60ms
James Almer [Thu, 23 Aug 2018 20:47:37 +0000 (17:47 -0300)]
avcodec/libopusenc: support encoding packets of sizes bigger than 60ms

Packets of sizes 80ms, 100ms and 120ms are allowed since libopus 1.2

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolavf/Makefile: Fix standalone compilation of the matroska and webm muxers.
Carl Eugen Hoyos [Fri, 24 Aug 2018 10:59:41 +0000 (12:59 +0200)]
lavf/Makefile: Fix standalone compilation of the matroska and webm muxers.

Reported-by: irc user Kam_
6 months agoavdevice/decklink_enc: print preroll and buffer size
Gyan Doshi [Wed, 22 Aug 2018 10:53:58 +0000 (16:23 +0530)]
avdevice/decklink_enc: print preroll and buffer size

Helpful in diagnosing latency issues.

6 months agoRevert "avcodec/opus_parser: Handle complete frames flag."
James Almer [Thu, 23 Aug 2018 20:29:27 +0000 (17:29 -0300)]
Revert "avcodec/opus_parser: Handle complete frames flag."

This reverts commit 7e0df5910ec0f107cd0700d6b9359d29177f1933.

"complete frames" containers, even if they don't need to assemble
packets, still depended on this code for proper packet duration and
timestamp generation.

6 months agolavc/extract_extradata_bsf.c: add AVS2
hwren [Mon, 6 Aug 2018 13:42:51 +0000 (21:42 +0800)]
lavc/extract_extradata_bsf.c: add AVS2

Signed-off-by: hwren <hwrenx@126.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mov: Correct opus-in-mp4 pre-skip to be uint16_t versus int16_t.
Dale Curtis [Tue, 21 Aug 2018 22:42:31 +0000 (15:42 -0700)]
avformat/mov: Correct opus-in-mp4 pre-skip to be uint16_t versus int16_t.

This field is a uint16_t, see docs:
http://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoconfigure: do not add fsanitize cflags with ossfuzz if coverage is tested
Michael Niedermayer [Sat, 18 Aug 2018 08:34:15 +0000 (10:34 +0200)]
configure: do not add fsanitize cflags with ossfuzz if coverage is tested

Found-by: Max Moroz
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agolavc/encode: remove redundant av_init_packet after av_packet_unref.
Jun Zhao [Thu, 16 Aug 2018 06:33:23 +0000 (14:33 +0800)]
lavc/encode: remove redundant av_init_packet after av_packet_unref.

remove redundant av_init_packet after av_packet_unref.
av_packet_unref have call av_init_packet and reset the packet size.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavc/hevc_ps: fix crop info for monochrome
Zhao Zhili [Wed, 22 Aug 2018 09:37:15 +0000 (17:37 +0800)]
lavc/hevc_ps: fix crop info for monochrome

The values of SubWidthC and SubHeightC are 1 in the ITU-T H.265. The
current code use the value of 2.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavformat/utils: avoid undefined integer overflow behavior in update_stream_timings()
Fredrik Hubinette [Mon, 20 Aug 2018 19:59:32 +0000 (12:59 -0700)]
avformat/utils: avoid undefined integer overflow behavior in update_stream_timings()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mov: Allow saio/saiz in clear content.
Jacob Trimble [Tue, 14 Aug 2018 17:18:55 +0000 (10:18 -0700)]
avformat/mov: Allow saio/saiz in clear content.

If there is a saio/saiz in clear content, we shouldn't create the
encryption index if we don't already have one.  Otherwise it will
confuse the cenc_filter.

The changed method is also used for senc atoms, but they should not
appear in clear content.

Found by Chromium's ClusterFuzz: https://crbug.com/873432

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mxfenc: automatically update descriptors klv size
Baptiste Coudurier [Wed, 21 Mar 2018 15:37:59 +0000 (08:37 -0700)]
avformat/mxfenc: automatically update descriptors klv size

6 months agoavformat/hls: support decryption AES128 fmp4 m3u8 list
Steven Liu [Mon, 13 Aug 2018 10:15:23 +0000 (18:15 +0800)]
avformat/hls: support decryption AES128 fmp4 m3u8 list

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agolavc/libkvazaar: fix incompatible pointer type.
Jun Zhao [Mon, 20 Aug 2018 06:39:32 +0000 (14:39 +0800)]
lavc/libkvazaar: fix incompatible pointer type.

fix the waring: libavcodec/libkvazaar.c:210:27: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
                           frame->data, frame->linesize,
                           ^~~~~
In file included from libavcodec/libkvazaar.c:31:0:
./libavutil/imgutils.h:119:6: note: expected ‘const uint8_t ** {aka const unsigned char **}’ but argument is of type ‘uint8_t * const* {aka unsigned char * const*}’
 void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavf/hlsenc: fix mixed declarations and code warning.
Jun Zhao [Mon, 20 Aug 2018 06:36:20 +0000 (14:36 +0800)]
lavf/hlsenc: fix mixed declarations and code warning.

fix the build warning for "ISO C90 forbids mixed declarations and code"

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoavcodec/psd : add support for gray float
Martin Vignali [Mon, 20 Aug 2018 13:26:07 +0000 (15:26 +0200)]
avcodec/psd : add support for gray float

6 months agoswscale/swscale : small cosmetic
Martin Vignali [Mon, 20 Aug 2018 13:31:01 +0000 (15:31 +0200)]
swscale/swscale : small cosmetic

6 months agoswscale : treat float input data as uint 16bpc
Martin Vignali [Mon, 20 Aug 2018 13:28:00 +0000 (15:28 +0200)]
swscale : treat float input data as uint 16bpc

Currently float are converted to 16b uint in input part
using src depth (32 bits) in hScale16To19 and hScale16to15,
make an invalid shift for the data

So shift the value when using float input
like 16 bpc uint.

6 months agolavc/qsvenc: add quality status to side_data
Zhong Li [Wed, 8 Aug 2018 14:42:47 +0000 (22:42 +0800)]
lavc/qsvenc: add quality status to side_data

Add fix a memory leak issue as James's comments.

V2: use a local pict_type since coded_frame is deprecated.

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 months agoavcodec/opus_parser: Handle complete frames flag.
Jacob Trimble [Mon, 20 Aug 2018 18:25:27 +0000 (11:25 -0700)]
avcodec/opus_parser: Handle complete frames flag.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavformat/mxfenc: fix muxing when audio tracks are longer than video track
Baptiste Coudurier [Mon, 30 Apr 2018 01:44:59 +0000 (18:44 -0700)]
avformat/mxfenc: fix muxing when audio tracks are longer than video track

6 months agoavformat/audiointerleave: pad last audio frame
Baptiste Coudurier [Wed, 21 Mar 2018 21:14:36 +0000 (14:14 -0700)]
avformat/audiointerleave: pad last audio frame

6 months agoavcodec/codec_desc: mark Duck TrueMotion 2.0 Real Time as intra only
Paul B Mahol [Tue, 21 Aug 2018 15:11:43 +0000 (17:11 +0200)]
avcodec/codec_desc: mark Duck TrueMotion 2.0 Real Time as intra only

6 months agoavcodec/nvenc: add option to turn off a53 closed caption embedding
Timo Rothenpieler [Tue, 21 Aug 2018 12:28:15 +0000 (14:28 +0200)]
avcodec/nvenc: add option to turn off a53 closed caption embedding

6 months agoavformat/avidec: fix demuxing of all keyframes of sample 200707170736151.avi
Paul B Mahol [Tue, 14 Aug 2018 18:06:32 +0000 (20:06 +0200)]
avformat/avidec: fix demuxing of all keyframes of sample 200707170736151.avi

6 months agodoc/general: add some missed codecs
Paul B Mahol [Tue, 21 Aug 2018 09:54:45 +0000 (11:54 +0200)]
doc/general: add some missed codecs

6 months agoavcodec: add IMM4 decoder
Paul B Mahol [Fri, 3 Aug 2018 17:43:20 +0000 (19:43 +0200)]
avcodec: add IMM4 decoder

This work is sponsored by VideoLAN.

6 months agoavfilter/buffersrc.h: fix typo of the comment
Steven Liu [Tue, 21 Aug 2018 07:44:33 +0000 (15:44 +0800)]
avfilter/buffersrc.h: fix typo of the comment

6 months agoavformat/nsvdec: Do not parse multiple NSVf
Michael Niedermayer [Thu, 16 Aug 2018 10:23:20 +0000 (12:23 +0200)]
avformat/nsvdec: Do not parse multiple NSVf

The specification states "NSV files may contain a single file header. "
Fixes: out of array access
Fixes: nsv-asan-002f473f726a0dcbd3bd53e422c4fc40b3cf3421

Found-by: Paul Ch <paulcher@icloud.com>
Tested-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/cfhd: Use the actual count instead of the expected in peak_table()
Michael Niedermayer [Sun, 12 Aug 2018 22:58:32 +0000 (00:58 +0200)]
avcodec/cfhd: Use the actual count instead of the expected in peak_table()

Fixes: out of array access (no testcase)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/cfhd: Move peak_table() and difference_coding() calls after the existing...
Michael Niedermayer [Sun, 12 Aug 2018 22:44:48 +0000 (00:44 +0200)]
avcodec/cfhd: Move peak_table() and difference_coding() calls after the existing coefficient count check

Fixes: out of array access
Fixes: 9509/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5283250636324864
Fixes: 9572/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4920757409808384
Fixes: 9596/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5114917580439552
Fixes: 9640/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6247840698335232
Fixes: 9659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6079554987753472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/lagarith: Optimize FRAME_SOLID_RGBA
Michael Niedermayer [Sun, 12 Aug 2018 22:19:55 +0000 (00:19 +0200)]
avcodec/lagarith: Optimize FRAME_SOLID_RGBA

Changes 5466110 decicycles to 1798072 decicycles (tested with fate-suite/lagarith/lag-rgb32.avi)

Fixes: Timeout
Fixes: 9484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5707859156271104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 months agoavformat/matroskaenc: handle AV1 extradata in packet side data
James Almer [Sat, 11 Aug 2018 02:25:32 +0000 (23:25 -0300)]
avformat/matroskaenc: handle AV1 extradata in packet side data

This is a temporary workaround for transcoding scenarious using libaom-av1
encoder, which currently can't propagate extradata during initialization.

Signed-off-by: James Almer <jamrial@gmail.com>
7 months agoImprove hls VOD mode hls performance problem.
Ronak Patel [Sun, 19 Aug 2018 01:57:44 +0000 (09:57 +0800)]
Improve hls VOD mode hls performance problem.

This fixes the creation of the hls manifest in hlsenc.c by writing the
entire manifest at the end for VOD playlists. Live & Event Playlists are unaffected.
This also fixes the behavior with HLS_TEMP_FILE to work correctly when
-hlsflags temp_file is specified, instead of always relying on use_rename, which caused these problems.

Files that would previously take over a week to fragment now take
1 minute on the same hardware. This was a 153 hour audio file (2.2GB of audio).

Signed-off-by: Ronak Patel <ronak2121@yahoo.com>
7 months agoavformat/dashdec: Fix strlen(rep_id_val) with it being NULL
Michael Niedermayer [Sat, 18 Aug 2018 00:19:51 +0000 (02:19 +0200)]
avformat/dashdec: Fix strlen(rep_id_val) with it being NULL

Fixes: dash-crash-da39a3ee5e6b4b0d3255bfef95601890afd80709.xml

Found-by: Paul Ch <paulcher@icloud.com>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 months agoavformat/tls_schannel: Fix use of uninitialized variable
Paweł Wegner [Thu, 2 Aug 2018 19:08:12 +0000 (21:08 +0200)]
avformat/tls_schannel: Fix use of uninitialized variable

Fixes: runtime error: passing uninitialized value to FreeContextBuffer
causes a crash

Signed-off-by: Paweł Wegner <pawel.wegner95@gmail.com>
7 months agolavf/udp: use ff_log_net_error to replace log_net_error
Jun Zhao [Sat, 4 Aug 2018 09:49:57 +0000 (17:49 +0800)]
lavf/udp: use ff_log_net_error to replace log_net_error

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
7 months agolavf/tcp: check return value of setsockopt.
Jun Zhao [Sat, 4 Aug 2018 09:52:16 +0000 (17:52 +0800)]
lavf/tcp: check return value of setsockopt.

when setsockopt fail, use ff_log_net_error to dump the string
describing for error number.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
7 months agolavf/network: check return value of setsockopt.
Jun Zhao [Sun, 5 Aug 2018 12:19:28 +0000 (20:19 +0800)]
lavf/network: check return value of setsockopt.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>