]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavformat/dashenc: update stream extradata from packet side data
James Almer [Tue, 30 Jul 2019 18:08:36 +0000 (15:08 -0300)]
avformat/dashenc: update stream extradata from packet side data

codecpar->extradata is not going to change between packets. New extradata
is instead propagated using packet side data.

Use ff_alloc_extradata() as well.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth value
James Almer [Tue, 30 Jul 2019 14:55:26 +0000 (11:55 -0300)]
avformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth value

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: rename some AV1SequenceParameters fields
James Almer [Tue, 30 Jul 2019 14:48:38 +0000 (11:48 -0300)]
avformat/av1: rename some AV1SequenceParameters fields

Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: split off sequence header parsing from the av1C writing function
James Almer [Tue, 30 Jul 2019 15:08:44 +0000 (12:08 -0300)]
avformat/av1: split off sequence header parsing from the av1C writing function

It will be used by the dash muxer

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: add color config values to AV1SequenceParameters
James Almer [Tue, 30 Jul 2019 14:43:02 +0000 (11:43 -0300)]
avformat/av1: add color config values to AV1SequenceParameters

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/vp8: do vp7_fade_frame() later
Michael Niedermayer [Thu, 1 Aug 2019 11:54:21 +0000 (13:54 +0200)]
avcodec/vp8: do vp7_fade_frame() later

Fixes: Timeout (100sec -> 5sec)
Fixes: 15073/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5649257362620416
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vp3: Check for end of input in vp4_unpack_vlcs()
Michael Niedermayer [Fri, 2 Aug 2019 19:23:18 +0000 (21:23 +0200)]
avcodec/vp3: Check for end of input in vp4_unpack_vlcs()

Fixes: Timeout (too long -> 1sec)
Fixes: 15232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5769583086010368
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>
4 years agoavcodec/vp3: Check that theora is theora
Michael Niedermayer [Sun, 21 Jul 2019 22:41:06 +0000 (00:41 +0200)]
avcodec/vp3: Check that theora is theora

Theora is forced to be non zero if it is zero and a sample
is asked for, as suggested by reimar

Fixes: Timeout (2min -> 600ms)
Fixes: 15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavutil/mips: Avoid instruction exception caused by gssqc1/gslqc1.
Shiyou Yin [Wed, 31 Jul 2019 01:30:01 +0000 (09:30 +0800)]
avutil/mips: Avoid instruction exception caused by gssqc1/gslqc1.

Ensure the address accesed by gssqc1/gslqc1 are 16-byte aligned.

4 years agoavcodec/msrle: remove unused items
Paul B Mahol [Thu, 1 Aug 2019 14:02:18 +0000 (16:02 +0200)]
avcodec/msrle: remove unused items

4 years agolavu/tx: add support for double precision FFT and MDCT
Lynne [Sat, 27 Jul 2019 17:54:20 +0000 (18:54 +0100)]
lavu/tx: add support for double precision FFT and MDCT

Simply moves and templates the actual transforms to support an
additional data type.
Unlike the float version, which is equal or better than libfftw3f,
double precision output is bit identical with libfftw3.

4 years agolavfi/zmq: Avoid mem copy past the end of input buffer
Andriy Gelman [Tue, 30 Jul 2019 21:16:08 +0000 (17:16 -0400)]
lavfi/zmq: Avoid mem copy past the end of input buffer

4 years agoFATE: add hls single file mode test case
Steven Liu [Tue, 30 Jul 2019 09:05:36 +0000 (17:05 +0800)]
FATE: add hls single file mode test case

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agotools/target_dec_fuzzer: fix memleak of extradata
Michael Niedermayer [Wed, 10 Jul 2019 20:32:49 +0000 (22:32 +0200)]
tools/target_dec_fuzzer: fix memleak of extradata

Fixes: memleak
Fixes: 15535/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5692162424963072
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vc1_pred: Fix invalid shift in scaleforsame()
Michael Niedermayer [Wed, 10 Jul 2019 21:27:19 +0000 (23:27 +0200)]
avcodec/vc1_pred: Fix invalid shift in scaleforsame()

Fixes: left shift of negative value -1
Fixes: 15531/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5759556258365440
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vc1_block: Fix integer overflow in ff_vc1_pred_dc()
Michael Niedermayer [Thu, 4 Jul 2019 21:13:13 +0000 (23:13 +0200)]
avcodec/vc1_block: Fix integer overflow in ff_vc1_pred_dc()

Fixes: signed integer overflow: 32796 * 65536 cannot be represented in type 'int'
Fixes: 15430/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5735424087031808
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/truemotion2: Fix several integer overflows in tm2_motion_block()
Michael Niedermayer [Mon, 8 Jul 2019 21:00:09 +0000 (23:00 +0200)]
avcodec/truemotion2: Fix several integer overflows in tm2_motion_block()

Fixes: 15524/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5173148372172800
Fixes: signed integer overflow: 13701388 - -2134868270 cannot be represented in type 'int'
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: Make coeffsA/B uint32_t, this avoids several cases of undefined behavior
Michael Niedermayer [Tue, 2 Jul 2019 10:30:32 +0000 (12:30 +0200)]
avcodec/apedec: Make coeffsA/B uint32_t, this avoids several cases of undefined behavior

Changing the type to an unsigned one to avoid many casts was suggested
This may be inadequate for fixing the UB on ILP64

Fixes: signed integer overflow: -1418162611 * 383 cannot be represented in type 'int'
Fixes: 15547/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5691384901664768
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: make left/right unsigned to avoid undefined behavior
Michael Niedermayer [Tue, 2 Jul 2019 10:13:19 +0000 (12:13 +0200)]
avcodec/apedec: make left/right unsigned to avoid undefined behavior

Fixes: signed integer overflow: 755176387 + 1515360583 cannot be represented in type 'int'
Fixes: 15506/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5706859232624640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: Fix multiple integer overflows and undefined behaviorin filter_3800()
Michael Niedermayer [Sun, 16 Jun 2019 09:39:15 +0000 (11:39 +0200)]
avcodec/apedec: Fix multiple integer overflows and undefined behaviorin filter_3800()

Fixes: left shift of negative value -4
Fixes: signed integer overflow: -15091694 * 167 cannot be represented in type 'int'
Fixes: signed integer overflow: 1898547155 + 453967445 cannot be represented in type 'int'
Fixes: 15258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5759095564402688
Fixes: signed integer overflow: 962196438 * 31 cannot be represented in type 'int'
Fixes: 15364/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5718799845687296
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mpc: deallocate frames array on errors
Michael Niedermayer [Wed, 24 Jul 2019 21:11:50 +0000 (23:11 +0200)]
avformat/mpc: deallocate frames array on errors

Fixes: memleak on error path
Fixes: 15984/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679918412726272
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavfi/vf_thumbnail_cuda: fix operator precedence bug
Rodger Combs [Tue, 30 Jul 2019 07:51:43 +0000 (02:51 -0500)]
lavfi/vf_thumbnail_cuda: fix operator precedence bug

Discovered via a warning when building with clang

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agolavd/v4l2: produce a 0 byte packet when a dequeued buffer's size is unexpected
Stephan Hilb [Wed, 5 Jun 2019 20:04:38 +0000 (22:04 +0200)]
lavd/v4l2: produce a 0 byte packet when a dequeued buffer's size is unexpected

Behave like we do for V4L2_BUF_FLAG_ERROR, implemented in commit 28f20d2ff4 .

For some devices (probably also related to the V4L driver implementation)
it happens that when invoking the ioctl DQBUF, the returned buffer is not
of the expected size. Here are two examples for such occurrences:

    [video4linux2,v4l2 @ 0x258b440] Dequeued v4l2 buffer contains 609596 bytes, but 614400 were expected. Flags: 0x00000001.
    /dev/video1: Invalid data found when processing input

    [video4linux2,v4l2 @ 0x225f440] Dequeued v4l2 buffer contains 609508 bytes, but 614400 were expected. Flags: 0x00000001.
    /dev/video1: Invalid data found when processing input

For the ffmpeg CLI tool this means it will stop capturing and exit.

The described behaviour was observed at least with one OmniVision USB
web cam and with some stk1160 devices.

If you search the web for the error message, you will find quite a few
instances of this problem. Some of them experienced on other devices.

Probably fixes ticket #4795

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
4 years agolavu/hwcontext_qsv: fix the memory leak
Linjie Fu [Fri, 26 Jul 2019 08:00:24 +0000 (16:00 +0800)]
lavu/hwcontext_qsv: fix the memory leak

av_dict_free child_device_opts to fix the memory leak.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
4 years agoavformat/av1: fix AV1CodecConfigurationBox name in doxy
James Almer [Tue, 30 Jul 2019 03:33:47 +0000 (00:33 -0300)]
avformat/av1: fix AV1CodecConfigurationBox name in doxy

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agocbs_mpeg2: Fix parsing the last unit
Andreas Rheinhardt [Mon, 29 Jul 2019 19:56:56 +0000 (21:56 +0200)]
cbs_mpeg2: Fix parsing the last unit

There is one way to find out if avpriv_find_start_code has found a start
code or not: One has to check whether the state variable contains a
start code, i.e. whether the three most significant bytes are 0x00 00 01.
Checking for whether the return value is the end of the designated
buffer is not enough: If the last four bytes constitute a start code,
the return value is also the end of the buffer. This happens with
sequence_end_codes which have been ignored for exactly this reason,
although e.g. all three files used for fate tests of cbs_mpeg2 contain
sequence_end_codes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs_mpeg2: Rearrange start code search
Andreas Rheinhardt [Mon, 29 Jul 2019 19:56:55 +0000 (21:56 +0200)]
cbs_mpeg2: Rearrange start code search

1. Currently, cbs_mpeg2_split_fragment uses essentially three variables
to hold the start code values found by avpriv_find_start_code. By
rearranging the code, one of them can be omitted.
2. The return value of avpriv_find_start_code points to the byte after
the byte containing the start code identifier (or to the byte after the
last byte of the fragment's data if no start code was found), but
cbs_mpeg2_split_fragment needs to work with the pointer to the byte
containing the start code identifier; it already did this, but in a
clumsy way. This has been changed.
3. Also use the correct type for the variable holding the
CodedBitstreamUnitType.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs_mpeg2: Decompose Sequence End
Andreas Rheinhardt [Mon, 29 Jul 2019 19:56:54 +0000 (21:56 +0200)]
cbs_mpeg2: Decompose Sequence End

Sequence End units (or actually, sequence_end_codes) have up until now
not been decomposed; in fact due to a bug in cbs_mpeg2_split_fragment they
have mostly been treated as part of the preceding unit. So implement
decomposing them as preparation for fixing said bug.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs_h264: Improve adding SEI messages
Andreas Rheinhardt [Mon, 29 Jul 2019 19:56:53 +0000 (21:56 +0200)]
cbs_h264: Improve adding SEI messages

Up until now, if an SEI messages was to be added to a fragment, it was
tried to add said SEI message to the first SEI NAL unit of the fragment
and if this SEI NAL unit already contained H264_NAL_SEI SEI messages (an
arbitrary limit imposed by cbs_h264), adding failed; if there was no SEI
NAL unit, a new one has been added.
With this commit, the fragment is searched for further NAL units to add
the SEI messages to. If all of them are full, a new SEI NAL unit is added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs: Don't set AVBuffer's opaque
Andreas Rheinhardt [Mon, 29 Jul 2019 19:56:52 +0000 (21:56 +0200)]
cbs: Don't set AVBuffer's opaque

cbs is currently inconsistent regarding the opaque field that can be
used as a special argument to av_buffer_create in order to be used
during freeing the buffer: ff_cbs_alloc_unit_content and all the free
functions used name this parameter as if it should contain a pointer to
the unit whose content is about to be created; but both
ff_cbs_alloc_unit_content as well as ff_cbs_h264_add_sei_message
actually use a pointer to the CodedBitstreamContext as opaque. It should
actually be neither, because it is unneeded (as is evidenced by the fact
that none of the free functions use this pointer at all) and because it
ties the unit's content to the lifetime of other objects, although a
refcounted buffer is supposed to have its own lifetime that only ends
when its reference count reaches zero. This problem manifests itself in
the pointer becoming dangling.
The pointer to the unit can become dangling if another unit is added to
the fragment later as happens in the bitstream filters; in this case,
the pointer can point to the wrong unit (if the fragment's unit array
needn't be relocated) or it can point to where the array was earlier.
It can also become dangling if the unit's content is meant to survive
the resetting of the fragment it was originally read with. This applies
to the extradata of H.264 and HEVC.
The pointer to the context can become dangling if the context is closed
before the content is freed. Although this doesn't seem to happen right
now, it could happen, in particular if one uses different
CodedBitstreamContexts for in- and output.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/eatqi: Check for minimum frame size
Michael Niedermayer [Sun, 28 Jul 2019 20:29:57 +0000 (22:29 +0200)]
avcodec/eatqi: Check for minimum frame size

The minimum header is 8 bytes, the smallest bitstream that is passed to
the MB decode code is 4 bytes

Fixes: Timeout (35sec -> 18sec)
Fixes: 15800/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATQI_fuzzer-5684154517159936
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>
4 years agoavcodec/eatgv: Check remaining size after the keyframe header
Michael Niedermayer [Sun, 28 Jul 2019 19:09:14 +0000 (21:09 +0200)]
avcodec/eatgv: Check remaining size after the keyframe header

The minimal size which unpack() will not fail on is 5 bytes
Fixes: Timeout (14sec -> 77ms) (testcase 15508)
Fixes: 15508/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5700053513011200
Fixes: 15996/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5751353223151616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoh264_metadata: Support overscan_appropriate_flag
Mark Thompson [Sun, 28 Jul 2019 18:23:16 +0000 (19:23 +0100)]
h264_metadata: Support overscan_appropriate_flag

Fixes #8041.

4 years agocbs_h264: Fix missing inferred colour description fields
Mark Thompson [Sun, 28 Jul 2019 18:23:15 +0000 (19:23 +0100)]
cbs_h264: Fix missing inferred colour description fields

With video_signal_type_present_flag set but colour_description_present_flag
unset the colour fields would not have had their correct values inferred.

4 years agodnn: convert tf.pad to native model in python script, and load/execute it in the...
Guo, Yejun [Mon, 29 Jul 2019 01:56:54 +0000 (09:56 +0800)]
dnn: convert tf.pad to native model in python script, and load/execute it in the c code.

since tf.pad is enabled, the conv2d(valid) changes back to its original behavior.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agofate: add unit test for dnn-layer-pad
Guo, Yejun [Mon, 29 Jul 2019 01:56:40 +0000 (09:56 +0800)]
fate: add unit test for dnn-layer-pad

'make fate-dnn-layer-pad' to run the test

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agodnn: add layer pad which is equivalent to tf.pad
Guo, Yejun [Mon, 29 Jul 2019 01:56:33 +0000 (09:56 +0800)]
dnn: add layer pad which is equivalent to tf.pad

the reason to add this layer first is that vf_sr uses it in its
tensorflow model, and the next plan is to update the python script
to convert tf.pad into native model.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agoavcodec/cfhd: add bayer support
Paul B Mahol [Sat, 27 Jul 2019 11:09:20 +0000 (13:09 +0200)]
avcodec/cfhd: add bayer support

4 years agoavformat/hlsenc: Fix overflow of int for durations compute
Steven Liu [Mon, 29 Jul 2019 11:48:06 +0000 (19:48 +0800)]
avformat/hlsenc: Fix overflow of int for durations compute

Fix ticket: 8037

Reported-by: DusanBrejka
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agoavfilter/fade: don't allow nb_frames == 0
Gyan Doshi [Mon, 29 Jul 2019 05:23:12 +0000 (10:53 +0530)]
avfilter/fade: don't allow nb_frames == 0

In filter init, there's a division by nb_frames but value isn't checked.

4 years agolavfi: addroi filter
Mark Thompson [Sun, 7 Jul 2019 19:26:50 +0000 (20:26 +0100)]
lavfi: addroi filter

This can be used to add region of interest side data to video frames.

4 years agovaapi_encode: Add ROI support
Mark Thompson [Sun, 7 Jul 2019 19:26:49 +0000 (20:26 +0100)]
vaapi_encode: Add ROI support

4 years agoavcodec/mips: [loongson] refine process of setting block as 0 in h264dsp_mmi.
Shiyou Yin [Sun, 28 Jul 2019 04:42:09 +0000 (12:42 +0800)]
avcodec/mips: [loongson] refine process of setting block as 0 in h264dsp_mmi.

In function ff_h264_add_pixels4_8_mmi, there is no need to reset '%[ftmp0]'
to 0, because it's value has never changed since the start of the asm block.
This patch remove the redundant 'xor' and set src to zero once it was loaded.

In function ff_h264_idct_add_8_mmi, 'block' is seted to zero twice.
This patch removed the first setting zero operation and move the second one
after the load operation of block.

In function ff_h264_idct8_add_8_mmi, 'block' is seted to zero twice too.
This patch just removed the second setting zero operation.

This patch mainly simplifies the implementation of functions above,
the effect on the performance of whole h264 decoding process is not obvious.
According to the perf data, proportion of ff_h264_idct_add_8_mmi decreased from
0.29% to 0.26% and ff_h264_idct8_add_8_mmi decreased from 0.62% to 0.59% when decoding
H264 format on loongson 3A3000(For reference only , not very stable.).

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agovp9_metadata: Improve spec-compliance and warnings
Andreas Rheinhardt [Tue, 9 Jul 2019 01:10:45 +0000 (03:10 +0200)]
vp9_metadata: Improve spec-compliance and warnings

The earlier version had three deficits:
1. It allowed to set the stream to RGB although this is not allowed when
the profile is 0 or 2.
2. If it set the stream to RGB, then it did not automatically set the
range to full range; the result was that one got a warning every time a
frame with color_config element was processed if the frame originally
had TV range and the user didn't explicitly choose PC range. Now one
gets only one warning in such a situation.
3. Intra-only frames in profile 0 are automatically BT.601, but if the
user wished another color space, he was not informed about his wishes
being unfulfillable.

The commit also improves the documentation about this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoav1/h264_metadata: Don't reinitialize data
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:14 +0000 (01:45 +0200)]
av1/h264_metadata: Don't reinitialize data

If the relevant elements (the color description elements for AV1 and the
VUI elements in general for H.264 (since 1156b507)) are absent, then their
correct values (usually meaning unknown) have already been inferred by
the reading process, so that it is unnecessary to initialize them again
in the av1/h264_metadata filters even when they were initially absent.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs_mpeg2: Fix parsing of picture and slice headers
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:12 +0000 (01:45 +0200)]
cbs_mpeg2: Fix parsing of picture and slice headers

1. The extra information in slice headers was parsed incorrectly:
In the first reading pass to derive the length of the extra information,
one should look at bits n, n + 9, n + 18, ... and check whether they
equal one (further extra information) or zero (end of extra information),
but instead bits n, n + 8, n + 16, ... were inspected. The second pass
of reading (where the length is already known and the bytes between the
length-determining bits are copied into a buffer) did not record what
was in bits n, n + 9, n + 18, ..., presuming they equal one. And during
writing, the bytes in the buffer are interleaved with set bits and
written. This means that if the detected length of the extra information
was greater than the real length, the output was corrupted. Fortunately
no sample is known that made use of this mechanism: The extra information
in slices is still marked as reserved in the specifications. cbs_mpeg2
is now ready in case this changes.

2. Furthermore, the buffer is now padded and slightly different, but
very similar code for reading resp. writing has been replaced by code
used for both. This was made possible by a new macro, the equivalent
to cbs_h2645's fixed().

3. These changes also made it possible to remove the extra_bit_slice
element from the MPEG2RawSliceHeader structure. Said element was always
zero except when the detected length of the extra information was less
than the real length.

4. The extra information in picture headers (which uses essentially the
same syntax as the extra information in slice headers) has simply been
forgotten. This meant that if this extra information was present, it was
discarded during reading; and unfortunately writing created invalid
bitstreams in this case (an extra_bit_picture - the last set bit of the
whole unit - indicated that there would be a further byte of data,
although the output didn't contain said data).

This has been fixed; both types of extra information are now parsed via
the same code and essentially passed through.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agocbs: Remove useless initializations
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:11 +0000 (01:45 +0200)]
cbs: Remove useless initializations

Up until now, a temporary variable was used and initialized every time a
value was read in CBS; if reading turned out to be successfull, this
value was overwritten (without having ever been looked at) with the
value read if reading was successfull; on failure the variable wasn't
touched either. Therefore these initializations can be and have been
removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agompeg2_metadata, cbs_mpeg2: Fix handling of colour_description
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:10 +0000 (01:45 +0200)]
mpeg2_metadata, cbs_mpeg2: Fix handling of colour_description

If a sequence display extension is read with colour_description equal to
zero, but a user wants to add one or more of the colour_description
elements, then the colour_description elements the user did not explicitly
request to be set are set to zero and not to the value equal to
unknown/unspecified (namely 2). A value of zero is not only inappropriate,
but explicitly forbidden. This is fixed by inferring the right default
values during the reading process if the elements are absent; moreover,
changing any of the colour_description elements to zero is now no longer
possible.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/assdec: undefined use of memcpy()
Michael Niedermayer [Wed, 24 Jul 2019 20:55:15 +0000 (22:55 +0200)]
avcodec/assdec: undefined use of memcpy()

Fixes: null pointer passed as argument 2, which is declared to never be null
Fixes: 16008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SSA_fuzzer-5650582821404672 (this is a separate issue found in this testcase)
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>
4 years agoavcodec/brenderpix: Check input size before allocating image
Michael Niedermayer [Fri, 26 Jul 2019 12:16:16 +0000 (14:16 +0200)]
avcodec/brenderpix: Check input size before allocating image

An incomplete image is not supported prior to this and will
not produce any output. This commit moves the failure before
time consuming operations.

Fixes: Timeout (81sec -> 76ms)
Fixes: 15723/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BRENDER_PIX_fuzzer-5147265653538816
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>
4 years agolibavfilter/dnn: move dnn files from libavfilter to libavfilter/dnn
Guo, Yejun [Tue, 16 Jul 2019 05:55:45 +0000 (13:55 +0800)]
libavfilter/dnn: move dnn files from libavfilter to libavfilter/dnn

it is expected that there will be more files to support native mode,
so put all the dnn codes under libavfilter/dnn

The main change of this patch is to move the file location, see below:
modified:   libavfilter/Makefile
new file:   libavfilter/dnn/Makefile
renamed:    libavfilter/dnn_backend_native.c -> libavfilter/dnn/dnn_backend_native.c
renamed:    libavfilter/dnn_backend_native.h -> libavfilter/dnn/dnn_backend_native.h
renamed:    libavfilter/dnn_backend_tf.c -> libavfilter/dnn/dnn_backend_tf.c
renamed:    libavfilter/dnn_backend_tf.h -> libavfilter/dnn/dnn_backend_tf.h
renamed:    libavfilter/dnn_interface.c -> libavfilter/dnn/dnn_interface.c

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agoavcodec/adpcm: reindent after last commit
Paul B Mahol [Thu, 25 Jul 2019 14:18:01 +0000 (16:18 +0200)]
avcodec/adpcm: reindent after last commit

4 years agoavcodec/adpcm: add support for 5.1 ADPCM MS
Paul B Mahol [Thu, 25 Jul 2019 14:11:27 +0000 (16:11 +0200)]
avcodec/adpcm: add support for 5.1 ADPCM MS

4 years agolafv/wavdec: Fail bext parsing on incomplete reads
Matt Wolenetz [Thu, 25 Jul 2019 22:54:49 +0000 (15:54 -0700)]
lafv/wavdec: Fail bext parsing on incomplete reads

avio_read can successfully return even when less than the requested
amount of input was read. wavdec's bext parsing mistakenly assumed a
successful avio_read always read the full amount that was requested.
The result could be dictionary tags populated with partially
uninitialized values.

This change also fixes a broken assertion in wav_parse_bext_string that
was off-by-one, though no known current usage of that method hits that
broken case.

Chromium bug: 987270

Signed-off-by: Matt Wolenetz <wolenetz@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavf/hls: replace the same code logic with ensure_playlist()
vacingfang [Sun, 21 Jul 2019 13:55:47 +0000 (21:55 +0800)]
lavf/hls: replace the same code logic with ensure_playlist()

Replace the same code logic with ensure_playlist(), it's will
help reusable blocks of code.

Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: vacingfang <vacingfang@tencent.com>
4 years agolavf/hls: remove redundancy reset_packet() after av_packet_unref()
Jun Zhao [Mon, 15 Jul 2019 04:24:14 +0000 (12:24 +0800)]
lavf/hls: remove redundancy reset_packet() after av_packet_unref()

av_packet_unref have reseted the AVPacket, so don't need to call
reset_packet after that.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavcodec/adxenc: add EOF header
Paul B Mahol [Wed, 24 Jul 2019 09:11:35 +0000 (11:11 +0200)]
avcodec/adxenc: add EOF header

Fixes #8031.

4 years agoavcodec/utils: fix leak of subtitle_header on error path
Michael Niedermayer [Thu, 4 Jul 2019 21:39:23 +0000 (23:39 +0200)]
avcodec/utils: fix leak of subtitle_header on error path

Fixes: memleak
Fixes: 15528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_STL_fuzzer-5735993371525120
Fixes: 15792/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SAMI_fuzzer-5737754232619008
Fixes: 16008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SSA_fuzzer-5650582821404672
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/af_dynaudnorm: add more descriptive aliases for options
Paul B Mahol [Wed, 24 Jul 2019 12:16:49 +0000 (14:16 +0200)]
avfilter/af_dynaudnorm: add more descriptive aliases for options

4 years agoavcodec/mpc8huff: Make some arrays unsigned to prevent overflow
Andreas Rheinhardt [Sat, 20 Jul 2019 13:51:25 +0000 (15:51 +0200)]
avcodec/mpc8huff: Make some arrays unsigned to prevent overflow

mpc8_q4_syms is an array of int8_t that is initialized using
values not in the range of an int8_t and that is only accessed via
a pointer to uint8_t in ff_init_vlc_sparse. The latter applies to all
the other *_bits and *_syms tables in mpc8huff.h, so make them all
unsigned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agovp3data: Make some arrays unsigned to prevent overflow
Andreas Rheinhardt [Sat, 20 Jul 2019 13:51:25 +0000 (15:51 +0200)]
vp3data: Make some arrays unsigned to prevent overflow

Some of the VP3 arrays (namely vp31_intra_y_dequant, vp31_intra_c_dequant
and vp31_inter_dequant) are currently declared as array of (const) int8_t
despite them being only used to directly initialize an array of uint8_t.
vp31_inter_dequant even contains the value 128 which is not
representible in int8_t and might generate overflow warnings by
compilers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_ciescope: add DCI-P3
Paul B Mahol [Mon, 22 Jul 2019 19:19:34 +0000 (21:19 +0200)]
avfilter/vf_ciescope: add DCI-P3

4 years agoavformat/f_select: add support for more pixel formats for scene change score calculations
Limin Wang [Sat, 20 Jul 2019 23:27:20 +0000 (07:27 +0800)]
avformat/f_select: add support for more pixel formats for scene change score calculations

This avoids automatic conversions to rgb if scene change score is used in the expression.

Below is the tested results for the new added pixel format without autoscale to rgb24:
1. AV_PIX_FMT_YUVJ420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)"

master:
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.875036
pkt_pts=5800|tag:lavfi.scene_score=1.000000
pkt_pts=6720|tag:lavfi.scene_score=0.461625
pkt_pts=8160|tag:lavfi.scene_score=1.000000
pkt_pts=9760|tag:lavfi.scene_score=1.000000
pkt_pts=14080|tag:lavfi.scene_score=0.838916
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.474948
pkt_pts=20040|tag:lavfi.scene_score=0.379700
pkt_pts=21760|tag:lavfi.scene_score=1.000000
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  0.71s user 0.01s system 99% cpu 0.721 total

patch applied:
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.668643
pkt_pts=5800|tag:lavfi.scene_score=0.996721
pkt_pts=6720|tag:lavfi.scene_score=0.357390
pkt_pts=8160|tag:lavfi.scene_score=0.886268
pkt_pts=9760|tag:lavfi.scene_score=0.926219
pkt_pts=14080|tag:lavfi.scene_score=0.650033
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.316402
pkt_pts=20040|tag:lavfi.scene_score=0.269509
pkt_pts=21760|tag:lavfi.scene_score=1.000000
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  0.19s user 0.01s system 81% cpu 0.240 total

2. AV_PIX_FMT_YUV420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)"
master:
pkt_pts=3587|tag:lavfi.scene_score=0.462364
pkt_pts=4838|tag:lavfi.scene_score=0.419519
pkt_pts=6548|tag:lavfi.scene_score=0.397027
pkt_pts=9968|tag:lavfi.scene_score=0.419245
pkt_pts=12471|tag:lavfi.scene_score=0.413084
pkt_pts=16225|tag:lavfi.scene_score=0.506370
pkt_pts=19645|tag:lavfi.scene_score=0.507538
pkt_pts=22314|tag:lavfi.scene_score=0.504319
pkt_pts=24817|tag:lavfi.scene_score=0.417544
pkt_pts=25651|tag:lavfi.scene_score=0.413916
pkt_pts=26652|tag:lavfi.scene_score=0.487707
18.58s user 0.07s system 99% cpu 18.663 total

patch applied:
pkt_pts=3587|tag:lavfi.scene_score=0.272173
pkt_pts=4838|tag:lavfi.scene_score=0.247841
pkt_pts=6548|tag:lavfi.scene_score=0.233134
pkt_pts=9968|tag:lavfi.scene_score=0.247253
pkt_pts=12471|tag:lavfi.scene_score=0.244129
pkt_pts=16225|tag:lavfi.scene_score=0.302531
pkt_pts=19645|tag:lavfi.scene_score=0.303560
pkt_pts=22314|tag:lavfi.scene_score=0.301861
pkt_pts=24817|tag:lavfi.scene_score=0.249331
pkt_pts=25651|tag:lavfi.scene_score=0.247096
pkt_pts=26652|tag:lavfi.scene_score=0.287728
10.90s user 0.06s system 99% cpu 10.967 total

3. AV_PIX_FMT_YUV422P

time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)"
master:

patched applied:
pkt_pts=3587|tag:lavfi.scene_score=0.224017
pkt_pts=4838|tag:lavfi.scene_score=0.204225
pkt_pts=9968|tag:lavfi.scene_score=0.204636
pkt_pts=12471|tag:lavfi.scene_score=0.202772
pkt_pts=16225|tag:lavfi.scene_score=0.248765
pkt_pts=19645|tag:lavfi.scene_score=0.250144
pkt_pts=22314|tag:lavfi.scene_score=0.248802
pkt_pts=24817|tag:lavfi.scene_score=0.208362
pkt_pts=25651|tag:lavfi.scene_score=0.205777
pkt_pts=26652|tag:lavfi.scene_score=0.230742

4.  AV_PIX_FMT_YUV420P10
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)"

master:
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  76.03s user 0.22s system 99% cpu 1:16.27 total

patch applied
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f  50.27s user 0.20s system 99% cpu 50.476 total

5. AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8
are tested by format= with the fate sample: Vertical400kbit.sorenson3.mov like below:
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=rgba,select=gt(scene\,.25)"

patch applied:
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.656277
pkt_pts=5800|tag:lavfi.scene_score=1.000000
pkt_pts=6720|tag:lavfi.scene_score=0.346218
pkt_pts=8160|tag:lavfi.scene_score=0.987686
pkt_pts=9760|tag:lavfi.scene_score=1.000000
pkt_pts=14080|tag:lavfi.scene_score=0.629187
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.356211
pkt_pts=20040|tag:lavfi.scene_score=0.284775
pkt_pts=21760|tag:lavfi.scene_score=1.000000

6. AV_PIX_FMT_YUVJ422P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=yuvj422p,select=gt(scene\,.25)"

patch applied:
pkt_pts=1620|tag:lavfi.scene_score=0.838281
pkt_pts=4140|tag:lavfi.scene_score=0.541382
pkt_pts=5800|tag:lavfi.scene_score=0.780588
pkt_pts=6720|tag:lavfi.scene_score=0.298274
pkt_pts=8160|tag:lavfi.scene_score=0.699106
pkt_pts=9760|tag:lavfi.scene_score=0.730136
pkt_pts=14080|tag:lavfi.scene_score=0.537742
pkt_pts=15700|tag:lavfi.scene_score=0.811946
pkt_pts=18500|tag:lavfi.scene_score=0.263382
pkt_pts=21760|tag:lavfi.scene_score=0.880773

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofate: change the scenecut fate threshold
Limin Wang [Sat, 20 Jul 2019 23:24:19 +0000 (07:24 +0800)]
fate: change the scenecut fate threshold

why change .4 to .25, it's for:
one scenecut(pkt_pts=20040) isn't detected by 0.4 threshold

why not change to 0.3 instead of 0.25:
it will miss the scenecut(pkt_pts=20040) after applying the next
patch which enables yuvj420

for fate testing, it's better to catch all scenecut scenes.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/f_select: support scenecut with more pixel formats
Limin Wang [Sat, 20 Jul 2019 23:24:18 +0000 (07:24 +0800)]
avformat/f_select: support scenecut with more pixel formats

This patch does not make other pixel formats usable yet to make sure the test
result is the same with rgb32 format.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mxfenc: fix index byte count in partition header
Baptiste Coudurier [Thu, 18 Jul 2019 17:35:00 +0000 (10:35 -0700)]
avformat/mxfenc: fix index byte count in partition header

4 years agoavformat/mov: fix return code for trun box with no sample entries
Gyan Doshi [Sat, 20 Jul 2019 18:14:14 +0000 (23:44 +0530)]
avformat/mov: fix return code for trun box with no sample entries

A value of zero for sample_count in trun box is not
prohibited by 14496-12 section 8.8.8. 4a9d32baca
disallowed this which led the demuxer to error out
when reading the header of valid files.

4 years agoavcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecN...
Matthieu Bouron [Fri, 26 Apr 2019 08:32:31 +0000 (10:32 +0200)]
avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()

4 years agoavcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_ge...
Matthieu Bouron [Thu, 25 Apr 2019 15:12:32 +0000 (17:12 +0200)]
avcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_getCodecNameByType()

4 years agoavcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()
Matthieu Bouron [Thu, 25 Apr 2019 15:40:55 +0000 (17:40 +0200)]
avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()

4 years agoavcodec/mediacodec_wrapper: add missing "avcodec.h" include
Matthieu Bouron [Mon, 29 Apr 2019 09:24:37 +0000 (11:24 +0200)]
avcodec/mediacodec_wrapper: add missing "avcodec.h" include

4 years agoavformat/dashenc: add descriptor which is useful to the scheme defined by ISO/IEC...
Leo Zhang [Fri, 19 Jul 2019 07:43:46 +0000 (15:43 +0800)]
avformat/dashenc: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.

Signed-off-by: leozhang <leozhang@qiyi.com>
4 years agoRELEASE: Update value for post 4.2 branch
Michael Niedermayer [Sun, 21 Jul 2019 16:37:32 +0000 (18:37 +0200)]
RELEASE: Update value for post 4.2 branch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoBump minor versions again on master to keep 4.2 versions separate from master
Michael Niedermayer [Sun, 21 Jul 2019 16:31:20 +0000 (18:31 +0200)]
Bump minor versions again on master to keep 4.2 versions separate from master

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoBump minor versions to separate 4.2 from master
Michael Niedermayer [Sun, 21 Jul 2019 16:31:20 +0000 (18:31 +0200)]
Bump minor versions to separate 4.2 from master

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoChangelog: Add 4.2 cut marker
Michael Niedermayer [Sun, 21 Jul 2019 16:25:21 +0000 (18:25 +0200)]
Changelog: Add 4.2 cut marker

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodoc/APIchanges: Fill in missing Fields, add 4.2 cut marker
Michael Niedermayer [Sun, 21 Jul 2019 16:24:06 +0000 (18:24 +0200)]
doc/APIchanges: Fill in missing Fields, add 4.2 cut marker

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/utils: Check close before calling it
Michael Niedermayer [Sat, 20 Jul 2019 22:08:55 +0000 (00:08 +0200)]
avcodec/utils: Check close before calling it

Fixes: NULL pointer dereference
Fixes: 15733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDF_fuzzer-5658616977162240
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: Free parser in case of avcodec_open2() failure
Michael Niedermayer [Sun, 7 Jul 2019 20:50:42 +0000 (22:50 +0200)]
tools/target_dec_fuzzer: Free parser in case of avcodec_open2() failure

Fixes: memleak
Fixes: part of 15529/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVPX_VP8_fuzzer-5140143700180992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vorbisdec: Check vlc for floor0 dec vector offset
Michael Niedermayer [Sun, 7 Jul 2019 21:23:53 +0000 (23:23 +0200)]
avcodec/vorbisdec: Check vlc for floor0 dec vector offset

Fixes: out of array access
Fixes: 15649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5729191309344768
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/vorbisdec: amplitude bits can be more than 25 bits
Michael Niedermayer [Sun, 7 Jul 2019 21:16:12 +0000 (23:16 +0200)]
avcodec/vorbisdec: amplitude bits can be more than 25 bits

Fixes: assertion failure, invalid shift
Fixes: 15583/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5640157484548096
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavutil/softfloat_ieee754: Fix odd bit position for exponent and sign in av_bits2sf_ie...
Michael Niedermayer [Sun, 7 Jul 2019 12:47:58 +0000 (14:47 +0200)]
avutil/softfloat_ieee754: Fix odd bit position for exponent and sign in av_bits2sf_ieee754()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/alsdec: fix undefined shift in multiply()
Michael Niedermayer [Sat, 6 Jul 2019 22:03:51 +0000 (00:03 +0200)]
avcodec/alsdec: fix undefined shift in multiply()

Fixes: left shift of negative value -6
Fixes: 15564/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5701655938465792
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/alsdec: Fix 2 integer overflows
Michael Niedermayer [Sat, 6 Jul 2019 21:20:30 +0000 (23:20 +0200)]
avcodec/alsdec: Fix 2 integer overflows

Fixes: signed integer overflow: 1270564968 + 904828220 cannot be represented in type 'int'
Fixes: 15402/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5755426823471104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: Fix various integer overflows
Michael Niedermayer [Sun, 16 Jun 2019 09:32:10 +0000 (11:32 +0200)]
avcodec/apedec: Fix various integer overflows

Fixes: signed integer overflow: -538976267 * 31 cannot be represented in type 'int'
Fixes: left shift of 65312 by 16 places cannot be represented in type 'int'
Fixes: 15255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5718831688843264
Fixes: 15547/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5691384901664768
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: Fix multiple integer overflows in predictor_update_filter()
Michael Niedermayer [Sun, 16 Jun 2019 08:54:13 +0000 (10:54 +0200)]
avcodec/apedec: Fix multiple integer overflows in predictor_update_filter()

Fixes: signed integer overflow: -829262115 + -1410750414 cannot be represented in type 'int'
Fixes: 15251/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5651742252859392
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/flicvideo: Make line_packets int
Michael Niedermayer [Fri, 21 Jun 2019 21:01:04 +0000 (23:01 +0200)]
avcodec/flicvideo: Make line_packets int

Fixes: signed integer overflow: -32768 * 196032 cannot be represented in type 'int'
Fixes: 15300/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5733319519502336
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavf/avio: remove ffio_open2_wrapper function
Jun Zhao [Sat, 13 Jul 2019 02:45:18 +0000 (10:45 +0800)]
lavf/avio: remove ffio_open2_wrapper function

Remove the function ffio_open2_wrapper, it's not being used anymore.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavfi/showinfo: support regions of interest sidedata
Jun Zhao [Sat, 9 Mar 2019 07:55:38 +0000 (15:55 +0800)]
lavfi/showinfo: support regions of interest sidedata

support regions of interest sidedata

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavformat/aacdec: resync to the next adts frame on invalid data instead of aborting
James Almer [Sun, 21 Jul 2019 00:47:55 +0000 (21:47 -0300)]
avformat/aacdec: resync to the next adts frame on invalid data instead of aborting

Should fix ticket #6634

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/aacdec: factorize the adts frame resync code
James Almer [Sat, 20 Jul 2019 13:13:08 +0000 (10:13 -0300)]
avformat/aacdec: factorize the adts frame resync code

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/dvbsubdec: Use ff_set_dimensions()
Michael Niedermayer [Fri, 19 Jul 2019 22:07:59 +0000 (00:07 +0200)]
avcodec/dvbsubdec: Use ff_set_dimensions()

Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 'int'
Fixes: 15740/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5641749164195840
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>
4 years agoavcodec/ffwavesynth: Check if there is enough extradata before allocation
Michael Niedermayer [Sun, 14 Jul 2019 22:35:49 +0000 (00:35 +0200)]
avcodec/ffwavesynth: Check if there is enough extradata before allocation

Fixes: OOM
Fixes: 15750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5702090367696896
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ffwavesynth: More correct cast in wavesynth_seek()
Michael Niedermayer [Sun, 14 Jul 2019 22:35:48 +0000 (00:35 +0200)]
avcodec/ffwavesynth: More correct cast in wavesynth_seek()

Fixes: signed integer overflow: 553590816 - -9223372036315799520 cannot be represented in type 'long'
Fixes: 15743/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5705835377852416
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ffwavesynth: Check sample rate before use
Michael Niedermayer [Sun, 14 Jul 2019 22:35:47 +0000 (00:35 +0200)]
avcodec/ffwavesynth: Check sample rate before use

Fixes: division by zero
Fixes: 15725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5641231956180992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/tak_parser: don't return error values
James Almer [Wed, 17 Jul 2019 22:22:00 +0000 (19:22 -0300)]
avcodec/tak_parser: don't return error values

The API does not allow it.

Also set poutbuf and poutbuf_size to NULL/0 on error.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/cbs_h265: add support for Alpha Channel Info SEI messages
James Almer [Fri, 21 Jun 2019 01:21:26 +0000 (22:21 -0300)]
avcodec/cbs_h265: add support for Alpha Channel Info SEI messages

As defined in sections F.14.2.8 and F.14.3.8

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agocbs_h2645: Fix infinite loop in more_rbsp_data
Andreas Rheinhardt [Wed, 5 Jun 2019 02:18:54 +0000 (04:18 +0200)]
cbs_h2645: Fix infinite loop in more_rbsp_data

cbs_h2645_read_more_rbsp_data does not handle malformed input very well:
1. If there were <= 8 bits left in the bitreader, these bits were read
via show_bits. But show_bits requires the number of bits to be read to
be > 0 (internally it shifts by 32 - number of bits to be read which is
undefined behaviour if said number is zero; there is also an assert for
this, but it is only an av_assert2). Furthermore, in this case a shift
by -1 was performed which is of course undefined behaviour, too.
2. If there were > 0 and <= 8 bits left and all of them were zero
(this can only happen for defective input), it was reported that there
was further RBSP data.

This can lead to an infinite loop in H.265's cbs_h265_read_extension_data
corresponding to the [vsp]ps_extension_data_flag syntax elements. If the
relevant flag indicates the (potential) occurence of these syntax elements,
while all bits after this flag are zero, cbs_h2645_read_more_rbsp_data
always returns 1 on x86. Given that a checked bitstream reader is used,
we are also not "saved" by an overflow in the bitstream reader's index.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mux: correct error msg for when BSF filtering fails
Gyan Doshi [Tue, 16 Jul 2019 12:36:42 +0000 (18:06 +0530)]
avformat/mux: correct error msg for when BSF filtering fails

4 years agoavcodec/flashsv: add FF_CODEC_CAP_INIT_CLEANUP to flashsv2
Michael Niedermayer [Sun, 7 Jul 2019 09:05:53 +0000 (11:05 +0200)]
avcodec/flashsv: add FF_CODEC_CAP_INIT_CLEANUP to flashsv2

Fixes: memleaks on error paths during init
Fixes: 15548/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV2_fuzzer-6324019382452224
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>