2 years agoMerge commit '04e8b8b0530e2aa33010faba3d0b6b6c9c5b704e'
James Almer [Wed, 20 Feb 2019 16:48:42 +0000 (13:48 -0300)]
Merge commit '04e8b8b0530e2aa33010faba3d0b6b6c9c5b704e'

* commit '04e8b8b0530e2aa33010faba3d0b6b6c9c5b704e':
  avcodec/libaomenc: export the Sequence Header OBU as extradata

This commit is a noop. aom_codec_get_global_headers() is buggy at the moment.
See https://bugs.chromium.org/p/aomedia/issues/detail?id=2208

Merged-by: James Almer <jamrial@gmail.com>
2 years agoMerge commit '97c9a5084479eeb66f4beb100cc7589a2c8bfe81'
James Almer [Wed, 20 Feb 2019 16:48:09 +0000 (13:48 -0300)]
Merge commit '97c9a5084479eeb66f4beb100cc7589a2c8bfe81'

* commit '97c9a5084479eeb66f4beb100cc7589a2c8bfe81':
  avcodec/libaomenc: remove AVOption related to frame partitions
  avcodec/extract_extradata: don't uninitialize the H2645Packet on every processed packet
  avcodec/extract_extradata: Move the reference in the bsf internal buffer
  avcodec/extract_extradata: Do not allocate more space than needed when removing NALUs in h264/hevc
  avcodec/extract_extradata: Zero-initialize the padding bytes in all allocated buffers
  avcodec/extract_extradata_bsf: Fix leak discovered via fuzzing
  avcodec/bsf: Add ff_bsf_get_packet_ref() function

This commit is a noop, see


Merged-by: James Almer <jamrial@gmail.com>
2 years agoaarch64: vp8: Move the vp8dsp makefile entries to the right places
Martin Storsjö [Thu, 31 Jan 2019 21:03:55 +0000 (23:03 +0200)]
aarch64: vp8: Move the vp8dsp makefile entries to the right places

Even if NEON would be disabled, the init functions should be built
as they are called as long as ARCH_AARCH64 is set.

These functions are part of a generic DSP subsytem, not tied directly
to one decoder. (They should be built if the vp7 decoder is enabled,
even if the vp8 decoder is disabled.)

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b4b27dce95a6d40bfcd78043d3abec7d80dae143)

2 years agoaarch64: vp8: Remove superfluous includes
Martin Storsjö [Thu, 31 Jan 2019 21:03:38 +0000 (23:03 +0200)]
aarch64: vp8: Remove superfluous includes

This fixes building with MSVC, which lacks unistd.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit ad32f7b1264dbc614f0db1c443d5361420e9e07e)

2 years agoaarch64: vp8: Fix assembling with armasm64
Martin Storsjö [Thu, 31 Jan 2019 21:49:31 +0000 (23:49 +0200)]
aarch64: vp8: Fix assembling with armasm64

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2eeac79936e83c4495cbe5905064ab797e9b45ff)

2 years agoaarch64: vp8: Fix assembling with clang
Martin Storsjö [Thu, 31 Jan 2019 21:43:45 +0000 (23:43 +0200)]
aarch64: vp8: Fix assembling with clang

This also partially fixes assembling with MS armasm64 (via

The movrel macro invocations need to pass the offset via a separate
parameter. Mach-o and COFF relocations don't allow a negative
offset to a symbol, which is handled properly if the offset is passed
via the parameter. If no offset parameter is given, the macro
evaluates to something like "adrp x17, subpel_filters-16+(0)", which
older clang versions also fail to parse (the older clang versions
only support one single offset term, although it can be a parenthesis.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 26d7af4c381ee3c7b13b032b3817168b84b98ca6)

2 years agopalettegen: Fill with last color, not black
Tomas Härdin [Wed, 16 Jan 2019 12:07:48 +0000 (13:07 +0100)]
palettegen: Fill with last color, not black

If we fill with black then the generated palette will have one color more
than what the user requested. This also resulted in unwanted black specks in
the output of paletteuse, especially when generating small palettes.

2 years agolibavcodec/zmbvenc: motion estimation improvements/bug fixes:
Matthew Fearnley [Thu, 7 Feb 2019 12:54:59 +0000 (12:54 +0000)]
libavcodec/zmbvenc: motion estimation improvements/bug fixes:

- Clamp ME range to -64..63 (prevents corruption when me_range is too high)
- Allow MV's up to *and including* the positive range limit
- Allow out-of-edge ME by padding the prev buffer with a border of 0's
- Try previous MV before checking the rest (improves speed in some cases)
- More robust logic in code - ensure *mx,*my,*xored are updated together

2 years agolibavcodec/zmbvenc: block scoring improvements/bug fixes
Matthew Fearnley [Sat, 9 Feb 2019 13:10:20 +0000 (13:10 +0000)]
libavcodec/zmbvenc: block scoring improvements/bug fixes

- Improve block choices by counting 0-bytes in the entropy score
- Make histogram use uint16_t type, to allow byte counts from 16*16
(current block size) up to 255*255 (maximum allowed 8bpp block size)
- Make sure score table is big enough for a full block's worth of bytes
- Calculate *xored without using code in inner loop

2 years agolavc/libdavs2: fix parameter setting error
hwren [Thu, 24 Jan 2019 15:16:18 +0000 (23:16 +0800)]
lavc/libdavs2: fix parameter setting error

Signed-off-by: hwrenx <hwrenx@126.com>
2 years agolavc/libxavs2: use upper layer qp parameters first
hwren [Thu, 24 Jan 2019 15:16:17 +0000 (23:16 +0800)]
lavc/libxavs2: use upper layer qp parameters first

Signed-off-by: hwrenx <hwrenx@126.com>
2 years agolavc/libxavs2: remove unused context parameter
hwren [Thu, 24 Jan 2019 15:16:16 +0000 (23:16 +0800)]
lavc/libxavs2: remove unused context parameter

Signed-off-by: hwrenx <hwrenx@126.com>
2 years agolavf/mpeg: fix indent
Xiaofeng Wang [Mon, 18 Feb 2019 01:16:58 +0000 (09:16 +0800)]
lavf/mpeg: fix indent

Signed-off-by: Xiaofeng Wang <xiaofeng.wang@bqvision.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/matroskadec: Check parents remaining length
Steve Lhomme [Wed, 13 Feb 2019 12:20:45 +0000 (13:20 +0100)]
avformat/matroskadec: Check parents remaining length

This was found through the Hacker One program on VLC but is not a security issue in libavformat
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/webmdashenc: Check id in adaption_sets
Michael Niedermayer [Wed, 13 Feb 2019 09:15:04 +0000 (10:15 +0100)]
avformat/webmdashenc: Check id in adaption_sets

Fixes: out of array access

Found-by: Wenxiang Qian
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/http: Fix Out-of-Bounds access in process_line()
Wenxiang Qian [Wed, 13 Feb 2019 07:54:08 +0000 (08:54 +0100)]
avformat/http: Fix Out-of-Bounds access in process_line()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/ftp: Fix Out-of-Bounds Access and Information Leak in ftp.c:393
Wenxiang Qian [Wed, 13 Feb 2019 07:47:20 +0000 (08:47 +0100)]
avformat/ftp: Fix Out-of-Bounds Access and Information Leak in ftp.c:393

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop...
Kevin Backhouse via RT [Wed, 6 Feb 2019 12:56:01 +0000 (12:56 +0000)]
avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for handling braces

Fixes: [Semmle Security Reports #19439]
Fixes: dos_sscanf2.mkv

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop...
Kevin Backhouse via RT [Wed, 6 Feb 2019 11:29:22 +0000 (11:29 +0000)]
avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for tag scaning

Fixes: [Semmle Security Reports #19438]
Fixes: dos_sscanf1.mkv

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mpegvideo_enc: Use av_assert1() instead of assert()
Michael Niedermayer [Fri, 1 Feb 2019 21:53:53 +0000 (22:53 +0100)]
avcodec/mpegvideo_enc: Use av_assert1() instead of assert()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/matroskadec: Do not leak queued packets on sync errors
Michael Niedermayer [Wed, 6 Feb 2019 14:29:38 +0000 (15:29 +0100)]
avformat/matroskadec: Do not leak queued packets on sync errors

Fixes: memleak
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-5649187601121280

Reported-by: Chris Cunningham <chcunningham@google.com>
Tested-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agodoc/fftools-common-opts: add example for codec option stream specifiers
Gyan Doshi [Sun, 17 Feb 2019 05:58:31 +0000 (11:28 +0530)]
doc/fftools-common-opts: add example for codec option stream specifiers

2 years agodoc/muxers: grammar fix
Reto Kromer [Wed, 13 Feb 2019 16:03:07 +0000 (17:03 +0100)]
doc/muxers: grammar fix

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 years agolavc/libgsmenc: Force mono and use 13k as default bitrate.
Carl Eugen Hoyos [Sat, 16 Feb 2019 19:18:07 +0000 (20:18 +0100)]
lavc/libgsmenc: Force mono and use 13k as default bitrate.

2 years agoavcodec/mips: [loongson] optimize theora decoding with mmi.
gxw [Tue, 12 Feb 2019 10:55:48 +0000 (18:55 +0800)]
avcodec/mips: [loongson] optimize theora decoding with mmi.

Optimize theora decoding with mmi in functions:
1. ff_vp3_idct_add_mmi
2. ff_vp3_idct_put_mmi
3. ff_vp3_idct_dc_add_mmi
4. ff_put_no_rnd_pixels_l2_mmi

Theora decoding speed improved about 32%(from 88fps to 116fps, Tested on loongson 3A3000).

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mpeg4videodec: Clear interlaced_dct for studio profile
Michael Niedermayer [Fri, 15 Feb 2019 00:57:09 +0000 (01:57 +0100)]
avcodec/mpeg4videodec: Clear interlaced_dct for studio profile

Fixes: Out of array access
Fixes: 13090/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5408668986638336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/version: Bump micro-version for nvdec/cuviddec changes
Philip Langdale [Sat, 16 Feb 2019 18:40:32 +0000 (10:40 -0800)]
avcodec/version: Bump micro-version for nvdec/cuviddec changes

I forgot to add the version bump and changelog within the changes.

2 years agoavcodec/cuviddec: Add support for decoding HEVC 4:4:4 content
Philip Langdale [Sun, 7 Oct 2018 16:10:00 +0000 (09:10 -0700)]
avcodec/cuviddec: Add support for decoding HEVC 4:4:4 content

This is the equivalent change for cuviddec after the previous change
for nvdec. I made similar changes to the copying routines to handle
pixel formats in a more generic way.

Note that unlike with nvdec, there is no confusion about the ability
of a codec to output 444 formats. This is because the cuvid parser is
used, meaning that 444 JPEG content is still indicated as using a 420
output format.

2 years agoavcodec/nvdec: Explicitly mark codecs that support 444 output formats
Philip Langdale [Sun, 7 Oct 2018 03:20:58 +0000 (20:20 -0700)]
avcodec/nvdec: Explicitly mark codecs that support 444 output formats

With the introduction of HEVC 444 support, we technically have two
codecs that can handle 444 - HEVC and MJPEG. In the case of MJPEG,
it can decode, but can only output one of the semi-planar formats.

That means we need additional logic to decide whether to use a
444 output format or not.

2 years agoavcodec/nvdec: Add support for decoding HEVC 4:4:4 content
Philip Langdale [Sun, 7 Oct 2018 01:11:52 +0000 (18:11 -0700)]
avcodec/nvdec: Add support for decoding HEVC 4:4:4 content

The latest generation video decoder on the Turing chips supports
decoding HEVC 4:4:4. Supporting this is relatively straight-forward;
we need to account for the different chroma format and pick the
right output and sw formats at the right times.

There was one bug which was the hard-coded assumption that the
first chroma plane would be half-height; I fixed this to use the
actual shift value on the plane.

We also need to pass the SPS and PPS range extension flags.

2 years agoavcodec/hevc_ps: Expose all SPS and PPS range extension flags
Philip Langdale [Wed, 13 Feb 2019 20:40:52 +0000 (12:40 -0800)]
avcodec/hevc_ps: Expose all SPS and PPS range extension flags

We need all the flags to be exposed to be able to pass them on to
HW decoders. I did not attempt to nuance any of the warnings about
flags being unsupported as there's no way, at the point we extract
flags, to say whether an HW decoder is being used.

2 years agoavutil/cuda_check: fix usage of removed .c file
Timo Rothenpieler [Thu, 14 Feb 2019 23:37:49 +0000 (00:37 +0100)]
avutil/cuda_check: fix usage of removed .c file

Why did this not break compilation?

2 years agoavformat/mov: Do not use reference stream in mov_read_sidx() if there is no reference...
Michael Niedermayer [Tue, 12 Feb 2019 22:28:35 +0000 (23:28 +0100)]
avformat/mov: Do not use reference stream in mov_read_sidx() if there is no reference stream

Fixes: NULL pointer dereference
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-5634316373721088

Reported-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/nvenc: add b_as_ref support for HEVC
Roman Arzumanyan [Thu, 14 Feb 2019 12:20:25 +0000 (13:20 +0100)]
avcodec/nvenc: add b_as_ref support for HEVC

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2 years agoavutil/cuda_check: avoid pointlessly exporting same symbol from two libraries
Timo Rothenpieler [Fri, 8 Feb 2019 21:47:01 +0000 (22:47 +0100)]
avutil/cuda_check: avoid pointlessly exporting same symbol from two libraries

2 years agoavformat/utils: parse some stream specifiers recursively
Marton Balint [Mon, 4 Feb 2019 23:16:36 +0000 (00:16 +0100)]
avformat/utils: parse some stream specifiers recursively

This removes lots of code duplication and also allows more complex specifiers,
for example you can use p:204:a:m:language:eng to select the English language
audio stream from program 204.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/mpegts: also convert strings without a specified encoding to UTF-8
Marton Balint [Sat, 9 Feb 2019 23:33:04 +0000 (00:33 +0100)]
avformat/mpegts: also convert strings without a specified encoding to UTF-8

The default codepage (ISO6937) should be used in this case.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/mpegts: fix charset of type 0x11
Marton Balint [Sat, 9 Feb 2019 23:25:05 +0000 (00:25 +0100)]
avformat/mpegts: fix charset of type 0x11

ISO-10646 alone means UCS-4 for iconv, the specs refers to the Basic
Multilingual Plane (BMP), therefore we need UCS-2. VLC also using that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agodoc/muxers: fix typo
Reto Kromer [Wed, 13 Feb 2019 13:08:23 +0000 (14:08 +0100)]
doc/muxers: fix typo

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 years agoavfilter/tests/integral: Correct the comment
Jun Zhao [Wed, 13 Feb 2019 11:59:39 +0000 (19:59 +0800)]
avfilter/tests/integral: Correct the comment

Correct the comment

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 years agoconfigure: fix dependencies for mlp and truehd encoders
Moritz Barsnick [Tue, 12 Feb 2019 16:51:26 +0000 (17:51 +0100)]
configure: fix dependencies for mlp and truehd encoders

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
2 years agolavc/libaribb24: use integer math to calculate font scaling
Jan Ekström [Mon, 11 Feb 2019 01:01:51 +0000 (03:01 +0200)]
lavc/libaribb24: use integer math to calculate font scaling

2 years agolavc/libaribb24: add missing type struct members to AVOptions
Jan Ekström [Mon, 11 Feb 2019 00:09:48 +0000 (02:09 +0200)]
lavc/libaribb24: add missing type struct members to AVOptions

2 years agolavc/libaribb24: protect handled value with parenthesis in RGB_TO_BGR
Jan Ekström [Mon, 11 Feb 2019 00:06:37 +0000 (02:06 +0200)]
lavc/libaribb24: protect handled value with parenthesis in RGB_TO_BGR

2 years agolavc/libaribb24: add error handling to region handling
Jan Ekström [Sun, 10 Feb 2019 23:54:26 +0000 (01:54 +0200)]
lavc/libaribb24: add error handling to region handling

Fixes some rather embarrassing mistakes that somehow passed my

* Now catches if memory allocation has failed during bprint usage
  by checking av_bprint_is_complete().
* Now catches if adding an ASS rectangle into an AVSubtitle failed.
* Returns AVERROR_INVALIDDATA if we get an invalid region buffer

2 years agotests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts/pts
Jun Zhao [Tue, 12 Feb 2019 06:16:57 +0000 (14:16 +0800)]
tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts/pts

Use av_ts2str() for AVFrame.pkt_dts/pts to avoid print the
pkt_dts/pts as negative number like:
"0,    3616613, -9223372036854775808,     1001,  3110400, 0x75e37a65"

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 years agoavfilter/tests/integral: Fix build warning after adjust the location
Jun Zhao [Sun, 10 Feb 2019 06:28:22 +0000 (14:28 +0800)]
avfilter/tests/integral: Fix build warning after adjust the location

Fix build warning like "warning: ISO C90 forbids mixed declarations
and code" after adjust the location for malloc fail check.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 years agoavfilter/tests/integral: Check malloc fail before using it
Jun Zhao [Sun, 10 Feb 2019 04:57:44 +0000 (12:57 +0800)]
avfilter/tests/integral: Check malloc fail before using it

Need to check malloc fail before using it, so adjust the location
in the code.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 years agoconfigure: warn about disabled explicitly enabled components
Marton Balint [Mon, 28 Jan 2019 00:49:46 +0000 (01:49 +0100)]
configure: warn about disabled explicitly enabled components

If we enable a component but a dependant library is disabled, then the enabled
component gets silently disabled. Warning about disabled explicitly enabled components
allows configure to show the missing dependencies and if --fatal-warnings is
used it can also fail if the user wants it so.

For example if libdav1d is not availble ./configure --enable-decoder=libdav1d
succeeds but the libdav1d decoder is not be enabled. After the patch configure
will warn about this:

WARNING: Disabled libdav1d_decoder because not all dependencies are satisfied: libdav1d

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/mov: fix hang while seek on a kind of fragmented mp4
Charles Liu [Sun, 3 Feb 2019 15:09:06 +0000 (23:09 +0800)]
avformat/mov: fix hang while seek on a kind of fragmented mp4

Binary searching would hang if the fragment items do NOT have timestamp for the
specified stream.

For example, a fmp4 consists of separated 'moof' boxes for each track, and
separated 'sidx' for each segment, but no 'mfra' box.  Then every fragment item
only have the timestamp for one of its tracks.

ffmpeg -f lavfi -i testsrc -f lavfi -i sine -movflags dash+frag_keyframe+skip_trailer+separate_moof -t 1 out.mp4
ffmpeg -ss 0.5 -i out.mp4 -f null none

Also fixes the hang in ticket #7572, but not the reason for having
AV_NOPTS_VALUE timestamps there.

Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/mov: don't rescale mastering display values from the SmDm atom
James Almer [Sat, 9 Feb 2019 23:14:14 +0000 (20:14 -0300)]
avformat/mov: don't rescale mastering display values from the SmDm atom

Simplifies code.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agodoc/faq: update macOS and URLs
Reto Kromer [Sun, 10 Feb 2019 16:44:10 +0000 (17:44 +0100)]
doc/faq: update macOS and URLs

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 years agoavcodec/cbs_av1: don't call cbs_av1_read_trailing_bits() when no bits remain in the OBU
James Almer [Sun, 10 Feb 2019 20:41:38 +0000 (17:41 -0300)]
avcodec/cbs_av1: don't call cbs_av1_read_trailing_bits() when no bits remain in the OBU

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agolavf/img2: Move "loop" into common options.
Carl Eugen Hoyos [Sun, 10 Feb 2019 17:56:46 +0000 (18:56 +0100)]
lavf/img2: Move "loop" into common options.

While the image2pipe demuxer ignores the option - confusing users -
the autodetecting demuxers that are favoured over image2 act on it.

2 years agolavf/img2dec: Split img2 and img2pipe options.
Carl Eugen Hoyos [Sun, 10 Feb 2019 16:56:01 +0000 (17:56 +0100)]
lavf/img2dec: Split img2 and img2pipe options.

2 years agodoc/snow: fix typos
Reto Kromer [Sun, 10 Feb 2019 12:24:05 +0000 (13:24 +0100)]
doc/snow: fix typos

2 years agodoc: fix various typos
Moritz Barsnick [Sun, 10 Feb 2019 11:10:20 +0000 (12:10 +0100)]
doc: fix various typos

Found with the help of codespell-1.14.0.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 years agodoc/filters: fix typos
Reto Kromer [Sun, 10 Feb 2019 05:59:09 +0000 (06:59 +0100)]
doc/filters: fix typos

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 years agoavformat/hlsenc: fix fmp4_init_filename file name with %v problem
Steven Liu [Sat, 19 Jan 2019 06:59:44 +0000 (14:59 +0800)]
avformat/hlsenc: fix fmp4_init_filename file name with %v problem

when set option fmp4_init_filename to init_%v.mp4
before patch:
the init file will be init_%v_0.mp4, init_%v_1.mp4
after patch:
the init file will be init_0.mp4, init_1.mp4

Reported-By: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 years agolavf/mpegts: add reading of ARIB data coding descriptor
Jan Ekström [Mon, 14 Jan 2019 20:07:51 +0000 (22:07 +0200)]
lavf/mpegts: add reading of ARIB data coding descriptor

This enables us to read the data coding type utilized for
a specific private data stream, of which we currently are
interested in ARIB caption streams.

The component tag limitations are according to ARIB TR-B14,
and the component IDs are defined in ARIB STD-B10.

2 years agoadd libaribb24 ARIB STD-B24 caption decoder
Jan Ekström [Mon, 14 Jan 2019 19:52:23 +0000 (21:52 +0200)]
add libaribb24 ARIB STD-B24 caption decoder

* Outputs ASS lines with basic coloring and font scaling for each
  given region.
* Sets the default style to the resolution of the subtitle plane
  (for example, 960x540 / 36pt font for profile A).
* Has options to:
  * Disable ruby text (which is coded as regions which have
    half-height text in libaribb24).
    Enabled by default as without positioning ruby text only
    confuses as it is usually coded in the beginning of the decoded
    subtitle line.
  * Set the working directory, in which libaribb24 will read
    configuration as well as into which it may save broadcast extra
    symbols as PNG.
    Unset by default.

The unconventional library check can be explained by the library's
current master branch being licensed as LGPLv3, but at the time of
writing the latest official release is still licensed under GPLv3.

Thus, one either has to wait for the following release, or enable

2 years agolavf/mpegts: Convert service_name and service_provider to utf-8.
Carl Eugen Hoyos [Sat, 9 Feb 2019 17:38:13 +0000 (18:38 +0100)]
lavf/mpegts: Convert service_name and service_provider to utf-8.

Fixes ticket #6320.

2 years agodoc/ffprobe: fix typo and update URL in man
Reto Kromer [Sat, 9 Feb 2019 18:07:46 +0000 (19:07 +0100)]
doc/ffprobe: fix typo and update URL in man

2 years agotools/target_dec_fate.list: Extend selftests upto issue 2000
Michael Niedermayer [Sun, 3 Feb 2019 14:34:40 +0000 (15:34 +0100)]
tools/target_dec_fate.list: Extend selftests upto issue 2000

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/sbrdsp_fixed.c: remove input value limit for sbr_sum_square_c()
Michael Niedermayer [Sun, 3 Feb 2019 14:13:03 +0000 (15:13 +0100)]
avcodec/sbrdsp_fixed.c: remove input value limit for sbr_sum_square_c()

Fixes: 1377/clusterfuzz-testcase-minimized-5487049807233024
Fixes: assertion failure in sbr_sum_square_c()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolavu/parseutils: Allow to parse >= 100 hours.
Carl Eugen Hoyos [Sat, 9 Feb 2019 00:20:43 +0000 (01:20 +0100)]
lavu/parseutils: Allow to parse >= 100 hours.

Reported and tested by gamnark.
Fixes ticket #7721.

2 years agoavcodec/h264_parse: Clear ref_list[1] if only [0] is used
Michael Niedermayer [Fri, 8 Feb 2019 10:04:54 +0000 (11:04 +0100)]
avcodec/h264_parse: Clear ref_list[1] if only [0] is used

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/h264_parse: no need check ref list1 for P slices.
Decai Lin [Thu, 31 Jan 2019 07:36:56 +0000 (15:36 +0800)]
avcodec/h264_parse: no need check ref list1 for P slices.

This is robust for some corner case there is incorrect list1 count
in pps header, but it's a P slice and can be decoded well.

Signed-off-by: Decai Lin <decai.lin@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/mov: validate chunk_count vs stsc_data
chcunningham [Thu, 7 Feb 2019 22:58:17 +0000 (14:58 -0800)]
avformat/mov: validate chunk_count vs stsc_data

Bad content may contain stsc boxes with a first_chunk index that
exceeds stco.entries (chunk_count). This ammends the existing check to
include cases where chunk_count == 0. It also patches up the case
when stsc refers to unknown chunks, but stts has no samples (so we
can simply ignore stsc).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/mov.c: require tfhd to begin parsing trun
chcunningham [Thu, 7 Feb 2019 00:12:51 +0000 (16:12 -0800)]
avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoffplay: add support for setting the number of filter threads
Marton Balint [Sat, 2 Feb 2019 19:30:16 +0000 (20:30 +0100)]
ffplay: add support for setting the number of filter threads

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoffplay: add missing avfilter_graph_alloc result check
Marton Balint [Sat, 2 Feb 2019 18:33:34 +0000 (19:33 +0100)]
ffplay: add missing avfilter_graph_alloc result check

Also do not allocate a graph at start, we will reallocate it anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoffplay: use different decoder names for each media type
Marton Balint [Sat, 2 Feb 2019 10:32:50 +0000 (11:32 +0100)]
ffplay: use different decoder names for each media type

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/movenc: Add more error checking when writing sample entries.
Nikolas Bowe [Tue, 5 Feb 2019 01:02:19 +0000 (17:02 -0800)]
avformat/movenc: Add more error checking when writing sample entries.

Fixes a problem where a sample entry which cannot be written correctly appears to succeed, but produces an invalid file.
For example, this command:
ffmpeg -f lavfi -i sine=frequency=1000:duration=5 -codec:a ac3 -movflags +empty_moov -frag_duration 5000000 /tmp/foo.mp4
produced a file with the ac-3 sample entry, but no AC3SpecificBox (dac3) child, which is invalid according to ETSI TS 102 366.

Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mpegvideo_enc: Use av_assert1() instead of assert() in merge_context_after_en...
Michael Niedermayer [Fri, 1 Feb 2019 16:08:35 +0000 (17:08 +0100)]
avcodec/mpegvideo_enc: Use av_assert1() instead of assert() in merge_context_after_encode()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/ac3: Explicitly return to discard large amounts of nonsense bytes
Michael Niedermayer [Wed, 30 Jan 2019 23:45:51 +0000 (00:45 +0100)]
avcodec/ac3: Explicitly return to discard large amounts of nonsense bytes

Changes 19sec to 10ms (12559) runtime, 17sec to 177ms (12570)
Fixes: Timeout
Fixes: 12559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5666516266123264
Fixes: 12561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5682923041193984
Fixes: 12570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5194734308425728

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 agolibavformat/dashdec: disable seeking only for live streams.
Paweł Wegner [Mon, 4 Feb 2019 20:27:29 +0000 (21:27 +0100)]
libavformat/dashdec: disable seeking only for live streams.

Signed-off-by: Paweł Wegner <pawel.wegner95@gmail.com>
2 years agolibswscale/ppc: VSX-optimize 9-16 bit yuv2planeX
Lauri Kasanen [Sun, 13 Jan 2019 08:26:20 +0000 (10:26 +0200)]
libswscale/ppc: VSX-optimize 9-16 bit yuv2planeX

./ffmpeg_g -f rawvideo -pix_fmt rgb24 -s hd1080 -i /dev/zero -pix_fmt yuv420p16be \
-s 1920x1728 -f null -vframes 100 -v error -nostats -

9-14 bit funcs get about 6x speedup, 16-bit gets about 15x.
Fate passes, each format tested with an image to video conversion.

Only POWER8 includes 32-bit vector multiplies, so POWER7 is locked out
of the 16-bit function. This includes the vec_mulo/mule functions too,
not just vmuluwm.

With TIMER_REPORT skips disabled:
  12412 UNITS in planarX,  131072 runs,      0 skips
  73136 UNITS in planarX,  131072 runs,      0 skips
  12481 UNITS in planarX,  131072 runs,      0 skips
  73410 UNITS in planarX,  131072 runs,      0 skips
  12322 UNITS in planarX,  131072 runs,      0 skips
  72546 UNITS in planarX,  131072 runs,      0 skips
  12291 UNITS in planarX,  131072 runs,      0 skips
  72935 UNITS in planarX,  131072 runs,      0 skips
  12316 UNITS in planarX,  131072 runs,      0 skips
  72708 UNITS in planarX,  131072 runs,      0 skips
  12319 UNITS in planarX,  131072 runs,      0 skips
  72577 UNITS in planarX,  131072 runs,      0 skips
  12259 UNITS in planarX,  131072 runs,      0 skips
  72516 UNITS in planarX,  131072 runs,      0 skips
  12440 UNITS in planarX,  131072 runs,      0 skips
  72962 UNITS in planarX,  131072 runs,      0 skips
  10548 UNITS in planarX,  131072 runs,      0 skips
  73429 UNITS in planarX,  131072 runs,      0 skips
  10634 UNITS in planarX,  131072 runs,      0 skips
 150959 UNITS in planarX,  131072 runs,      0 skips

Signed-off-by: Lauri Kasanen <cand@gmx.com>
2 years agoavutil/ppc/cpu: Fix power8 linux detection
Lauri Kasanen [Tue, 8 Jan 2019 08:59:22 +0000 (10:59 +0200)]
avutil/ppc/cpu: Fix power8 linux detection

The existing code was in no released kernel that I can see. The corrected code
was added in 3.9.

2 years agoavformat/async: fix assertion condition when draining buffer
Marton Balint [Sun, 27 Jan 2019 18:48:12 +0000 (19:48 +0100)]
avformat/async: fix assertion condition when draining buffer

Fixes some random assertion failures with

ffprobe -show_packets async:samples/ffmpeg-bugs/trac/ticket6132/Samsung_HDR_-_Chasing_the_Light.ts > /dev/null

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavformat/mpegts: cache PID discard values
Marton Balint [Wed, 23 Jan 2019 00:28:26 +0000 (01:28 +0100)]
avformat/mpegts: cache PID discard values

discard_pid can be quite expensive, so let's cache it and recalculate it on
every packet start.

ffmpeg -y -i samples/MPEG-VOB/sdtv/RAI.ts -c copy -map 0:v:0 -map 0:a:0 -f mpegts /dev/null

   1685 decicycles in handle_packet,  523483 runs,    805 skips

    883 decicycles in handle_packet,  523505 runs,    783 skips

Signed-off-by: Marton Balint <cus@passwd.hu>
2 years agoavcodec/mpeg4_unpack_bframes_bsf: Use avpriv_find_start_code
Andreas Rheinhardt [Sat, 2 Feb 2019 19:34:11 +0000 (20:34 +0100)]
avcodec/mpeg4_unpack_bframes_bsf: Use avpriv_find_start_code

instead of an ad-hoc function to search for start codes in order to
remove code duplication and to improve performance.

Improved performance of finding startcodes from 52606 decicycles to
9543 decicycles based upon 262144 runs for a 1 Mb/s MPEG4 video.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoMAINTAINERS: add myself to the PPC section
Lauri Kasanen [Sun, 27 Jan 2019 18:51:19 +0000 (20:51 +0200)]
MAINTAINERS: add myself to the PPC section

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agodoc/filters: correct headphone examples
Gyan Doshi [Mon, 4 Feb 2019 05:07:11 +0000 (10:37 +0530)]
doc/filters: correct headphone examples

lavfi-complex is not a valid option. [a:0] is not correct pad form for input.

2 years agoavcodec/pgssubdec: Check for duplicate display segments
Michael Niedermayer [Tue, 29 Jan 2019 00:06:01 +0000 (01:06 +0100)]
avcodec/pgssubdec: Check for duplicate display segments

In such a duplication the previous gets overwritten and leaks

Fixes: memleak
Fixes: 12510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5694439226343424

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/mips: [loongson] optimize put_hevc_qpel_h_8 with mmi.
Shiyou Yin [Fri, 1 Feb 2019 06:05:02 +0000 (14:05 +0800)]
avcodec/mips: [loongson] optimize put_hevc_qpel_h_8 with mmi.

Optimize put_hevc_qpel_h_8 with mmi in the case width=4/8/12/16/24/32/48/64.
This optimization improved HEVC decoding performance 2%(2.39x to 2.44x, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mips: [loongson] optimize put_hevc_qpel_bi_h_8 with mmi.
Shiyou Yin [Fri, 1 Feb 2019 06:05:01 +0000 (14:05 +0800)]
avcodec/mips: [loongson] optimize put_hevc_qpel_bi_h_8 with mmi.

Optimize put_hevc_qpel_bi_h_8 with mmi in the case width=4/8/12/16/24/32/48/64.
This optimization improved HEVC decoding performance 2.1%(2.34x to 2.39x, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mips: [loongson] optimize put_hevc_epel_bi_hv_8 with mmi.
Shiyou Yin [Fri, 1 Feb 2019 06:05:00 +0000 (14:05 +0800)]
avcodec/mips: [loongson] optimize put_hevc_epel_bi_hv_8 with mmi.

Optimize put_hevc_epel_bi_hv_8 with mmi in the case width=4/8/12/16/24/32.
This optimization improved HEVC decoding performance 1.7%(2.30x to 2.34x, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/mips: [loongson] optimize put_hevc_qpel_uni_hv_8 with mmi.
Shiyou Yin [Fri, 1 Feb 2019 06:04:59 +0000 (14:04 +0800)]
avcodec/mips: [loongson] optimize put_hevc_qpel_uni_hv_8 with mmi.

Optimize put_hevc_qpel_uni_hv_8 with mmi in the case width=4/8/12/16/24/32/48/64.
This optimization improved HEVC decoding performance 2.7%(2.24x to 2.30x, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavfilter/vf_mix: always output frame if array is filled
Paul B Mahol [Sat, 2 Feb 2019 17:54:54 +0000 (18:54 +0100)]
avfilter/vf_mix: always output frame if array is filled

2 years agoavfilter/vf_mix: add timeline support to tmix filter
Paul B Mahol [Sat, 2 Feb 2019 17:52:03 +0000 (18:52 +0100)]
avfilter/vf_mix: add timeline support to tmix filter

2 years agodoc/filters: document ranges and defaults for nlmeans options
Jun Zhao [Fri, 1 Feb 2019 06:00:04 +0000 (14:00 +0800)]
doc/filters: document ranges and defaults for nlmeans options

document ranges and defaults for nlmeans options

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 years agolavu/imgutils: Use FFABS() instead of abs() for ptrdiff_t.
Carl Eugen Hoyos [Fri, 1 Feb 2019 22:18:05 +0000 (23:18 +0100)]
lavu/imgutils: Use FFABS() instead of abs() for ptrdiff_t.

Fixes a warning with clang:
libavutil/imgutils.c:314:16: warning: absolute value function 'abs'
given an argument of type 'ptrdiff_t' (aka 'long') but has
parameter of type 'int' which may cause truncation of value

2 years agolavfi/nlmeans: use a dynamic size for the weight LUT
Clément Bœsch [Fri, 1 Feb 2019 19:50:34 +0000 (20:50 +0100)]
lavfi/nlmeans: use a dynamic size for the weight LUT

2 years agolavfi/nlmeans: simplify log() call
Clément Bœsch [Fri, 1 Feb 2019 19:45:52 +0000 (20:45 +0100)]
lavfi/nlmeans: simplify log() call

2 years agolavfi/nlmeans: improve the performance
Jun Zhao [Fri, 1 Feb 2019 02:45:24 +0000 (10:45 +0800)]
lavfi/nlmeans: improve the performance

Remove the pdiff_lut_scale in nlmeans and increase weight_lut table size
from 2^9 to 500000, this change will avoid using pdiff_lut_scale in
nlmeans_slice() for weight_lut table search, improving the performance
by about 12%. (in 1080P size picture case).

Use the profiling command like:

perf stat -a -d -r 5 ./ffmpeg -i input -an -vf nlmeans=s=30 -vframes 10 \
-f null /dev/null

without this change:
when s=1.0(default value) 63s
     s=30.0               72s

after this change:
     s=1.0(default value) 56s
     s=30.0               63s

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Clément Bœsch <u@pkh.me>
2 years agolavc/aarch64/vp8dsp: Fix the include guard.
Carl Eugen Hoyos [Thu, 31 Jan 2019 21:35:44 +0000 (22:35 +0100)]
lavc/aarch64/vp8dsp: Fix the include guard.

Fixes fate-source.

2 years agoINSTALL.md: Fix Markdown formatting
Justin Bull [Thu, 31 Jan 2019 16:46:49 +0000 (11:46 -0500)]
INSTALL.md: Fix Markdown formatting

Signed-off-by: Lou Logan <lou@lrcd.com>
2 years agolibavcodec: vp8 neon optimizations for aarch64
Magnus Röös [Thu, 31 Jan 2019 16:04:27 +0000 (17:04 +0100)]
libavcodec: vp8 neon optimizations for aarch64

Partial port of the ARM Neon for aarch64.

Benchmarks from fate:

benchmarking with Linux Perf Monitoring API
nop: 58.6
checkasm: using random seed 1760970128
 - vp8dsp.idct       [OK]
 - vp8dsp.mc         [OK]
 - vp8dsp.loopfilter [OK]
checkasm: all 21 tests passed
vp8_idct_add_c: 201.6
vp8_idct_add_neon: 83.1
vp8_idct_dc_add_c: 107.6
vp8_idct_dc_add_neon: 33.8
vp8_idct_dc_add4y_c: 426.4
vp8_idct_dc_add4y_neon: 59.4
vp8_loop_filter8uv_h_c: 688.1
vp8_loop_filter8uv_h_neon: 216.3
vp8_loop_filter8uv_inner_h_c: 649.3
vp8_loop_filter8uv_inner_h_neon: 195.3
vp8_loop_filter8uv_inner_v_c: 544.8
vp8_loop_filter8uv_inner_v_neon: 131.3
vp8_loop_filter8uv_v_c: 706.1
vp8_loop_filter8uv_v_neon: 141.1
vp8_loop_filter16y_h_c: 668.8
vp8_loop_filter16y_h_neon: 242.8
vp8_loop_filter16y_inner_h_c: 647.3
vp8_loop_filter16y_inner_h_neon: 224.6
vp8_loop_filter16y_inner_v_c: 647.8
vp8_loop_filter16y_inner_v_neon: 128.8
vp8_loop_filter16y_v_c: 721.8
vp8_loop_filter16y_v_neon: 154.3
vp8_loop_filter_simple_h_c: 387.8
vp8_loop_filter_simple_h_neon: 187.6
vp8_loop_filter_simple_v_c: 384.1
vp8_loop_filter_simple_v_neon: 78.6
vp8_put_epel8_h4v4_c: 3971.1
vp8_put_epel8_h4v4_neon: 855.1
vp8_put_epel8_h4v6_c: 5060.1
vp8_put_epel8_h4v6_neon: 989.6
vp8_put_epel8_h6v4_c: 4320.8
vp8_put_epel8_h6v4_neon: 1007.3
vp8_put_epel8_h6v6_c: 5449.3
vp8_put_epel8_h6v6_neon: 1158.1
vp8_put_epel16_h6_c: 6683.8
vp8_put_epel16_h6_neon: 831.8
vp8_put_epel16_h6v6_c: 11110.8
vp8_put_epel16_h6v6_neon: 2214.8
vp8_put_epel16_v6_c: 7024.8
vp8_put_epel16_v6_neon: 799.6
vp8_put_pixels8_c: 112.8
vp8_put_pixels8_neon: 78.1
vp8_put_pixels16_c: 131.3
vp8_put_pixels16_neon: 129.8

Signed-off-by: Magnus Röös <mla2.roos@gmail.com>
2 years agotests/checkasm/checkasm: Do not define an unused function.
Carl Eugen Hoyos [Thu, 31 Jan 2019 19:16:17 +0000 (20:16 +0100)]
tests/checkasm/checkasm: Do not define an unused function.

Fixes the following warning:
tests/checkasm/checkasm.c:615:12: warning: 'bench_init_ffmpeg' defined but not used