It allows to share them between frame threads.
dc11 can unfortunately not be made static without increasing
LOCALBUF_ELEMS in vlc.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This is trivial as well as beneficial because frame threads
now use the same table, saving cache/memory.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This avoids having to expose HQXContext in a header
and allows to make several symbols static.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
hqxvlc.c contains sort-of run-length VLCs in hardcoded form;
they amount to 26688 elements, taking 104KiB. These tables contain
many duplicated entries (they are partially created via a RPT_1024
macro). There are actually only 3039 different codes in all tables
combined, making this very wasteful.
This commit changes this by extracting the underlying entries
and creating a (static) RL-VLC. This only costs 3*3039 bytes
of .rodata. The resulting table needs only 15630 entries,
because our VLC init code uses smaller subtables when possible
(for an incomplete code, the negative of the length stored in
the VLC code is the number of bits the subtable uses; the hardcoded
tables uses a worst-case per table value).
Using GET_RL_VLC also gets rid of an unnecessary reload in case
a code is too long to be parsed in the first stage.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
It will simplify creating RL-VLCs (which until now used
a stack-based VLC as temporary buffer).
Notice that there would be another option to merge them, namely:
struct VLCElem {
union {
VLCBaseType sym;
int16_t level;
};
int8_t len;
uint8_t run;
};
The main difference to the current patch is that this would change
the type of the length field of VLCElem to int8_t from int16_t.
It turns out that that this would entail additional sign extensions
on ppc, see https://godbolt.org/z/behWYEYE7. I have therefore refrained
from doing so, although it would make the patch simpler.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
These fields are meant to be for encoders; just use a local
table in pcm_decode_init() to convert from AVCodecID to AVSampleFormat
and also use it to provide sample_size.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Instead use a dedicated context for the few decoders that
use the LUT. Also use a dedicated init function for them.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
All codecs here have a valid sample size at this point.
This check has (presumably) been added for DVD PCM,
but even for them the check was always-true after
381e195b46 (and the DVD
code was later moved out altogether). So just remove
this check and the leftover DVD comment.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.
This is the eamad analogue of fe9bc1cc45.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.
This is the mdec analogue of fe9bc1cc45.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
These values are only used by the mpegvideo unquantize functions,
yet these are not active when intrax is in use. Furthermore,
given that ff_intrax8_decode_picture() decodes multiple
macroblocks in a given call, it makes no sense to return
any value (that was in practice the maximum of the indices
of all the macroblocks decoded).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
It is only used by the mpegvideo unquantize functions which
this decoder does not use at all.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
dst_depth - src_depth where the result is 6 or 7 in a high bd path means this
is only executed for 16 -> 10 and 16 -> 9.
This patch makes this path general, supporting arbitrary formats as long as
dst_depth > src_depth > 8.
Signed-off-by: James Almer <jamrial@gmail.com>
If pps_single_slice_per_subpic_flag is 1,
slice_{width,height}_in_tiles are undefined and we must instead get the
dimensions of the slice by referring to the corresponding subpicture.
Signed-off-by: Frank Plowman <post@frankplowman.com>
av_frame_side_data_add() typically takes ownership of
the provided AVBufferRef reference and therefore
uses a parameter of type AVBufferRef**; yet with
the AV_FRAME_SIDE_DATA_FLAG_NEW_REF, it creates
new references instead, without touching the given
reference. Therefore it is safe to cast const away.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
utils.c is getting quite crowded, and I need a new place to dump a lot of
format handling code for the ongoing rewrite. Rather than bloating this file
even more, start splitting format handling helpers off into a new file.
This also renames the existing utils.h header, which didn't really contain
anything except the SwsFormat definition anyway (the prototypes for what should
have been in utils.h are all still in the legacy swscale_internal.h).
This also makes remap optional (which is a good idea even if we decide to keep flip fixed)
Effect on compression (using 2 rawlsb, golomb rice, large context model with ACES_OT_VWG_SampleFrames
-rw-r----- 1 michael michael 499101306 Mär 11 14:58 float-303503-try3d-m2.nut
-rw-r----- 1 michael michael 503700199 Mär 11 14:57 float-303503-try3d-m1.nut
-rw-r----- 1 michael michael 518150578 Mär 11 14:57 float-303503-try3d-m0.nut
(the test above used the rawlsb patch, which is not applied yet)
Reviewed-by: Jerome Martinez <jerome@mediaarea.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
and call it from ff_ffv1_encode_init()
setting micro version from code writing the extradata is messy, this should
be cleaner
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
It has been deconstified in 2c2dfd9149
because the FFCodec is touched in av_codec_init_static because
of its get_supported_config callback. Yet this is easily remedied:
Only call get_supported_config to set pix_fmts if the codec does
not already have it set.
This also fixes a mismatch between the declaration of ff_mjpeg_encoder
in allcodecs.c and the definition in mjpegenc.c. Said mismatch is
actually undefined behaviour.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Only two encoders (the native MPEG-1/2 ones) provide
supported_framerates and they don't implement the
get_supported_config callback. It is highly unlikely that
any codec will set supported_framerates dynamically at all,
so remove the code querying for frame rates.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
These functions check whether the AVCodec* is NULL, but this
has already been checked at a lot of places in our codebase,
so that it boils down to checking the is_decoder flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>