ffmpeg.git
2 months agoavfilter/vf_midequalizer: always use framesync timestamps
Paul B Mahol [Sun, 14 Jul 2019 15:45:42 +0000 (17:45 +0200)]
avfilter/vf_midequalizer: always use framesync timestamps

2 months agoavfilter/vf_maskedmerge: always use framesync timestamps
Paul B Mahol [Sun, 14 Jul 2019 15:38:26 +0000 (17:38 +0200)]
avfilter/vf_maskedmerge: always use framesync timestamps

2 months agoavfilter/vf_threshold: use time_base from framesync
Paul B Mahol [Sun, 14 Jul 2019 15:28:04 +0000 (17:28 +0200)]
avfilter/vf_threshold: use time_base from framesync

Fixes non-monotonous timestamps.

2 months agoavfilter/vf_blend: add 9bit support
Paul B Mahol [Sun, 14 Jul 2019 15:00:58 +0000 (17:00 +0200)]
avfilter/vf_blend: add 9bit support

2 months agoavcodec/dvbsub: add support for Display Definition Segment to DVB Subtitle encoder
Jernej Fijacko [Sat, 13 Jul 2019 17:33:16 +0000 (19:33 +0200)]
avcodec/dvbsub: add support for Display Definition Segment to DVB Subtitle encoder

Current version of dvbsub encoder doesn't support HD DVB subtitles. The high
resolution bitmaps are muxed into the stream but without the DDS (display definition
segment) the players asume that the DVB subtitles are in SD (720x576) resolution
which causes them to either render the subtitles too large and misplaced or don't
render them at all. By including the DDS as defined in section 7.7.1 of ETSI EN 300
743 (V1.3.1) this problem is fixed.

7.2.1 Display definition segment The display definition for a subtitle service may
be defined by the display definition segment if present in the stream. Absence of a
DDS implies that the stream is coded in accordance with EN 300 743 (V1.2.1) [5] and
that a display width of 720 pixels and a display height of 576 lines may be assumed.

https://www.etsi.org/deliver/etsi_en/300700_300799/300743/01.03.01_60/en_300743v010301p.pdf

Signed-off-by: Jernej Fijacko <mikrohard@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat: Don't suggest deprecated function
Andreas Rheinhardt [Sat, 13 Jul 2019 16:48:48 +0000 (18:48 +0200)]
avformat: Don't suggest deprecated function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavfilter/af_aiir: calculate group delay too
Paul B Mahol [Sat, 13 Jul 2019 13:43:17 +0000 (15:43 +0200)]
avfilter/af_aiir: calculate group delay too

2 months agoavcodec/pngdec: Check that previous_picture has same w/h/format
Michael Niedermayer [Wed, 10 Jul 2019 21:02:36 +0000 (23:02 +0200)]
avcodec/pngdec: Check that previous_picture has same w/h/format

Fixes: out of array access
Fixes: 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480

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>
2 months agoavcodec/huffyuvdec: Check vertical subsampling in hymt
Michael Niedermayer [Wed, 3 Jul 2019 22:16:49 +0000 (00:16 +0200)]
avcodec/huffyuvdec: Check vertical subsampling in hymt

Fixes: out of array access
Fixes: 15484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5765377054736384
Fixes: 15559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5710295743332352

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>
2 months agoavcodec/huffyuv: remove gray8a (the format is listed but not supported by the impleme...
Michael Niedermayer [Wed, 3 Jul 2019 21:25:07 +0000 (23:25 +0200)]
avcodec/huffyuv: remove gray8a (the format is listed but not supported by the implementation)

Fixes: null pointer dereference
Fixes: 15464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5681391150301184

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>
2 months agotools/target_dec_fuzzer: Remove redundant av_free()
Michael Niedermayer [Thu, 11 Jul 2019 20:31:57 +0000 (22:31 +0200)]
tools/target_dec_fuzzer: Remove redundant av_free()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()
Michael Niedermayer [Thu, 11 Jul 2019 18:02:24 +0000 (20:02 +0200)]
avcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()

Fixes: left shift of negative value -456
Fixes: 15561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC8_fuzzer-5758130404720640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavfilter/af_aiir: do not ignore k option for audio filtering
Paul B Mahol [Sat, 13 Jul 2019 10:25:54 +0000 (12:25 +0200)]
avfilter/af_aiir: do not ignore k option for audio filtering

Previously it was used only for displaying frequency response.

2 months agoavformat/mpegts: respect program number when merging streams
Marton Balint [Tue, 9 Jul 2019 20:32:06 +0000 (22:32 +0200)]
avformat/mpegts: respect program number when merging streams

merge_pmt_versions was not usable if multiple programs were present because
when it was searching for candidate streams it did not make sure that the PMT was
of the same program. This caused the streams of all programs to get merged into
a single (garbled) program.

This patch makes sure that the program number (service ID) is also matching
with the old streams when parsing the PMT making the feature useful for multi
program streams.

This change might cause issues for single program streams if the program number
changes, but I think it is acceptable because the goal of the option is to make
the parsing resilient to PID changes, and that is still working as expected.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat/movenc: use unspecified language by default
Marton Balint [Sun, 19 May 2019 17:58:40 +0000 (19:58 +0200)]
avformat/movenc: use unspecified language by default

English was used before.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agolavf/webm_chunk: Correct duration if start time > 0
Andreas Rheinhardt [Fri, 19 Apr 2019 22:03:16 +0000 (00:03 +0200)]
lavf/webm_chunk: Correct duration if start time > 0

Up until now, it was simply presumed that the first packet had a pts of
zero; otherwise the duration of the first chunk was wrong.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agolavf/webm_chunk: Fix NULL dereference
Andreas Rheinhardt [Fri, 19 Apr 2019 22:03:15 +0000 (00:03 +0200)]
lavf/webm_chunk: Fix NULL dereference

The earlier version of the webm_chunk muxer had several bugs:

1. If the first packet of an audio stream didn't have a PTS of zero,
then no chunk will be started before a packet is delivered to the
underlying Matroska/WebM muxer, i.e. the AVFormatContext used to write
these packets had a NULL as AVIOContext for output. This is behind the
crash in ticket #5752.

2. If an error happens during writing a packet, the underlyimg
Matroska/WebM muxer context is freed. This leads to a use-after-free
coupled with a double-free in webm_chunk_write_trailer (which supposes
that the underlying AVFormatContext is still valid).

3. Even when no error occurs at all, webm_chunk_write_trailer is still
buggy: After the underlying Matroska/WebM muxer has written its trailer,
ending the chunk implicitly flushes it again which is illegal at this
point.

These bugs have been fixed.

Fixes #5752.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/magicyuv: add support for recently added YUV444P10
Paul B Mahol [Thu, 11 Jul 2019 14:53:09 +0000 (16:53 +0200)]
avcodec/magicyuv: add support for recently added YUV444P10

2 months agofate: add hls_list_size fate test case
Steven Liu [Thu, 11 Jul 2019 01:39:44 +0000 (09:39 +0800)]
fate: add hls_list_size fate test case

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavformat/hlsenc: use one handler for m3u8 and segments
Steven Liu [Thu, 11 Jul 2019 01:38:39 +0000 (09:38 +0800)]
avformat/hlsenc: use one handler for m3u8 and segments

Use one handler for m3u8 and segments.
Use two handler in byterange mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agofate: add hls_init_time option fate
Steven Liu [Thu, 11 Jul 2019 01:37:29 +0000 (09:37 +0800)]
fate: add hls_init_time option fate

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavformat/http: change error message from numeric code to string
Steven Liu [Thu, 11 Jul 2019 01:35:31 +0000 (09:35 +0800)]
avformat/http: change error message from numeric code to string

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavutil/hwcontext_vaapi: move kernel_driver into CONFIG_LIBDRM
Steven Liu [Thu, 11 Jul 2019 01:34:57 +0000 (09:34 +0800)]
avutil/hwcontext_vaapi: move kernel_driver into CONFIG_LIBDRM

Reviewed-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2 months agoavcodec/videotoolboxenc: remove unused variable
Steven Liu [Thu, 11 Jul 2019 01:34:34 +0000 (09:34 +0800)]
avcodec/videotoolboxenc: remove unused variable

Signed-off-by: Steven Liu <lq@onvideo.cn>
2 months agoavfilter/avf_showfreqs: make selecting window size simpler
Paul B Mahol [Wed, 10 Jul 2019 14:03:34 +0000 (16:03 +0200)]
avfilter/avf_showfreqs: make selecting window size simpler

The previous solution was very bad.

2 months agoavfilter/af_afftfilt: make selecting window size simpler
Paul B Mahol [Wed, 10 Jul 2019 13:57:38 +0000 (15:57 +0200)]
avfilter/af_afftfilt: make selecting window size simpler

Next step after this one will be adding support for more window sizes.

2 months agoavcodec/utils, avcodec_open2: close codec on failure
James Zern [Wed, 10 Jul 2019 02:03:58 +0000 (19:03 -0700)]
avcodec/utils, avcodec_open2: close codec on failure

after a successful init if the function fails for another reason close
the codec without requiring FF_CODEC_CAP_INIT_CLEANUP which is meant to
cover init failures themselves. fixes a memory leak in those cases.

BUG=oss-fuzz:15529

Signed-off-by: James Zern <jzern@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/rpl: Replace strcpy with av_strlcpy
Cameron Cawley [Wed, 10 Jul 2019 08:27:02 +0000 (10:27 +0200)]
avformat/rpl: Replace strcpy with av_strlcpy

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mips/cabac: replace addi with addiu
YunQiang Su [Tue, 2 Jul 2019 03:52:43 +0000 (11:52 +0800)]
avcodec/mips/cabac: replace addi with addiu

addi/daddi are deprecated by MIPS for years, and MIPS r6 remove
them.

They should be replace with addiu:
   ADDIU performs the same arithmetic operation but
   does not trap on overflow.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavutil/mips: optimize UNPCK&SAD macros with MSA2.0 instruction.
Shiyou Yin [Tue, 9 Jul 2019 12:43:37 +0000 (20:43 +0800)]
avutil/mips: optimize UNPCK&SAD macros with MSA2.0 instruction.

Loongson 3A4000 and 2k1000 has supported MSA2.0.
This patch optimized SAD_UB2_UH,UNPCK_R_SH_SW,UNPCK_SB_SH and UNPCK_SH_SW with MSA2.0 instruction.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/dashdec: fix code style and remove some empty line
Steven Liu [Wed, 10 Jul 2019 09:26:33 +0000 (17:26 +0800)]
avformat/dashdec: fix code style and remove some empty line

2 months agotruehd_core: Switch to in-place modifications
Andreas Rheinhardt [Sat, 6 Jul 2019 14:18:04 +0000 (16:18 +0200)]
truehd_core: Switch to in-place modifications

The truehd_core bitstream filter decreases the sizes of the
major_sync_info structure (if present), of the
substream_directory and of the substreams themselves. As a consequence,
there is enough space available in front of the actual substream data
for the new header, so that one only needs to modify the header in front
of the actual data (which apart from shrinking is left untouched) and
the packet's size and buffer pointer (after having made sure that the
packet is writable).

This and switching to bsf_get_packet_ref also removed the need for
having separate packets for in- and output.

Even if the input is not writable, there are noticable performance
improvements: The average of 10 iterations of processing a file with 262144
runs each (inlcuding about 20 skips per iteration) went down from 5669
to 4362 decicycles. If the input is writable, it goes down to 1363
decicycles.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agotruehd_core: Use byte offsets instead of bit offsets
Andreas Rheinhardt [Sat, 6 Jul 2019 14:18:03 +0000 (16:18 +0200)]
truehd_core: Use byte offsets instead of bit offsets

Words of 16 bit are the unit for TrueHD's size and offset fields;
in particular the sizes of the high-level structures of TrueHD are
always a multiple of a byte; yet truehd_core unnecessarily used
bit offsets at several places. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agotruehd_core: Miscellaneous improvements
Andreas Rheinhardt [Sat, 6 Jul 2019 14:18:02 +0000 (16:18 +0200)]
truehd_core: Miscellaneous improvements

1. The loop counter of the substream_directory loop is always less than
the number of substreams, yet within the loop it is checked whether it
is less than FFMIN(3, s->hdr.num_substreams), although the check for < 3
would suffice.
2. In case the packet is a major sync packet, the last two bytes of the
major sync structure were initialized to 0xff and then immediately
overwritten afterwards without ever making use of the values just set.
3. When updating the parity_nibble during writing the new
substream_directory, the parity_nibble is updated one byte at a time
with bytes that might be read from the output packet's data. But one can
do both bytes at the same time without resorting to the data just
written by XOR'ing with the variable that contains the value that has
just been written as a big endian number. This changes the intermediate
value of parity_nibble, but in the end it just amounts to a reordering
of the sum modulo two that will eventually be written as parity_nibble.
Due to associativity and commutativity, this value is unchanged.
4. init_get_bits8 already checks that no overflow happens during the
conversion of its argument from bytes to bits. ff_mlp_read_major_sync
makes sure not to overread (the maximum size of a major_sync_info is 60
bytes anyway) and last_offset is < 2^13, so that no overflow in the
calculation of size can happen, i.e. the check for whether size is >= 0
is unnecessary. But then size is completely unnecessary and can be
removed.
5. In case the packet is just passed through, it is unnecessary to read
the packet's dts. This is therefore postponed to when we know that the
packet is not passed through.
6. Given that it seems overkill to use a bitreader just for one
variable, the size of the input access unit is now read directly.
7. A substream's offset (of the end of the substream) is now stored as is
(i.e. in units of words).

These changes amount to a slight performance improvement: It improved
from 5897 decicycles of ten runs with about 262144 runs each (including
an insignificant amount -- about 20-25 usually of skips) to 5747
decicycles under the same conditions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agotruehd_core: Return error in case of error
Andreas Rheinhardt [Sat, 6 Jul 2019 14:18:01 +0000 (16:18 +0200)]
truehd_core: Return error in case of error

Several checks (e.g. when the size of the input packet is too small)
simply used "goto fail", but didn't set the return value appropriately
for an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agotruehd_core: Correct output size
Andreas Rheinhardt [Sat, 6 Jul 2019 14:18:00 +0000 (16:18 +0200)]
truehd_core: Correct output size

If truehd_core strips Atmos data away, three parts of the output differ
in size compared to the input access unit: a) The major_sync_info block
if the extra_channel_meaning_data is present, as the newly written
output never contains said block; b) the substream_directory (because
entries relating to discarded substreams are discarded, too); and c)
the actual substream data. b) and c) have already been taken into account
when choosing the size of the output packet, but a) has been forgotten.

This is also the reason behind the end of the output buffer having been
uninitialized until 801d78f0. The workaround added in said commit has
been removed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agotruehd_core: Disable 16-channel presentation
Andreas Rheinhardt [Sat, 6 Jul 2019 13:59:06 +0000 (15:59 +0200)]
truehd_core: Disable 16-channel presentation

The most serious bit of the substream_info header field (in a mayor sync
packet) indicates whether a 16-channel presentation is present in the
bitstream. If set, the extended_substream_info header field contains
information about the 16-channel presentation. This presentation always
uses substream 3, a substream that is discarded by truehd_core. So
substream_info needs to be changed to no longer indicate the presence
of a 16-channel presentation in order for truehd_core's output to be
consistent. This is implemented in this commit.

This change also makes MediaInfo no longer display the presence of Atmos
in the output of truehd_core.

Also, set the (now irrelevant) extended_substream_info field to zero as
this seems to be the common value for ordinary TrueHD.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoconfigure, cbs_h2645: Remove unneeded golomb dependency
Andreas Rheinhardt [Mon, 8 Jul 2019 16:38:21 +0000 (18:38 +0200)]
configure, cbs_h2645: Remove unneeded golomb dependency

This has been forgotten in 44cde38c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agocbs_h264, h264_metadata: Deleting SEI messages never fails
Andreas Rheinhardt [Sun, 7 Jul 2019 23:14:02 +0000 (01:14 +0200)]
cbs_h264, h264_metadata: Deleting SEI messages never fails

Given the recent changes to ff_cbs_delete_unit, it is no longer sensible
to use a return value for ff_cbs_h264_delete_sei_message; instead, use
asserts to ensure that the required conditions are met and remove the
callers' checks for the return value. Also, document said conditions.

An assert that is essentially equivalent to the one used in
ff_cbs_delete_unit has been removed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agocbs: ff_cbs_delete_unit: Replace return value with assert
Andreas Rheinhardt [Sun, 7 Jul 2019 23:14:01 +0000 (01:14 +0200)]
cbs: ff_cbs_delete_unit: Replace return value with assert

ff_cbs_delete_unit never fails if the index of the unit to delete is
valid, as it is with all current callers of the function. So just assert
in ff_cbs_delete_unit that the index is valid and change the return
value to void in order to remove the callers' checks for whether
ff_cbs_delete_unit failed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agolavd/avfoundation: Set correct default value 0 for option capture_raw_data.
Thilo Borgmann [Mon, 8 Jul 2019 17:52:53 +0000 (19:52 +0200)]
lavd/avfoundation: Set correct default value 0 for option capture_raw_data.

2 months agodoc/indevs: Add new option and example to avfoundation.
Thilo Borgmann [Mon, 8 Jul 2019 17:52:10 +0000 (19:52 +0200)]
doc/indevs: Add new option and example to avfoundation.

2 months agolavd/avfoundation: Reindent after last commit.
Thilo Borgmann [Mon, 8 Jul 2019 17:39:35 +0000 (19:39 +0200)]
lavd/avfoundation: Reindent after last commit.

2 months agolavd/avfoundation: Support muxed type of devices including raw muxed data capture.
Thilo Borgmann [Mon, 8 Jul 2019 11:33:29 +0000 (13:33 +0200)]
lavd/avfoundation: Support muxed type of devices including raw muxed data capture.

2 months agolavd/avfoundation: Refine some log messages.
Thilo Borgmann [Mon, 8 Jul 2019 11:32:22 +0000 (13:32 +0200)]
lavd/avfoundation: Refine some log messages.

2 months agolavd/avfoundation: Change binary Options to boolean type.
Thilo Borgmann [Mon, 8 Jul 2019 11:29:40 +0000 (13:29 +0200)]
lavd/avfoundation: Change binary Options to boolean type.

2 months agolavd/avfoundation: Remove useless index increment.
Thilo Borgmann [Sun, 30 Jun 2019 11:56:08 +0000 (13:56 +0200)]
lavd/avfoundation: Remove useless index increment.

2 months agodoc/filters: document new readeia608 option
Paul B Mahol [Mon, 8 Jul 2019 17:30:48 +0000 (19:30 +0200)]
doc/filters: document new readeia608 option

2 months agoavfilter/vf_readeia608: implement lowpass operation prior to processing lines
Paul B Mahol [Mon, 8 Jul 2019 17:19:52 +0000 (19:19 +0200)]
avfilter/vf_readeia608: implement lowpass operation prior to processing lines

2 months agoavfilter/vf_tinterlace: re-enable lowpass option
Paul B Mahol [Mon, 8 Jul 2019 15:57:31 +0000 (17:57 +0200)]
avfilter/vf_tinterlace: re-enable lowpass option

2 months agoavfilter/af_aiir: implement mix option
Paul B Mahol [Mon, 8 Jul 2019 14:44:53 +0000 (16:44 +0200)]
avfilter/af_aiir: implement mix option

2 months agoavfilter/af_biquads: clip gain picked from command to sane values
Paul B Mahol [Mon, 8 Jul 2019 14:29:15 +0000 (16:29 +0200)]
avfilter/af_biquads: clip gain picked from command to sane values

2 months agoavfilter/af_biquads: implement mix option to all filters
Paul B Mahol [Mon, 8 Jul 2019 14:20:57 +0000 (16:20 +0200)]
avfilter/af_biquads: implement mix option to all filters

2 months agoavcodec/ilbcdec: Simplify use of unsigned and fix more undefined overflows
Michael Niedermayer [Sun, 30 Jun 2019 21:28:13 +0000 (23:28 +0200)]
avcodec/ilbcdec: Simplify use of unsigned and fix more undefined overflows

Fixes: signed integer overflow: 2147475672 + 8192 cannot be represented in type 'int'
Fixes: 15415/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-5712074128228352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/golomb: Correct the doxy about get_ue_golomb() and errors
Michael Niedermayer [Sun, 30 Jun 2019 15:54:45 +0000 (17:54 +0200)]
avcodec/golomb: Correct the doxy about get_ue_golomb() and errors

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/utils: Check timebase before use in estimate_timings()
Michael Niedermayer [Sat, 29 Jun 2019 21:23:25 +0000 (23:23 +0200)]
avformat/utils: Check timebase before use in estimate_timings()

Fixes: division by 0
Fixes: 15480/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5746727434321920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/hq_hqa: Use ff_set_dimensions()
Michael Niedermayer [Sat, 29 Jun 2019 19:53:09 +0000 (21:53 +0200)]
avcodec/hq_hqa: Use ff_set_dimensions()

Fixes: 15530/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5637370344374272
Fixes: signed integer overflow: 65312 * 65312 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>
2 months agoavcodec/rv10: Fix integer overflow in aspect ratio compare
Michael Niedermayer [Fri, 28 Jun 2019 17:20:43 +0000 (19:20 +0200)]
avcodec/rv10: Fix integer overflow in aspect ratio compare

Fixes: signed integer overflow: 2040 * 1187872 cannot be represented in type 'int'
Fixes: 15368/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV20_fuzzer-5681657136283648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/tta: Limit decoder to 16 channels
Michael Niedermayer [Fri, 28 Jun 2019 18:02:32 +0000 (20:02 +0200)]
avcodec/tta: Limit decoder to 16 channels

libtta 2.3 has a limit of 6 channels, so 16 is substantially above the "official" already

Fixes: OOM
Fixes: 15249/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5643988125614080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/sanm: Optimize fill_frame() with av_memcpy_backptr()
Michael Niedermayer [Fri, 28 Jun 2019 18:38:56 +0000 (20:38 +0200)]
avcodec/sanm: Optimize fill_frame() with av_memcpy_backptr()

Fixes: Timeout (76 sec -> 24 sec)
Fixes: 15043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5699856238116864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/vividas: Check for input length in get_v()
Michael Niedermayer [Wed, 26 Jun 2019 22:02:31 +0000 (00:02 +0200)]
avformat/vividas: Check for input length in get_v()

Fixes: out of array read
Fixes: 15286/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5658245101780992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/4xm: Fix signed integer overflows in idct()
Michael Niedermayer [Wed, 26 Jun 2019 22:15:03 +0000 (00:15 +0200)]
avcodec/4xm: Fix signed integer overflows in idct()

Fixes: signed integer overflow: 20242 * 121095 cannot be represented in type 'int'
Fixes: 15310/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5737051745419264

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/qdm2: Check checksum_size for 0
Michael Niedermayer [Sun, 23 Jun 2019 23:01:04 +0000 (01:01 +0200)]
avcodec/qdm2: Check checksum_size for 0

Fixes: Infinite loop
Fixes: 15337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5757428949319680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/qdm2: error out of qdm2_fft_decode_tones() before entering endless loop
Michael Niedermayer [Sun, 23 Jun 2019 23:01:03 +0000 (01:01 +0200)]
avcodec/qdm2: error out of qdm2_fft_decode_tones() before entering endless loop

Fixes: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'
Fixes: infinite loop
Fixes: 15396/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5116605501014016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/qdm2: Do not read out of array in fix_coding_method_array()
Michael Niedermayer [Sun, 23 Jun 2019 23:01:02 +0000 (01:01 +0200)]
avcodec/qdm2: Do not read out of array in fix_coding_method_array()

Instead we ask for a sample, its unclear what to do in this case.

Fixes: index 30 out of bounds for type 'int8_t [30][64]'
Fixes: 15339/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5749441484554240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/simple_idct_template: Fix integer overflow in idctSparseColAdd()
Michael Niedermayer [Tue, 25 Jun 2019 22:23:47 +0000 (00:23 +0200)]
avcodec/simple_idct_template: Fix integer overflow in idctSparseColAdd()

Fixes: signed integer overflow: 1106434976 + 1041773512 cannot be represented in type 'int'
Fixes: 15421/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5669209314426880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/simple_idct_template: Fix integer overflow in idctSparseCol()
Michael Niedermayer [Tue, 25 Jun 2019 22:03:01 +0000 (00:03 +0200)]
avcodec/simple_idct_template: Fix integer overflow in idctSparseCol()

Fixes: signed integer overflow: -1027919784 + -1120041624 cannot be represented in type 'int'
Fixes: 15406/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-5700646528876544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/svq3: Use ff_set_dimension()
Michael Niedermayer [Tue, 25 Jun 2019 21:42:43 +0000 (23:42 +0200)]
avcodec/svq3: Use ff_set_dimension()

Fixes: OOM
Fixes: 15410/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5659464805384192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/iff: Check ham vs bpp
Michael Niedermayer [Sat, 22 Jun 2019 17:21:50 +0000 (19:21 +0200)]
avcodec/iff: Check ham vs bpp

This checks the ham value much stricter and avoids hitting cases which cannot be reached
with data from the libavformat demuxer.

Fixes: out of array access
Fixes: 15320/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5080476840099840
Fixes: 15423/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5630765833912320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/ffwavesynth: use uint32_t to compute difference, it is enough
Michael Niedermayer [Fri, 21 Jun 2019 20:43:23 +0000 (22:43 +0200)]
avcodec/ffwavesynth: use uint32_t to compute difference, it is enough

Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 cannot be represented in type 'long'
Fixes: 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case
Michael Niedermayer [Fri, 21 Jun 2019 20:41:25 +0000 (22:41 +0200)]
avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case

Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself
Fixes: 15289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5709034499342336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/ffwavesynth: Fix backward lcg_seek()
Michael Niedermayer [Fri, 21 Jun 2019 20:08:27 +0000 (22:08 +0200)]
avcodec/ffwavesynth: Fix backward lcg_seek()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/flicvideo: Fix off by 1 error in flic_decode_frame_24BPP()
Michael Niedermayer [Fri, 21 Jun 2019 21:45:36 +0000 (23:45 +0200)]
avcodec/flicvideo: Fix off by 1 error in flic_decode_frame_24BPP()

Fixes: out of array access
Fixes: 15360/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5653837190266880
Fixes: 15412/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5740537648250880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/vc1_block: Check for vlc error in vc1_decode_ac_coeff()
Michael Niedermayer [Sat, 15 Jun 2019 21:28:25 +0000 (23:28 +0200)]
avcodec/vc1_block: Check for vlc error in vc1_decode_ac_coeff()

Fixes: index -1 out of bounds for type 'const uint8_t [185][2]'
Fixes: 15250/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5648992869810176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/alac: Check lpc_quant
Michael Niedermayer [Tue, 18 Jun 2019 23:04:07 +0000 (01:04 +0200)]
avcodec/alac: Check lpc_quant

lpc_quant of 0 produces undefined behavior, thus disallow this.
If valid samples use this then such a sample would be quite
usefull to confirm the correct&lossles handling of this.

Fixes: libavcodec/alac.c:218:25: runtime error: shift exponent -1 is negative
Fixes: 15273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5656388535058432
Fixes: 15276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5761238417539072
Fixes: 15315/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5767260766994432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/dxv: Initialize tex_funct to NULL
Michael Niedermayer [Mon, 3 Jun 2019 09:22:36 +0000 (11:22 +0200)]
avcodec/dxv: Initialize tex_funct to NULL

Fixes: Various anomalies
Fixes: 14493/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5071018000908288
Fixes: 14630/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5714888963391488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agovp9_metadata: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:09 +0000 (01:45 +0200)]
vp9_metadata: Avoid allocations and copies of packet structures

This commit changes vp9_metadata to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agompeg2_metadata: Localize inserting of sequence display extensions
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:08 +0000 (01:45 +0200)]
mpeg2_metadata: Localize inserting of sequence display extensions

If a new sequence display extension had to be added, this was up until
now done at two places: One where a sequence display extension was
initialized with default values and one where the actual sequence
display extension was inserted into the fragment. This division of
labour is unnecessary and pointless; it has been changed.

Furthermore, if a sequence display extension has to be added, the
earlier code set some fields to their default value twice. This has been
changed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agompeg2_metadata: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:07 +0000 (01:45 +0200)]
mpeg2_metadata: Avoid allocations and copies of packet structures

This commit changes mpeg2_metadata to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh265_metadata: Correct error check
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:06 +0000 (01:45 +0200)]
h265_metadata: Correct error check

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh265_metadata: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:05 +0000 (01:45 +0200)]
h265_metadata: Avoid allocations and copies of packet structures

This commit changes h265_metadata to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh264_redundant_pps: Fix looping over an access unit's units
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:04 +0000 (01:45 +0200)]
h264_redundant_pps: Fix looping over an access unit's units

When looping over an access unit's units in positive direction and
deleting some of them, one needs to make sure that a unit that is at
the position of a unit that just got deleted gets checked, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh264_redundant_pps: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:03 +0000 (01:45 +0200)]
h264_redundant_pps: Avoid allocations and copies of packet structures

This commit changes h264_redundant_pps to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoav1_metadata: Error out if fragment is empty
Andreas Rheinhardt [Wed, 19 Jun 2019 23:45:00 +0000 (01:45 +0200)]
av1_metadata: Error out if fragment is empty

If the fragment is empty after parsing (i.e. it contains no OBUs), then
the check for the type of the fragment's first OBU is nonsensical; so
error out in this case just as h264_metadata and hevc_metadata do.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh264_metadata: Localize code for display orientation
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:14 +0000 (05:42 +0200)]
h264_metadata: Localize code for display orientation

The recent changes to h264_metadata (enabled by the recent changes to
ff_cbs_write_packet) made it possible to add side_data to the output
packet at any place, not only after the output packet has been written
and the properties of the input packet copied. This means that one can
now localize the code to add display orientation side-data to the packet
to the place dealing with said display-orientation.

Furthermore, the documentation of av_display_rotation_set states that
the matrix will be fully overwritten by it, so there is no need to
allocate it with av_mallocz.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoh264_metadata: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:13 +0000 (05:42 +0200)]
h264_metadata: Avoid allocations and copies of packet structures

This commit changes h264_metadata to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoav1/h264_metadata, filter_units: Count down when deleting units
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:12 +0000 (05:42 +0200)]
av1/h264_metadata, filter_units: Count down when deleting units

When testing whether a particular unit should be kept or discarded, it
is best to start at the very last unit of a fragment and count down,
because that way a unit that will eventually be deleted won't be
memmoved during earlier deletions; and frag/au->nb_units need only be
evaluated once in this case and the counter is automatically correct
when a unit got deleted.

It also works for double loops, i.e. when looping over all SEI messages
in all SEI units of an access unit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agofilter_units: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:11 +0000 (05:42 +0200)]
filter_units: Avoid allocations and copies of packet structures

This commit changes filter_units to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props (or, in case of
passthrough, to av_packet_move_ref).

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agofilter_units: Reindent after previous commit
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:10 +0000 (05:42 +0200)]
filter_units: Reindent after previous commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agofilter_units: Don't use fake loop
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:09 +0000 (05:42 +0200)]
filter_units: Don't use fake loop

According to the BSF API, when a BSF is finished with an input packet,
it should return AVERROR(EAGAIN) to signal that another packet should be
sent to the BSF via av_bsf_send_packet that the actual BSF can receive
via ff_bsf_get_packet[_ref]. filter_units on the other hand simply called
ff_bsf_get_packet again if the first packet received didn't result in
any output. This call of course returned AVERROR(EAGAIN) which was
returned, but it is nevertheless better to not include a fake loop.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agofilter_units: Unref packet on failure
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:08 +0000 (05:42 +0200)]
filter_units: Unref packet on failure

According to the API, the packet structure a bsf receives must not be
touched on failure, yet filter_units nevertheless did it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoav1_metadata: Avoid allocations and copies of packet structures
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:07 +0000 (05:42 +0200)]
av1_metadata: Avoid allocations and copies of packet structures

This commit changes av1_metadata to (a) use ff_bsf_get_packet_ref
instead of ff_bsf_get_packet (thereby avoiding one malloc and free per
filtered packet) and (b) to use only one packet structure at all,
thereby avoiding a call to av_packet_copy_props.

(b) has been made possible by the recent changes to ff_cbs_write_packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agocbs: Allow non-blank packets in ff_cbs_write_packet
Andreas Rheinhardt [Mon, 17 Jun 2019 03:42:06 +0000 (05:42 +0200)]
cbs: Allow non-blank packets in ff_cbs_write_packet

Up until now, ff_cbs_write_packet always initialized the packet
structure it received without documenting this behaviour; furthermore,
the packet's buffer would (on success) be overwritten with the new
buffer without unreferencing the old. This meant that the input packet
had to be either clean (otherwise there would be memleaks) in which case
the initialization is redundant or uninitialized. ff_cbs_write_packet
was never used with uninitialized packets, so the initialization was
redundant. Worse yet, it forced callers to use more than one packet and
made it difficult to add side-data to a packet designated for output,
because said side-data could only be attached after the call to
ff_cbs_write_packet.

This has been changed. It is now allowed to use a non-blank packet.
The currently existing buffer will be unreferenced and replaced by
the new one, as will be the accompanying fields (i.e. data and size).
The rest isn't touched at all.

This change will enable us to use only one packet in the bitstream
filters that rely on CBS.

This commit also updates the documentation of ff_cbs_write_extradata
and ff_cbs_write_packet (to better describe existing behaviour and in
the latter case to also describe the new behaviour).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/h264dec: set AVFrame decode_error_flags in case of decoding error
Amir Pauker [Fri, 21 Jun 2019 14:15:17 +0000 (07:15 -0700)]
avcodec/h264dec: set AVFrame decode_error_flags in case of decoding error

set AVFrame decode_error_flags in case h->slice_ctx->er.error_occurred is set
after the call to ff_h264_execute_decode_slices. This allows the user to detect
concealed decoding errors in the call to avcodec_receive_frame

Signed-off-by: Amir Pauker <amir@livelyvideo.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/error_resilience: set AVFrame decode_error_flags in case of decoding error
Amir Pauker [Fri, 21 Jun 2019 14:15:17 +0000 (07:15 -0700)]
avcodec/error_resilience: set AVFrame decode_error_flags in case of decoding error

Signed-off-by: Amir Pauker <amir@livelyvideo.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agolibx265: Update ROI behaviour to match documentation
Mark Thompson [Mon, 3 Jun 2019 23:19:03 +0000 (00:19 +0100)]
libx265: Update ROI behaviour to match documentation

Equivalent to the previous patch for libx264.

2 months agolibx264: Update ROI behaviour to match documentation
Mark Thompson [Mon, 3 Jun 2019 23:19:02 +0000 (00:19 +0100)]
libx264: Update ROI behaviour to match documentation

Fix the quantisation offset - use the whole range, and don't change the
offset size based on bit depth.

Iterate the list in reverse order.  The first region in the list is the one
that applies in the case of overlapping regions.

2 months agolavu/frame: Improve ROI documentation
Mark Thompson [Mon, 3 Jun 2019 23:19:01 +0000 (00:19 +0100)]
lavu/frame: Improve ROI documentation

Clarify and add examples for the behaviour of the quantisation offset,
and define how multiple ranges should be handled.

2 months agolavc/h265_profile_level: Add new profiles
Mark Thompson [Mon, 6 May 2019 21:02:23 +0000 (22:02 +0100)]
lavc/h265_profile_level: Add new profiles

Monochrome 10 and Main 10 Still Picture profiles are added by the 2018
version of the standard.

2 months agolavc/h265_profile_level: Add unit test
Mark Thompson [Mon, 6 May 2019 21:02:22 +0000 (22:02 +0100)]
lavc/h265_profile_level: Add unit test

Operates in the same way as the h264-levels test.