Using VDPAU correctly means checking for preemption
and possibly regenerating the context all the time.
With the current API there is no context or other
user-defined pointer and thus this in not possible
during decoding unless using some hack like global
variables.
The need to reinitialize both surfaces and even function
pointers makes handling preemption even more difficult.
This patch introduces a new render2 function that gets
both the AVCodecContext and AVFrame in addition,
in both the user can store additional opaque data.
This allows even advanced approaches like keeping a
"generation counter" for the surfaces so they can be
regenerated on the fly and efficiently.
In addition, the function has a return value that will
be passed through all the way instead of being silently
ignored as for the current render function.
Unfortunately the HWAccel API has no way of providing
API/ABI compatibility, so a currently disallowed
state (render pointer being NULL) is used to extend it.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.
This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.
On systems not using msvcrt, the function is not duplicated.
Signed-off-by: Martin Storsjö <martin@martin.st>
Such buffers are not malloced thus freeing would be bad.
Note though this condition never could have happened so this
is more for correctness sake and not a true bugfix
Fixes CID1061047
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Before After
Mean StdDev Mean StdDev Change
This function 508.8 23.4 185.4 9.0 +174.4%
Overall 3068.5 31.7 2752.1 29.4 +11.5%
In combination with the preceding patch:
Before After
Mean StdDev Mean StdDev Change
Overall 2925.6 26.2 2752.1 29.4 +6.3%
Signed-off-by: Martin Storsjö <martin@martin.st>
This performs the start code search which was previously part of
h264_find_frame_end() - the most CPU intensive part of the function.
By itself, this results in a performance regression:
Before After
Mean StdDev Mean StdDev Change
Overall time 2925.6 26.2 3068.5 31.7 -4.7%
but this can more than be made up for by platform-optimised
implementations of the function.
Signed-off-by: Martin Storsjö <martin@martin.st>
Each AVStream struct for an H.264 elementary stream actually has two
copies of the H264DSPContext struct (and in fact all the other members
of H264Context as well):
((H264Context *) ((AVStream *)st)->codec->priv_data)->h264dsp
((H264Context *) ((AVStream *)st)->parser->priv_data)->h264dsp
but only the first of these was actually being initialised. This
prevented the addition of platform-specific implementations of
parser-related functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
Prevent build failure for applicatins using the old API
This could be replaced be a include of version.h but some applications
would then need extern C wrapers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The options table is used in tools built by the host compiler and the
deprecation macros pull in bits that are not safe to use if host and
target compiler differ.
This is required for the future addition of VoxWare MetaSound decoder, for its
functions are mostly the same but bitstream reader is completely different
and bitstream format is slightly different too.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
The common case of the pointer having increased by one packet (which results
in no change to the modulus) can be detected with a 64-bit subtraction,
which is far cheaper than a division on many platforms.
Before After
Mean StdDev Mean StdDev Change
Divisions 248.3 8.8 51.5 7.4 +381.7%
Overall 2773.2 25.6 2372.5 43.1 +16.9%
Signed-off-by: Martin Storsjö <martin@martin.st>