Commit Graph

109746 Commits

Author SHA1 Message Date
Anton Khirnov f566032bfd lavc/decode: validate frames output by decoders
Make sure no frames with invalid parameters will be seen by the caller.
2023-01-10 11:47:29 +01:00
Anton Khirnov a1eec66867 lavc/decode: deduplicate cleanup in ff_decode_receive_frame() 2023-01-10 11:47:29 +01:00
Anton Khirnov 5bf8f29135 lavc/qsvdec: check ff_decode_frame_props() return value 2023-01-10 11:47:29 +01:00
Anton Khirnov 3dc7a9f623 lavc/ac3dec: fail when the sample rate is unset 2023-01-10 11:47:29 +01:00
Derek Buitenhuis 94aa70d757 avformat: Rename IPFS to IPFS gateway
It is a URL rewriter for IPFS gateways, not an actual implementation of
IPFS, and naming it as such was both incorrect and misleading.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2023-01-09 12:14:47 -05:00
Paul B Mahol 5d3f0226ad avfilter/avf_avectorscope: add anti-aliased line drawing mode 2023-01-09 18:07:05 +01:00
Derek Buitenhuis dae3679a9b mov: Disable advanced_editlist for fragmented MP4 input
Advanced edit list support is entirely broken for fragmented MP4s,
currently. mov_fix_index is never run in mov_build_index, since
in fragmented MP4s the stco, stsz, stts, and stsc boxes have zero
entries, with the index being filled in as each fragment's trun
box is seen.

The result of this is that the skip samples is never set properly,
since half the code thinks it doesn't need to, as advanced_editlist
is enabled, but as mov_fix_index is never called, it doesnt get set.
This means that any edits for e.g. priming are not properly applied
as skip samples side data.

This also means remuxing to fragmented MP4 from progressive MP4 with
lavf will quietly drop the edit list, currently.

Example:

    $ ffmpeg -loglevel quiet -advanced_editlist 1 -i non_fragmented.mp4 -f md5 -
    MD5=d02d929f8eb4edef624758a298d5f7c6
    $ ffmpeg -loglevel quiet -advanced_editlist 0 -i non_fragmented.mp4 -f md5 -
    MD5=d02d929f8eb4edef624758a298d5f7c6
    $ ffmpeg -loglevel quiet -advanced_editlist 1 -i fragmented.mp4 -f md5 -
    MD5=e38b110f586fa886ff94e0ca98a95d59 <-- wrong, extra samples are output instead of being skipped
    $ ffmpeg -loglevel quiet -advanced_editlist 0 -i fragmented.mp4 -f md5 -
    MD5=d02d929f8eb4edef624758a298d5f7c6

We cannot call mov_fix_index after reading a trun box
since mov_fix_index seems to assume it is only called once, on a
fully complete index, an multiple calls to it don't seem like
they'd work, so the "best" option seems to be disabling advanced
edit list support entirely for the time being, as it is broken
for these types of files.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2023-01-09 15:23:41 +00:00
Wenbin Chen 13d04e30d7 libavcodec/qsvenc_av1: Add max_frame_size support to av1_qsv encoder
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-01-09 13:56:03 +08:00
Wenbin Chen c8e73558fe libavcodec/qsvenc_av1: Add low_delay_brc support to av1_qsv encoder
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-01-09 13:56:03 +08:00
Zhao Zhili a598be44df avcodec/mediacodecenc: enable B frames only with -strict experimental
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-09 19:21:57 +08:00
Anton Khirnov fcd557a2c2 lavc/get_bits: add a compat wrapper for the cached bitstream reader
Use that instead of the merged version.
2023-01-06 11:04:10 +01:00
Anton Khirnov b6742259bf lavc/tests: add a cached bitstream reader test 2023-01-06 11:01:00 +01:00
Anton Khirnov 9177970bca lavc/bitstream: templatize for BE/LE
Allows using both BE and LE bitstream readers in the same file.
2023-01-06 10:49:42 +01:00
Alexandra Hájková 8fe551eca0 lavc: add standalone cached bitstream reader
The cached bitstream reader was originally written by Alexandra Hájková
for Libav, with significant input from Kostya Shishkov and Luca Barbato.
It was then committed to FFmpeg in ca079b0954, by merging it with the
implementation of the current bitstream reader.

This merge makes the code of get_bits.h significantly harder to read,
since it now contains two different bitstream readers interleaved with
 #ifdefs. Additionally, the code was committed without proper authorship
attribution.

This commit re-adds the cached bitstream reader as a standalone header,
as it was originally developed. It will be made useful in following
commits.

Integration by Anton Khirnov.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-01-06 10:48:56 +01:00
Aman Karmani 4b2b9a6604 avcodec/mpeg12dec: flush a53 data
Signed-off-by: Aman Karmani <aman@tmm1.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-01-06 10:47:53 +01:00
James Almer 4a80db5fc2 avcodec/mpeg12dec: use init_get_bits8 and check the return value in all remaining cases
Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-04 20:48:06 -03:00
Thierry Foucu efbe84eb1b avcodec/mpeg12dec: use init_get_bits8 and check the return value
Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-04 16:18:21 -03:00
Paul B Mahol 99bd2dbc91 swresample/swresample_frame: fix regression in detecting changes
Do not overwrite return variable values, instead use different
one for checking results.
2023-01-04 18:19:07 +01:00
Anton Khirnov a0b5aaceca lavc/libx265: restructure handling reordered_opaque
Current code stores a pointer to allocated data in libx265 and frees it
when the encoded packet is retrieved. This will leak if the packet is
never retrieved, e.g. if the encoder is closed without being flushed.

Restructure the code such that only indices to an array stored in our
private data are given to libx265. This ensures no allocated memory can
be lost.
2023-01-04 11:48:17 +01:00
Anton Khirnov 7399e5305c lavc/libx264: do not leave an invalid array size on alloc error 2023-01-04 11:48:17 +01:00
Anton Khirnov a4a81be1a8 lavc/libx264: zero reordered opaque on alloc
This is safer.
2023-01-04 11:48:17 +01:00
Anton Khirnov 141303f323 lavc/libx264: print an error on invalid opaque pointer 2023-01-04 11:48:17 +01:00
Anton Khirnov 89761c2122 lavc/libx264: use a local variable to shorten code 2023-01-04 11:48:17 +01:00
Anton Khirnov 4469ce10a6 lavc/libx264: reindent after previous commit 2023-01-04 11:48:17 +01:00
Anton Khirnov 9ed5b0ac3b lavc/libx264: reorder control flow in setup_roi() to reduce nesting depth 2023-01-04 11:48:17 +01:00
Anton Khirnov ce5b2d34b4 lavc/libx264: reindent after previous commit 2023-01-04 11:48:17 +01:00
Anton Khirnov e17b609fc6 lavc/libx264: do not ignore memory allocation errors 2023-01-04 11:48:17 +01:00
Anton Khirnov cccd2c2179 lavc/libx264: unify cleanup in setup_frame() 2023-01-04 11:48:17 +01:00
Anton Khirnov 87eb362693 lavc/libx264: reindent after previous commit 2023-01-04 11:48:17 +01:00
Anton Khirnov b1a184283b lavc/libx264: factor out setting up ROI 2023-01-04 11:48:17 +01:00
Anton Khirnov c7a8a6939b lavc/libx264: use a local variable for input frame in setup_frame() 2023-01-04 11:48:17 +01:00
Anton Khirnov 9f8f980165 lavc/libx264: reindent after previous commit 2023-01-04 11:48:17 +01:00
Anton Khirnov 33cbba165c lavc/libx264: factor out setting up the input frame
X264_frame() is currently too large and complex.
2023-01-04 11:48:17 +01:00
James Almer a781279871 avformat/oggenc: don't flush twice when the last packet is side data only
Commit 18f24527eb accidentally made side data only packets be handled like a
flush request. Fix this regression by effectively ignoring them as was the
original intention.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-03 21:35:03 -03:00
James Almer 99e3d26f20 avformat/mux: use only valid timestamps when calculating packet distance
Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long int'
Fixes: fate-cover-art-aiff-id3v2-remux, fate-cover-art-mp3-id3v2-remux and fate-mov-cover-image
under ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-03 21:35:03 -03:00
Clément Bœsch 6e05622216 avfilter/paletteuse: use explicit key indexes in set_frame_lut 2023-01-03 17:29:13 +01:00
Clément Bœsch 68275043a0 avfilter/paletteuse: add atkinson dithering
Atkinson according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

        *   1   1    / 8
    1   1   1
        1
2023-01-03 17:29:13 +01:00
Clément Bœsch c973e8ae79 avfilter/paletteuse: add burkes dithering
Burkes according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

          *  8  4
    2  4  8  4  2   / 32
2023-01-03 17:29:13 +01:00
Clément Bœsch 9973343bf9 avfilter/paletteuse: add sierra3 dithering
Sierra3 according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

          *  5  3
    2  4  5  4  2
       2  3  2      / 32
2023-01-03 17:29:13 +01:00
Clément Bœsch 11926c4bd4 avfilter/palette{gen,use}: misc for-loop cosmetics 2023-01-03 17:18:56 +01:00
Clément Bœsch 1340fe7caf avfilter/paletteuse: move r,g,b computation in a more local scope 2023-01-03 17:18:55 +01:00
Clément Bœsch 1ae1b707e2 avfilter/paletteuse: remove mean error tool
This belongs in another filter.
2023-01-03 17:18:55 +01:00
Clément Bœsch 8789a9e05b avfilter/paletteuse: remove alternative search methods
This is a maintenance pain more than anything. It appears to make the
code slightly faster as a side effect.
2023-01-03 17:18:55 +01:00
Clément Bœsch 0f7942afa6 avfilter/paletteuse: switch to recursive method
It appears faster than the iterative method on my machine (1.06x
faster), so I'm guessing compilers improved over time (the iterative
version was slightly faster in the past).
2023-01-03 17:18:55 +01:00
Clément Bœsch 6c7b54e962 avfilter/paletteuse: use lowbias32 for color hashing
Impact is more negligible than previous commit but still faster (1.02x).
2023-01-03 17:18:55 +01:00
Clément Bœsch c9084cd0e2 avfilter/palettegen: use lowbias32 for color hashing
1.12x faster overall in palettegen on my machine.
2023-01-03 17:18:55 +01:00
Clément Bœsch 3cafbdc083 avfilter/palette: add lowbias32 hashing 2023-01-03 17:18:55 +01:00
Clément Bœsch 051926868c avfilter/palette{gen,use}: update Copyright after recent changes 2023-01-03 17:18:55 +01:00
Clément Bœsch 3a4a6c7815 avfilter/palettegen: use libc qsort
Now that the sort function is deterministic, we can rely on the libc
sorting function.
2023-01-03 17:18:55 +01:00
Clément Bœsch 8057e1a618 avfilter/palettegen: make refs order deterministic
Currently, in case of equality on the first color channel, the order of
the ref colors is defined by the hashing function. This commit makes the
sorting deterministic and improve the hierarchical ordering.
2023-01-03 17:18:55 +01:00