ffmpeg.git
3 years agolibavcodec/ppc: Fix HEVC AltiVec routines with --enable-small
A. Wilcox [Sat, 21 Jul 2018 05:42:00 +0000 (00:42 -0500)]
libavcodec/ppc: Fix HEVC AltiVec routines with --enable-small

GCC requires the argument to vec_splat_u32 to be a literal.  The easiest
way to accomplish this is to change 'shift' to be const in scale (as it
is in the transform routine above), and convert both routines to be
inline.  This way, GCC can coerce the values to literals.

Tested on a 970 (Apple G5) and POWER9 (Talos II); passed fate and played
a clip of Big Buck Bunny correctly.

Fixes ticket #7048

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
3 years agoavcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1
James Almer [Fri, 20 Jul 2018 23:43:40 +0000 (20:43 -0300)]
avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1

A packet may have Metadata OBUs but no Sequence Header OBU, which is
useless as extradata.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: bump micro version after previous changes
James Almer [Fri, 20 Jul 2018 18:49:13 +0000 (15:49 -0300)]
avcodec: bump micro version after previous changes

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/movenc: add support for AV1 streams
James Almer [Sat, 7 Jul 2018 19:35:32 +0000 (16:35 -0300)]
avformat/movenc: add support for AV1 streams

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mov: add support for AV1 streams
James Almer [Sat, 7 Jul 2018 19:33:41 +0000 (16:33 -0300)]
avformat/mov: add support for AV1 streams

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libaomenc: export Sequence Header and Metadata OBUs as extradata
James Almer [Sat, 7 Jul 2018 19:33:16 +0000 (16:33 -0300)]
avcodec/libaomenc: export Sequence Header and Metadata OBUs as extradata

aom_codec_get_global_headers() is not implemented as of libaom 1.0.0 for AV1, so
we're forced to extract the relevant header OBUs from the first packet and propagate
them as packet side data.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/extract_extradata: add support for AV1
James Almer [Sat, 7 Jul 2018 19:32:52 +0000 (16:32 -0300)]
avcodec/extract_extradata: add support for AV1

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: add AV1 packet split API
James Almer [Sat, 14 Apr 2018 20:29:31 +0000 (17:29 -0300)]
avcodec: add AV1 packet split API

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavutil/pixfmt: Document chroma plane size for odd resolutions
Michael Niedermayer [Wed, 18 Jul 2018 20:22:35 +0000 (22:22 +0200)]
avutil/pixfmt: Document chroma plane size for odd resolutions

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavfi/af_afir,af_aiir: Remove a variable that is always -1.
Carl Eugen Hoyos [Thu, 19 Jul 2018 00:28:25 +0000 (02:28 +0200)]
lavfi/af_afir,af_aiir: Remove a variable that is always -1.

Fixes two warnings:
libavfilter/af_afir.c:194:45: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     int dx = FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
                                 ~~~~~~~~~~~~^~~~
libavfilter/af_aiir.c:689:45: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     int dx = FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
                                 ~~~~~~~~~~~~^~~~

3 years agolavu/x86/cpu: Fix aesni detection
alexander schmid [Mon, 16 Jul 2018 08:43:11 +0000 (10:43 +0200)]
lavu/x86/cpu: Fix aesni detection

3 years agoavcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0
Thomas Guillem [Wed, 4 Jul 2018 07:05:22 +0000 (09:05 +0200)]
avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

On macOS, a zero rc_max_rate cause an error from
VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits).

on iOS (depending on device/version), a zero rc_max_rate cause invalid
arguments from the vtenc_output_callback after few frames and then a crash
within the VideoToolbox library.

Signed-off-by: Aman Gupta <aman@tmm1.net>
3 years agoavcodec: parse options from AVCodec.bsfs
Aman Gupta [Wed, 18 Jul 2018 18:52:33 +0000 (11:52 -0700)]
avcodec: parse options from AVCodec.bsfs

Fixes a bug that would prevent using multiple comma-separated filters,
and allows options to be passed to each filter.

Based on similar loop in ffmpeg_opt.c's new_output_stream().

Signed-off-by: Aman Gupta <aman@tmm1.net>
3 years agoavformat/mxfdec: only call mxf_free_metadataset when ctx_size is != 0, otherwise...
Baptiste Coudurier [Fri, 6 Jul 2018 19:06:26 +0000 (12:06 -0700)]
avformat/mxfdec: only call mxf_free_metadataset when ctx_size is != 0, otherwise ctx == mxf

3 years agoavcodec/dvbsub_parser: Do not discard data
Michael Niedermayer [Fri, 6 Jul 2018 11:02:19 +0000 (13:02 +0200)]
avcodec/dvbsub_parser: Do not discard data

May fix: oss fuzz issue 9220

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cfhd: Use bytestream2 for peaks
Michael Niedermayer [Fri, 13 Jul 2018 22:26:08 +0000 (00:26 +0200)]
avcodec/cfhd: Use bytestream2 for peaks

This fixes out of array accesses
No testcase known

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/tscc: Move reget buffer to after decoding
Michael Niedermayer [Sun, 15 Jul 2018 11:52:50 +0000 (13:52 +0200)]
avcodec/tscc: Move reget buffer to after decoding

reget buffer can be time consuming, theres no need to do it if failures
occur

Testcase: 9010/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TSCC_fuzzer-6042614817095680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/lagarith: Remove redundant varianble init
Michael Niedermayer [Sun, 15 Jul 2018 11:32:09 +0000 (13:32 +0200)]
avcodec/lagarith: Remove redundant varianble init

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agofate: add more vc2 encoder tests
James Darnley [Mon, 29 Jan 2018 16:40:00 +0000 (17:40 +0100)]
fate: add more vc2 encoder tests

3 years agoavformat/mov: only set handler_name from mdia->hdlr
Gyan Doshi [Sat, 14 Jul 2018 08:29:51 +0000 (13:59 +0530)]
avformat/mov: only set handler_name from mdia->hdlr

6 FATE references updated.

Fixes #7104

3 years agodoc/filters: add missing details to aphasemeter
Gyan Doshi [Mon, 16 Jul 2018 05:50:22 +0000 (11:20 +0530)]
doc/filters: add missing details to aphasemeter

First output is audio and is rematrixed to stereo

3 years agoavcodec/dvdsub_parser: Allocate input padding
Michael Niedermayer [Fri, 13 Jul 2018 16:56:10 +0000 (18:56 +0200)]
avcodec/dvdsub_parser: Allocate input padding

Fixes: out of array read
Fixes: 9350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVDSUB_fuzzer-5746777750765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/vp8_parser: Remove redundant output initialization
Michael Niedermayer [Fri, 13 Jul 2018 16:53:38 +0000 (18:53 +0200)]
avcodec/vp8_parser: Remove redundant output initialization

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/dvdsub_parser: Init output buf/size
Michael Niedermayer [Fri, 13 Jul 2018 16:54:48 +0000 (18:54 +0200)]
avcodec/dvdsub_parser: Init output buf/size

No testcase

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/lagarith: Check that the range coded data stream is consistent when the proba...
Michael Niedermayer [Thu, 14 Jun 2018 20:16:52 +0000 (22:16 +0200)]
avcodec/lagarith: Check that the range coded data stream is consistent when the probabilities indicate no data could have been coded.

Fixes: Timeout
Fixes: 8638/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5132046098759680
Fixes: 8943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-4883030219948032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/cfhd: Fix signed overflow in shift
Michael Niedermayer [Fri, 13 Jul 2018 22:24:47 +0000 (00:24 +0200)]
libavcodec/cfhd: Fix signed overflow in shift

Fixes: 8695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4906172426485760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoUpdate Changelog for lensfun addition and bump minor
Paul B Mahol [Sun, 15 Jul 2018 08:23:20 +0000 (10:23 +0200)]
Update Changelog for lensfun addition and bump minor

3 years agoAdd lensfun filter
Stephen Seo [Fri, 13 Jul 2018 10:33:12 +0000 (19:33 +0900)]
Add lensfun filter

Lensfun is a library that applies lens correction to an image using a
database of cameras/lenses (you provide the camera and lens models, and
it uses the corresponding database entry's parameters to apply lens
correction). It is licensed under LGPL3.

The lensfun filter utilizes the lensfun library to apply lens
correction to videos as well as images.

This filter was created out of necessity since I wanted to apply lens
correction to a video and the lenscorrection filter did not work for me.

While this filter requires little info from the user to apply lens
correction, the flaw is that lensfun is intended to be used on indvidual
images. When used on a video, the parameters such as focal length is
constant, so lens correction may fail on videos where the camera's focal
length changes (zooming in or out via zoom lens). To use this filter
correctly on videos where such parameters change, timeline editing may
be used since this filter supports it.

Note that valgrind shows a small memory leak which is not from this
filter but from the lensfun library (memory is allocated when loading
the lensfun database but it somehow isn't deallocated even during
cleanup; it is briefly created in the init function of the filter, and
destroyed before the init function returns). This may have been fixed by
the latest commit in the lensfun repository; the current latest release
of lensfun is almost 3 years ago.

Bi-Linear interpolation is used by default as lanczos interpolation
shows more artifacts in the corrected image in my tests.

The lanczos interpolation is derived from lenstool's implementation of
lanczos interpolation. Lenstool is an app within the lensfun repository
which is licensed under GPL3.

v2 of this patch fixes license notice in libavfilter/vf_lensfun.c

v3 of this patch fixes code style and dependency to gplv3 (thanks to
Paul B Mahol for pointing out the mentioned issues).

v4 of this patch fixes more code style issues that were missed in
v3.

v5 of this patch adds line breaks to some of the documentation in
doc/filters.texi (thanks to Gyan Doshi for pointing out the issue).

v6 of this patch fixes more problems (thanks to Moritz Barsnick for
pointing them out).

v7 of this patch fixes use of sqrt() (changed to sqrtf(); thanks to
Moritz Barsnick for pointing this out). Also should be rebased off of
latest master branch commits at this point.

Signed-off-by: Stephen Seo <seo.disparate@gmail.com>
3 years agoaadec: improve seeking in mp3 content
Karsten Otto [Sat, 14 Jul 2018 09:20:46 +0000 (11:20 +0200)]
aadec: improve seeking in mp3 content

MP3 frames may not be aligned to aa chunk boundaries. When seeking,
calculate the expected frame offset in the target chunk. Adjust the
timestamp and truncate the next packet accordingly.

This solution works for the majority of tested audio material. For
some rare encodings with mp3 padding or embedded id3 tags, it will
mispredict the correct offset, and at worst skip an extra frame.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/dirac_dwt_template: Fix signedness regression in interleave()
Michael Niedermayer [Fri, 13 Jul 2018 16:33:08 +0000 (18:33 +0200)]
avcodec/dirac_dwt_template: Fix signedness regression in interleave()

Found-by: <jdarnley>
Tested-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mips: fix conflicting types error of ff_vc1_h_s_overlap_mmi.
Shiyou Yin [Thu, 12 Jul 2018 07:16:14 +0000 (15:16 +0800)]
avcodec/mips: fix conflicting types error of ff_vc1_h_s_overlap_mmi.

In commit 975a1a8,function ff_vc1_h_s_overlap_mmi was refactored,
but the declaration in libavcodec/mips/vc1dsp_mips.h was unchanged.

Change-Id: I90beae683511622a0cc1130ab1660ac8669ec3ef
Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Reviewed-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/movenc: add reason for minf->hdlr in MOV only
Gyan Doshi [Sat, 14 Jul 2018 06:31:58 +0000 (12:01 +0530)]
avformat/movenc: add reason for minf->hdlr in MOV only

3 years agoavformat/mxfdec: only return stream indexes which have a corresponding track
Marton Balint [Tue, 3 Jul 2018 23:23:45 +0000 (01:23 +0200)]
avformat/mxfdec: only return stream indexes which have a corresponding track

Without this check some crafted files might crash because a packet might be
demuxed which have no corresponding mxf track.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/internal: increase FF_SANE_NB_CHANNELS to 256
Marton Balint [Tue, 3 Jul 2018 10:10:54 +0000 (12:10 +0200)]
avcodec/internal: increase FF_SANE_NB_CHANNELS to 256

This was reduced from 128 in libav commit
192f1984b1a93aa08af053b8f9ab4950f307bd5d, but since we support unknown channel
layouts, we can increase this limit.

Fixes ticket #6332.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/utils: report insane channel count errors
Marton Balint [Tue, 3 Jul 2018 10:09:13 +0000 (12:09 +0200)]
avcodec/utils: report insane channel count errors

More than 64 is not *that* insane, so let's report the error at least.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoffplay: add support for various YUV conversion modes
Marton Balint [Mon, 2 Jul 2018 17:16:31 +0000 (19:16 +0200)]
ffplay: add support for various YUV conversion modes

SDL from version 2.0.8 has support for full range YUV and specifying
BT601/BT709 color space for YUV->RGB conversion.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agolavc/aarch64/h264dsp_init_aarch64: Fix weight function prototypes.
Carl Eugen Hoyos [Sat, 20 Jan 2018 23:17:19 +0000 (00:17 +0100)]
lavc/aarch64/h264dsp_init_aarch64: Fix weight function prototypes.

Fixes the following warnings:
libavcodec/aarch64/h264dsp_init_aarch64.c: In function ‘ff_h264dsp_init_aarch64’:
libavcodec/aarch64/h264dsp_init_aarch64.c:84:38: warning: assignment from incompatible pointer type [enabled by default]
         c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
                                      ^
libavcodec/aarch64/h264dsp_init_aarch64.c:85:38: warning: assignment from incompatible pointer type [enabled by default]
         c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;
                                      ^
libavcodec/aarch64/h264dsp_init_aarch64.c:86:38: warning: assignment from incompatible pointer type [enabled by default]
         c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;
                                      ^
libavcodec/aarch64/h264dsp_init_aarch64.c:88:40: warning: assignment from incompatible pointer type [enabled by default]
         c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;
                                        ^
libavcodec/aarch64/h264dsp_init_aarch64.c:89:40: warning: assignment from incompatible pointer type [enabled by default]
         c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;
                                        ^
libavcodec/aarch64/h264dsp_init_aarch64.c:90:40: warning: assignment from incompatible pointer type [enabled by default]
         c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;
                                        ^

3 years agolavc/hevc_ps: use skip_bits instead of get_bits when skip bits.
Jun Zhao [Sat, 7 Jul 2018 05:40:47 +0000 (13:40 +0800)]
lavc/hevc_ps: use skip_bits instead of get_bits when skip bits.

use skip_bits when want to skip some bits.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
3 years agolavc/hevc_ps: Refine sps_range_extension parse.
Jun Zhao [Sat, 7 Jul 2018 04:54:15 +0000 (12:54 +0800)]
lavc/hevc_ps: Refine sps_range_extension parse.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
3 years agodoc/filters: correct description of variables in blend filter
Gyan Doshi [Fri, 13 Jul 2018 05:21:49 +0000 (10:51 +0530)]
doc/filters: correct description of variables in blend filter

Invert description of SW / SH variables.

3 years agoavfilter/drawtext: fix box sizing
Gyan Doshi [Tue, 10 Jul 2018 09:44:06 +0000 (15:14 +0530)]
avfilter/drawtext: fix box sizing

At present, box size is clipped to frame size before being drawn,
which can lead to the box not fully covering animated text which is
longer than one or both frame dimensions.

Since ff_blend_rectangle correctly takes care of clipping, it is skipped
here which results in correct box sizing

3 years agoavformat/mov: Simplify last element computation in mov_estimate_video_delay()
Michael Niedermayer [Wed, 11 Jul 2018 00:17:57 +0000 (02:17 +0200)]
avformat/mov: Simplify last element computation in mov_estimate_video_delay()

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/mpegaudiodecheader.h: fix version check pattern
Karsten Otto [Thu, 12 Jul 2018 07:30:25 +0000 (09:30 +0200)]
libavcodec/mpegaudiodecheader.h: fix version check pattern

This fixes the check for the reserved MPEG audio version ID,
used to detect an invalid frame header.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Break out of inner loop early in mov_estimate_video_delay()
Michael Niedermayer [Wed, 11 Jul 2018 00:17:58 +0000 (02:17 +0200)]
avformat/mov: Break out of inner loop early in mov_estimate_video_delay()

0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things)

Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i /dev/zero -t 24:00:00.00 out.mp4

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavc/h263dec: Remove a variable declaration that can lead to a warning.
Carl Eugen Hoyos [Wed, 11 Jul 2018 22:07:55 +0000 (00:07 +0200)]
lavc/h263dec: Remove a variable declaration that can lead to a warning.

3 years agolavfi/convolution_opencl: use CL_FAIL_ON_ERROR for error handling
Danil Iashchenko [Thu, 12 Jul 2018 22:20:18 +0000 (01:20 +0300)]
lavfi/convolution_opencl: use CL_FAIL_ON_ERROR for error handling

Switch to use CL_FAIL_ON_ERROR for error handling

3 years agolavc/qsv: handle MFX_FRAMETYPE_UNKNOWN case
Zhong Li [Tue, 3 Jul 2018 08:01:30 +0000 (16:01 +0800)]
lavc/qsv: handle MFX_FRAMETYPE_UNKNOWN case

Signed-off-by: Zhong Li <zhong.li@intel.com>
3 years agoavformat/mov: Eliminate variable buf_size from mov_estimate_video_delay()
Michael Niedermayer [Wed, 11 Jul 2018 00:17:56 +0000 (02:17 +0200)]
avformat/mov: Eliminate variable buf_size from mov_estimate_video_delay()

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: remove modulo operations from mov_estimate_video_delay()
Michael Niedermayer [Wed, 11 Jul 2018 00:17:55 +0000 (02:17 +0200)]
avformat/mov: remove modulo operations from mov_estimate_video_delay()

0.324 <-0.491 sec

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavfi/avgblur_opencl: fix using uninitialized value
Danil Iashchenko [Mon, 9 Jul 2018 12:41:48 +0000 (15:41 +0300)]
lavfi/avgblur_opencl: fix using uninitialized value

Fixed using uninitialized value "global_work[0]" when calling "av_log".

Fixes CID #1437471.

3 years agolavfi/vf_avgblur_opencl: remove useless clFinish().
Ruiling Song [Tue, 3 Jul 2018 18:16:25 +0000 (02:16 +0800)]
lavfi/vf_avgblur_opencl: remove useless clFinish().

The very last clFinish() should be ok.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Danil Iashchenko <danyaschenko@gmail.com>
3 years agolavfi/opencl: add macro for opencl error handling.
Ruiling Song [Tue, 3 Jul 2018 18:16:24 +0000 (02:16 +0800)]
lavfi/opencl: add macro for opencl error handling.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
3 years agoavutil/pixelutils: correct the function name in comments
Jun Zhao [Sun, 8 Jul 2018 08:26:47 +0000 (16:26 +0800)]
avutil/pixelutils: correct the function name in comments

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
3 years agoavformat/hlsenc: improve compute after_init_list_dur
Steven Liu [Mon, 9 Jul 2018 09:05:30 +0000 (17:05 +0800)]
avformat/hlsenc: improve compute after_init_list_dur

fix ticket: 7305
vs->sequence - hls->start_sequence - vs->nb_entries is the
after_init_list_dur fragment numbers
fix the wrong compute way vs->sequence - vs->nb_entries

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 years agofate: allow temp files for passed test to be kept
Gyan Doshi [Fri, 6 Jul 2018 09:23:33 +0000 (14:53 +0530)]
fate: allow temp files for passed test to be kept

Set make variable KEEP to non-zero value to preserve temp files
when a test has passed.

Helpful in diagnosing failed tests when test outfile is some type of
single hash and does not reveal differences in processed output.

3 years agoavformat/movenc: Write version 2 of audio atom if channels is not known
Michael Niedermayer [Sat, 7 Jul 2018 22:16:42 +0000 (00:16 +0200)]
avformat/movenc: Write version 2 of audio atom if channels is not known

The version 1 needs the channel count and would divide by 0
Fixes: division by 0
Fixes: fpe_movenc.c_1108_1.ogg
Fixes: fpe_movenc.c_1108_2.ogg
Fixes: fpe_movenc.c_1108_3.wav

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoaadec: add chapters and seeking
Karsten Otto [Sun, 8 Jul 2018 09:46:26 +0000 (11:46 +0200)]
aadec: add chapters and seeking

read_packet reads content in chunks. Thus seek must be clamped to valid
chunk positions in the file, which in turn are relative to chapter start
positions.

So in read_header, scan for chapter headers once by skipping through the
content. Set stream time_base based on bitrate in bytes/s, for easy
timestamp to position conversion.

Then in read_seek, find the chapter containing the seek position, calculate
the nearest chunk position, and reinit the read_seek state accordingly.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/mpegaudiodecheader.h : detect reserved mpeg id
Karsten Otto [Sun, 8 Jul 2018 10:26:10 +0000 (12:26 +0200)]
libavcodec/mpegaudiodecheader.h : detect reserved mpeg id

Check the MPEG version ID for the reserved bit pattern 01, and abort the
header check in that case. This reduces the chance of misinterpreting
arbitrary data as a valid header, and prevents resulting audio artifacts.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavfi/minterpolate: fix blending calc issue.
Jun Zhao [Wed, 27 Jun 2018 07:09:25 +0000 (15:09 +0800)]
lavfi/minterpolate: fix blending calc issue.

the right blending calc is:
(alpha * Frame_2 + (MAX - alpha) * Frame_1 + 512) >> 10

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
3 years agoaadec: improve eof detection
Karsten Otto [Sat, 7 Jul 2018 17:41:27 +0000 (19:41 +0200)]
aadec: improve eof detection

Remember the end position of audio content in the file and check it during
read_packet. There always seems to be other data beyond it, which could be
misinterpreted as more audio. Also add some extra avio_read error checks,
to bail early in case of a broken/truncated file.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/movenc: Check input sample count
Michael Niedermayer [Fri, 6 Jul 2018 20:23:25 +0000 (22:23 +0200)]
avformat/movenc: Check input sample count

Fixes: division by 0
Fixes: fpe_movenc.c_199_1.wav
Fixes: fpe_movenc.c_199_2.wav
Fixes: fpe_movenc.c_199_3.wav
Fixes: fpe_movenc.c_199_4.wav
Fixes: fpe_movenc.c_199_5.wav
Fixes: fpe_movenc.c_199_6.wav
Fixes: fpe_movenc.c_199_7.wav

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mjpegdec: Check for odd progressive RGB
Michael Niedermayer [Fri, 6 Jul 2018 14:28:14 +0000 (16:28 +0200)]
avcodec/mjpegdec: Check for odd progressive RGB

Fixes: out of array access
Fixes: 9225/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5684770334834688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/setpts: add FR shorthand for FRAME_RATE
Gyan Doshi [Thu, 5 Jul 2018 09:54:55 +0000 (15:24 +0530)]
avfilter/setpts: add FR shorthand for FRAME_RATE

3 years agolibavcodec/vp8: Do not compute line pointers per pixel in fade()
Michael Niedermayer [Sun, 24 Jun 2018 00:50:16 +0000 (02:50 +0200)]
libavcodec/vp8: Do not compute line pointers per pixel in fade()

72->60 seconds
Testcase: 8680/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5861504418054144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotests/fate/demux: Add test for d25c945247979a88fac6bb3b7a26370262b96ef1
Michael Niedermayer [Tue, 26 Jun 2018 19:26:12 +0000 (21:26 +0200)]
tests/fate/demux: Add test for d25c945247979a88fac6bb3b7a26370262b96ef1

Sample provided by Thierry for fate

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/vp8_parser: Do not leave data/size uninitialized
Michael Niedermayer [Fri, 6 Jul 2018 10:01:46 +0000 (12:01 +0200)]
avcodec/vp8_parser: Do not leave data/size uninitialized

This is identical to what the VP9 parser does

Fixes: 9215/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVPX_VP8_fuzzer-5768227253649408
Fixes: out of memory access

This may also fix oss fuzz issue 9212

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: set parser codec id to avoid assertion failure
Michael Niedermayer [Fri, 6 Jul 2018 10:16:22 +0000 (12:16 +0200)]
tools/target_dec_fuzzer: set parser codec id to avoid assertion failure

Fixes: 9211/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GSM_fuzzer-5680396581732352
Fixes: assertion failure

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mms: Add missing chunksize check
Michael Niedermayer [Tue, 3 Jul 2018 18:33:04 +0000 (20:33 +0200)]
avformat/mms: Add missing chunksize check

Fixes: out of array read
Fixes: mms-crash-01b6c5d85f9d9f40f4e879896103e9f5b222816a

Found-by: Paul Ch <paulcher@icloud.com>
1st hunk by Paul Ch <paulcher@icloud.com>
Tested-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoconfigure: toolchain-tsan does not need -fPIE.
Carl Eugen Hoyos [Tue, 3 Jul 2018 20:17:06 +0000 (22:17 +0200)]
configure: toolchain-tsan does not need -fPIE.

Fixes compilation with some kernel-gcc combinations:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67308

Reported and analyzed by Gonzalo Garramuño.

3 years agoavformat/pva: Check for EOF before retrying in read_part_of_packet()
Michael Niedermayer [Tue, 3 Jul 2018 20:14:42 +0000 (22:14 +0200)]
avformat/pva: Check for EOF before retrying in read_part_of_packet()

Fixes: Infinite loop
Fixes: pva-4b1835dbc2027bf3c567005dcc78e85199240d06

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rmdec: Do not pass mime type in rm_read_multi() to ff_rm_read_mdpr_codecdata()
Michael Niedermayer [Tue, 3 Jul 2018 19:37:46 +0000 (21:37 +0200)]
avformat/rmdec: Do not pass mime type in rm_read_multi() to ff_rm_read_mdpr_codecdata()

Fixes: use after free()
Fixes: rmdec-crash-ffe85b4cab1597d1cfea6955705e53f1f5c8a362

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/asfdec_o: Check size_bmp more fully
Michael Niedermayer [Tue, 3 Jul 2018 19:01:23 +0000 (21:01 +0200)]
avformat/asfdec_o: Check size_bmp more fully

Fixes: integer overflow and out of array access
Fixes: asfo-crash-46080c4341572a7137a162331af77f6ded45cbd7

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mxfdec: Fix av_log context
Michael Niedermayer [Tue, 3 Jul 2018 18:38:06 +0000 (20:38 +0200)]
avformat/mxfdec: Fix av_log context

Fixes: out of array access
Fixes: mxf-crash-1c2e59bf07a34675bfb3ada5e1ec22fa9f38f923

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agodoc/filters: state negate filter's option
Gyan Doshi [Thu, 5 Jul 2018 14:06:32 +0000 (19:36 +0530)]
doc/filters: state negate filter's option

Also clarify that the negate_alpha option is a boolean

3 years agoavcodec/mpeg4videodec: Check for bitstream end in read_quant_matrix_ext()
Michael Niedermayer [Tue, 3 Jul 2018 20:48:32 +0000 (22:48 +0200)]
avcodec/mpeg4videodec: Check for bitstream end in read_quant_matrix_ext()

Fixes: out of array read
Fixes: asff-crash-0e53d0dc491dfdd507530b66562812fbd4c36678

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mxfdec: add support for opAtom without index
Marton Balint [Sun, 24 Jun 2018 20:08:22 +0000 (22:08 +0200)]
avformat/mxfdec: add support for opAtom without index

Clip wrapped code is capable of doing some magic for such files.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mxfdec: guess constant byte count indexes based on track duration
Marton Balint [Sun, 24 Jun 2018 20:07:31 +0000 (22:07 +0200)]
avformat/mxfdec: guess constant byte count indexes based on track duration

For clip wrapped essences this should work. Also, since index_edit_rate can now
be different from track edit rate, remove overriding track edit rate.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mxfdec: take into account index_edit_rate
Marton Balint [Wed, 30 May 2018 00:17:20 +0000 (02:17 +0200)]
avformat/mxfdec: take into account index_edit_rate

Fixes samples/ffmpeg-bugs/roundup/issue591/02785736.mxf
Fixes samples/ffmpeg-bugs/trac/ticket1916/pcm_s24le_to_pcm_s16le.mxf

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mxfdec: fix indentation and rename mxf_read_packet_old
Marton Balint [Sun, 10 Jun 2018 10:00:06 +0000 (12:00 +0200)]
avformat/mxfdec: fix indentation and rename mxf_read_packet_old

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mxfdec: add support for clip wrapped essences
Marton Balint [Thu, 10 May 2018 18:30:19 +0000 (20:30 +0200)]
avformat/mxfdec: add support for clip wrapped essences

Also use common code with opAtom.

Fixes ticket #2776.
Partially fixes ticket #5671.
Fixes ticket #5866.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/atrac9tab: add missing header include
James Almer [Wed, 4 Jul 2018 18:56:23 +0000 (15:56 -0300)]
avcodec/atrac9tab: add missing header include

Fixes make checkheaders

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavc/atrac9tab: Add inclusion guards.
Carl Eugen Hoyos [Wed, 4 Jul 2018 16:54:44 +0000 (18:54 +0200)]
lavc/atrac9tab: Add inclusion guards.

Fixes fate-source.

3 years agolavfi/weave: Refactor two near-identical clauses.
Shlomi Fish [Thu, 28 Jun 2018 08:42:45 +0000 (11:42 +0300)]
lavfi/weave: Refactor two near-identical clauses.

The changes contained in this patch are hereby placed under the Expat licence.

Reviewed-by: Paul B Mahol
3 years agoavcodec/indeo4: Check for end of bitstream in decode_mb_info()
Michael Niedermayer [Sun, 1 Jul 2018 23:26:44 +0000 (01:26 +0200)]
avcodec/indeo4: Check for end of bitstream in decode_mb_info()

Fixes: Timeout
Fixes: 8776/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5361788798369792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/truemotion2: Check len in tm2_read_stream()
Michael Niedermayer [Sun, 1 Jul 2018 19:19:57 +0000 (21:19 +0200)]
avcodec/truemotion2: Check len in tm2_read_stream()

Fixes: Timeout
Fixes: 8774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5942199639343104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
3 years agoavcodec/ac3dec: Check channel_map index
Michael Niedermayer [Wed, 27 Jun 2018 13:56:18 +0000 (15:56 +0200)]
avcodec/ac3dec: Check channel_map index

Fixes: out of array read
Fixes: 8924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5851861780267008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg4videodec: Remove use of FF_PROFILE_MPEG4_SIMPLE_STUDIO as indicator...
Michael Niedermayer [Mon, 2 Jul 2018 22:27:04 +0000 (00:27 +0200)]
avcodec/mpeg4videodec: Remove use of FF_PROFILE_MPEG4_SIMPLE_STUDIO as indicator of studio profile

The profile field is changed by code inside and outside the decoder,
its not a reliable indicator of the internal codec state.
Maintaining it consistency with studio_profile is messy.
Its easier to just avoid it and use only studio_profile

Fixes: assertion failure
Fixes: ffmpeg_crash_9.avi

Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/shorten: Fix undefined addition in shorten_decode_frame()
Michael Niedermayer [Mon, 2 Jul 2018 17:11:46 +0000 (19:11 +0200)]
avcodec/shorten: Fix undefined addition in shorten_decode_frame()

Fixes: signed integer overflow: 1139785606 + 1454196085 cannot be represented in type 'int'
Fixes: 8937/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-6202943597445120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/shorten: Fix undefined integer overflow
Michael Niedermayer [Mon, 2 Jul 2018 17:08:54 +0000 (19:08 +0200)]
avcodec/shorten: Fix undefined integer overflow

Fixes: signed integer overflow: 8454144 * 256 cannot be represented in type 'int'
Fixes: 8788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5728205041303552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpeg2000dec: Fixes invalid shifts in jpeg2000_decode_packets_po_iteration()
Michael Niedermayer [Mon, 2 Jul 2018 16:57:05 +0000 (18:57 +0200)]
avcodec/jpeg2000dec: Fixes invalid shifts in jpeg2000_decode_packets_po_iteration()

Fixes: shift exponent 47 is too large for 32-bit type 'int'
Fixes: 9163/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5661750182543360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpeg2000dec: Check that there are enough bytes for all tiles
Michael Niedermayer [Mon, 2 Jul 2018 16:40:08 +0000 (18:40 +0200)]
avcodec/jpeg2000dec: Check that there are enough bytes for all tiles

Fixes: OOM
Fixes: 8781/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5810709081358336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Expose encryption info to the app.
Jacob Trimble [Thu, 7 Dec 2017 00:17:54 +0000 (16:17 -0800)]
avformat/mov: Expose encryption info to the app.

This exposes encryption info from the container to the app.  This
includes key ID, IV, and subsample byte ranges.  The info is passed
using the new side-data AV_PKT_DATA_ENCRYPTION_DATA and
AV_PKT_DATA_ENCRYPTION_INIT_DATA.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoriff: add ATRAC9 guid
Rostislav Pehlivanov [Sat, 30 Jun 2018 07:32:05 +0000 (08:32 +0100)]
riff: add ATRAC9 guid

Enables demuxing of ATRAC9 files.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agolavc: implement an ATRAC9 decoder
Rostislav Pehlivanov [Sat, 30 Jun 2018 07:31:31 +0000 (08:31 +0100)]
lavc: implement an ATRAC9 decoder

This commit implements a full ATRAC9 decoder, a simple low-delay codec
developed by Sony and used in most PSVita games, some PS3 games and some
PS4 games. Its similar to AAC in that it uses Huffman coded scalefactors
but instead of vector quantization it just Huffman codes the spectral
coefficients (in a way similar to how Opus splits band energy coding
into coarse and fine precision). It opts to write rather large Huffman
codes by packing several small coefficients into one Huffman coded
symbol, though I don't believe this increases efficiency at all.
Band extension implements SBC in a simple way, first it mirrors the
lower spectrum onto the higher frequencies and then it uses one of 5
filters to shape it. Noise substitution is implemented via 2 of them.
Unlike previous ATRAC codecs, there's no QMF, this is a standard MDCT
codec.

Based off of the reverse engineering work of Alex Barney.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoconfigure: add missing swscale to avfilter when sr filter is enabled
James Almer [Tue, 3 Jul 2018 01:18:47 +0000 (22:18 -0300)]
configure: add missing swscale to avfilter when sr filter is enabled

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavfi: add sobel, prewitt, roberts filters
Danil Iashchenko [Sat, 30 Jun 2018 00:46:24 +0000 (03:46 +0300)]
lavfi: add sobel, prewitt, roberts filters

Add opencl version of sobel, prewitt, roberts filters.

3 years agolibavfilter: vf_sr.c remove warnings
Pedro Arthur [Mon, 2 Jul 2018 16:45:38 +0000 (13:45 -0300)]
libavfilter: vf_sr.c remove warnings

3 years agoAdds ESPCN super resolution filter merged with SRCNN filter.
Sergey Lavrushkin [Wed, 13 Jun 2018 21:37:12 +0000 (00:37 +0300)]
Adds ESPCN super resolution filter merged with SRCNN filter.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
3 years agoavcodec/dvdsubdec: Check for fully transparent rectangles earlier
Michael Niedermayer [Sat, 30 Jun 2018 21:34:14 +0000 (23:34 +0200)]
avcodec/dvdsubdec: Check for fully transparent rectangles earlier

Testcase with large transparent rectangles changes from 67 sec to 3 sec decode time

Fixes: Timeout
Fixes: 8728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVDSUB_fuzzer-5190088756559872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/apngdec: set pts to AV_NOPTS_VALUE
Marton Balint [Thu, 28 Jun 2018 19:07:30 +0000 (21:07 +0200)]
avformat/apngdec: set pts to AV_NOPTS_VALUE

And let the generic code figure out the proper PTS. This is needed because apng
does not provide seek functions, but after a generic seek (e.g. to file start)
timestamps are not reset which causes broken timestamps when looping apngs,
like in ticket #6121.

Signed-off-by: Marton Balint <cus@passwd.hu>