The return value of ff_draw_init and ff_draw_init2 are not checked in
most usages. However, if they return an error, they don't get to the
point where they set the attributes of the FFDrawContext. These
functions are typically used in conjunction with ff_draw_color, which
checks draw->desc->flags, causing a null pointer dereference.
Signed-off-by: Nil Fons Miret <nilf@netflix.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This patch refactors the CUDA import code to allow for Vulkan images
with multiple planes to be mapped.
Currently, a driver bug exists which causes NV12 images to be mapped
incorrectly when the memory being mapped contains both planes, the
issue has been reported to NVIDIA.
yuv420p does work correctly, however.
This is still an improvement, as the code used to crash when trying to
map the memory, unless disable_multiplane=1 was given as an option.
When using a 64bit PutBitContext (i.e. on x64), put_bits_no_assert()
can naturally write up to 63 bits. So one can avoid treating the
cases <32bits, 32 bits and <63 bits differently.
As it turns out, no user actually wants to write 64 bit at once
(maybe except testprograms).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The earlier code used a loop to determine the number of bits used
and called ff_log2() on a power of two (and it would be easy to
keep track of the exponent of said power-of-two); neither GCC nor
Clang optimized the loop away or avoided the ff_log2().
This patch replaces the loop and the log2 with a single av_log2().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Unused since aea4d4b423c62aecf326ef3ae1578710faa3eca6.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
We normally don't need else statements here; the common pattern
is to assign lower level SIMD implementations first, then
conditionally reassign higher level ones afterwards, if supported.
Signed-off-by: Martin Storsjö <martin@martin.st>
The aim of this is twofold: a) Clang warns when setting a deprecated
field in a definition and because several of the widely set
AVCodec fields are deprecated, one gets several hundred warnings
from Clang for an ordinary build. Yet fortunately Clang (unlike GCC)
allows to disable deprecation warnings inside a definition, so
that one can create simple macros to set these fields that also suppress
deprecation warnings for Clang. This has already been done in
fdff1b9cbfd8cf5a9810c29efa4baf13a4786742 for AVCodec.channel_layouts.
b) Using macros will allow to easily migrate these fields to internal ones.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
where appropriate. Avoids including ff_vp8_decode_frame()
when the VP8 decoder is disabled.
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
While just at it, also move the init functions inside
the #if CONFIG_VP?_DECODER (to avoid linking failures).
While just at it, also declare these init functions
as av_cold and uninline the remaining common init function.
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
When pps_num_exp_slices_in_tile[i] is nonzero, the ith tile is made up
of pps_num_exp_slices_in_tile[i] slices stacked atop one another, where
the height of the jth slice in the ith tile is given by
pps_exp_slice_height_in_ctus_minus1[i][j]. The sum of the heights of
the slices in the tile should not exceed the height of the tile itself.
Signed-off-by: Frank Plowman <post@frankplowman.com>
It comes from a time before frames were refcounted; it has indeed been
added in a follow-up commit to c13e490dce1a66d79e1f053d8a38fb9b2eb53267:
"codec_release_buffer: fix handling of non user buffers". This type
of check is obsolete now.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This improves compression by 0.1% overall and 44% for the changed table
I tried several other things but so far this is the best
compromise between complexity and compression
This can also be extended to 32 and 64bit floats
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This allows switching it on conditionally and also for non float,
it may improve compression for RGB data that was paletted
or other synthetic images
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
float16 (and more so float32) have many odd values
half the values are negative, many are larger than "1.0"
and many values are very close to 0.
Storing the 16bits as is, looses compression because of the mixture
of dense and sparse regions and also many completely unused ones.
This simply remaps the 65536 values so no unused values remain
This improves compression by about 1.5% for the ACES_OT_VWG_SampleFrames testset
(this testset contains all kind of funny values including many images
with negative rgb values)
The space needed for the map is insignificant compared to the
compression gained
This patch also flips half the float range as it can be done
using the same table.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Don't error out, just ignore unknown codec numbers and pretend
decode succeeded. This is useful for older LucasArts titles
which stack a lot of different FOBJs with different codecs into
a single frame.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Otherwise it is possible for av_log() to receive a non-NULL object
with a NULL AVClass pointer; the default log callback handles it
gracefully, yet this is probably an API violation.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
While it is save for these codecs (they all have private contexts),
it is customary to always use the AVCodecContext for logging.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The logging functions here can be reached by codecs without
private class, so that the log callback will receive a non-NULL
object whose AVClass pointer is NULL. Although the default log
callback handles this gracefully, it is probably an API violation.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Said parent is shared between all slice contexts and encode_block()
can be run concurrently by slice threads, so the parent context
must not be (and is not) modified. So constify the pointers.
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Both these options are unsupported and silently ignored for AMV;
so it is better to not offer them at all.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
It is an extremely simple function that is only called once,
so it should be inlined.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Also only allocate them when they are needed (namely iff
adaptive quant is true) and allocate them jointly.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>