Commit Graph

5002 Commits

Author SHA1 Message Date
Matt Oliver
f0c0ad4455 avutil/hwcontext_d3d11va: Use secure dlopen.
dlopen contains additional security to prevent dll hijacking compared to standard LoadLibrary.
2020-02-15 23:53:54 +11:00
Lynne
e1c84856bb lavu/tx: improve 3-point fixed precision
There's just no reason not to when its so easy (albeit messy) and its also
reducing the precision of all non-power-of-two transforms that use it.
2020-02-14 19:58:14 +00:00
Lynne
223b58c74b lavu/tx: slightly optimize fft15
Saves 2 additions.
2020-02-13 17:11:30 +00:00
Lynne
a38c6f47c9 lavu/tx: undef the correct macro
It was renamed and no warning was given for undeffing a nonexisting one.
2020-02-13 17:11:30 +00:00
Lynne
e8f054b095 lavu/tx: implement 32 bit fixed point FFT and MDCT
Required minimal changes to the code so made sense to implement.
FFT and MDCT tested, the output of both was properly rounded.
Fun fact: the non-power-of-two fixed-point FFT and MDCT are the fastest ever
non-power-of-two fixed-point FFT and MDCT written.
This can replace the power of two integer MDCTs in aac and ac3 if the
MIPS optimizations are ported across.
Unfortunately the ac3 encoder uses a 16-bit fixed point forward transform,
unlike the encoder which uses a 32bit inverse transform, so some modifications
might be required there.

The 3-point FFT is somewhat less accurate than it otherwise could be,
having minor rounding errors with bigger transforms. However, this
could be improved later, and the way its currently written is the way one
would write assembly for it.
Similar rounding errors can also be found throughout the power of two FFTs
as well, though those are more difficult to correct.
Despite this, the integer transforms are more than accurate enough.
2020-02-13 17:10:34 +00:00
Michael Niedermayer
3182114f88 avutil/log: Add av_log_once() for printing a message just once with a high log level
Compared to ad-hoc if(printed) ... code this allows the user to disable
it by adjusting the log level

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-12 10:25:25 +01:00
Marton Balint
cbf2a9bfac avutil/log: add support for multibyte console log for win32
Fixes ticket #5398.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-09 20:31:44 +01:00
Marton Balint
31acaa1ec6 avutil/log: add support for forced ANSI colors on win32
To make behavior the same as non-win32 code when the standard error is
redirected. Also restructure the code a bit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-09 20:31:44 +01:00
Marton Balint
1b34c0690f avutil/log: fix detecting console mode on Win32
A redirected stderr can still have a valid handle.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-09 20:31:44 +01:00
Marton Balint
bad8feb5e6 avutil/log: factorize ansi_fputs
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-09 20:31:44 +01:00
Marton Balint
2b496c90cd avutil/log: drop support for NO_COLOR environment variable
Deprecated for more than 9 years now.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-09 20:31:44 +01:00
Lynne
d500eff3cc lavu/tx: mention FFT output is not normalized
Not even FFTW's output is normalized.
This should prevent at least some users from complaining that doing a forward
transform followed by an inverse transform has a mismatching output to the
original input.
2020-02-08 23:11:29 +00:00
Lynne
73a8c8e6e4 lavu: bump minor version for the Vulkan patchset 2020-02-04 23:49:56 +00:00
Philip Langdale
7f149b0452 lavu/hwcontext_cuda: refactor context initialisation
There's enough going on here now that it should not be duplicated
between cuda_device_create and cuda_device_derive.
2020-02-04 23:19:48 +00:00
Lynne
a88449ffb2 lavu: add Vulkan hwcontext code
This commit adds the necessary code to initialize and use a Vulkan device
within the hwcontext libavutil framework.
Currently direct mapping to VAAPI and DRM frames is functional, and
transfers to CUDA and native frames are supported.

Lets hope the future Vulkan video decode extension fits well within this
framework.
2020-02-04 23:19:48 +00:00
Philip Langdale
d7210ce7f5 lavu/hwcontext: Add support for HW -> HW transfers
We are beginning to consider scenarios where a given HW Context
may be able to transfer frames to another HW Context without
passing via system memory - this would usually be when two
contexts represent different APIs on the same device (eg: Vulkan
and CUDA).

This is modelled as a transfer, as we have today, but where both
the src and the dst are hardware frames with hw contexts. We need
to be careful to ensure the contexts are compatible - particularly,
we cannot do transfers where one of the frames has been mapped via
a derived frames context - we can only do transfers for frames that
were directly allocated by the specified context.

Additionally, as we have two hardware contexts, the transfer function
could be implemented by either (or indeed both). To handle this
uncertainty, we explicitly look for ENOSYS as an indicator to try
the transfer in the other direction before giving up.
2020-02-04 23:19:48 +00:00
Marton Balint
6026384047 avutil/common: warn about possible move of the data pointer after the last 0 byte in GET_UTF8
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-31 00:15:13 +01:00
Marton Balint
d9f5fe4ed7 avutil/common: put ERROR statements into separate code blocks in GET_UTF8/16
To be able to safely use more than one statement in ERROR.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-31 00:15:13 +01:00
Marton Balint
1466bb0bad avutil/common: add parenthesis around GET_16BIT in GET_UTF16
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-31 00:15:13 +01:00
Marton Balint
5df1c1ad9a avutil/common: use unsigned int in GET_UTF8
Right shift of signed value is implementation defined.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-31 00:15:12 +01:00
Marton Balint
1812b42554 avutil/thread: fix strict_pthread_cond_timedwait
Timeout error was assumed to be fatal which it is not.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:18 +01:00
Martin Storsjö
1001b6a750 libavutil: x86: Include stdlib.h before using _byteswap_ulong
When clang works in MSVC mode, it does have the _byteswap_ulong
builtin, but one has to include stdlib.h before using it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-23 18:30:26 +02:00
Martin Storsjö
63418e374f configure: Check for GetStdHandle in addition to SetConsoleTextAttribute
SetConsoleTextAttribute used to be unavailable for Windows Store apps,
but is available to them now. But GetStdHandle still is unavailable,
thus make sure to check for both functions before using code that
requires both.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-23 18:30:09 +02:00
Michael Niedermayer
07b3dbbbb2 avutil/log: Move log_level_offset_offset code from av_log() to v_log()
Suggested-by: Anton
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 18:41:46 +01:00
Matt Oliver
fc6fde22c3 avutil/thread: Add pthread_cond_timedwait function
v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2020-01-21 22:34:15 +01:00
Limin Wang
44a80897e8 avutil/avstring: Fix warning: ISO C90 forbids mixed declarations and code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 19:19:30 +01:00
Carl Eugen Hoyos
96fab29e96 Silence "string-plus-int" warning shown by clang.
libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
2020-01-06 22:38:56 +01:00
Jun Zhao
3c8da7b982 libavutil/opt: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 09:05:23 +08:00
Michael Niedermayer
45259a0ee4 avutil/eval: Add av_expr_count_func() similar to av_expr_count_vars()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Marton Balint
a619787a9c avutil/tests/opt: add av_opt_get/av_opt_set tests
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Marton Balint
672b925e8a avutil/tests/opt: add tests for AV_OPT_TYPE_DICT
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Marton Balint
5edacc4609 avutil/opt: add full support for AV_OPT_TYPE_DICT
Now it is possible to set them from a string, to serialize them and to use a
default value.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Marton Balint
16685114d5 avutil/buffer: add av_buffer_pool_buffer_get_opaque
In order to access the original opaque parameter of a buffer in the buffer
pool. (The buffer pool implementation overrides the normal opaque parameter but
also saves it so it is accessible).

v2: add assertion check before dereferencing the BufferPoolEntry.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Carl Eugen Hoyos
84db67894f lavu/log: Also print the log level for level trace. 2019-12-16 20:53:27 +01:00
Carl Eugen Hoyos
8b5ef2dcff lavu/pixfmt: Cosmetics, remove wrong end-of-comment markers. 2019-12-14 16:09:41 +01:00
Zhao Zhili
71fd72070c avutil/buffer: use appropriate atomic operations
No functional changes. ref/unref vs add/sub is symmetrical.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-05 20:53:52 -03:00
Oleg Dobkin
32ba563cfc avutil/hwcontext_cuda: allow using primary CUDA device context
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-11-26 16:24:40 +01:00
Michael Niedermayer
6014bcf1b7 avutil/lfg: Correct index increment type to avoid undefined behavior
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 18333/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COMFORTNOISE_fuzzer-5668481831272448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-24 22:58:59 +01:00
Gyan Doshi
1c23abc88f avutil/eval: add function to track variable use
1)Some filters allow cross-referenced expressions e.g. x=y+10. In
such cases, filters evaluate expressions multiple times for
successful evaluation of all expressions. If the expression for one or
more variables contains a RNG, the result may vary across evaluation
leading to inconsistent values across the cross-referenced expressions.

2)A related case is circular expressions e.g. x=y+10 and y=x+10 which
cannot be succesfully resolved.

3)Certain filter variables may only be applicable in specific eval modes
and lead to a failure of evaluation in other modes e.g. pts is only
relevant for frame eval mode.

At present, there is no reliable means to identify these occurrences and
thus the error messages provided are broad or inaccurate. The helper
function introduced - av_expr_count_vars - allows developers to identify
the use and count of variables in expressions and thus tailor the error
message, allow for a graceful fallback and/or decide evaluation order.
2019-11-17 11:07:05 +05:30
Zhao Zhili
20c5f4d835 avutil/frame: fix remove_side_data
remove_side_data is supposed to remove a single instance by design.
Since new_side_data() doesn't forbid add multiple instances of the
same type, remove_side_data should deal with that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-11-11 22:15:45 +01:00
Michael Niedermayer
d6fea2ef22 avutil/lfg: Document the AVLFG struct
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:10:02 +01:00
gxw
648b422e17 avcodec/mips: msa optimizations for vc1dsp
Performance of WMV3 decoding has speed up from 3.66x to 5.23x tested on 3A4000.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-30 18:09:00 +01:00
Paul B Mahol
c109dfc1b1 avutil/opt: print runtime flag too 2019-10-14 11:28:54 +02:00
Paul B Mahol
f3746d31f9 avutil/opt: add AV_OPT_FLAG_RUNTIME_PARAM flag 2019-10-14 11:28:54 +02:00
Paul B Mahol
961d6493e8 avutil/eval: add sgn() 2019-10-12 10:13:29 +02:00
Limin Wang
a77fb510c2 avutil/avstring: support input path as a null pointer or empty string
Linux and OSX systems support basename and dirname via <libgen.h>, I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.

You can get more description about the system interface by below command:
 "man 3 basename"

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-08 14:12:43 +08:00
Mengye Lv
9f353e376b avutil/common: Fix underflow for ROUNDED_DIV with unsigned integer
When used ROUNDED_DIV(a,b), if a is unsigned integer zero, it's
will lead to an underflow issue(it called unsigned integer
wrapping).

Fixes #8062

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Mengye Lv <mengyelv@tencent.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-10-06 17:28:29 +08:00
Zhong Li
0686651aab lavu/qsv: remove redundant version query
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-09-27 23:50:57 +08:00
Andreas Rheinhardt
25a501b528 avutil/opt: Fix type specifier
This bug has been introduced in 9e0a071e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-22 18:16:38 +02:00
Andreas Rheinhardt
e6018fda14 avutil/encryption_info: Don't pass NULL to memcpy
The pointer arguments to memcpy (and several other functions of the
C standard library) are not allowed to be NULL, not even when the number
of bytes to copy is zero. An AVEncryptionInitInfo's data pointer is
explicitly allowed to be NULL and yet av_encryption_init_info_add_side_data
unconditionally used it as a source pointer to copy from. This commit changes
this so that copying is only done if the number of bytes to copy is > 0.

Fixes ticket #8141 as well as a part of ticket #8150.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-20 23:26:34 +02:00