ffmpeg.git
4 weeks agoavfilter/vf_separatefields: switch to activate
Paul B Mahol [Thu, 16 May 2019 10:31:57 +0000 (12:31 +0200)]
avfilter/vf_separatefields: switch to activate

Fixes timestamp of last output frame.

4 weeks agodoc/filters: mention obvious operation, for our always clueless users
Paul B Mahol [Thu, 16 May 2019 08:40:38 +0000 (10:40 +0200)]
doc/filters: mention obvious operation, for our always clueless users

4 weeks agoavfilter/drawtext: stop resource leak
Gyan Doshi [Wed, 15 May 2019 07:06:05 +0000 (12:36 +0530)]
avfilter/drawtext: stop resource leak

Fixes Coverity CID 1445099

4 weeks agolavu: bump minor and update APIchanges for the new transform API
Lynne [Wed, 15 May 2019 23:01:14 +0000 (00:01 +0100)]
lavu: bump minor and update APIchanges for the new transform API

4 weeks agoconfigure: replace 'pr' with printf since busybox does not support pr
Guo, Yejun [Wed, 24 Apr 2019 13:13:21 +0000 (21:13 +0800)]
configure: replace 'pr' with printf since busybox does not support pr

This patch is based on https://trac.ffmpeg.org/ticket/5680 provided by
Kylie McClain <somasis@exherbo.org> at Wed, 29 Jun 2016 16:37:20 -0400,
and have some changes.

contributor: Kylie McClain <somasis@exherbo.org>
contributor: avih <avihpit@yahoo.com>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 weeks agoavfilter/vf_scale_cuda: Simplify output plane addressing
Philip Langdale [Tue, 14 May 2019 03:07:42 +0000 (20:07 -0700)]
avfilter/vf_scale_cuda: Simplify output plane addressing

I'm not sure why this was written the way it was originally. We
initialise the plane addresses correctly in hwcontext_cuda so
why try and play games to calculate the plane offsets directly
in this code?

4 weeks agoavfilter/vf_scale_cuda: Add support for YUV444P16
Philip Langdale [Tue, 14 May 2019 03:00:12 +0000 (20:00 -0700)]
avfilter/vf_scale_cuda: Add support for YUV444P16

This format is interesting because it's what you get for decoded
10/12bit HEVC 4:4:4.

4 weeks agoavfilter/vf_scale_cuda: Fix incorrect scaling of > 8bit content
Philip Langdale [Tue, 14 May 2019 02:15:41 +0000 (19:15 -0700)]
avfilter/vf_scale_cuda: Fix incorrect scaling of > 8bit content

When i converted the filter to use texture objects instead of
texture references, I incorrect dropped the `pixel_size` scaling
factor when setting `pitchInBytes`. `src_pitch` is in pixels and
so must be scaled up.

4 weeks agolibavutil: add an FFT & MDCT implementation
Lynne [Thu, 2 May 2019 14:07:12 +0000 (15:07 +0100)]
libavutil: add an FFT & MDCT implementation

This commit adds a new API to libavutil to allow for arbitrary transformations
on various types of data.
This is a partly new implementation, with the power of two transforms taken
from libavcodec/fft_template, the 5 and 15-point FFT taken from mdct15, while
the 3-point FFT was written from scratch.
The (i)mdct folding code is taken from mdct15 as well, as the mdct_template
code was somewhat old, messy and not easy to separate.

A notable feature of this implementation is that it allows for 3xM and 5xM
based transforms, where M is a power of two, e.g. 384, 640, 768, 1280, etc.
AC-4 uses 3xM transforms while Siren uses 5xM transforms, so the code will
allow for decoding of such streams.
A non-exaustive list of supported sizes:
4, 8, 12, 16, 20, 24, 32, 40, 48, 60, 64, 80, 96, 120, 128, 160, 192, 240,
256, 320, 384, 480, 512, 640, 768, 960, 1024, 1280, 1536, 1920, 2048, 2560...

The API was designed such that it allows for not only 1D transforms but also
2D transforms of certain block sizes. This was partly on accident as the stride
argument is required for Opus MDCTs, but can be used in the context of a 2D
transform as well.
Also, various data types would be implemented eventually as well, such as
"double" and "int32_t".

Some performance comparisons with libfftw3f (SIMD disabled for both):
120:
  22353 decicycles in     fftwf_execute,     1024 runs,      0 skips
  21836 decicycles in compound_fft_15x8,     1024 runs,      0 skips

128:
  22003 decicycles in       fftwf_execute,   1024 runs,      0 skips
  23132 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

384:
  75939 decicycles in      fftwf_execute,    1024 runs,      0 skips
  73973 decicycles in compound_fft_3x128,    1024 runs,      0 skips

640:
 104354 decicycles in       fftwf_execute,   1024 runs,      0 skips
 149518 decicycles in compound_fft_5x128,    1024 runs,      0 skips

768:
 109323 decicycles in      fftwf_execute,    1024 runs,      0 skips
 164096 decicycles in compound_fft_3x256,    1024 runs,      0 skips

960:
 186210 decicycles in      fftwf_execute,    1024 runs,      0 skips
 215256 decicycles in compound_fft_15x64,    1024 runs,      0 skips

1024:
 163464 decicycles in       fftwf_execute,   1024 runs,      0 skips
 199686 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

With SIMD we should be faster than fftw for 15xM transforms as our fft15 SIMD
is around 2x faster than theirs, even if our ptwo SIMD is slightly slower.

The goal is to remove the libavcodec/mdct15 code and deprecate the
libavcodec/avfft interface once aarch64 and x86 SIMD code has been ported.
New code throughout the project should use this API.

The implementation passes fate when used in Opus, AAC and Vorbis, and the output
is identical with ATRAC9 as well.

4 weeks agoaarch64/asm-offsets: remove old CELT offsets
Lynne [Sat, 20 Apr 2019 01:04:51 +0000 (02:04 +0100)]
aarch64/asm-offsets: remove old CELT offsets

They're not used and they're incorrect.

4 weeks agoavcodec/Makefile: add missing pngdsp dependency to the lscr decoder
James Almer [Tue, 14 May 2019 19:47:56 +0000 (16:47 -0300)]
avcodec/Makefile: add missing pngdsp dependency to the lscr decoder

Signed-off-by: James Almer <jamrial@gmail.com>
4 weeks agoavfilter: add asr filter
Paul B Mahol [Sun, 5 May 2019 13:01:53 +0000 (15:01 +0200)]
avfilter: add asr filter

4 weeks agoavfilter/vf_stack: Don't modify const strings
Andreas Rheinhardt [Tue, 14 May 2019 04:15:17 +0000 (06:15 +0200)]
avfilter/vf_stack: Don't modify const strings

b3b7ba62 introduced undefined behaviour: A (non-modifiable) string
literal has been assigned to a modifiable string; said string was indeed
modified later via av_strtok.
This of course caused compiler warnings because of the discarded
qualifier; these are in particular fixed by this commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 weeks agoavfilter: add xmedian filter
Paul B Mahol [Fri, 3 May 2019 12:08:49 +0000 (14:08 +0200)]
avfilter: add xmedian filter

4 weeks agoavcodec/cinepak: Check available input against encoded buffer size
Michael Niedermayer [Sun, 12 May 2019 20:06:30 +0000 (22:06 +0200)]
avcodec/cinepak: Check available input against encoded buffer size

Fixes: Timeout (12sec -> 2sec)
Fixes: 14606/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5738687561728000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 weeks agoavutil: Add missing reference files for pixdesc fate test
Andreas Rheinhardt [Tue, 14 May 2019 05:53:13 +0000 (07:53 +0200)]
avutil: Add missing reference files for pixdesc fate test

Commit cd48318035 added support for NV24 and NV42, including several
fate tests for these formats, but did not include the reference files
for the tests filter-pixdesc-nv24 and filter-pixdesc-nv42. As a result,
these two tests were broken.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 weeks agolavf/dashdec: refactoring error handle logic for open_input
Jun Zhao [Sat, 11 May 2019 07:23:44 +0000 (15:23 +0800)]
lavf/dashdec: refactoring error handle logic for open_input

refactoring error handle logic for open_input.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 weeks agolavf/dashdec: fix the coding logic after open_input fail
Jun Zhao [Sat, 11 May 2019 07:23:43 +0000 (15:23 +0800)]
lavf/dashdec: fix the coding logic after open_input fail

setting return status following goto will never be executed, so
adjust the location in the code.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agodoc/filters: add scale2ref example for proportional scaling
Gyan Doshi [Mon, 13 May 2019 16:28:19 +0000 (21:58 +0530)]
doc/filters: add scale2ref example for proportional scaling

5 weeks agoswscale/tests/swscale: Lengthen pixfmt name buffer to 21 bytes
Michael Niedermayer [Mon, 13 May 2019 10:50:38 +0000 (12:50 +0200)]
swscale/tests/swscale: Lengthen pixfmt name buffer to 21 bytes

Some formats use longer names than 12.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agolibswcale: Fix possible string overflow in test.
Adam Richter [Sun, 12 May 2019 12:03:25 +0000 (05:03 -0700)]
libswcale: Fix possible string overflow in test.

In libswcale/tests/swcale.c, the function fileTest() calls sscanf in
an argument of "%12s" on character srcStr[] and dstStr[], which are
only 12 bytes.  So, if the input string is 12 characters, a
terminating null byte can be written past the end of these arrays.

This bug was found by cppcheck.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agoavfilter/vf_chromahold: implement blend option
Paul B Mahol [Mon, 13 May 2019 10:10:22 +0000 (12:10 +0200)]
avfilter/vf_chromahold: implement blend option

5 weeks agodoc/filters: mention drawtext command support
Gyan Doshi [Mon, 13 May 2019 06:52:05 +0000 (12:22 +0530)]
doc/filters: mention drawtext command support

5 weeks agoavfilter/drawtext: make command processing error-resilient
Gyan Doshi [Fri, 10 May 2019 13:43:33 +0000 (19:13 +0530)]
avfilter/drawtext: make command processing error-resilient

Prevents crash or interruption in text rendering
if new option string contains invalid values.

5 weeks agolavc/videotoolboxenc: Add support for 10-bit HEVC encoding.
Rick Kern [Sun, 12 May 2019 20:05:51 +0000 (16:05 -0400)]
lavc/videotoolboxenc: Add support for 10-bit HEVC encoding.

Hardware-accelerated encoding may not support 10-bit encoding. Use
'-require_sw 1' in this case.

Fixes: #7581

Signed-off-by: Rick Kern <kernrj@gmail.com>
5 weeks agolavc/videotoolboxenc: simplify frame creation logic between OS X and iOS.
Rick Kern [Sun, 12 May 2019 20:04:37 +0000 (16:04 -0400)]
lavc/videotoolboxenc: simplify frame creation logic between OS X and iOS.

Signed-off-by: Rick Kern <kernrj@gmail.com>
5 weeks agolavc/videotoolboxenc: add require_sw option to force software encoding.
Rick Kern [Sun, 12 May 2019 20:01:50 +0000 (16:01 -0400)]
lavc/videotoolboxenc: add require_sw option to force software encoding.

Signed-off-by: Rick Kern <kernrj@gmail.com>
5 weeks agoavfilter/af_astats: fix calculations involving last sample
Paul B Mahol [Sun, 12 May 2019 15:10:40 +0000 (17:10 +0200)]
avfilter/af_astats: fix calculations involving last sample

5 weeks agoavfilter/af_astats: fix initial values of variables
Paul B Mahol [Sun, 12 May 2019 14:56:00 +0000 (16:56 +0200)]
avfilter/af_astats: fix initial values of variables

5 weeks agoswscale: Add test for isSemiPlanarYUV to pixdesc_query
Philip Langdale [Sat, 11 May 2019 17:12:47 +0000 (10:12 -0700)]
swscale: Add test for isSemiPlanarYUV to pixdesc_query

Lauri had asked me what the semi planar formats were and that reminded
me that we could add it to pixdesc_query so we know exactly what the
list is.

5 weeks agoswscale: Add support for NV24 and NV42
Philip Langdale [Fri, 10 May 2019 04:02:09 +0000 (21:02 -0700)]
swscale: Add support for NV24 and NV42

The implementation is pretty straight-forward. Most of the existing
NV12 codepaths work regardless of subsampling and are re-used as is.
Where necessary I wrote the slightly different NV24 versions.

Finally, the one thing that confused me for a long time was the
asm specific x86 path that did an explicit exclusion check for NV12.
I replaced that with a semi-planar check and also updated the
equivalent PPC code, which Lauri kindly checked.

5 weeks agoavutil: Add NV24 and NV42 pixel formats
Philip Langdale [Tue, 7 May 2019 03:39:39 +0000 (20:39 -0700)]
avutil: Add NV24 and NV42 pixel formats

These are the 4:4:4 variants of the semi-planar NV12/NV21 formats.

These formats are not used much, so we've never had a reason to add
them until now. VDPAU recently added support HEVC 4:4:4 content
and when you use the OpenGL interop, the returned surfaces are in
NV24 format, so we need the pixel format for media players, even
if there's no direct use within ffmpeg.

Separately, there are apparently webcams that use NV24, but I've
never seen one.

5 weeks agoavcodec/h264_ps: Check offset_for_non_ref_pic, offset_for_top_to_bottom_field and...
Michael Niedermayer [Sat, 11 May 2019 17:36:55 +0000 (19:36 +0200)]
avcodec/h264_ps: Check offset_for_non_ref_pic, offset_for_top_to_bottom_field and offset_for_ref_frame

Fixes: signed integer overflow: -2147483648 + -1 cannot be represented in type 'int'
Fixes: 14444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5675880333967360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agoavcodec/hq_hqa: Check available space before reading slice offsets
Michael Niedermayer [Sat, 11 May 2019 21:05:47 +0000 (23:05 +0200)]
avcodec/hq_hqa: Check available space before reading slice offsets

Fixes: Timeout (43sec -> 18sec)
Fixes: 14556/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5673543024508928

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>
5 weeks agoavcodec/wmv2dec: Check input bits vs. coded MBs
Michael Niedermayer [Tue, 30 Apr 2019 22:40:03 +0000 (00:40 +0200)]
avcodec/wmv2dec: Check input bits vs. coded MBs

Fixes: Timeout (94sec ->8sec)
Fixes: 14387/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5723546887651328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agolavc/pngenc: check malloc fail before using the pointer
Jun Zhao [Fri, 10 May 2019 14:28:38 +0000 (22:28 +0800)]
lavc/pngenc: check malloc fail before using the pointer

Need to check malloc fail before using the pointer

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/mlpenc: remove the redundant condition check
Jun Zhao [Fri, 10 May 2019 13:24:17 +0000 (21:24 +0800)]
lavc/mlpenc: remove the redundant condition check

remove the redundant condition check for 'frame'

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/libvpxenc: remove redundant condition check
Jun Zhao [Fri, 10 May 2019 13:02:40 +0000 (21:02 +0800)]
lavc/libvpxenc: remove redundant condition check

Redundant condition: '!A || B' is equivalent to '!A || (A && B)' but
more clearly.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/bink: Remove the dead code block
Jun Zhao [Fri, 10 May 2019 11:22:01 +0000 (19:22 +0800)]
lavc/bink: Remove the dead code block

Remove the dead code block

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/avpacket: check NULL before using the pointer
Jun Zhao [Fri, 10 May 2019 11:03:54 +0000 (19:03 +0800)]
lavc/avpacket: check NULL before using the pointer

Need to check NULL before using the pointer

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/aacenc_ltp: remove unnecessary condition check.
Jun Zhao [Fri, 10 May 2019 07:49:45 +0000 (15:49 +0800)]
lavc/aacenc_ltp: remove unnecessary condition check.

Condition 'sum==2' is always true, so remove the check logic to
make the code clean.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavf/isom: Allow reading mp3-in-isom as written by vlc.
Carl Eugen Hoyos [Sat, 11 May 2019 23:35:47 +0000 (01:35 +0200)]
lavf/isom: Allow reading mp3-in-isom as written by vlc.

Reported-by: IRC user aiena
5 weeks agoavfilter: add colorhold filter
Paul B Mahol [Sun, 13 Jan 2019 18:02:52 +0000 (19:02 +0100)]
avfilter: add colorhold filter

Fixes #7671.

5 weeks agoavcodec/gif: remove flags from gifimage option
Paul B Mahol [Sat, 11 May 2019 14:40:59 +0000 (16:40 +0200)]
avcodec/gif: remove flags from gifimage option

It does not belong there.

5 weeks agoavcodec/gif: fix issues with transparent crop
Jacob Graff [Thu, 9 May 2019 20:45:56 +0000 (16:45 -0400)]
avcodec/gif: fix issues with transparent crop

Resolves issues with some transparent gifs.

5 weeks agolavc/libx265: Use avctx->framerate first for frame rate setting
Jun Zhao [Sat, 27 Apr 2019 10:52:57 +0000 (18:52 +0800)]
lavc/libx265: Use avctx->framerate first for frame rate setting

perfer avctx->framerate first than use avctx->time_base when setting
the frame rate to encoder. 1/time_base is not the average frame rate
if the frame rate is not constant, so use avctx->framerate if the
value is not zero.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavc/libx264: Use avctx->framerate first for frame rate setting
Jun Zhao [Sat, 27 Apr 2019 10:45:23 +0000 (18:45 +0800)]
lavc/libx264: Use avctx->framerate first for frame rate setting

perfer avctx->framerate first than use avctx->time_base when setting
the frame rate to encoder. 1/time_base is not the average frame rate
if the frame rate is not constant. In this case, we need to setting
avctx->framerate and avctx->time_base both, but avctx->framerate not
equal to 1/(avctx->time_base).

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agolavf/avidec: Do not test for bitrate <= INT_MAX.
Carl Eugen Hoyos [Fri, 10 May 2019 08:44:34 +0000 (10:44 +0200)]
lavf/avidec: Do not test for bitrate <= INT_MAX.

AVCodecContext->bit_rate is int64_t since 7404f3bd

Unbreaks non-interleaved detection of v210 4k avi files, broken since 0eec40b7.
Reported-by: Xavier Càmara, Centre de Conservació i Restauració, Filmoteca de Catalunya
5 weeks agolavf/cover_rect: Fix logic check issue
Jun Zhao [Wed, 8 May 2019 13:54:46 +0000 (21:54 +0800)]
lavf/cover_rect: Fix logic check issue

Fix logic check issue #6741

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agoLICENSE: Clarify --enable-nonfree.
Carl Eugen Hoyos [Thu, 9 May 2019 23:18:58 +0000 (01:18 +0200)]
LICENSE: Clarify --enable-nonfree.

Using the configure option --enable-nonfree makes the resulting binary unredistributable.

5 weeks agoLICENSE: Remove nvenc from the non-free section.
Carl Eugen Hoyos [Thu, 9 May 2019 23:15:44 +0000 (01:15 +0200)]
LICENSE: Remove nvenc from the non-free section.

The headers are auto-detected by current FFmpeg.

5 weeks agoLICENSE: Remove an incorrect statement.
Carl Eugen Hoyos [Thu, 9 May 2019 22:55:10 +0000 (00:55 +0200)]
LICENSE: Remove an incorrect statement.

Missed in bc4137d4

5 weeks agoavcodec/prosumer: Only memset(0) what is needed.
Michael Niedermayer [Wed, 1 May 2019 17:43:40 +0000 (19:43 +0200)]
avcodec/prosumer: Only memset(0) what is needed.

Fixes: Timeout (11sec -> 0.08sec)
Fixes: 14406/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5151210148986880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agoavcodec/fic: Check input size against minimal frame size
Michael Niedermayer [Wed, 1 May 2019 18:12:12 +0000 (20:12 +0200)]
avcodec/fic: Check input size against minimal frame size

Fixes: Timeout (22sec ->54ms)
Fixes: 14439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-5660988231122944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agoavcodec/pafvideo: Check input space for decode_0() before slow operations
Michael Niedermayer [Sun, 28 Apr 2019 23:23:41 +0000 (01:23 +0200)]
avcodec/pafvideo: Check input space for decode_0() before slow operations

Fixes: Timeout (11sec -> 2sec)
Fixes: 14403/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5697465698746368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agoavcodec/scpr: check remaining data after decode
Michael Niedermayer [Thu, 25 Apr 2019 18:23:26 +0000 (20:23 +0200)]
avcodec/scpr: check remaining data after decode

Fixes Timeout (29sec -> 14sec)
Fixes: 13713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5756778069884928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 weeks agotools/crypto_bench: update the comment about build command
Jun Zhao [Wed, 8 May 2019 17:24:28 +0000 (01:24 +0800)]
tools/crypto_bench: update the comment about build command

commit cd62f9d557f missing the comment about build

Reviewed-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agotools/crypto_bench: check malloc fail before using it
Jun Zhao [Wed, 8 May 2019 17:16:27 +0000 (01:16 +0800)]
tools/crypto_bench: check malloc fail before using it

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

Reviewed-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 weeks agoavfilter/af_atempo: Make ffplay display correct timestamps when seeking
Pavel Koshevoy [Wed, 8 May 2019 04:39:45 +0000 (22:39 -0600)]
avfilter/af_atempo: Make ffplay display correct timestamps when seeking

NOTE: this is a refinement of the patch from Paul B Mahol
offset all output timestamps by same amount of first input timestamp

5 weeks agoavformat/matroskaenc: Reduce usage of ebml_master
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:10 +0000 (01:41 +0200)]
avformat/matroskaenc: Reduce usage of ebml_master

After the last few commits, the functions for writing master elements
with CRC-32 elements didn't really make use of the ebml_master
structure any more, so remove these parameters from the functions.

The only things that still need to be kept are the positions of the
level 1 elements that are written preliminarily and updated later.
These positions are stored in the MatroskaMuxContext and
replace the corresponding ebml_master structures.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Improve log messages for blocks
Andreas Rheinhardt [Tue, 23 Apr 2019 19:45:52 +0000 (21:45 +0200)]
avformat/matroskaenc: Improve log messages for blocks

Up until now, a block's relative offset has been reported as the offset
in the log messages output when writing blocks; given that it is
impossible to know the real offset from the beginning of the file at
this point due to the fact that it is not yet known how many bytes will
be used for the containing cluster's length field both the relative
offset in the cluster as well as the offset of the containing cluster
will be reported from now on.

Furthermore, the TrackNumber of the written block has been added to the
log output.

Also, the log message for writing vtt blocks has been brought in line
with the message for normal blocks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Don't waste bytes writing level 1 elements
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:08 +0000 (01:41 +0200)]
avformat/matroskaenc: Don't waste bytes writing level 1 elements

Up until now, the length field of most level 1 elements has been written
using eight bytes, although it is known in advance how much space the
content of said elements will take up so that it would be possible to
determine the minimal amount of bytes for the length field. This
commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Cosmetics and typo
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:07 +0000 (01:41 +0200)]
avformat/matroskaenc: Cosmetics and typo

Fixes intendation, whitespace, a typo and renames a variable
(dyn_bc->cluster_bc) to make its meaning clearer and to bring
it more in line with the naming of similar variables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Write CRC-32 in non-seekable mode
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:06 +0000 (01:41 +0200)]
avformat/matroskaenc: Write CRC-32 in non-seekable mode

Given that in both the seekable as well as the non-seekable mode dynamic
buffers are used to write level 1 elements and that now no seeks are
used in the seekable case any more, the two modes can be combined; as a
consequence, the non-seekable mode automatically inherits the ability to
write CRC-32 elements.

There are no differences in case the output is seekable; when it is not
and writing CRC-32 elements is disabled, there can still be minor
differences because before this commit, the EBML ID and length field
were counted towards the cluster size limit; now they no longer are.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Avoid seeking when writing level 1 elements
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:05 +0000 (01:41 +0200)]
avformat/matroskaenc: Avoid seeking when writing level 1 elements

Up until now, the writing process for level 1 elements (those elements
for which CRC-32 elements are written by default) was this in case the
output was seekable: Write the EBML ID, write an "unkown length" EBML
number of the desired length, then write the element into a dynamic
buffer, then write the dynamic buffer (after possible calculation and
writing of the CRC-element), then seek back to the size element and
overwrite the unknown-size element with the real size. The seeking and
overwriting part has been eliminated by not writing the size initially.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Change variable types
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:04 +0000 (01:41 +0200)]
avformat/matroskaenc: Change variable types

A Matroska EBML ID can only be maximally four bytes long, so make the
variables denoting EBML IDs uint32_t instead of unsigned int to
better reflect this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Remove redundant check
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:03 +0000 (01:41 +0200)]
avformat/matroskaenc: Remove redundant check

All places where end_ebml_master_crc32_preliminary are used already
check for whether the output is seekable, so the check in the function
is redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Improve log message
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:02 +0000 (01:41 +0200)]
avformat/matroskaenc: Improve log message

Since 4e3bdf729a80f868b014ceb02901d87198b545a5 there is no reason any
more to treat the seekable and non-seekable cases separate with regards
to the log message for a new cluster. This effectively reverts
d41aeea8a64bab5d7aacd602f7214f95baad109f.

Also improved the log message: "pts 80dts 0" -> "pts 80, dts 0".

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Simplify check for writing CRCs
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:01 +0000 (01:41 +0200)]
avformat/matroskaenc: Simplify check for writing CRCs

Up until now, the check for whether to write CRC32 elements was always
mkv->write_crc && mkv->mode != MODE_WEBM. This is equivalent to simply
set write_crc to zero in WebM-mode. And this is what this commit does.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Remove traces of secondary seek head
Andreas Rheinhardt [Fri, 19 Apr 2019 23:41:00 +0000 (01:41 +0200)]
avformat/matroskaenc: Remove traces of secondary seek head

Up until e7ddafd515dc9826915b739d0b977a63c21e96af the Matroska muxer
wrote a secondary seek head referencing all the clusters. When this
was changed, a (now completely wrong) comment remained and the unique
remaining seek head was still called main_seekhead. This has been
changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Don't waste bytes in EBML Header
Andreas Rheinhardt [Fri, 19 Apr 2019 23:40:59 +0000 (01:40 +0200)]
avformat/matroskaenc: Don't waste bytes in EBML Header

Up until now the EBML Header length field has been written with eight
bytes, although the EBML Header is always so small that only one byte
is needed for it. This patch saves seven bytes for every Matroska/Webm
file.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Slightly improve size bounds for cues
Andreas Rheinhardt [Fri, 19 Apr 2019 23:40:58 +0000 (01:40 +0200)]
avformat/matroskaenc: Slightly improve size bounds for cues

The upper bounds currently used for determining the size of a CuePoint's
length field can be improved somewhat; as a result, a CuePoint
containing three CueTrackPositions will now only need a size field
with one byte length.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Fix BlockGroup size calculation
Andreas Rheinhardt [Fri, 19 Apr 2019 23:40:57 +0000 (01:40 +0200)]
avformat/matroskaenc: Fix BlockGroup size calculation

The earlier code included the size of the BlockGroup's length field and
the EBML ID in the calculation of the size for the payload and ignored
the size of the  duration's length field. This meant that Blockgroups
corresponding to packets with size 2^(7n) - 17 - n - i, i = 0,..., n - 1,
n = 1,..., 8 (i.e. 110, 16364, 16365, 2097130..2097132, ...) were written
with length fields that are unnecessarily long.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavformat/matroskaenc: Fix relative timestamp check
Andreas Rheinhardt [Fri, 19 Apr 2019 23:40:56 +0000 (01:40 +0200)]
avformat/matroskaenc: Fix relative timestamp check

At this point, ts already includes the ts_offset so that the relative
time written with the cluster is already given by ts - mkv->cluster_pts.
It is this number that needs to fit into an int16_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agolibavfilter/dnn: add more data type support for dnn model input
Guo, Yejun [Thu, 25 Apr 2019 02:14:42 +0000 (10:14 +0800)]
libavfilter/dnn: add more data type support for dnn model input

currently, only float is supported as model input, actually, there
are other data types, this patch adds uint8.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/dnn: support multiple outputs for tensorflow model
Guo, Yejun [Thu, 25 Apr 2019 02:14:33 +0000 (10:14 +0800)]
libavfilter/dnn: support multiple outputs for tensorflow model

some models such as ssd, yolo have more than one output.

the clean up code in this patch is a little complex, it is because
that set_input_output_tf could be called for many times together
with ff_dnn_execute_model_tf, we have to clean resources for the
case that the two interfaces are called interleaved.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/dnn: avoid memcpy for tensorflow dnn output
Guo, Yejun [Thu, 25 Apr 2019 02:14:25 +0000 (10:14 +0800)]
libavfilter/dnn: avoid memcpy for tensorflow dnn output

use TF_Tensor's cpu address to avoid extra memcpy.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/dnn: determine dnn output during execute_model instead of set_input_output
Guo, Yejun [Thu, 25 Apr 2019 02:14:17 +0000 (10:14 +0800)]
libavfilter/dnn: determine dnn output during execute_model instead of set_input_output

Currently, within interface set_input_output, the dims/memory of the tensorflow
dnn model output is determined by executing the model with zero input,
actually, the output dims might vary with different input data for networks
such as object detection models faster-rcnn, ssd and yolo.

This patch moves the logic from set_input_output to execute_model which
is suitable for all the cases. Since interface changed, and so dnn_backend_native
also changes.

In vf_sr.c, it knows it's srcnn or espcn by executing the model with zero input,
so execute_model has to be called in function config_props

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/dnn: remove limit for the name of DNN model input/output
Guo, Yejun [Thu, 25 Apr 2019 02:14:08 +0000 (10:14 +0800)]
libavfilter/dnn: remove limit for the name of DNN model input/output

remove the requirment that the name of DNN model input/output
should be "x"/"y",

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/vf_sr: refine code to remove keyword 'else'
Guo, Yejun [Thu, 25 Apr 2019 02:14:01 +0000 (10:14 +0800)]
libavfilter/vf_sr: refine code to remove keyword 'else'

remove 'else' since there is always 'return' in 'if' scope,
so the code will be clean for later maintenance

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agolibavfilter/dnn_backend_tf.c: set layer_add_res for input layer
Guo, Yejun [Thu, 25 Apr 2019 02:13:49 +0000 (10:13 +0800)]
libavfilter/dnn_backend_tf.c: set layer_add_res for input layer

otherwise, the following check will return error if layer_add_res
is randomly initialized.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
5 weeks agoavfilter/af_afftfilt: switch to activate
Paul B Mahol [Wed, 8 May 2019 13:03:22 +0000 (15:03 +0200)]
avfilter/af_afftfilt: switch to activate

5 weeks agoconfigure: enable ffnvcodec, nvenc, nvdec for ppc6le
Ruta Gadkari [Tue, 12 Mar 2019 08:24:04 +0000 (13:54 +0530)]
configure: enable ffnvcodec, nvenc, nvdec for ppc6le

Adding the support to build FFMPEG with HW accelerated decode and encode on PPC64
little endian architecture.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
5 weeks agoavcodec/cuviddec: add capability check for maximum macroblock count
Ruta Gadkari [Fri, 3 May 2019 08:11:11 +0000 (13:41 +0530)]
avcodec/cuviddec: add capability check for maximum macroblock count

Cuvid supports clips with a limit on maximum number of macroblocks.
This check was missing after cuvidGetDecoderCaps API call allowing
unsupported clips to proceed.
Added the missing check, same as the one in hwaccel nvdec implementation.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
5 weeks agolavfi/gblur: doing several columns at the same time
Ruiling Song [Mon, 6 May 2019 03:48:31 +0000 (11:48 +0800)]
lavfi/gblur: doing several columns at the same time

Instead of doing each column one by one, doing several columns
together gives about 30% better performance.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
5 weeks agoconfigure: remove mlp parser dependency from truehd_core bsf
James Almer [Tue, 7 May 2019 20:42:07 +0000 (17:42 -0300)]
configure: remove mlp parser dependency from truehd_core bsf

It's no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agoavcodec/mlp_parser: split off shared code to its own file
James Almer [Sat, 4 May 2019 18:15:50 +0000 (15:15 -0300)]
avcodec/mlp_parser: split off shared code to its own file

Signed-off-by: James Almer <jamrial@gmail.com>
5 weeks agodoc/filters: layout requirements for xstack
Gyan Doshi [Tue, 7 May 2019 12:24:24 +0000 (17:54 +0530)]
doc/filters: layout requirements for xstack

5 weeks agoavfilter/vf_xstack: set better error msg for
Gyan Doshi [Tue, 7 May 2019 10:30:40 +0000 (16:00 +0530)]
avfilter/vf_xstack: set better error msg for
missing layout

5 weeks agoswscale/ppc: Shorten power8 tests via a var
Lauri Kasanen [Tue, 30 Apr 2019 11:36:17 +0000 (14:36 +0300)]
swscale/ppc: Shorten power8 tests via a var

5 weeks agoswscale/ppc: VSX-optimize hScale16To*
Lauri Kasanen [Tue, 30 Apr 2019 11:25:38 +0000 (14:25 +0300)]
swscale/ppc: VSX-optimize hScale16To*

./ffmpeg -loop 1 -s 1200x1440 -i tux16.png \
    -s 2400x720 -f rawvideo -y -vframes 5 -pix_fmt yuv420p16le -nostats test.raw

./ffmpeg -loop 1 -s 1200x1440 -i tux16.png \
    -s 2400x720 -f rawvideo -y -vframes 5 -pix_fmt yuv420p -nostats test.raw

32-bit mul, power8 only

2x speedup for hScale8To19_vsx (x86 SSE2 is 2.37):
  30896 UNITS in hscale,    8192 runs,      0 skips
  63956 UNITS in hscale,    8192 runs,      0 skips

2.06 for hScale16To15_vsx:
  30531 UNITS in hscale,    8192 runs,      0 skips
  63161 UNITS in hscale,    8192 runs,      0 skips

5 weeks agoswscale/ppc: Indent
Lauri Kasanen [Tue, 30 Apr 2019 10:24:49 +0000 (13:24 +0300)]
swscale/ppc: Indent

5 weeks agoswscale/ppc: VSX-optimize hScale8To19
Lauri Kasanen [Tue, 30 Apr 2019 10:21:28 +0000 (13:21 +0300)]
swscale/ppc: VSX-optimize hScale8To19

./ffmpeg -f lavfi -i yuvtestsrc=duration=1:size=1200x1440 \
    -s 2400x720 -f rawvideo -y -vframes 5 -pix_fmt yuv420p16le -nostats test.raw

2.26 speedup (x86 SSE2 is 2.32):
  23772 UNITS in hscale,    4096 runs,      0 skips
  53862 UNITS in hscale,    4096 runs,      0 skips

5 weeks agolavc/qsv: extactly map profile
Zhong Li [Sun, 28 Apr 2019 12:27:48 +0000 (20:27 +0800)]
lavc/qsv: extactly map profile

Currently profile mapping is hard-coded, and not flexible to do extactly
map (E.g: libmfx treats H264 constrained baseline to be baseline profile).

vaapi profile mapping funtion provides a better soultion than current
qsv mapping.

Signed-off-by: Zhong Li <zhong.li@intel.com>
5 weeks agolavc/qsvdec: fix hevc level incorrectly map
Zhong Li [Sun, 28 Apr 2019 09:15:55 +0000 (17:15 +0800)]
lavc/qsvdec: fix hevc level incorrectly map

libmfx hevc level defination is same as h264, not level_idc of SPEC.

Signed-off-by: Zhong Li <zhong.li@intel.com>
5 weeks agolavc/qsvdec: add query function and provide error message
Zhong Li [Thu, 25 Apr 2019 10:51:10 +0000 (18:51 +0800)]
lavc/qsvdec: add query function and provide error message

It is helpful to know why some clips decoding failed.
Ticket#7330 is a good example, with this patch it is easily to
know bitstream codec level is out of support range.

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 weeks agoavcodec/fits: Check bitpix
Michael Niedermayer [Sun, 5 May 2019 16:38:33 +0000 (18:38 +0200)]
avcodec/fits: Check bitpix

Reference: Table 8: Interpretation of valid BITPIX value from FITS standard 4.0
Fixes: runtime error: division by zero
Fixes: 14581/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5652382425284608

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>
6 weeks agoavfilter/af_rubberband: also do not ignore failures
Paul B Mahol [Mon, 6 May 2019 19:09:43 +0000 (21:09 +0200)]
avfilter/af_rubberband: also do not ignore failures

6 weeks agoavfilter/af_rubberband: handle case when no frame is given
Paul B Mahol [Mon, 6 May 2019 19:04:52 +0000 (21:04 +0200)]
avfilter/af_rubberband: handle case when no frame is given

6 weeks agoavcodec/vp9_raw_reorder: reset state when flushing
James Almer [Mon, 6 May 2019 03:22:32 +0000 (00:22 -0300)]
avcodec/vp9_raw_reorder: reset state when flushing

Signed-off-by: James Almer <jamrial@gmail.com>