ffmpeg.git
11 months agox86/vf_v360: make remap{1,2}_8bit_line_avx2 work on x86_32
James Almer [Fri, 6 Sep 2019 14:11:45 +0000 (11:11 -0300)]
x86/vf_v360: make remap{1,2}_8bit_line_avx2 work on x86_32

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavfilter/vf_v360: add option to pick rotation order
Paul B Mahol [Fri, 6 Sep 2019 11:14:29 +0000 (13:14 +0200)]
avfilter/vf_v360: add option to pick rotation order

11 months agoavfilter/vf_v360: reduce allocations by reusing duplicated remaps
Paul B Mahol [Fri, 6 Sep 2019 09:46:11 +0000 (11:46 +0200)]
avfilter/vf_v360: reduce allocations by reusing duplicated remaps

11 months agoavfilter/vf_v360: x86 SIMD for interpolations
Paul B Mahol [Tue, 3 Sep 2019 16:54:44 +0000 (18:54 +0200)]
avfilter/vf_v360: x86 SIMD for interpolations

11 months agoavfilter/vf_v360: add asserts to guard against invalid conditions
Paul B Mahol [Tue, 3 Sep 2019 15:02:20 +0000 (17:02 +0200)]
avfilter/vf_v360: add asserts to guard against invalid conditions

11 months agoavfilter/vf_v360: stop using floats in interpolation
Paul B Mahol [Tue, 3 Sep 2019 11:15:03 +0000 (13:15 +0200)]
avfilter/vf_v360: stop using floats in interpolation

11 months agoavfilter/vf_v360: rewrite storing of remap positions and interpolations
Paul B Mahol [Tue, 3 Sep 2019 09:45:25 +0000 (11:45 +0200)]
avfilter/vf_v360: rewrite storing of remap positions and interpolations

In preparation of SIMD assembly.

11 months agodoc/filters: correct range for contrast in eq filter
Sourabh Sharma [Fri, 6 Sep 2019 02:58:13 +0000 (08:28 +0530)]
doc/filters: correct range for contrast in eq filter

Fixes #8111

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
11 months agoavformat/hlsenc: fix compiling error of hlsenc
Steven Liu [Fri, 6 Sep 2019 04:47:15 +0000 (12:47 +0800)]
avformat/hlsenc: fix compiling error of hlsenc

11 months agoavformat/hlsenc: fix code style
Steven Liu [Fri, 6 Sep 2019 04:15:45 +0000 (12:15 +0800)]
avformat/hlsenc: fix code style

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agoavformat/hlsenc: move the warning message from every segment upload to init part
Steven Liu [Fri, 6 Sep 2019 04:10:15 +0000 (12:10 +0800)]
avformat/hlsenc: move the warning message from every segment upload to init part

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agoavformat/hlsenc: avformat/hlsenc: reopen new http session for http_persistent
Steven Liu [Thu, 29 Aug 2019 23:14:28 +0000 (07:14 +0800)]
avformat/hlsenc: avformat/hlsenc: reopen new http session for http_persistent

fix ticket: 7975

Tested-by: Ian Klassen <ian@virtualfunc.com>
Suggested-by: Ian Klassen <ian@virtualfunc.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agoavformat/http: add ff_http_get_shutdown_status api for check the status of shutdown
Steven Liu [Thu, 29 Aug 2019 23:14:27 +0000 (07:14 +0800)]
avformat/http: add ff_http_get_shutdown_status api for check the status of shutdown

this function is used to get the previous shutdown status
when reusing the old connection in block mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agofate: add test for stream_loop
Gyan Doshi [Wed, 4 Sep 2019 09:53:35 +0000 (15:23 +0530)]
fate: add test for stream_loop

Checks that seek to start indeed seeks to start.

11 months agoffmpeg: switch to avformat_seek_file for stream_loop
Gyan Doshi [Sat, 31 Aug 2019 14:15:58 +0000 (19:45 +0530)]
ffmpeg: switch to avformat_seek_file for stream_loop

Fixes stream_loop with very short files where seeking is generic index
search

11 months agoavcodec/iff: Check for overlap in cmap_read_palette()
Michael Niedermayer [Wed, 21 Aug 2019 21:22:39 +0000 (23:22 +0200)]
avcodec/iff: Check for overlap in cmap_read_palette()

Fixes: undefined memcpy() use
Fixes: 16302/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5678750575886336

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 agoavcodec/vqavideo: Limit resolution
Michael Niedermayer [Thu, 22 Aug 2019 17:39:29 +0000 (19:39 +0200)]
avcodec/vqavideo: Limit resolution

Fixes: Timeout (288sec -> 1ms)
Fixes: 16353/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-5633402606190592

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 agoavcodec/apedec: Fix 32bit int overflow in do_apply_filter()
Michael Niedermayer [Mon, 2 Sep 2019 20:44:50 +0000 (22:44 +0200)]
avcodec/apedec: Fix 32bit int overflow in do_apply_filter()

Fixes: signed integer overflow: 2147480546 + 4096 cannot be represented in type 'int'
Fixes: 16280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5123442566758400

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>
11 months agoconfigure: fix --disable-v4l2-m2m can't work
Jun Zhao [Wed, 4 Sep 2019 09:39:59 +0000 (17:39 +0800)]
configure: fix --disable-v4l2-m2m can't work

Use the command ./configure with/without --disable-v4l2-m2m test.

Reviewed-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
11 months agoconfigure: fix --disable-alsa can't work
Jun Zhao [Wed, 4 Sep 2019 09:27:09 +0000 (17:27 +0800)]
configure: fix --disable-alsa can't work

fix --disable-alsa can't work in configure

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
11 months agodoc/filters: fix alphabetic order of some video filters
Paul B Mahol [Thu, 5 Sep 2019 09:32:21 +0000 (11:32 +0200)]
doc/filters: fix alphabetic order of some video filters

11 months agoavutil/version: bump for hwcontext_videotoolbox api change
Aman Gupta [Wed, 4 Sep 2019 19:55:52 +0000 (12:55 -0700)]
avutil/version: bump for hwcontext_videotoolbox api change

av_map_videotoolbox_format_from_pixfmt2() added in previous
commit to support full-range pixel formats.

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/videotoolbox: add support for full range pixel formats
Akemi [Sat, 13 Apr 2019 14:36:01 +0000 (16:36 +0200)]
avcodec/videotoolbox: add support for full range pixel formats

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavformat/mxfenc: fix warning: unused function 'klv_ber_length' [-Wunused-function]
Limin Wang [Thu, 29 Aug 2019 08:44:01 +0000 (16:44 +0800)]
avformat/mxfenc: fix warning: unused function 'klv_ber_length' [-Wunused-function]

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
11 months agolibavfilter/dnn: add header into native model file
Guo, Yejun [Mon, 2 Sep 2019 04:35:58 +0000 (12:35 +0800)]
libavfilter/dnn: add header into native model file

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
11 months agoavformat/matroskadec: use av_fast_realloc to reallocate ebml list arrays
James Almer [Tue, 3 Sep 2019 21:45:04 +0000 (18:45 -0300)]
avformat/matroskadec: use av_fast_realloc to reallocate ebml list arrays

Speeds up the process considerably.

Fixes ticket #8109.

Suggested-by: nevcairiel
Suggested-by: cehoyos
Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavformat/matroskadec: use proper types for some EbmlSyntax fields
James Almer [Tue, 3 Sep 2019 21:52:51 +0000 (18:52 -0300)]
avformat/matroskadec: use proper types for some EbmlSyntax fields

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavcodec/nuv: prevent frame copying when outputting duplicate frames
James Almer [Wed, 4 Sep 2019 02:54:19 +0000 (23:54 -0300)]
avcodec/nuv: prevent frame copying when outputting duplicate frames

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavcodec/wcmv: prevent frame copying when outputting duplicate frames
James Almer [Wed, 4 Sep 2019 02:53:46 +0000 (23:53 -0300)]
avcodec/wcmv: prevent frame copying when outputting duplicate frames

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoRevert "avcodec/wcmv: Avoid copying frames if they are unchanged"
James Almer [Wed, 4 Sep 2019 02:49:00 +0000 (23:49 -0300)]
Revert "avcodec/wcmv: Avoid copying frames if they are unchanged"

This reverts commit 976dae8b32f48d17cccfd6b19d2beb01770dfa7c.

An alternative approach to reduce frame copying will follow.

11 months agoavcodec/wcmv: use ff_reget_buffer()
James Almer [Thu, 29 Aug 2019 22:24:10 +0000 (19:24 -0300)]
avcodec/wcmv: use ff_reget_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavcodec/decode: add a flags parameter to ff_reget_buffer()
James Almer [Fri, 30 Aug 2019 14:37:25 +0000 (11:37 -0300)]
avcodec/decode: add a flags parameter to ff_reget_buffer()

Some decoders may not need a writable buffer in some specific cases, but only
a reference to the existing buffer with updated frame properties instead, for
the purpose of returning duplicate frames. For this, the
FF_REGET_BUFFER_FLAG_READONLY flag is added, which will prevent potential
allocations and buffer copies when they are not needed.

Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavformat/mpegts: Check if ready on SCTE reception
Anthony Delannoy [Tue, 3 Sep 2019 15:54:24 +0000 (17:54 +0200)]
avformat/mpegts: Check if ready on SCTE reception

On some DVB stream SCTE-35 data packet are available before the end of
MpegTSContext initialization. We have to check if it is the case to
avoid a SEGFAULT.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoconfigure: ensure --enable-omx-rpi uses rpi-specific IL headers
Aman Gupta [Mon, 2 Sep 2019 20:04:42 +0000 (21:04 +0100)]
configure: ensure --enable-omx-rpi uses rpi-specific IL headers

When compiling natively on an RPI where libomxil-bellagio-dev
was also installed, `check_headers OMX_Core.h` succeeded and
the -isystem compiler flag was never added to the build.

For non-native builds, the error message now mentions the
raspberrypi/firmware repository where the RPI specific
headers are available.

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m: fix minor indentation issue
Aman Gupta [Wed, 28 Aug 2019 19:27:20 +0000 (12:27 -0700)]
avcodec/v4l2_m2m: fix minor indentation issue

11 months agoavcodec/v4l2_m2m: use log_ctx variable consistently
Aman Gupta [Fri, 23 Aug 2019 19:31:24 +0000 (12:31 -0700)]
avcodec/v4l2_m2m: use log_ctx variable consistently

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m: log planar mode used by driver
Aman Gupta [Thu, 22 Aug 2019 18:03:31 +0000 (11:03 -0700)]
avcodec/v4l2_m2m: log planar mode used by driver

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_context: use EAGAIN to signal when input buffers are unavailable
Aman Gupta [Wed, 28 Aug 2019 23:42:46 +0000 (16:42 -0700)]
avcodec/v4l2_context: use EAGAIN to signal when input buffers are unavailable

ENOMEM indicates an allocation failure, and there are no allocations
happening here. The buffers are pre-allocated and there are simply
none available at this time.

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2m2m: fix error handling during buffer init
Jorge Ramirez-Ortiz [Sun, 6 May 2018 17:56:30 +0000 (19:56 +0200)]
avcodec/v4l2m2m: fix error handling during buffer init

Signed-off-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_buffers: return int64_t in v4l2_get_pts
Lukas Rusak [Mon, 8 Jan 2018 23:27:37 +0000 (15:27 -0800)]
avcodec/v4l2_buffers: return int64_t in v4l2_get_pts

v4l2_pts is type int64_t we should return that instead of uint64_t

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_context: return {decoder,encoder}_cmd errors
Aman Gupta [Mon, 26 Aug 2019 22:17:43 +0000 (15:17 -0700)]
avcodec/v4l2_context: return {decoder,encoder}_cmd errors

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m_enc: fix typo in log message
Aman Gupta [Fri, 23 Aug 2019 20:39:32 +0000 (13:39 -0700)]
avcodec/v4l2_m2m_enc: fix typo in log message

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m_enc: log errno on v4l2_set_ext_ctrl failures
Aman Gupta [Thu, 22 Aug 2019 23:00:37 +0000 (16:00 -0700)]
avcodec/v4l2_m2m_enc: log errno on v4l2_set_ext_ctrl failures

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_buffers: fix minor typos and whitespace
Aman Gupta [Thu, 22 Aug 2019 19:42:34 +0000 (12:42 -0700)]
avcodec/v4l2_buffers: fix minor typos and whitespace

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_context: log VIDIOC_REQBUFS failures
Aman Gupta [Thu, 22 Aug 2019 19:20:56 +0000 (12:20 -0700)]
avcodec/v4l2_context: log VIDIOC_REQBUFS failures

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m: remove trailing whitespace in output identifier
Aman Gupta [Thu, 22 Aug 2019 19:20:40 +0000 (12:20 -0700)]
avcodec/v4l2_m2m: remove trailing whitespace in output identifier

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavcodec/v4l2_m2m: log requested pixel formats
Aman Gupta [Thu, 22 Aug 2019 19:06:24 +0000 (12:06 -0700)]
avcodec/v4l2_m2m: log requested pixel formats

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavformat: Add ZeroMQ as a protocol
Andriy Gelman [Tue, 30 Jul 2019 18:39:32 +0000 (14:39 -0400)]
avformat: Add ZeroMQ as a protocol

When ffmpeg was streaming, multiple clients were only supported by using a
multicast destination address. An alternative was to stream to a server which
re-distributes the content. This commit adds ZeroMQ as a protocol, which allows
multiple clients to connect to a single ffmpeg instance.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavcodec/omx: fix xFramerate calculation
Aman Gupta [Thu, 29 Aug 2019 23:00:50 +0000 (16:00 -0700)]
avcodec/omx: fix xFramerate calculation

Integer overflow in the Q16 framerate calculation was sending
invalid values to the OMX encoder.

On the RPI4, this manifested as bitrate controls being ignored
on video streams with 60000/1001 framerates. Video streams with
30000/1001 framerates were not affected.

Signed-off-by: Aman Gupta <aman@tmm1.net>
11 months agoavformat/mpegtsenc: fix flushing of audio packets
Marton Balint [Sun, 25 Aug 2019 23:05:40 +0000 (01:05 +0200)]
avformat/mpegtsenc: fix flushing of audio packets

7d097a0fc57f0fa8385962a539c657c2f40b5ed0 had the same purpose as
3700f655c55e2001b57215210b957b169d66b50f but the former is much simpler, so
let's remove the latter.

Unfortunately both checks were wrong, because in order to make sure DTS > PCR
we have to give us some headroom, so instead of using a dts_difference <
max_delay check let's use a dts_difference < max_delay/2 check.

Fixes DTS < PCR errors with this command line:

./ffmpeg -loglevel verbose -y -f lavfi -i \
  "testsrc=s=64x64:d=20,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=20,asetnsamples=1000[out2]" \
  -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact  \
  -codec:v libx264 -codec:a mp2 -b:a 32k -pix_fmt yuv420p \
  -map '0:v:0' \
  -map '0:v:1' \
  -map '0:a:0'  \
  -muxrate 800000 \
  -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out1.ts

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agodocs/formats: fix max_interleave_delta default
Marton Balint [Sun, 25 Aug 2019 21:47:52 +0000 (23:47 +0200)]
docs/formats: fix max_interleave_delta default

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavcodec/ralf: fix undefined shift in extend_code()
Michael Niedermayer [Sat, 17 Aug 2019 17:25:01 +0000 (19:25 +0200)]
avcodec/ralf: fix undefined shift in extend_code()

Fixes: left shift of negative value -3
Fixes: 16147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5658392722407424

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 agoavcodec/ralf: fix undefined shift
Michael Niedermayer [Sat, 17 Aug 2019 17:18:31 +0000 (19:18 +0200)]
avcodec/ralf: fix undefined shift

Fixes: left shift of negative value -2
Fixes: 16145/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5146671058518016

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 agoavcodec/pngdec: Optimize has_trns code
Michael Niedermayer [Sat, 17 Aug 2019 23:28:38 +0000 (01:28 +0200)]
avcodec/pngdec: Optimize has_trns code

add inner loop specialisations for 2 bpp and 4 bpp
These are all cases for which i found testsamples.

30M cycles -> 5M cycles

Testcase: fate-rgbapng-4816
Testcase: 16097/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5664690889293824

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 agovcodec/apedec: Fix integer overflow in filter_3800()
Michael Niedermayer [Sat, 17 Aug 2019 22:36:17 +0000 (00:36 +0200)]
vcodec/apedec: Fix integer overflow in filter_3800()

Fixes: signed integer overflow: 2021654528 + 2032575680 cannot be represented in type 'int'
Fixes: 16270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5732438816325632

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 agoavcodec/apedec: Fix integer overflow in filter_fast_3320()
Michael Niedermayer [Sat, 17 Aug 2019 22:28:34 +0000 (00:28 +0200)]
avcodec/apedec: Fix integer overflow in filter_fast_3320()

Fixes: signed integer overflow: -1094994793 * 2 cannot be represented in type 'int'
Fixes: 16139/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5663911036059648

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 agolavc/v4l2_m2m: don't close the file descriptor we don't own
Pavel Koshevoy [Mon, 2 Sep 2019 06:34:35 +0000 (00:34 -0600)]
lavc/v4l2_m2m: don't close the file descriptor we don't own

ff_v4l2_m2m_create_context initialized V4L2m2mContext.fd to 0
which is a valid file descriptor value. Next ff_v4l2_m2m_codec_init
failed and v4l2_m2m_destroy_context closed file descriptor 0 even
though it didn't belong to V4L2m2mContext.

Signed-off-by: Pavel Koshevoy <pkoshevoy@gmail.com>
11 months agoconfigure: Update libmysofa check with a new symbol.
Andrey Semashev [Wed, 28 Aug 2019 20:16:35 +0000 (23:16 +0300)]
configure: Update libmysofa check with a new symbol.

The current code in libavfilter/af_sofalizer.c requires
mysofa_neighborhood_init_withstepdefine function, which only appeared
in libmysofa 0.7. Use this function in configure script to bail out
early if a too old libmysofa is found in the system instead of failing
at compile time.

11 months agoavcodec/bgmc: Check input space in ff_bgmc_decode_init()
Michael Niedermayer [Sun, 1 Sep 2019 20:31:45 +0000 (22:31 +0200)]
avcodec/bgmc: Check input space in ff_bgmc_decode_init()

Fixes: Infinite loop
Fixes: 16608/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5636229827133440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()
Michael Niedermayer [Sun, 1 Sep 2019 15:37:47 +0000 (17:37 +0200)]
avcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()

Fixes: Timeout (82sec -> 1sec)
Fixes: 16411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5166958151991296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavfilter/vf_v360: remove not needed items from ThreadData
Paul B Mahol [Mon, 2 Sep 2019 14:45:55 +0000 (16:45 +0200)]
avfilter/vf_v360: remove not needed items from ThreadData

11 months agoavfilter/vf_delogo: unbreak fate
Paul B Mahol [Mon, 2 Sep 2019 14:12:01 +0000 (16:12 +0200)]
avfilter/vf_delogo: unbreak fate

It is not clear what was real intention of previous commit to this filter.
It was not working correctly, hopefully this is fixed now.
It never checked that new x/y/w/h are actually valid, hopeffully this is fixed now.
It uses named variables in expressions that are never set, still not fixed.
It does not set named variables that uses actual frame widht/height, making actual
expressions less usable for our users, still now fixed.

11 months agoavfilter/vf_v360: set much smaller limit to w/h
Paul B Mahol [Mon, 2 Sep 2019 08:47:29 +0000 (10:47 +0200)]
avfilter/vf_v360: set much smaller limit to w/h

11 months agoavfilter/vf_v360: fix some small code style issues
Paul B Mahol [Mon, 2 Sep 2019 08:43:37 +0000 (10:43 +0200)]
avfilter/vf_v360: fix some small code style issues

11 months agoavfilter/vf_v360: extend description of eac format
Paul B Mahol [Mon, 2 Sep 2019 08:36:45 +0000 (10:36 +0200)]
avfilter/vf_v360: extend description of eac format

11 months agoavfilter/vf_v360: rename fb format to barrel
Paul B Mahol [Mon, 2 Sep 2019 08:35:25 +0000 (10:35 +0200)]
avfilter/vf_v360: rename fb format to barrel

11 months agoavcodec/tiff: rewrite lut handling
Paul B Mahol [Sat, 31 Aug 2019 19:14:28 +0000 (21:14 +0200)]
avcodec/tiff: rewrite lut handling

Remove endianess hack.

11 months agoavcodec/tiff: set color_trc, remove sRGB conversion
Paul B Mahol [Sat, 31 Aug 2019 18:57:29 +0000 (20:57 +0200)]
avcodec/tiff: set color_trc, remove sRGB conversion

11 months agolavc/tiff: Enable decoding of LinearRaw images
Nick Renieris [Thu, 29 Aug 2019 13:10:54 +0000 (16:10 +0300)]
lavc/tiff: Enable decoding of LinearRaw images

"LinearRaw" is a value that the PhotometricInterpretation tag can be set
to on DNG images that contain color information for all channels instead
of being bayer-encoded ("CFA" value).

The DNG decoder is complete enough that we can enable this now.

Sample:
- http://www.rawsamples.ch/raws/nikon/SCANNER_NIKON_LS5000.DNG

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Default-initialize WhiteLevel DNG tag value
Nick Renieris [Thu, 29 Aug 2019 13:10:53 +0000 (16:10 +0300)]
lavc/tiff: Default-initialize WhiteLevel DNG tag value

Initialized to `(2 ^ BitsPerSample) - 1` as per the DNG Specification.

Also make sure that `BlackLevel < WhiteLevel`.

This fixes decoding for "X7 CinemaDNG" samples here:
- https://www.dji.com/gr/zenmuse-x7/info#downloads

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Support DNGs with striped (non-tiled) JPEGs images
Nick Renieris [Thu, 29 Aug 2019 13:10:52 +0000 (16:10 +0300)]
lavc/tiff: Support DNGs with striped (non-tiled) JPEGs images

DNG samples here can now be decoded:
- https://www.photographyblog.com/previews/pentax_k1_photos

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/mjpegdec: Skip unknown APPx marker on bayer images
Nick Renieris [Thu, 29 Aug 2019 13:10:51 +0000 (16:10 +0300)]
lavc/mjpegdec: Skip unknown APPx marker on bayer images

Samples:
- Embedded JPEG images in the DNG images here:
  https://www.photographyblog.com/previews/pentax_k1_photos

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Decode 10-bit and 14-bit DNG images
Nick Renieris [Thu, 29 Aug 2019 13:10:50 +0000 (16:10 +0300)]
lavc/tiff: Decode 10-bit and 14-bit DNG images

10-bit sample: http://www.rawsamples.ch/raws/phones/RAW_ONEPLUS_ONE-A0001.DNG
14-bit sample: https://drive.google.com/open?id=0B4JyRT3Lth5HVndyOTVOdWktM3J4TFEydTk1MnY3RWlpSzVB

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Support decoding of DNGs with single-component JPEGs
Nick Renieris [Thu, 29 Aug 2019 13:10:49 +0000 (16:10 +0300)]
lavc/tiff: Support decoding of DNGs with single-component JPEGs

This enables decoding of DNG images generated by the 'DJI Zenmuse X7'
digital camera
Samples: https://www.dji.com/gr/zenmuse-x7/info#downloads

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/mjpegdec: Enable decoding of single-component bayer images
Nick Renieris [Thu, 29 Aug 2019 13:10:48 +0000 (16:10 +0300)]
lavc/mjpegdec: Enable decoding of single-component bayer images

Also, ensure no false positives when determining DNG bayer images, by
setting them in tiff.c instead of relying on a heuristic.  There's no
way to determine this just from the JPEG data, so we have to pass this
information from outside the MJPEG decoder.

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Force DNG pixel data endianness on an edge case
Nick Renieris [Thu, 29 Aug 2019 13:10:47 +0000 (16:10 +0300)]
lavc/tiff: Force DNG pixel data endianness on an edge case

This fixes "X7 RAW" and "X7 CinemaDNG" samples here:
- https://www.dji.com/gr/zenmuse-x7/info#downloads

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Don't apply strips-related logic to tiled images
Nick Renieris [Thu, 29 Aug 2019 13:10:46 +0000 (16:10 +0300)]
lavc/tiff: Don't apply strips-related logic to tiled images

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Fix edge case with full-length/width tiles
Nick Renieris [Thu, 29 Aug 2019 13:10:45 +0000 (16:10 +0300)]
lavc/tiff: Fix edge case with full-length/width tiles

When the height is equal to the tile length (full-height tile)
after `height % tile_length` is applied with the current code,
it results in the operating tile_length to be 0.  This commit
makes this leftover logic only applies if it's necessary.

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/jpegtables: Handle multiple mappings to the same value
Nick Renieris [Thu, 29 Aug 2019 13:10:44 +0000 (16:10 +0300)]
lavc/jpegtables: Handle multiple mappings to the same value

Some JPEGs [1] have incorrect DHT entries that map 2 codes to
the same value.

The second (last) mapping does not ever actually appear in the
code stream, therefore ignoring any mappings after the first one
fixes this.

Without this, an "mjpeg_decode_dc: bad vlc: 0:0" error is thrown.

In all known files, the 2 codes are mapped to symbol 0 so only
that case is checked.

[1]: Embedded JPEGs in "X7 RAW" and "X7 CinemaDNG" samples here:
     https://www.dji.com/gr/zenmuse-x7/info#downloads

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Apply color scaling to uncompressed DNGs
Nick Renieris [Thu, 29 Aug 2019 13:10:43 +0000 (16:10 +0300)]
lavc/tiff: Apply color scaling to uncompressed DNGs

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Convert DNGs to sRGB color space
Nick Renieris [Thu, 29 Aug 2019 13:10:42 +0000 (16:10 +0300)]
lavc/tiff: Convert DNGs to sRGB color space

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/tiff: Decode embedded JPEGs in DNG images
Nick Renieris [Thu, 29 Aug 2019 13:10:41 +0000 (16:10 +0300)]
lavc/tiff: Decode embedded JPEGs in DNG images

Used a technique similar to lavc/tdsc.c for invoking the MJPEG decoder.

This commit adds support for:
- DNG tiles
- DNG tile huffman lossless JPEG decoding
- DNG 8-bpp ("packed" as dcraw calls it) decoding
- DNG color scaling [1]
  - LinearizationTable tag
  - BlackLevel tag

[1]: As specified in the DNG Specification - Chapter 5

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agolavc/mjpegdec: Decode Huffman-coded lossless JPEGs embedded in DNGs
Nick Renieris [Thu, 29 Aug 2019 13:10:40 +0000 (16:10 +0300)]
lavc/mjpegdec: Decode Huffman-coded lossless JPEGs embedded in DNGs

Main image data in DNGs is usually comprised of tiles, each of which is a Huffman-encoded lossless JPEG.

Tested for ljpeg regressions with:
`ffmpeg -f lavfi -i testsrc=d=1 -vcodec ljpeg test.avi`
`ffmpeg test.avi out.avi`
The modified code in ljpeg_decode_rgb_scan runs without issues.

Signed-off-by: Nick Renieris <velocityra@gmail.com>
11 months agoavformat/dashdec: start from the root uri when baseURL is start with '/'
Steven Liu [Thu, 29 Aug 2019 09:33:34 +0000 (17:33 +0800)]
avformat/dashdec: start from the root uri when baseURL is start with '/'

fix ticket: 8097

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agoavfilter/vf_delogo: support expr in delogo filter
Steven Liu [Tue, 27 Aug 2019 21:39:32 +0000 (05:39 +0800)]
avfilter/vf_delogo: support expr in delogo filter

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
11 months agolavf/hlsenc: refine the get_relative_url function to avoid extra malloc for relation...
Limin Wang [Fri, 30 Aug 2019 03:45:39 +0000 (11:45 +0800)]
lavf/hlsenc: refine the get_relative_url function to avoid extra malloc for relation path

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
11 months agoavcodec: Support EBU Tech. 3213-E primaries values
Raphaël Zumer [Sun, 11 Aug 2019 13:54:58 +0000 (09:54 -0400)]
avcodec: Support EBU Tech. 3213-E primaries values

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavfilter: Support EBU Tech. 3213-E primaries values
Raphaël Zumer [Sun, 11 Aug 2019 13:54:57 +0000 (09:54 -0400)]
avfilter: Support EBU Tech. 3213-E primaries values

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavutil/pixfmt: Add EBU Tech. 3213-E AVColorPrimaries value
Raphaël Zumer [Sun, 11 Aug 2019 13:54:56 +0000 (09:54 -0400)]
avutil/pixfmt: Add EBU Tech. 3213-E AVColorPrimaries value

This is an alias for JEDEC P22.

The name associated with the value is also changed
from jedec-p22 to ebu3213 to match ITU-T H.273.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
11 months agoavcodec/truemotion2: Fix multiple integer overflows in tm2_null_res_block()
Michael Niedermayer [Thu, 15 Aug 2019 21:22:50 +0000 (23:22 +0200)]
avcodec/truemotion2: Fix multiple integer overflows in tm2_null_res_block()

Fixes: signed integer overflow: 1795032576 + 598344192 cannot be represented in type 'int'
Fixes: 16196/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5636723419119616

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 agotools/target_dec_fuzzer: adjust pixel threshold for TRUEMOTION2, as it allows coding...
Michael Niedermayer [Thu, 15 Aug 2019 20:26:14 +0000 (22:26 +0200)]
tools/target_dec_fuzzer: adjust pixel threshold for TRUEMOTION2, as it allows coding gigantic images on tiny input

Fixes: Timeout (137sec -> 6sec)
Fixes: 16090/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5674245178261504

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 agoavcodec/vc1_block: Check the return code from vc1_decode_p_block()
Michael Niedermayer [Thu, 15 Aug 2019 18:15:20 +0000 (20:15 +0200)]
avcodec/vc1_block: Check the return code from vc1_decode_p_block()

Fixes: left shift of negative value -1
Fixes: 16424/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-5656579055026176
Fixes: 16358/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5714436358144000

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 agoavcodec/vc1dec: Require res_sprite for wmv3images
Michael Niedermayer [Thu, 15 Aug 2019 18:04:35 +0000 (20:04 +0200)]
avcodec/vc1dec: Require res_sprite for wmv3images

non res_sprite leads to decoder delay which leads to assertion failure
Fixes: Assertion failure
Fixes: 16402/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5704510034411520
Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int'
Fixes: 16425/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5692858838810624

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 agoavcodec/vc1_block: Check for double escapes
Michael Niedermayer [Thu, 15 Aug 2019 16:47:54 +0000 (18:47 +0200)]
avcodec/vc1_block: Check for double escapes

Fixes: out of array read
Fixes: 16331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5672735195267072

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 agoavutil/mathematics: Fix 2 overflows in av_add_stable()
Michael Niedermayer [Sat, 10 Aug 2019 19:09:03 +0000 (21:09 +0200)]
avutil/mathematics: Fix 2 overflows in av_add_stable()

Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: 16022/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5759796759756800

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 agoavformat/utils: return pending IO error on EOF in av_read_frame()
Marton Balint [Sat, 24 Aug 2019 20:00:12 +0000 (22:00 +0200)]
avformat/utils: return pending IO error on EOF in av_read_frame()

avio_feof() returns true both in case of actual EOF and in case of IO errors.
Some demuxers (matroska) have special handling to be able to return the proper
error for this exact reason, e.g.:

if (avio_feof(pb)) {
     if (pb->error) {
         return pb->error;
     } else {
         return AVERROR_EOF;
     }
}

However, most of the demuxers do not, and they simply return AVERROR_EOF if
avio_feof() is true, so there is a real chance that IO errors are mistaken for
EOF.

We might just say that the API user should always check the IO context error
attribute on EOF to make sure no IO errors happened, but not even ffmpeg.c does
this. It should be more intuitive to the API user if we simply return the IO
error as the return value of av_read_frame() instead of AVERROR_EOF.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavformat/avidec: add support for recognizing HEVC fourcc when demuxing
Marton Balint [Fri, 23 Aug 2019 23:39:33 +0000 (01:39 +0200)]
avformat/avidec: add support for recognizing HEVC fourcc when demuxing

Some security cams generate this, as well as some versions of VirtualDub and
VLC so support for _reading_ such files is justified.

Fixes ticket #7110.

See also this discussion: https://patchwork.ffmpeg.org/patch/8744/

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavformat/mpegts: fix teletext PTS when selecting teletext streams only
Marton Balint [Fri, 23 Aug 2019 22:27:41 +0000 (00:27 +0200)]
avformat/mpegts: fix teletext PTS when selecting teletext streams only

After a1b4f120c031e6697bac9fd8c725d9c37ee36d13 the teletext PTS values were set
to AV_NOPTS_VALUE if the stream of the PCR pid was discarded.

What actually matters is that if we parse the PCR of the PCR PID or not, so
let's use the cached discard value of the actual PCR PID instead of the stream
discard value, which may be different.

Also fixes ticket #7567, which was caused by the fact that teletext PTS values
were not touched if the PCR pid was discarded even before
a1b4f120c031e6697bac9fd8c725d9c37ee36d13.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agotools/target_dec_fuzzer: Init parsepkt
Michael Niedermayer [Fri, 30 Aug 2019 22:03:57 +0000 (00:03 +0200)]
tools/target_dec_fuzzer: Init parsepkt

Fixes: memory corruption
Fixes: 16702/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-5768418552184832

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 agoavfilter/vf_v360: add cubemap 1x6 layout
Paul B Mahol [Sat, 31 Aug 2019 12:52:32 +0000 (14:52 +0200)]
avfilter/vf_v360: add cubemap 1x6 layout