Commit Graph

101444 Commits

Author SHA1 Message Date
Linjie Fu 74b5564fb5 mailmap: add entry for myself
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-03-09 02:09:55 +00:00
Michael Niedermayer b4ebf483bc avcodec/dcadsp: Fix integer overflow in dmix_add_c()
Fixes: signed integer overflow: 1515225320 + 759416059 cannot be represented in type 'int'
Fixes: 29256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-5719088561258496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer 09e5e406c7 avformat/flvdec: Check double before cast in parse_keyframes_index()
Fixes: -2.21166e+304 is outside the range of representable values of type 'long'
Fixes: 29169/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5725452796821504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer bcb1e9d3b9 avformat/paf: Check for EOF before allocation in read_header()
Fixes: OOM
Fixes: 26584/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5172661183053824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer 12aca5d7b0 tools/target_dec_fuzzer: Adjust flv1 threshold
Fixes: Timeout (long -> 95ms)
Fixes: 29068/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLV_fuzzer-6509662832820224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer 633924539a avcodec/aacdec_template: Avoid undefined negation in imdct_and_windowing_eld()
Fixes: negation of -2147483648 cannot be represented in type 'INTFLOAT' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: 29057/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5642758933053440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Michael Niedermayer 1957095e80 avformat/swfdec: Check outlen before allocation
Fixes: Timeout (too long -> 241ms)
Fixes: 29083/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-6273684478230528

The source of the magic number is
A very quick simulation of the best case compression for "compress"
below is not nice written code as i did not expect I or anyone else
would ever see it again

I would have preferred some nicer expression or course, but thats
what it seems to be asymptotically. For smaller amounts of data a
tighter bound is possible but i saw no nice way to consider that
and it seems also overkill to try to do it more fine grained for
just this

main(){
    int64_t bits = 0;
    int bank = 256;
    int bitbank = 8;
    for(unsigned i = 0; i<1024*1024*1024*4U-100000;) {
        int word_size = bank-255;
        i += word_size;
        bits += bitbank;

        if (!(bank & (bank-1)))
            bitbank ++;
        bank++;
        if (bitbank > 16) {
            printf("BEST %f \n", 8.0 * i / bits );
            bank = 256;
            bitbank = 8;
        }
    }
}

above assumes i remembered correctly how the algorithm works but the
value was close to what actual compession of zeros gave

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Paul B Mahol e6ff5d0fac avcodec/mpeg4videodec: add forgotten flags to mpeg4_options 2021-03-08 19:22:21 +01:00
Florian Nouwt f067fcb9df mobiclip: fix copyright headers
The Mobiclip related code was based on Mobius (https://github.com/adibsurani/Mobius),
which was based on my original reverse engineering efforts (https://github.com/Gericom/MobiclipDecoder).
This commit adds the appropriate copyright headers on the related files.

Signed-off-by: Florian Nouwt <fnouwt2@gmail.com>
2021-03-08 19:19:19 +01:00
Andreas Rheinhardt e8c646e975 avcodec/ylc: Reindent after previous commit
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 17:37:05 +01:00
Andreas Rheinhardt d7d33c0376 avcodec/ylc: Avoid code duplication when creating and freeing VLCs
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 17:37:05 +01:00
Andreas Rheinhardt 50645e5044 avcodec/ylc: Use only one temporary buffer
The effective lifetime of the buffer used to build the VLCs and
the buffer containing the bitstream is disjoint, so that one can use
a common buffer for both.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 17:37:04 +01:00
Andreas Rheinhardt 6b48076f9d avcodec/ylc: Remove write-only variable
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 17:37:04 +01:00
Andreas Rheinhardt 7f1207cb79 avcodec/h261dec: Remove parse_context cruft
The H.261 decoder doesn't use the ParseContext of its
MpegEncContext since e731697665.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 13:25:04 +01:00
Anton Khirnov 54e5d21aca lavc: clarify thread_safe_callbacks doxy
State explicitly when this field will be removed and how to access it in
a forward compatible way.
2021-03-08 11:34:54 +01:00
Anton Khirnov 781fc06f8e lscrdec: add copyright header
As requested by the author.
2021-03-08 09:31:04 +01:00
Anton Khirnov 2644a5d418 lavc: remove tests/options
It tests deprecated avcodec_copy_context().
2021-03-08 09:29:50 +01:00
Anton Khirnov 8369a2873c tests/api-flac-test: reindent 2021-03-08 09:29:50 +01:00
Anton Khirnov f942e14884 tests/api-flac-test: convert to new encoding/decoding API 2021-03-08 09:29:50 +01:00
Anton Khirnov ba30fd6c81 tests/api-flac-test: ensure the frame is writable before writing to it
The encoder may keep a reference to frames that were sent to it, so the
caller cannot modify them without checking first.
2021-03-08 09:29:50 +01:00
Anton Khirnov 2f004b357e mjpegdec: handle lowres with AVID cropping 2021-03-08 09:29:50 +01:00
Andreas Rheinhardt e3c4e1f0c4 avcodec/jpeglsenc: Allocate buffers together
Having only one allocation that is not automatically freed in particular
means that one does not need to free the already allocated buffers
when allocating another one fails.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 05:04:04 +01:00
Andreas Rheinhardt 017baa8106 avcodec/jpeglsenc: Avoid allocation of JLSState
This state is currently allocated and freed for every packet; but it can
just be moved to the stack instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 04:54:57 +01:00
Andreas Rheinhardt 3aee27a975 avcodec/jpeglsenc: Only use one line at a time as spare buffer
ls_encode_line() encodes one line of input from left to right and
to do so it uses the values of the left, upper left, upper and upper
right pixels for prediction (i.e. the values that a decoder gets when it
decodes the already encoded part of the picture). So a simple algorithm
would use a buffer that can hold two lines, namely the current line as
well as the last line and swap the pointers to the two lines after
decoding each line. Yet if one is currently encoding the pixel with
index k of a line, one doesn't need any pixel with index < k - 1 of the
last line at all and similarly, no pixels with index >= k have been
written yet. So the overlap in the effective lifetime is pretty limited
and since the last patch (which stopped reading the upper left pixel and
instead reused the value of the upper pixel from the last iteration of
the loop) it is inexistent. Ergo one only needs one line and doesn't
need to swap the lines out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 04:28:52 +01:00
Andreas Rheinhardt fefe69c5c9 avcodec/jpeglsenc: Move check out of loop
ls_encode_line() encodes a line of input, going from left to right. In
order to calculate a predicted value it uses the left and upper-left
value of the output picture (that is, it uses how a decoder would see
the already encoded part of the picture), unless this is the very first
pixel of this line in which case one uses the first pixel of the last
(upper) line and the line before the last line. Therefore the loop
contained a check for whether this is the beginning of a new line. This
commit moves said check out of the loop by initializing these values
before the loop and by updating these values at the end of the loop
body; already read/calculated values are reused for this (the prediction
also needs the value of the upper pixel and this can be reused for the
upper left value of the next iteration of the loop).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 04:15:10 +01:00
Andreas Rheinhardt 0788a74876 avcodec/jpeglsenc: Don't modify frame we don't own
The jpegls encoder uses three buffers (as well as its state) to perform
its function: A copy of the last encoded line as a decoder would decode it,
the part of the current line that has been encoded (again, as a decoder
would decode it) and the part of the current line that is not yet encoded.

The encoder solves this by modifying the input frame as it encodes the
output (it also zero-allocates a line to serve as last line for the
first line where no preceding line exists); yet this is wrong as said
frame is not owned by the encoder, so it must not be modified (and it is
given to the encoder as const AVFrame *) without making it writable.

This patch solves this bug by allocating two lines, one for the last and
one for the currently encoded line of output (as a decoder would decode it).

Notice that the frame is only modified if the encoder is in the
non-default non-lossless mode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 03:33:27 +01:00
Andreas Rheinhardt 130d89d786 avcodec/jpeglsenc: Don't use put bits API for byte-aligned writes
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 03:33:05 +01:00
Andreas Rheinhardt 3065532a0e avcodec/codec: Update init_static_data doxygen
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:42:35 +01:00
Andreas Rheinhardt 136dd5b592 avcodec/avcodec: Don't suggest calling deprecated avcodec_register_all()
Despite avcodec_register and avcodec_register_all being deprecated,
their documentation still said that one of them has to be called
before doing anything else. Clarify this confusing situation.

Furthermore, don't use avcodec_register_all in sample code for
a non-deprecated function.

Reviewed-by: mypopy@gmail.com <mypopy@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:42:20 +01:00
Andreas Rheinhardt ea3953ad40 avformat/dashdec: Don't needlessly strdup metadata
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:25:52 +01:00
Andreas Rheinhardt 9a38e6ff97 avformat/dashdec: Remove limit on length of id
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-08 02:25:32 +01:00
James Almer b7e7813e7a avcodec/codec: add doxy to AVCodec.decode()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-07 11:21:57 -03:00
James Almer c063d556a8 avcodec/codec: use the correct name for all AVCodec.decode() parameters
This field hasn't been used to return the output frame size since
avcodec_decode_audio4() was introduced.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-07 11:21:57 -03:00
James Almer 48e715c3fd avcodec/codec: remove outdated comment about AVCodec.encode2()
The packet passed as argument to this function hasn't contained
a user-provided buffer since 93016f5d1d.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-07 11:21:57 -03:00
Andreas Rheinhardt 59c0301be9 avfilter/buffersink: Postpone removal of av_[a]buffersink_params_alloc
They have been deprecated in 61097535cd,
yet this was less than two years ago. Removing them will therefore have
to wait.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-07 15:19:10 +01:00
Andreas Rheinhardt fec3c730e6 avfilter/avfilter: Remove avfilter_link_set_closed() on bump
Deprecated in 39a09e995d.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-07 15:18:35 +01:00
Andreas Rheinhardt a7f841718f doc/muxers.texi: Readd documentation removed accidentally
Happened in e7c04eaf50.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-07 01:25:32 +01:00
Andreas Rheinhardt 9665fd31e8 avformat/http: Fix leak when using deprecated option
When the deprecated option "user-agent" was set to something different
than its default value, said option would always precede and overwrite
the ordinary user_agent option (regardless of whether it was explicitly
set) which leads to a leak of the user_agent option (which has a default
value, so the leak happens always).
Fix this by setting the same destination for both options; the last
option applied wins then.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-07 00:39:32 +01:00
Andreas Rheinhardt 2570663966 avcodec/libxvid: Remove unnecessary header
Forgotten in a1c6fc773f.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-06 13:05:42 +01:00
Paul B Mahol 17127f81c5 avfilter: add msad video filter 2021-03-06 12:42:16 +01:00
Paul B Mahol 4a69cd4e4e avfilter: add identity video filter 2021-03-06 12:41:30 +01:00
Andreas Rheinhardt dc20b27802 avcodec/parser: Schedule av_parser_change for removal
Originally deprecated in 748c2fca7e,
publically deprecated in 9a07c1332c
(merged into FFmpeg in 1885ffb03d).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-06 09:33:42 +01:00
Jan Ekström 64af14555b avformat: add TTML muxer
Enables writing TTML documents or encoded TTML paragraphs as such
documents.

Additionally, a test for the combined TTML encoder and muxer has
been added to validate that the components still work.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Jan Ekström 18713d22a2 avcodec: add TTML encoder
Enables encoding of other subtitle formats into TTML paragraphs.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Jan Ekström a0eec776b6 avcodec: enable usage of err_recognition for encoders
Enables the usage of such values as AV_EF_EXPLODE in encoders, which
can be useful in cases such as subtitle encoders where they have the
responsibility to validate the correctness of an incoming ASS dialog line.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Jan Ekström c8c6c9f5d9 ffprobe: switch to av_bprint_escape for XML escaping
Additionally update the result of the ffprobe XML writing test.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Stefano Sabatini 0f6bf94eb7 avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil
Base escaping only escapes values required for base character data
according to part 2.4 of XML, and if additional flags are added
single and double quotes can additionally be escaped in order
to handle single and double quoted attributes.

Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-03-05 19:45:00 +02:00
Andreas Rheinhardt a272f382d3 avcodec/decode: Check size before opening iconv
Avoids closing iconv when the size check fails.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-05 14:11:59 +01:00
Andreas Rheinhardt 684e501cb9 avcodec/decode: Return early upon failure
Allows to remove one level of indentation.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-05 14:11:21 +01:00
Andreas Rheinhardt 94bf3f90e9 tests/fate: Don't keep unnecessary temp files
Some FATE tests use files created by other FATE tests as input files;
this mostly affects the seek tests which use files from vsynth_lena as
well as acodec-pcm as input files. In order to make this possible the
temporary files of all the vsynth* and all acodec-pcm tests are kept.
Yet only a fraction of these files are actually used. This commit
changes this to only keep the files that are actually needed for other
tests. This reduces the size of the tests/data/fate folder after a full
FATE run from 2024727441B to 138739312B.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-05 09:24:34 +01:00