ffmpeg.git
10 months agoavformat/file: add seekable option to disallow seeking
Marton Balint [Tue, 2 Apr 2019 23:13:55 +0000 (01:13 +0200)]
avformat/file: add seekable option to disallow seeking

Signed-off-by: Marton Balint <cus@passwd.hu>
10 months agoavformat/mxfdec: export operational pattern UL as file metadata
Marton Balint [Tue, 2 Apr 2019 16:24:21 +0000 (18:24 +0200)]
avformat/mxfdec: export operational pattern UL as file metadata

Can be useful for API users as ffmpeg/libavformat can't properly support some
operational patterns.

Signed-off-by: Marton Balint <cus@passwd.hu>
10 months agoconfigure: fix av1_frame_split bsf dependencies
James Almer [Thu, 11 Apr 2019 18:59:34 +0000 (15:59 -0300)]
configure: fix av1_frame_split bsf dependencies

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agoavcodec: add an AV1 frame split bitstream filter
James Almer [Tue, 18 Dec 2018 00:56:27 +0000 (21:56 -0300)]
avcodec: add an AV1 frame split bitstream filter

This will be needed by the eventual native AV1 decoder.

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agoavcodec/agm: Check frame dimensions
Michael Niedermayer [Wed, 10 Apr 2019 22:36:48 +0000 (00:36 +0200)]
avcodec/agm: Check frame dimensions

Fixes: out of array access
Fixes: 14110/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5649184864075776

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>
10 months agoavcodec: add ADPCM AGM decoder
Paul B Mahol [Wed, 10 Apr 2019 10:10:09 +0000 (12:10 +0200)]
avcodec: add ADPCM AGM decoder

10 months agoavcodec/agm: add support for non-dct coding
Paul B Mahol [Tue, 9 Apr 2019 11:57:53 +0000 (13:57 +0200)]
avcodec/agm: add support for non-dct coding

10 months agoavcodec/agm: add support for higher compression
Paul B Mahol [Fri, 29 Mar 2019 13:43:42 +0000 (14:43 +0100)]
avcodec/agm: add support for higher compression

10 months agoswscale/ppc: VSX-optimize non-full-chroma yuv2rgb_2
Lauri Kasanen [Fri, 5 Apr 2019 08:31:43 +0000 (11:31 +0300)]
swscale/ppc: VSX-optimize non-full-chroma yuv2rgb_2

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 -sws_flags fast_bilinear \
        -s 1200x720 -f null -vframes 100 -pix_fmt $i -nostats \
        -cpuflags 0 -v error -

32-bit mul, power8 only.

~2x speedup:

rgb24
  24431 UNITS in yuv2packed2,   16384 runs,      0 skips
  13783 UNITS in yuv2packed2,   16383 runs,      1 skips
bgr24
  24396 UNITS in yuv2packed2,   16384 runs,      0 skips
  14059 UNITS in yuv2packed2,   16384 runs,      0 skips
rgba
  26815 UNITS in yuv2packed2,   16383 runs,      1 skips
  12797 UNITS in yuv2packed2,   16383 runs,      1 skips
bgra
  27060 UNITS in yuv2packed2,   16384 runs,      0 skips
  13138 UNITS in yuv2packed2,   16384 runs,      0 skips
argb
  26998 UNITS in yuv2packed2,   16384 runs,      0 skips
  12728 UNITS in yuv2packed2,   16381 runs,      3 skips
bgra
  26651 UNITS in yuv2packed2,   16384 runs,      0 skips
  13124 UNITS in yuv2packed2,   16384 runs,      0 skips

This is a low speedup, but the x86 mmx version also gets only ~2x. The mmx version
is also heavily inaccurate, while the vsx version has high accuracy.

10 months agoavcodec/pnm_parser: Factor out next/index compensation
Michael Niedermayer [Sat, 6 Apr 2019 12:43:14 +0000 (14:43 +0200)]
avcodec/pnm_parser: Factor out next/index compensation

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/pnm_parser: Factor next initialization out
Michael Niedermayer [Sat, 6 Apr 2019 12:41:33 +0000 (14:41 +0200)]
avcodec/pnm_parser: Factor next initialization out

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/pnm_parser: Support concatenated ASCII images
Michael Niedermayer [Sat, 6 Apr 2019 11:11:10 +0000 (13:11 +0200)]
avcodec/pnm_parser: Support concatenated ASCII images

Fixes: Timeout (8sec -> 0.1sec)
Fixes: 13864/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5737860621139968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavdevice/opengl_enc: fix build error using msvc compiler
Don C. Bigler [Tue, 9 Apr 2019 14:54:45 +0000 (10:54 -0400)]
avdevice/opengl_enc: fix build error using msvc compiler

10 months agolibavformat/dashenc : Prevent writing manifest files multiple times
joepadmiraal [Mon, 8 Apr 2019 12:53:52 +0000 (14:53 +0200)]
libavformat/dashenc : Prevent writing manifest files multiple times

10 months agoaarch64/opusdsp: implement NEON accelerated postfilter and deemphasis
Lynne [Fri, 15 Mar 2019 14:37:31 +0000 (14:37 +0000)]
aarch64/opusdsp: implement NEON accelerated postfilter and deemphasis

153372 UNITS in postfilter_c,   65536 runs,      0 skips
73164 UNITS in postfilter_neon,   65536 runs,      0 skips -> 2.1x speedup

80591 UNITS in deemphasis_c,  131072 runs,      0 skips
43969 UNITS in deemphasis_neon,  131072 runs,      0 skips -> 1.83x speedup

Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x realtime)

Deemphasis SIMD based on the following unrolling:
const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
float state = coeff;

for (int i = 0; i < len; i += 4) {
    y[0] = x[0] + c1*state;
    y[1] = x[1] + c2*state + c1*x[0];
    y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
    y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];

    state = y[3];
    y += 4;
    x += 4;
}

Unlike the x86 version, duplication is used instead of pslldq so
the structure and tables are different.

10 months agolibavutil/hwcontext_opencl: Fix channel order in format support check
Jarek Samic [Mon, 8 Apr 2019 02:01:23 +0000 (22:01 -0400)]
libavutil/hwcontext_opencl: Fix channel order in format support check

The `opencl_get_plane_format` function was incorrectly determining the
value used to set the image channel order. This resulted in all RGB
pixel formats being set to the `CL_RGBA` pixel format, regardless of
whether or not they actually *were* RGBA.

This patch fixes the issue by using the `offset` and depth of components
rather than the loop index to determine the value of `order`.

Signed-off-by: Jarek Samic <cldfire3@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
10 months agoavformat/matroskaenc: fix leak on error
Tristan Matthews [Thu, 4 Apr 2019 16:56:26 +0000 (12:56 -0400)]
avformat/matroskaenc: fix leak on error

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agolavf/movenc: Pass correct pointer to av_log().
Carl Eugen Hoyos [Sun, 7 Apr 2019 21:28:00 +0000 (23:28 +0200)]
lavf/movenc: Pass correct pointer to av_log().

10 months agolavf/matroskaenc: Fix memory leak after write trailer
Jun Zhao [Thu, 4 Apr 2019 15:47:46 +0000 (23:47 +0800)]
lavf/matroskaenc: Fix memory leak after write trailer

Fix memory leak after write trailer for #7827, only store a audio
packet whose buffer has size greater than zero in cur_audio_pkt.

Audio packets with size zero, but with side-data currently lead to
memleaks, in the Matroska muxer, because they are not properly freed:

They are currently put into an AVPacket in the MatroskaMuxContext to
ensure that the necessary audio is always available for a new cluster,
but are only written and freed when their size is > 0.

As the only use we have for such packets consists in updating the
CodecPrivate it makes no sense to store these packets at all and this
is how this commit solves the memleak.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
10 months agoavformat/av1: Initialize padding in ff_isom_write_av1c
Jeremy Dorfman via ffmpeg-devel [Mon, 8 Apr 2019 12:14:27 +0000 (08:14 -0400)]
avformat/av1: Initialize padding in ff_isom_write_av1c

Otherwise, AV1 encodes with FFmpeg trigger use-of-uninitialized-value
warnings under MemorySanitizer, and the output buffer potentially
changes from run to run.

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agoavfilter/af_asetnsamples: use correct function
Paul B Mahol [Sun, 7 Apr 2019 19:15:13 +0000 (21:15 +0200)]
avfilter/af_asetnsamples: use correct function

10 months agoavformat/riffdec: pass correct pointer to av_log
Paul B Mahol [Sun, 7 Apr 2019 19:09:56 +0000 (21:09 +0200)]
avformat/riffdec: pass correct pointer to av_log

10 months agoavfilter/af_asetnsamples: fix sample queuing.
Nikolas Bowe via ffmpeg-devel [Sat, 6 Apr 2019 00:11:15 +0000 (17:11 -0700)]
avfilter/af_asetnsamples: fix sample queuing.

When asetnsamples uses output samples < input samples, remaining samples build up in the fifo over time.
Fix this by marking the filter as ready again if there are enough samples.

Regression since ef3babb2c70f564dc1634b3f29c6e35a2b2dc239
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoswscale/ppc: VSX-optimize yuv2rgb_full_X
Lauri Kasanen [Mon, 1 Apr 2019 10:32:37 +0000 (13:32 +0300)]
swscale/ppc: VSX-optimize yuv2rgb_full_X

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 \
                -s 1200x720 -f null -vframes 100 -pix_fmt $i -nostats \
                -cpuflags 0 -v error -

32-bit mul, power8 only.

~6.4x speedup:

rgb24
 214278 UNITS in yuv2packedX,   16384 runs,      0 skips
  33249 UNITS in yuv2packedX,   16384 runs,      0 skips
bgr24
 214616 UNITS in yuv2packedX,   16384 runs,      0 skips
  33233 UNITS in yuv2packedX,   16384 runs,      0 skips
rgba
 214517 UNITS in yuv2packedX,   16384 runs,      0 skips
  33271 UNITS in yuv2packedX,   16384 runs,      0 skips
bgra
 214973 UNITS in yuv2packedX,   16384 runs,      0 skips
  33397 UNITS in yuv2packedX,   16384 runs,      0 skips
argb
 214613 UNITS in yuv2packedX,   16384 runs,      0 skips
  33310 UNITS in yuv2packedX,   16384 runs,      0 skips
bgra
 214637 UNITS in yuv2packedX,   16384 runs,      0 skips
  33330 UNITS in yuv2packedX,   16384 runs,      0 skips

10 months agoswscale/ppc: VSX-optimize yuv2rgb_full_2
Lauri Kasanen [Mon, 1 Apr 2019 10:04:11 +0000 (13:04 +0300)]
swscale/ppc: VSX-optimize yuv2rgb_full_2

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 -sws_flags area \
            -s 1200x720 -f null -vframes 100 -pix_fmt $i -nostats \
            -cpuflags 0 -v error -

32-bit mul, power8 only.

~4x speedup:

rgb24
  52763 UNITS in yuv2packed2,   16384 runs,      0 skips
  13453 UNITS in yuv2packed2,   16384 runs,      0 skips
bgr24
  53144 UNITS in yuv2packed2,   16384 runs,      0 skips
  13616 UNITS in yuv2packed2,   16384 runs,      0 skips
rgba
  52796 UNITS in yuv2packed2,   16384 runs,      0 skips
  12904 UNITS in yuv2packed2,   16384 runs,      0 skips
bgra
  52732 UNITS in yuv2packed2,   16384 runs,      0 skips
  13262 UNITS in yuv2packed2,   16384 runs,      0 skips
argb
  52661 UNITS in yuv2packed2,   16384 runs,      0 skips
  12879 UNITS in yuv2packed2,   16384 runs,      0 skips
bgra
  52662 UNITS in yuv2packed2,   16384 runs,      0 skips
  12932 UNITS in yuv2packed2,   16384 runs,      0 skips

10 months agoswscale/ppc: VSX-optimize non-full-chroma yuv2rgb_1
Lauri Kasanen [Sun, 31 Mar 2019 14:01:37 +0000 (17:01 +0300)]
swscale/ppc: VSX-optimize non-full-chroma yuv2rgb_1

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 -sws_flags fast_bilinear \
        -s 1200x1440 -f null -vframes 100 -pix_fmt $i -nostats \
        -cpuflags 0 -v error -

32-bit mul, power8 only.

1.8-2.3x speedup:

rgb24
  18192 UNITS in yuv2packed1,   32767 runs,      1 skips
   9983 UNITS in yuv2packed1,   32760 runs,      8 skips
bgr24
  18665 UNITS in yuv2packed1,   32766 runs,      2 skips
   9925 UNITS in yuv2packed1,   32763 runs,      5 skips
rgba
  20239 UNITS in yuv2packed1,   32767 runs,      1 skips
   8794 UNITS in yuv2packed1,   32759 runs,      9 skips
bgra
  20354 UNITS in yuv2packed1,   32768 runs,      0 skips
   8770 UNITS in yuv2packed1,   32761 runs,      7 skips
argb
  20185 UNITS in yuv2packed1,   32768 runs,      0 skips
   8761 UNITS in yuv2packed1,   32761 runs,      7 skips
bgra
  20360 UNITS in yuv2packed1,   32766 runs,      2 skips
   8759 UNITS in yuv2packed1,   32764 runs,      4 skips

This is a low speedup, but the x86 mmx version also gets only ~2x. The mmx version
is also heavily inaccurate, while the vsx version has high accuracy.

10 months agodoc/examples/metadata: fix the example can't dump FLV metadata
Jun Zhao [Wed, 3 Apr 2019 01:13:52 +0000 (09:13 +0800)]
doc/examples/metadata: fix the example can't dump FLV metadata

fix the example can't dump FLV metadata.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
10 months agolavf/Makefile: Fix kux demuxer standalone compilation.
Carl Eugen Hoyos [Sun, 7 Apr 2019 00:00:30 +0000 (02:00 +0200)]
lavf/Makefile: Fix kux demuxer standalone compilation.

10 months agolavf/flvdec: added support for KUX container
Swaraj Hota [Sat, 6 Apr 2019 13:53:43 +0000 (15:53 +0200)]
lavf/flvdec: added support for KUX container

Fixes ticket #4519.

The metadata starting at 0xe00004 is encrypted
with the password "meta" but zlib does not
support decryption, so no kux metadata is read.

10 months agolavd/x11grab: fix vertical repositioning
Octavio Alvarez [Thu, 28 Mar 2019 04:52:32 +0000 (22:52 -0600)]
lavd/x11grab: fix vertical repositioning

There is a calculation error in xcbgrab_reposition() that breaks
vertical repositioning on follow_mouse. It made the bottom
reposition occur when moving the mouse lower than N pixels after
the capture bottom edge, instead of before.

This commit fixes the calculation to match the documentation.

follow_mouse: centered or number of pixels. The documentation says:

When it is specified with "centered", the grabbing region follows
the mouse pointer and keeps the pointer at the center of region;
otherwise, the region follows only when the mouse pointer reaches
within PIXELS (greater than zero) to the edge of region.

10 months agoFATE: Add test for HEVC files that claim to have two first slices
Derek Buitenhuis [Mon, 18 Mar 2019 15:40:44 +0000 (15:40 +0000)]
FATE: Add test for HEVC files that claim to have two first slices

This makes sure we don't regress on 70c8c8a818f39bc262565ec29fae2baffb3e1660.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
10 months agoavcodec/agm: Fix integer overflow with w/h
Michael Niedermayer [Thu, 4 Apr 2019 22:20:33 +0000 (00:20 +0200)]
avcodec/agm: Fix integer overflow with w/h

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 13999/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5644405991538688

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>
10 months agoavformat/matroskadec: Improve length check
Andreas Rheinhardt via ffmpeg-devel [Wed, 27 Mar 2019 11:18:44 +0000 (12:18 +0100)]
avformat/matroskadec: Improve length check

The earlier code had three flaws:

1. The case of an unknown-sized element inside a finite-sized element
(which is against the specifications) was not caught.

2. The error message wasn't helpful: It compared the length of the child
with the offset of the end of the parent and claimed that the first
exceeds the latter, although that is not necessarily true.

3. Unknown-sized elements that are not parsed can't be skipped. Given
that according to the Matroska specifications only the segment and the
clusters can be of unknown-size, this is handled by not allowing any
other units to have infinite size whereas the earlier code would seek
back by 1 byte upon encountering an infinite-size element that ought
to be skipped.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/agm: More completely check size before using it
Michael Niedermayer [Wed, 3 Apr 2019 00:12:28 +0000 (02:12 +0200)]
avcodec/agm: More completely check size before using it

Fixes: out of array access
Fixes: 13997/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5701427252428800

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>
10 months agoavcodec/av1_metadata: add an option to remove Padding OBUs
James Almer [Mon, 25 Mar 2019 03:27:23 +0000 (00:27 -0300)]
avcodec/av1_metadata: add an option to remove Padding OBUs

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
10 months agolavc/qsvenc: enable hevc gpb option
Zhong Li [Fri, 11 Jan 2019 07:09:07 +0000 (15:09 +0800)]
lavc/qsvenc: enable hevc gpb option

GPB is the default type, just contains forward references but the
slice_type is B slice with higher encoding efficiency than regular P
slice, but lower performance.

Add an option to allow user to set regular P slice.

Fix ticket#6870

Test data on Intel Kabylake (i7-7567U CPU @ 3.50GHz):
1. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough
-vframes 1000  -c:v hevc_qsv -gpb 0 -bf 0 -q 25 test_gpb_off_bf0_kbl.mp4

transcoding fps: 85
encoded file size of test_gpb_off_bf0_kbl.mp4: 21960100 (bytes)

2. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough
-vframes 1000  -c:v hevc_qsv -gpb 1 -bf 0 -q 25 test_gpb_on_bf0_kbl.mp4

transcoding fps: 79
encoded file size oftest_gpb_on_bf0_kbl.mp4:  21211449 (bytes)

In this case, enable gpb can bring about 7% performance drop but 3.4% encoding efficiency improvment.

Signed-off-by: Zhong Li <zhong.li@intel.com>
10 months agolavc/qsvenc: enable hevc coding options configuration
Zhong Li [Wed, 27 Mar 2019 06:33:36 +0000 (14:33 +0800)]
lavc/qsvenc: enable hevc coding options configuration

Signed-off-by: Zhong Li <zhong.li@intel.com>
10 months agolavc/qsvenc: no need to include h264.h for jpeg encoder
Zhong Li [Mon, 1 Apr 2019 04:18:57 +0000 (12:18 +0800)]
lavc/qsvenc: no need to include h264.h for jpeg encoder

Signed-off-by: Zhong Li <zhong.li@intel.com>
10 months agolavf/movenc: fix tmcd writing for non-MP4/MOV modes
Gyan Doshi [Sat, 30 Mar 2019 18:30:50 +0000 (00:00 +0530)]
lavf/movenc: fix tmcd writing for non-MP4/MOV modes

write_tmcd allows tmcd track to be created with any mode but in
mov_write_header, index for first tmcd track is only set for modes
MP4 or MOV, causing a crash if tmcd creation is attempted with other
modes.

10 months agofate: unbreak fate with custom binary names
Gyan Doshi [Tue, 2 Apr 2019 11:13:06 +0000 (16:43 +0530)]
fate: unbreak fate with custom binary names

10 months agolavf/hashenc: Correct the hash/MD5 muxer class name
Jun Zhao [Fri, 29 Mar 2019 14:13:10 +0000 (22:13 +0800)]
lavf/hashenc: Correct the hash/MD5 muxer class name

Follow the name style to correct the hash/md5 muxer class name

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
10 months agoavcodec/libaomenc: fix range of values for enable-intrabc option
James Almer [Tue, 2 Apr 2019 22:54:34 +0000 (19:54 -0300)]
avcodec/libaomenc: fix range of values for enable-intrabc option

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agoavcodec/cbs_av1: fix parsing spatial_id
James Almer [Mon, 25 Mar 2019 04:08:30 +0000 (01:08 -0300)]
avcodec/cbs_av1: fix parsing spatial_id

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
10 months agolibavcodec/zmbvenc: add support for 24-bit encoding, using pix_fmt BGR24.
Matthew Fearnley [Tue, 26 Mar 2019 22:13:06 +0000 (22:13 +0000)]
libavcodec/zmbvenc: add support for 24-bit encoding, using pix_fmt BGR24.

Support is #ifdef'd out at this stage, using ZMBV_ENABLE_24BPP (like in
the zmbv.c decoder)

10 months agolibavcodec/zmbv: change 24-bit decoder channel order, from RGB24 to BGR24
Matthew Fearnley [Fri, 29 Mar 2019 22:03:03 +0000 (22:03 +0000)]
libavcodec/zmbv: change 24-bit decoder channel order, from RGB24 to BGR24

This brings the channel order in line with that used in 32-bit mode (BGR0).

24-bit decoding is disabled by default (#ifdef ZMBV_ENABLE_24BPP), and no
prior encoders or sample videos are known to exist for this bit depth, so
I consider this change in implementation is unlikely to affect anyone.

The decision has been made in agreement with the DOSBox Development Team
(dosbox.crew@gmail.com), specifically with harekiet, who wrote the original
codec.

10 months agolibavcodec/zmbv: use PTRDIFF_SPECIFIER for `src - c->decomp_buf`.
Matthew Fearnley [Tue, 26 Mar 2019 19:44:23 +0000 (19:44 +0000)]
libavcodec/zmbv: use PTRDIFF_SPECIFIER for `src - c->decomp_buf`.

Other bit depths saw this change in ced0d6c14d, but this instance was
presumably missed because of the #ifdef block.

10 months agoavcodec/opus: make redundancy_buf 32 byte aligned
James Almer [Tue, 2 Apr 2019 14:36:56 +0000 (11:36 -0300)]
avcodec/opus: make redundancy_buf 32 byte aligned

Fixes ff_opus_deemphasis_fma3 segmentation fault crashes on x86_32.

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agoavformat/dashenc: Add support for Global SIDX
Karthick J [Thu, 21 Mar 2019 06:17:08 +0000 (11:47 +0530)]
avformat/dashenc: Add support for Global SIDX

10 months agoavformat/movenc: Fix skip_trailer when global_sidx is enabled
Karthick J [Sun, 24 Mar 2019 12:00:36 +0000 (17:30 +0530)]
avformat/movenc: Fix skip_trailer when global_sidx is enabled

10 months agoavformat/hls: make different warning message between open url and parse playlist
Steven Liu [Wed, 27 Mar 2019 04:58:30 +0000 (12:58 +0800)]
avformat/hls: make different warning message between open url and parse playlist

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 months agolavf/mov: skip extradata check in esds for MPEG-1/2 audio
Gyan Doshi [Thu, 28 Mar 2019 17:29:30 +0000 (22:59 +0530)]
lavf/mov: skip extradata check in esds for MPEG-1/2 audio

As per 14496-3 9.D.2.2, it's not defined for these audio object types.

Fixes #7817.

10 months agox86/opusdsp: fix WIN64 return value
Lynne [Mon, 1 Apr 2019 12:06:34 +0000 (13:06 +0100)]
x86/opusdsp: fix WIN64 return value

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agolavc/qsvenc: get vps extradata from MSDK
Zhong Li [Tue, 26 Mar 2019 18:56:24 +0000 (02:56 +0800)]
lavc/qsvenc: get vps extradata from MSDK

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
10 months agolavc/qsvenc: expose low_power as a common option for QSV encoder
Linjie Fu [Fri, 29 Mar 2019 05:19:06 +0000 (13:19 +0800)]
lavc/qsvenc: expose low_power as a common option for QSV encoder

Always exposes low_power option for all qsv encoder, and reports a warning
if VDENC is not supported in current version of MSDK.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
10 months agodoc/general: make column key note more verbose
Gyan Doshi [Mon, 1 Apr 2019 08:37:28 +0000 (14:07 +0530)]
doc/general: make column key note more verbose

Addresses #7795

10 months agoavcodec/rscc: Check that the to be uncompressed input is large enough
Michael Niedermayer [Sun, 31 Mar 2019 15:31:17 +0000 (17:31 +0200)]
avcodec/rscc: Check that the to be uncompressed input is large enough

Fixes: Out of array access
Fixes: 13984/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-5734128093233152

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>
10 months agoavformat/movenc: free eac3 private data only when closing the stream
James Almer [Fri, 29 Mar 2019 01:36:25 +0000 (22:36 -0300)]
avformat/movenc: free eac3 private data only when closing the stream

This makes sure the data is available when writing the moov atom during the
second pass triggered by the faststart movflag.

Fixes ticket #7780

Signed-off-by: James Almer <jamrial@gmail.com>
10 months agox86/opusdsp: implement FMA3 accelerated postfilter and deemphasis
Lynne [Fri, 15 Mar 2019 14:43:04 +0000 (14:43 +0000)]
x86/opusdsp: implement FMA3 accelerated postfilter and deemphasis

58893 decicycles in deemphasis_c,  130548 runs,    524 skips
9475 decicycles in deemphasis_fma3,  130686 runs,    386 skips -> 6.21x speedup

24866 decicycles in postfilter_c,   65386 runs,    150 skips
5268 decicycles in postfilter_fma3,   65505 runs,     31 skips -> 4.72x speedup

Total decoder speedup: ~14%

Deemphasis SIMD based on the following unrolling:
const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
float state = coeff;

for (int i = 0; i < len; i += 4) {
    y[0] = x[0] + c1*state;
    y[1] = x[1] + c2*state + c1*x[0];
    y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
    y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];

    state = y[3];
    y += 4;
    x += 4;
}

10 months agoopusdsp: create and move deemphasis and postfiltering from opus_celt
Lynne [Fri, 15 Mar 2019 14:35:03 +0000 (14:35 +0000)]
opusdsp: create and move deemphasis and postfiltering from opus_celt

10 months agocelt_pvq_init: only build when CONFIG_OPUS_ENCODER is enabled
Lynne [Sat, 16 Mar 2019 16:28:52 +0000 (17:28 +0100)]
celt_pvq_init: only build when CONFIG_OPUS_ENCODER is enabled

The entire function was defined away before.

10 months agox86/opus_dsp: rename to celt_pvq
Lynne [Sat, 16 Mar 2019 16:30:16 +0000 (17:30 +0100)]
x86/opus_dsp: rename to celt_pvq

Its only used in the encoder and in CELT's PVQ.

10 months agoavcodec/ivi: Reduce dereferencing structs in inner loop of ivi_process_empty_tile()
Michael Niedermayer [Sun, 24 Mar 2019 22:20:19 +0000 (23:20 +0100)]
avcodec/ivi: Reduce dereferencing structs in inner loop of ivi_process_empty_tile()

This speeds the code up by about 15%
Testcase: 13779/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5699589711069184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/ivi: Mark band parameter as const
Michael Niedermayer [Sun, 24 Mar 2019 21:59:01 +0000 (22:59 +0100)]
avcodec/ivi: Mark band parameter as const

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/ivi: fix indention for previous commit
Michael Niedermayer [Sun, 24 Mar 2019 21:52:19 +0000 (22:52 +0100)]
avcodec/ivi: fix indention for previous commit

10 months agoavcodec/ivi: Factor ref_mb check out
Michael Niedermayer [Sun, 24 Mar 2019 21:49:59 +0000 (22:49 +0100)]
avcodec/ivi: Factor ref_mb check out

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/proresdec2: decode picture header before frame allocation
Michael Niedermayer [Sun, 24 Mar 2019 19:04:12 +0000 (20:04 +0100)]
avcodec/proresdec2: decode picture header before frame allocation

Fixes: Timeout (21sec -> 0.3sec)
Fixes: 13716/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_fuzzer-5755593333145600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavformat/doc, http, icecast, rtsp: Add option to disable send-expect-100
Jun Li [Sun, 31 Mar 2019 04:35:51 +0000 (21:35 -0700)]
avformat/doc, http, icecast, rtsp: Add option to disable send-expect-100

Fix ticket #7297
The current setting for send-expect-100 option is either
enabled if applicable or forced enabled, no option to force
disable the header. This change is to expand the option setting
to provide more flexibility, which is useful for rstp case.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 months agoavcodec/tiff: Multi-page support
Nick Renieris [Fri, 22 Mar 2019 15:55:56 +0000 (17:55 +0200)]
avcodec/tiff: Multi-page support

Option "-page N" (page index N starts from 1) can now be used to specify which TIFF page/subfile to decode.

Signed-off-by: Nick Renieris <velocityra@gmail.com>
10 months agolavf/flvdec: Cosmetics: Fix indentation for flv_read_packet
Jun Zhao [Tue, 26 Mar 2019 10:54:47 +0000 (18:54 +0800)]
lavf/flvdec: Cosmetics: Fix indentation for flv_read_packet

Commit e34ba5ec53b missed the indent

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
10 months agolavf/flvdec: add AMF date type support
Jun Zhao [Tue, 26 Mar 2019 08:54:33 +0000 (16:54 +0800)]
lavf/flvdec: add AMF date type support

Support AMF date type when parse the FLV metadata.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
10 months agoswscale/ppc: VSX-optimize yuv2422_X
Lauri Kasanen [Sun, 24 Mar 2019 12:55:45 +0000 (14:55 +0200)]
swscale/ppc: VSX-optimize yuv2422_X

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 \
          -s 1200x720 -f null -vframes 100 -pix_fmt $i -nostats \
          -cpuflags 0 -v error -

7.2x speedup:

yuyv422
 126354 UNITS in yuv2packedX,   16384 runs,      0 skips
  16383 UNITS in yuv2packedX,   16382 runs,      2 skips
yvyu422
 117669 UNITS in yuv2packedX,   16384 runs,      0 skips
  16271 UNITS in yuv2packedX,   16379 runs,      5 skips
uyvy422
 117310 UNITS in yuv2packedX,   16384 runs,      0 skips
  16226 UNITS in yuv2packedX,   16382 runs,      2 skips

10 months agoswscale/ppc: VSX-optimize yuv2422_2
Lauri Kasanen [Sun, 24 Mar 2019 12:23:46 +0000 (14:23 +0200)]
swscale/ppc: VSX-optimize yuv2422_2

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 -sws_flags area \
                -s 1200x720 -f null -vframes 100 -pix_fmt $i -nostats \
                -cpuflags 0 -v error -

5.1x speedup:

yuyv422
  19339 UNITS in yuv2packed2,   16384 runs,      0 skips
   3718 UNITS in yuv2packed2,   16383 runs,      1 skips
yvyu422
  19438 UNITS in yuv2packed2,   16384 runs,      0 skips
   3800 UNITS in yuv2packed2,   16380 runs,      4 skips
uyvy422
  19128 UNITS in yuv2packed2,   16384 runs,      0 skips
   3721 UNITS in yuv2packed2,   16380 runs,      4 skips

10 months agoswscale/ppc: VSX-optimize yuv2422_1
Lauri Kasanen [Sun, 24 Mar 2019 11:45:55 +0000 (13:45 +0200)]
swscale/ppc: VSX-optimize yuv2422_1

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 \
            -s 1200x1440 -f null -vframes 100 -pix_fmt $i -nostats \
            -cpuflags 0 -v error -

15.3x speedup:

yuyv422
  14513 UNITS in yuv2packed1,   32768 runs,      0 skips
    949 UNITS in yuv2packed1,   32767 runs,      1 skips
yvyu422
  14516 UNITS in yuv2packed1,   32767 runs,      1 skips
    943 UNITS in yuv2packed1,   32767 runs,      1 skips
uyvy422
  14530 UNITS in yuv2packed1,   32767 runs,      1 skips
    941 UNITS in yuv2packed1,   32766 runs,      2 skips

10 months agoavcodec: add Amuse Graphics decoder
Paul B Mahol [Wed, 10 Oct 2018 10:43:55 +0000 (12:43 +0200)]
avcodec: add Amuse Graphics decoder

This work is sponsored by VideoLAN.

10 months agoavutil/hcontext_cuda: Remove unnecessary stream synchronisation
Philip Langdale [Sat, 30 Mar 2019 17:56:49 +0000 (10:56 -0700)]
avutil/hcontext_cuda: Remove unnecessary stream synchronisation

Similarly to the previous changes, we don't need to synchronise
after a memcpy to device memory. On the other hand, we need to
keep synchronising after a copy to host memory, otherwise there's
no guarantee that subsequent host reads will return valid data.

10 months agoavcodec/cuviddec: Remove unnecessary stream synchronisation
Philip Langdale [Sat, 30 Mar 2019 17:51:07 +0000 (10:51 -0700)]
avcodec/cuviddec: Remove unnecessary stream synchronisation

We're also doing a sync here after copying the frame to be passed
on down the pipleine. And it is also unnecessary.

I was able to demonstrate a 33% speedup removing the sync from
an example transcode pipeline.

11 months agoavfilter/vf_yadif_cuda: Remove unnecessary stream synchronisation
Philip Langdale [Sat, 30 Mar 2019 15:50:44 +0000 (08:50 -0700)]
avfilter/vf_yadif_cuda: Remove unnecessary stream synchronisation

I put this call in by habit, rather than because there was any
actual need. The filter is simply processing frames one after
the other and has no need to synchronise.

malakudi on the devtalk forums noticed a slowdown when using nvenc
with temporal/spatial aq and that the slowdown went away if the
sync call was removed. I also verified that in the basic encoding
case there's an observable speedup.

I also verified that we aren't doing unnecessary sync calls in any
other filter.

11 months agodoc/filters: mention input requirements for ebur128
Gyan Doshi [Sat, 30 Mar 2019 06:37:24 +0000 (12:07 +0530)]
doc/filters: mention input requirements for ebur128

The filter requires input stream to have sample rate 48000 Hz and dbl fmt.

Fixes #7812

11 months agoavcodec/libaomenc: fix default value for row-mt option
James Almer [Fri, 29 Mar 2019 17:55:00 +0000 (14:55 -0300)]
avcodec/libaomenc: fix default value for row-mt option

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavcodec/libaomenc: Added more commandline options
Sam John via ffmpeg-devel [Fri, 29 Mar 2019 16:58:38 +0000 (09:58 -0700)]
avcodec/libaomenc: Added more commandline options

The following are the newly added options:
arnr_max_frames, arnr_strength, aq_mode, denoise_noise_level, denoise_block_size,
rc_undershoot_pct, rc_overshoot_pct, minsection_pct, maxsection_pct, frame_parallel,
enable_cdef, enable_global_motion, and intrabc.

Also added macros for compiling for aom 1.0.0 and fixed the default values.

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agolavc/qsvenc: fix hevc vps extradata issues
Zhong Li [Mon, 25 Mar 2019 22:10:21 +0000 (06:10 +0800)]
lavc/qsvenc: fix hevc vps extradata issues

cbs trace qsv vps header failed due to some reasons:
1. vps_temporal_id_nesting_flag is not set but spec required it must to
   be 1 when vps_max_sub_layers_minus1 is equal to 0.
2. vps_num_hrd_parameters is not set and written.
3. other issues in ff_hevc_encode_nal_vps() (fixed in pervious commit_id: 520226b683).

Reproduce: ffmpeg -hwaccel qsv -v verbose -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vframes 1
-c:v hevc_qsv  -bsf:v trace_headers -f null -

Signed-off-by: Zhong Li <zhong.li@intel.com>
11 months agolavc/hevc_ps_enc: fix vps nal issues
Zhong Li [Mon, 25 Mar 2019 22:08:37 +0000 (06:08 +0800)]
lavc/hevc_ps_enc: fix vps nal issues

1. write vps_num_hrd_parameters element
2. flush left bits

Signed-off-by: Zhong Li <zhong.li@intel.com>
11 months agoswscale/swscale_unscaled: Fix chroma slice height
Michael Niedermayer [Thu, 28 Mar 2019 21:30:59 +0000 (22:30 +0100)]
swscale/swscale_unscaled: Fix chroma slice height

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavcodec/dxv: Check remaining space in CHECKPOINT()
Michael Niedermayer [Wed, 20 Mar 2019 21:29:21 +0000 (22:29 +0100)]
avcodec/dxv: Check remaining space in CHECKPOINT()

Fixes: Timeout (77sec -> 1sec)
Fixes: 13407/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5093143018471424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agofftools/ffmpeg: Check if we do have also a filter_complex filter.
Thierry Foucu [Wed, 27 Mar 2019 21:11:59 +0000 (14:11 -0700)]
fftools/ffmpeg: Check if we do have also a filter_complex filter.

Right now, the code check for no filter description, but if we use a
filter_complex, the code will use the AVFrame.duration which could be
wrong in case of using fps filter.

How to reproduce the problem:
ffmpeg -f lavfi -i testsrc=duration=1 -vf fps=fps=50 -vsync 1 -f null -
output 50 frames

ffmpeg -f lavfi -i testsrc=duration=1 -filter_complex fps=fps=50 -vsync 1 -f null -
output 51 frames

With this commit, the same command will always output 50 frames.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoswscale/swscale_unscaled: fixed the issue that when width/height is not 2-multiple...
Dong, Jerry [Thu, 28 Mar 2019 11:40:53 +0000 (19:40 +0800)]
swscale/swscale_unscaled: fixed the issue that when width/height is not 2-multiple, transition of nv12 to u/v planes is not completed.

Signed-off-by: Dong, Jerry <jerry.dong@intel.com>
Signed-off-by: Decai Lin <decai.lin@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agolavc/qsvenc_h264: remove the privite option trellis
Zhong Li [Wed, 27 Mar 2019 11:39:41 +0000 (19:39 +0800)]
lavc/qsvenc_h264: remove the privite option trellis

There are many problems of current qsv trellis option:
1. Duplicated with AVCodecContext definition
2. MFX_TRELLIS_XXX is introduced by MSDK API 1.17
   Currently Without MSDK API checking thus may cause compilation issue.
3. user is inclined to enable trellis when set "-trellis 1", but
   actually it is to disable since MFX_TRELLIS_OFF is equal to 1.
4. It is too complex for user to enable trellis for every frame(I/P/B).

Just simply remove the private option, and switch to the AVCodecContext
definition. Compatibility should not a big problem (except can't exact map)
since the option name is same as AVCodecContext.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
11 months agolavc/qsvenc: use the common option "trellis" of AVCodecContext
Zhong Li [Wed, 27 Mar 2019 11:33:37 +0000 (19:33 +0800)]
lavc/qsvenc: use the common option "trellis" of AVCodecContext

Signed-off-by: Zhong Li <zhong.li@intel.com>
11 months agoqsv: fix the dangerous macro definitions
Zhong Li [Wed, 27 Mar 2019 10:18:15 +0000 (18:18 +0800)]
qsv: fix the dangerous macro definitions

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
11 months agolavc/qsvenc: make the queried libmfx version easily reused
Zhong Li [Mon, 25 Mar 2019 23:40:54 +0000 (07:40 +0800)]
lavc/qsvenc: make the queried libmfx version easily reused

Signed-off-by: Zhong Li <zhong.li@intel.com>
11 months agoconfigure: include pkgconfig path as vaapi header search
Zhong Li [Wed, 20 Mar 2019 06:51:12 +0000 (14:51 +0800)]
configure: include pkgconfig path as vaapi header search

Currectly just standard header path can be found,
check_type/struct will fail if vaapi is installed somewhere else.

Move them followed "check_pkg_config"

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Zhong Li <zhong.li@intel.com>
11 months agolavc/vaapi_h264: Do not set FMO fields.
Carl Eugen Hoyos [Wed, 27 Mar 2019 13:58:51 +0000 (14:58 +0100)]
lavc/vaapi_h264: Do not set FMO fields.

The fields are deprecated in current vaapi,
setting them to 0 in old versions is fine
as FMO is not implemented.

Fixes the following warnings:
libavcodec/vaapi_h264.c:259:10: warning: 'num_slice_groups_minus1' is deprecated [-Wdeprecated-declarations]
        .num_slice_groups_minus1                    = pps->slice_group_count - 1,
         ^
libavcodec/vaapi_h264.c:260:10: warning: 'slice_group_map_type' is deprecated [-Wdeprecated-declarations]
        .slice_group_map_type                       = pps->mb_slice_group_map_type,
         ^
libavcodec/vaapi_h264.c:261:10: warning: 'slice_group_change_rate_minus1' is deprecated [-Wdeprecated-declarations]
        .slice_group_change_rate_minus1             = 0, /* FMO is not implemented */
         ^

Reviewed-by: Mark Thompson
11 months agolavc/vaapi_hevc: Do not initialize fields twice.
Carl Eugen Hoyos [Wed, 27 Mar 2019 13:52:35 +0000 (14:52 +0100)]
lavc/vaapi_hevc: Do not initialize fields twice.

Fixes the following compilation warnings:
libavcodec/vaapi_hevc.c:155:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
        .pic_fields.bits = {
                   ~^~~~
libavcodec/vaapi_hevc.c:125:57: note: previous initialization is here
        .pic_fields.value                             = 0,
                                                        ^
libavcodec/vaapi_hevc.c:175:31: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
        .slice_parsing_fields.bits = {
                             ~^~~~
libavcodec/vaapi_hevc.c:126:57: note: previous initialization is here
        .slice_parsing_fields.value                   = 0,

Reviewed-by: Mark Thompson
11 months agoconfigure: Do not enable both OpenCL-VAAPI interop modes simultaneously
Mark Thompson [Tue, 26 Mar 2019 23:39:19 +0000 (23:39 +0000)]
configure: Do not enable both OpenCL-VAAPI interop modes simultaneously

Beignet offers a far more flexiable and complete interface, so choose it
by default if available.

11 months agolavf/latmenc: Return the correct error for wrong codec.
Carl Eugen Hoyos [Wed, 27 Mar 2019 13:54:05 +0000 (14:54 +0100)]
lavf/latmenc: Return the correct error for wrong codec.

Requested-by: Nicolas George
11 months agoavcodec/hevcdec: Avoid only partly skiping duplicate first slices
Michael Niedermayer [Sat, 23 Mar 2019 19:55:08 +0000 (20:55 +0100)]
avcodec/hevcdec: Avoid only partly skiping duplicate first slices

Fixes: NULL pointer dereference and out of array access
Fixes: 13871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5746167087890432
Fixes: 13845/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5650370728034304

This also fixes the return code for explode mode

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoswscale/ppc: VSX-optimize yuv2rgb_full
Lauri Kasanen [Wed, 20 Mar 2019 11:17:43 +0000 (13:17 +0200)]
swscale/ppc: VSX-optimize yuv2rgb_full

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 \
        -s 1200x1440 -f null -vframes 100 -pix_fmt $i -nostats \
        -cpuflags 0 -v error -

This uses 32-bit mul, so POWER8 only.

The following output formats get about 4.5x speedup:

rgb24
  39980 UNITS in yuv2packed1,   32768 runs,      0 skips
   8774 UNITS in yuv2packed1,   32768 runs,      0 skips
bgr24
  40069 UNITS in yuv2packed1,   32768 runs,      0 skips
   8772 UNITS in yuv2packed1,   32766 runs,      2 skips
rgba
  39759 UNITS in yuv2packed1,   32768 runs,      0 skips
   8681 UNITS in yuv2packed1,   32767 runs,      1 skips
bgra
  39729 UNITS in yuv2packed1,   32768 runs,      0 skips
   8696 UNITS in yuv2packed1,   32766 runs,      2 skips
argb
  39766 UNITS in yuv2packed1,   32768 runs,      0 skips
   8672 UNITS in yuv2packed1,   32766 runs,      2 skips
bgra
  39784 UNITS in yuv2packed1,   32768 runs,      0 skips
   8659 UNITS in yuv2packed1,   32767 runs,      1 skips

11 months agoswscale: Remove duplicated code
Lauri Kasanen [Sun, 24 Mar 2019 11:00:39 +0000 (13:00 +0200)]
swscale: Remove duplicated code

In this function, the exact same clamping happens both in the if and unconditionally.

11 months agolavc/h264_levels: add MaxMBPS checking and update fate test.
Decai Lin [Wed, 20 Mar 2019 09:14:47 +0000 (17:14 +0800)]
lavc/h264_levels: add MaxMBPS checking and update fate test.

1. add MaxMBPS checking for level idc setting to align with AVC spec
   AnnexA table A-1/A-6 level limits.
2. update h264 level fate test.

Signed-off-by: Decai Lin <decai.lin@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
11 months agolavc/bmp: Avoid a heap buffer overwrite for 1bpp input.
Carl Eugen Hoyos [Tue, 26 Mar 2019 12:32:11 +0000 (13:32 +0100)]
lavc/bmp: Avoid a heap buffer overwrite for 1bpp input.

Found by Mingi Cho, Seoyoung Kim, and Taekyoung Kwon
of the Information Security Lab, Yonsei University.