movenc: Add a flag for indicating a discontinuous fragment

This allows creating a later mp4 fragment without sequentially
writing the earlier ones before (when called from a segmenter).

Normally when writing a fragmented mp4 file sequentially, the
first timestamps of a fragment are adjusted to match the
end of the previous fragment, to make sure the timestamp is the
same, even if it is calculated as the sum of previous fragment
durations. (And for the first packet in a file, the offset of
the first packet is written using an edit list.)

When writing an individual mp4 fragment discontinuously like this
(with potentially writing the earlier fragments separately later),
there's a risk of getting a gap in the timeline if the duration
field of the last packet in the previous fragment doesn't match up
with the start time of the next fragment.

Using this requires setting -avoid_negative_ts make_non_negative
(or -avoid_negative_ts 0).

Signed-off-by: Martin Storsjö <martin@martin.st>
movenc: Expose the fragment index as an avoption

This allows setting the right fragment number if doing
random-access writing of fragments, and also allows reading the
current sequence number.

Signed-off-by: Martin Storsjö <martin@martin.st>
Merge commit 'ee37620b6ae4783cda637408422044b2d14a688c'

* commit 'ee37620b6ae4783cda637408422044b2d14a688c':
  movenc: Add a flag for indicating a discontinuous fragment

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '234fb81e3145e9c9aec4ec16266676fab7dc21fa'

* commit '234fb81e3145e9c9aec4ec16266676fab7dc21fa':
  movenc: Expose the fragment index as an avoption

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avformat/apngdec: use packet pts and duration instead of altering stream framerate.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pngdec: Check IHDR/IDAT order

Fixes out of array access
Fixes: asan_heap-oob_20a6c26_2690_cov_3434532168_mail.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pngdec: Fix paeth prediction with small images

Fixes out of array read
Fixes: asan_heap-oob_20b0a06_1962_cov_1907976991_delete_node_small.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mov: Fix memleaks for duplicate STCO/CO64/STSC atoms

Also see [FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations
which contains more fixes but is unfinished

Fixes: signal_sigabrt_7ffff6ac7bb9_3484_cov_1830000177_starfox2.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/rawdec: Check the return code of avpicture_get_size()

Fixes out of array access
Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
v210enc: Add SIMD optimised 8-bit and 10-bit encoders

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avfilter/signalstats: fix different buffers for out frame if burn is enabled

This was the original intend.
avfilter/signalstats: remove pointless sub filter init system
avfilter/signalstats: integrate height loop into subfilters
avfilter/signalstats: reindent after previous commit
avfilter/signalstats: fix repitition/repetition typo
avfilter/signalstats: add slice threading for subfilters
avfilter/signalstats: isolate sat hue computation metrics in a function

This will be useful for the following commit
avfilter/signalstats: add threading in compute_sat_hue_metrics
avfilter/signalstats: localize a few variables
avfilter/signalstats: re-use yuv/yuvu/yuvv vars in diff