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 c13e490dce:
"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>
Used with trellis; notice that inter_matrix is unused for
(intra-only) SpeedHQ, so it is irrelevant that its value changes.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Also start factoring the matrix-init code out into a function
of its own to declutter ff_mpv_encode_init().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
It currently does two things: a) Get a prediction for the dc
and the dc direction and b) process said prediction. Processing
the prediction differs for encoding (getting a diff) and decoding
(getting the level via diff+prediction). So having a common function
performing b) makes no sense.
Even worse, there is a decoding mode where the dc coefficient (diff)
is not coded specially and therefore unavailable before entering
the block decoding loop, so that one can only perform a). Before
this commit, the decoder simply called ff_mpeg4_pred_dc() twice;
the results of the b) part of the call before the loop were ignored
(but the compiler could not elide them because they involved error
messages) and a) was also performed twice.
This commit changes this by splitting b) out of ff_mpeg4_pred_dc()
and moving this code to decoder and encoder.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The scantables are unused for the parser (and in fact
the IDCT permutation used has not been initialized at all).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(To perform this optimization a compiler would have to look
at both ff_rv_decode_dc() and av_log(). The latter seems very
unlikely.)
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
h263_aic is always zero for FLV and ff_mpeg1_dc_scale_table
is already the default dc_scale table for both y and c.
h263_aic is also always zero for the FLV decoder.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
They only do it for the mv_penalty table. Factor initializating
the static tables out into a function of its own; also move
everything not needed by SVQ1 or Snow behind #if CONFIG_H263_ENCODER
(this involved moving ff_h263_encode_motion() which is used
by svq1enc).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
MPEG-1/2 and the H.263-based encoders overwrite the default later
and SpeedHQ and MJPEG-based encoders are intra-only and don't
need a mv_penalty table at all. So only H.261 uses this table.
Also add a comment to explain why it exists and is non-const.
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>