The current loop only works if the input and output have the same number
of planes. However, with the new scaling logic, we can also optimize into a
noop the case where the input has extra unneeded planes.
For the memcpy fallback to work in these cases we have to instead check if
the *output* pointer is set, rather than the input pointer.
The old limits were a bit too tightly clustered around 1.0. Make the
value range much more generous, and also introduce a new highlight
for speedups above 10.0 (order of magnitude improvement).
Fixes remaining \r\n is ASS header after 57c545090d.
Fixes AVERROR_BUG error during init as this decoder expected `\r\n` in
default ASS header. strstr(..., "\r\n[Events]\r\n") failed after changes
in 57c545090d.
Fixes ticket #11545.
Fixes: 57c545090d
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
Also return an better error code if it is set numerically.
(This option was added in 2862b63783
when an AVCodecContext generic option was moved to
a codec private one without realizing that not every
generic one is valid for every encoder.)
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Buffers are allocated inside some metadata types, so we must ensure
that the object is visible to the free function before a parse failure.
Found by libFuzzer.
Broken in 6e225123d8, because
ff_copy_bits() expects the amount of bits, not bytes to write.
And because it relies on the buffer to be padded, using
side_data->size * 8 is not possible. So partially revert
said commit.
Fixes ticket #11591.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Only the studio profile uses chroma_inter/intra matrices;
the ordinary profile has only inter/intra matrices.
And our code (namely the MPEG-2 unquantize functions)
only use these two matrices (the MPEG-2 decoder unquantizes
on its own while parsing).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
There is only one source of dirty MpegEncContexts:
update_mpvctx() (which copies an MpegEncContext
over another one in order to initialize it). So only clear
these contexts.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
When the destination MpegEncContext in ff_mpeg_update_thread_context()
is not initialized, the source MpegEncContext is simply copied
over it before (potentially) calling ff_mpv_common_init().
This leads to data races when this code is executed which is why
it should be replaced with only copying the necessary fields
(this is for future commits).
Given that the RV30 and RV40 decoders always call said function
with an already initialized MpegEncContext (they use context_reinit
in case of frame size changes), they don't need this ugly
initialization (and are therefore race-free). This means that
this code can be moved to the only decoder that actually needs it:
MPEG-4. This commit does so.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The spec indeed does not allow the aspect ratio to change
within a video sequence, but this does not imply that we
must reinitialize the decoder if only the aspect ratio changes,
as this value does not affect the decoding process at all.
Moreover, our reinitialization is a bit buggy: If there is
frame reordering, then the not yet output next P-frame is
simply discarded upon reinit. With this patch this no longer
happens when only the aspect ratio changes.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>