1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 06:01:30 +02:00
Commit Graph

32 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt
d4a4a6747d avcodec/sheervideo: Simplify creating VLC table
ff_init_vlc_from_lengths() can be used to offload the computation
of the codes; it also needn't check whether the codes are already
properly ordered (they are).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:46 +01:00
Andreas Rheinhardt
e74621b0a8 avcodec/sheervideo: Add av_cold to build_vlc()
It is an init function even when called from decode_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
8227f60fee avcodec/sheervideo: Avoid code duplication when creating VLC tables
The SheerVideo decoder uses two VLC tables and these are in turn created
from structures (called SheerTable) that are naturally paired. This
commit unifies these pairs of SheerTables to arrays and unifies creating
the VLC tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-10 20:59:05 +02:00
Andreas Rheinhardt
d3f35224a9 avcodec/sheervideo: Reduce the size of static arrays
The SheerVideo decoder uses VLC tables which are currently stored in
large arrays that contain the length of each leaf of the corresponding
tree from left to right, taking 15.5KB of space. But all these arrays
follow a common pattern: First the entries are ascending and then they
are descending with lots of successive entries have the same value.
Therefore it makes sense to use a run-length encoding to store them, as
this commit does. Notice that the length 16 has to be treated specially
because there are arrays with more than 256 consecutive entries with
value 16 and because the length of the entries start to descend from
this length onward.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-10 20:54:06 +02:00
Andreas Rheinhardt
8969b9aa06 avcodec/sheervideo: Don't leave context in inconsistent state upon error
This has happened if the format changed midstream and if the new packet
is so small that it is instantaneously rejected: In this case the VLC
tables were for the new format, although the context says that they are
still the ones for the old format. It can also happen if the format
changed midstream and the allocation of the new tables fails. If the
next packet is a packet for the old format, the decoder thinks it
already has the correct VLC tables, leading to a segfault.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-10 20:49:26 +02:00
Andreas Rheinhardt
07185f331e avcodec/sheervideo: Inline compile-time constants
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-10 15:37:54 +02:00
Andreas Rheinhardt
1bff2f3d92 avcodec/sheervideo: Improve creating VLC tables
Don't needlessly copy an array around; don't create a table with
default symbols; and use smaller types to save stack space: The longest
code here is 16 bits, so one can store the codes in this type.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-10 15:37:25 +02:00
Paul B Mahol
04d335e436 avcodec/sheervideo: use cached bitstream reader except for x32 2020-08-31 20:10:24 +02:00
Paul B Mahol
f95dac666c avcodec/sheervideo: reduce size of vlc tables to normal values 2020-08-12 10:17:01 +02:00
Anton Khirnov
1f4cf92cfb pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
  other threads
- a "fixup" function is called for all the other threads to e.g.
  allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
2020-04-10 15:24:54 +02:00
Paul B Mahol
be3a051ca8 avcodec/sheervideo: move tables to own header
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-03 17:28:16 +02:00
Michael Niedermayer
d8030c14bd avcodec/sheervideo: Check input buffer size before allocating and decoding
Fixes: Timeout
Fixes: 1858/clusterfuzz-testcase-minimized-6450473802399744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-28 13:32:12 +02:00
Clément Bœsch
67e370ee52 lavc: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
Carl Eugen Hoyos
46082c2b3f lavc/sheervideo: Fix Y prediction for interlaced frames with transparency.
Based on 260de8a2 by Paul B Mahol.
Fixes ticket #6210.
2017-03-02 18:11:57 +01:00
Carl Eugen Hoyos
c0e2846dcd lavc/sheervideo: Increase av_get_codec_tag_string() input buffer size.
A size of 32 is typically used.
2016-10-20 09:55:52 +02:00
Paul B Mahol
6216b4780b avcodec/sheervideo: print internal format in debug log
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-18 18:49:15 +02:00
Paul B Mahol
260de8a264 avcodec/sheervideo: fix Y prediction in decode_ybr(i) for older formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-18 18:49:14 +02:00
Paul B Mahol
dccea0ed0d avcodec/sheervideo: fix YbYr format decoding
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-23 12:59:20 +02:00
Paul B Mahol
6098d4b8a8 avcodec/sheervideo: check build_vlc for failure
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-16 23:05:30 +02:00
Paul B Mahol
1a57b464cf avcodec/sheervideo: add 10-bit interlaced RGB(A) support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-12 12:35:05 +02:00
Paul B Mahol
9e9286e9ed avcodec/sheervideo: add support for 10-bit interlaced YCbCr(A) 4:2:2
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-10 17:17:12 +02:00
Paul B Mahol
f0e7b06453 avcodec/sheervideo: fix argx format support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-10 17:17:12 +02:00
Paul B Mahol
2ed8baa614 avcodec/sheervideo: add support for 10-bit interlaced YCbCr(A) 4:4:4(:4)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-10 11:26:18 +02:00
Paul B Mahol
c156420bce avcodec/sheervideo: fix prediction for ybyr format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-10 09:52:38 +02:00
Paul B Mahol
0a9e781b88 avcodec/sheervideo: fix predictions for c82p format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-10 00:25:36 +02:00
Paul B Mahol
0c7fa152b9 avcodec/sheervideo: supports some other 8bit formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-09 15:30:27 +02:00
Paul B Mahol
e826ceeb55 avcodec/sheervideo: add interlaced YCbCr(A) 4:2:2:4 8-bit support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-09 13:17:38 +02:00
Paul B Mahol
131cb675cf avcodec/sheervideo: add interlaced YCbCr(A) 4:4:4:4 8-bit support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-09 10:23:02 +02:00
Paul B Mahol
c206a32435 avcodec/sheervideo: fix order of operations for raw lines
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-07 23:14:07 +02:00
Paul B Mahol
60bac785c3 avcodec/sheervideo: add support for 8-bit interlaced (A)RGB
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-07 22:47:12 +02:00
Paul B Mahol
fdf832a986 avcodec: add BitJazz SheerVideo decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-07 21:38:49 +02:00