Commit Graph

4922 Commits

Author SHA1 Message Date
Mark Thompson
d2141a9b65 hwcontext_vaapi: Add option to specify connection type
Can be set to "drm" or "x11" to force a specific connection type.
2019-06-02 22:58:22 +01:00
Steven Liu
76ef18fd39 avutil/dynarry.h: fix comment grammar mistakes of FF_DYNARRAY_ADD
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-06-01 17:43:48 +08:00
Ruiling Song
65646db8e8 avutil/tx: should check against (*ctx)
ctx is a pointer to pointer here.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-05-16 18:25:31 -03:00
Lynne
6044534964 avutil/tx: fix forward compound non-mod-15 based MDCTs
There was a hardcoded value left. Wasn't caught earlier as no code uses
compound forward mod-3/5 MDCTs yet.
2019-05-16 17:31:53 +01:00
Lynne
87ee9d580c lavu: bump minor and update APIchanges for the new transform API 2019-05-16 00:02:15 +01:00
Lynne
b79b29ddb1 libavutil: add an FFT & MDCT implementation
This commit adds a new API to libavutil to allow for arbitrary transformations
on various types of data.
This is a partly new implementation, with the power of two transforms taken
from libavcodec/fft_template, the 5 and 15-point FFT taken from mdct15, while
the 3-point FFT was written from scratch.
The (i)mdct folding code is taken from mdct15 as well, as the mdct_template
code was somewhat old, messy and not easy to separate.

A notable feature of this implementation is that it allows for 3xM and 5xM
based transforms, where M is a power of two, e.g. 384, 640, 768, 1280, etc.
AC-4 uses 3xM transforms while Siren uses 5xM transforms, so the code will
allow for decoding of such streams.
A non-exaustive list of supported sizes:
4, 8, 12, 16, 20, 24, 32, 40, 48, 60, 64, 80, 96, 120, 128, 160, 192, 240,
256, 320, 384, 480, 512, 640, 768, 960, 1024, 1280, 1536, 1920, 2048, 2560...

The API was designed such that it allows for not only 1D transforms but also
2D transforms of certain block sizes. This was partly on accident as the stride
argument is required for Opus MDCTs, but can be used in the context of a 2D
transform as well.
Also, various data types would be implemented eventually as well, such as
"double" and "int32_t".

Some performance comparisons with libfftw3f (SIMD disabled for both):
120:
  22353 decicycles in     fftwf_execute,     1024 runs,      0 skips
  21836 decicycles in compound_fft_15x8,     1024 runs,      0 skips

128:
  22003 decicycles in       fftwf_execute,   1024 runs,      0 skips
  23132 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

384:
  75939 decicycles in      fftwf_execute,    1024 runs,      0 skips
  73973 decicycles in compound_fft_3x128,    1024 runs,      0 skips

640:
 104354 decicycles in       fftwf_execute,   1024 runs,      0 skips
 149518 decicycles in compound_fft_5x128,    1024 runs,      0 skips

768:
 109323 decicycles in      fftwf_execute,    1024 runs,      0 skips
 164096 decicycles in compound_fft_3x256,    1024 runs,      0 skips

960:
 186210 decicycles in      fftwf_execute,    1024 runs,      0 skips
 215256 decicycles in compound_fft_15x64,    1024 runs,      0 skips

1024:
 163464 decicycles in       fftwf_execute,   1024 runs,      0 skips
 199686 decicycles in monolithic_fft_ptwo,   1024 runs,      0 skips

With SIMD we should be faster than fftw for 15xM transforms as our fft15 SIMD
is around 2x faster than theirs, even if our ptwo SIMD is slightly slower.

The goal is to remove the libavcodec/mdct15 code and deprecate the
libavcodec/avfft interface once aarch64 and x86 SIMD code has been ported.
New code throughout the project should use this API.

The implementation passes fate when used in Opus, AAC and Vorbis, and the output
is identical with ATRAC9 as well.
2019-05-15 17:39:59 +01:00
Philip Langdale
5de4f1d871 avutil: Add NV24 and NV42 pixel formats
These are the 4:4:4 variants of the semi-planar NV12/NV21 formats.

These formats are not used much, so we've never had a reason to add
them until now. VDPAU recently added support HEVC 4:4:4 content
and when you use the OpenGL interop, the returned surfaces are in
NV24 format, so we need the pixel format for media players, even
if there's no direct use within ffmpeg.

Separately, there are apparently webcams that use NV24, but I've
never seen one.
2019-05-12 07:51:02 -07:00
ManojGuptaBonda
d617d54efa avutil/hwcontext_vdpau: Map 444 pix fmts to new VdpYCbCr types
New VdpYCbCr Formats VDP_YCBCR_FORMAT_Y_U_V_444 and,
VDP_YCBCR_FORMAT_Y_UV_444 have been added in VDPAU with libvdpau-1.2
to be used in get/putbits for YUV 4:4:4 surfaces. Earlier mapping of
AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_YV12 is not valid.

Hence this Change maps AV_PIX_FMT_YUV444P to VDP_YCBCR_FORMAT_Y_U_V_444
to access the YUV 4:4:4 surface via read-back API's of VDPAU.
2019-05-05 11:35:35 -07:00
James Almer
e427ba5c68 Merge commit 'c4642788e83b0858bca449f9b6e71ddb015dfa5d'
* commit 'c4642788e83b0858bca449f9b6e71ddb015dfa5d':
  time_internal: Prefix fallback versions of gmtime_r/localtime_r with ff_

Merged-by: James Almer <jamrial@gmail.com>
2019-05-02 13:50:31 -03:00
Linjie Fu
2d81acaa1a lavu/hwcontext_qsv: Fix the realign check for hwupload
Fix the aligned check in hwupload, input surface should be 16 aligned
too.

Partly fix #7830.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-04-30 17:14:23 +08:00
Michael Niedermayer
6f0e9a8634 avutil/avstring: Fix bug and undefined behavior in av_strncasecmp()
The function in case of n=0 would read more bytes than 0.
The end pointer could be beyond the allocated space, which
is undefined.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-04-24 17:05:02 +02:00
Carl Eugen Hoyos
a24a1523e8 lavu/hwcontext_d3d: Cast src pointers calling av_image_copy*().
Silences several warnings:
libavutil/hwcontext_d3d11va.c:413:49: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type
libavutil/hwcontext_d3d11va.c:425:47: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type
libavutil/hwcontext_dxva2.c:351:45: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type
libavutil/hwcontext_dxva2.c:382:52: warning: passing argument 3 of ‘av_image_copy_uc_from’ from incompatible pointer type
2019-04-19 14:20:24 +02:00
Gyan Doshi
3bef1dab6e avutil/colorspace: add macros for RGB->YUV BT.709 2019-04-19 17:10:20 +05:30
Carl Eugen Hoyos
5ba769214f lavu/hwcontext_qsv: Mark a pointer as const.
Silences a warning:
libavutil/hwcontext_qsv.c:912:15: warning: assignment discards 'const' qualifier from pointer target type
2019-04-16 14:28:09 +02:00
Martin Storsjö
c4642788e8 time_internal: Prefix fallback versions of gmtime_r/localtime_r with ff_
Use a macro to redirect calling code from the official name to the
ff_ prefixed one.

Detecting these functions in configure can be tricky (on mingw, they
are conditionally available depending on posix feature defines).
If configure didn't detect them, but they still are visible at
compile time (due to an unrelated header defining the posix feature
defines), providing the local fallback versions with a prefixed
name is safer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-04-16 13:12:29 +03:00
Michael Niedermayer
9485cce6d5 time_internal: Do not attempt to override *time_r() macros
In case these already are defined as macros, we shouldn't try to
redefine them.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-04-16 13:12:20 +03:00
fumoboy007
036b4b0f85 avcodec/videotoolbox: add support for 10bit pixel format
this patch was originally posted on issue #7704 and was slightly
adjusted to check for the availability of the pixel format.
2019-04-16 03:43:06 +03:00
Jarek Samic
1c50d61a5a libavutil/hwcontext_opencl: Fix channel order in format support check
The `opencl_get_plane_format` function was incorrectly determining the
value used to set the image channel order. This resulted in all RGB
pixel formats being set to the `CL_RGBA` pixel format, regardless of
whether or not they actually *were* RGBA.

This patch fixes the issue by using the `offset` and depth of components
rather than the loop index to determine the value of `order`.

Signed-off-by: Jarek Samic <cldfire3@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2019-04-09 22:16:01 +01:00
Philip Langdale
52d8f35b14 avutil/hcontext_cuda: Remove unnecessary stream synchronisation
Similarly to the previous changes, we don't need to synchronise
after a memcpy to device memory. On the other hand, we need to
keep synchronising after a copy to host memory, otherwise there's
no guarantee that subsequent host reads will return valid data.
2019-03-30 10:56:49 -07:00
Ruiling Song
61cb505d18 lavu/opencl: replace va_ext.h with standard name
Khronos OpenCL header (https://github.com/KhronosGroup/OpenCL-Headers)
uses cl_va_api_media_sharing_intel.h. And Intel's official OpenCL driver
for Intel GPU (https://github.com/intel/compute-runtime) was compiled
against Khronos OpenCL header. So it's better to align with Khronos.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-03-22 09:33:28 +08:00
Zhong Li
15d016be30 lavu/qsv: allow surface size larger than requirement
Just like commit 6829a07944,
surface size larger than requirement should not be treated as error.

Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-03-18 07:06:41 +08:00
gxw
4571c7c05d avcodec/mips: [loongson] mmi optimizations for VP9 put and avg functions
VP9 decoding speed improved about 60.5%(from 38fps to 61fps, tested on loongson 3A3000).

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-27 01:51:40 +01:00
Philip Langdale
96d79ff5b5 avutil/cuda_check: Fix non-dynamic-loader implementation
The function typedefs we were using are only present when using the
dynamic loader, which means compilation breaks for code directly
using the cuda SDK.

To fix this, let's just duplicate the function typedefs locally.
These are not going to change.
2019-02-24 09:13:01 -08:00
James Almer
ebdc5c419a Merge commit '41cf3e3b1ca375962951fde1b90a03b16197d205'
* commit '41cf3e3b1ca375962951fde1b90a03b16197d205':
  arm: Create proper .rdata sections for COFF

Merged-by: James Almer <jamrial@gmail.com>
2019-02-20 14:48:58 -03:00
James Almer
b2f32d60ee Merge commit '5584abf69d83169a010aca404cd1cf95c23ad9ef'
* commit '5584abf69d83169a010aca404cd1cf95c23ad9ef':
  arm: Emit .thumb_func directives

Merged-by: James Almer <jamrial@gmail.com>
2019-02-20 13:51:30 -03:00
Timo Rothenpieler
15c6390139 avutil/cuda_check: avoid pointlessly exporting same symbol from two libraries 2019-02-14 13:21:07 +01:00
Carl Eugen Hoyos
0cac68bcf9 lavu/parseutils: Allow to parse >= 100 hours.
Reported and tested by gamnark.
Fixes ticket #7721.
2019-02-09 13:59:10 +01:00
Lauri Kasanen
fc6022e108 avutil/ppc/cpu: Fix power8 linux detection
The existing code was in no released kernel that I can see. The corrected code
was added in 3.9.
2019-02-05 09:29:57 +02:00
Carl Eugen Hoyos
73d4efc596 lavu/imgutils: Use FFABS() instead of abs() for ptrdiff_t.
Fixes a warning with clang:
libavutil/imgutils.c:314:16: warning: absolute value function 'abs'
given an argument of type 'ptrdiff_t' (aka 'long') but has
parameter of type 'int' which may cause truncation of value
2019-02-01 23:19:25 +01:00
Martin Storsjö
41cf3e3b1c arm: Create proper .rdata sections for COFF
As .rodata isn't one of the default created sections for COFF, it was
created as a read-write data section. By using the default .rdata
section name for COFF, it automatically becomes a read-only data section.
The existing ".section .rodata" works as intended for ELF though.

This is based on an original patch and diagnose by Tom Tan
<Tom.Tan@microsoft.com>.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-01-25 23:53:37 +02:00
Shiyou Yin
6d19164811 avcodec/mips: [loongson] optimize put_hevc_qpel_hv_8 with mmi.
Optimize put_hevc_qpel_hv_8 with mmi in the case width=4/8/12/16/24/32/48/64.
This optimization improved HEVC decoding performance 11%(1.81x to 2.01x, tested on loongson 3A3000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-22 00:46:36 +01:00
Michael Niedermayer
f64c0dffa1 avutil/imgutils: Optimize memset_bytes() by using av_memcpy_backptr()
This is strongly based on code by Marton Balint, and depends on the previous commit

Fixes: Timeout
Fixes: 11502/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5664893810769920
Before: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5664893810769920 in 11209 ms
After:  Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5664893810769920 in  4104 ms

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-20 21:42:20 +01:00
Michael Niedermayer
12b1338be3 avutil/mem: Optimize fill32() by unrolling and using 64bit
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-20 21:42:20 +01:00
Carl Eugen Hoyos
399c8e860f lavu/frame: Fix typo. 2019-01-18 12:34:19 +01:00
Guo, Yejun
1ef4828276 avutil: add ROI (Region Of Interest) data struct and bump version
The encoders such as libx264 support different QPs offset for different MBs,
it makes possible for ROI-based encoding. It makes sense to add support
within ffmpeg to generate/accept ROI infos and pass into encoders.

Typical usage: After AVFrame is decoded, a ffmpeg filter or user's code
generates ROI info for that frame, and the encoder finally does the
ROI-based encoding.

The ROI info is maintained as side data of AVFrame.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2019-01-17 21:47:11 +00:00
Peter Ross
b4e6d1f597 intreadwrite: add AV_RL64A, AV_WL64A
macros for reading and writing 64-bit aligned little-endian values.

these macros are used by the DST decoder and give a performance boost
on platforms that where the compiler must guard against unaligned
memory access.
2019-01-11 23:43:37 +11:00
Mohammad Izadi
2744d6b364 Add HDR dynamic metadata struct (for SMPTE 2094-40) to libavutil
The dynamic metadata contains data for color volume transform -
application 4 of SMPTE 2094-40:2016 standard. The data comes from
HEVC in the SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2018-12-21 17:52:00 +01:00
Carl Eugen Hoyos
a07470ba37 lavu/internal: Replace an empty loop with "do {}".
Silences a clang warning when not compiling for x86:
libswscale/utils.c:345:13: warning: while loop has empty body

Suggested-by: Nicolas George
2018-12-19 15:46:29 +01:00
Peter Ross
436bffaca2 avutil/tests/random_seed: seeds[] is uint32_t, therefore use PRIX32 macro
squelch format type warning
2018-12-16 13:52:21 +11:00
Paul B Mahol
be60dc2145 avutil/avsscanf: do not use long double functions
Not needed when only double is used.
2018-12-15 09:58:28 +01:00
Mark Thompson
21608bc303 hwcontext_opencl: Use correct function to enumerate devices
Also assert that all required functions are present.
2018-12-02 23:39:19 +00:00
Peter Ross
331715534a avpriv_tempfile: add djgpp fallback 2018-11-28 22:16:07 +11:00
Mark Thompson
b9aff7a53d hwcontext_opencl: Only release command queue if it exists
If the frames context creation fails then the command queue reference
need not exist when uninit is called.
2018-11-28 00:05:09 +00:00
Mark Harris
4361293fcf avutil/mem: Fix invalid use of av_alloc_size
The alloc_size attribute is valid only on functions that return a
pointer.  GCC 9 (not yet released) warns about invalid usage:

./libavutil/mem.h:342:1: warning: 'alloc_size' attribute ignored on a function returning int' [-Wattributes]
  342 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
      | ^~~~~~~~~~~~~

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-26 23:47:29 +01:00
Martin Vignali
80b0624099 avutil : add YUVA444P12 and YUVA422P12 2018-11-24 16:24:43 +01:00
Paul B Mahol
7d70f09307 avutil/avsscanf: do not use unsupported p suffix for hex variable 2018-11-22 10:09:05 +01:00
Paul B Mahol
277fd9c2ac avutil/avsscanf: use ptrdiff_t instead of off_t 2018-11-19 15:16:36 +01:00
Andreas Rheinhardt
8f875a90c4 avutil/mem: Correct documentation of av_fast_*alloc(z)
The current wording regarding size and min_size is completely wrong and
ignores that min_size is indeed only a desired minimal size, not the
actually allocated size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-18 23:12:45 +01:00
Carl Eugen Hoyos
529debc987 lavu/avsscanf: Do not mix declaration and code.
Fixes the following warning:
libavutil/avsscanf.c: In function 'decfloat':
libavutil/avsscanf.c:354:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         int bitlim = bits-3*(int)(rp-9);
         ^~~
2018-11-18 03:51:42 +01:00
Philip Langdale
420ab946ac avutil/cuda_check: Make sure this passes make fate-source
The header guards were unnecessarily non-standard and the c file
inclusion trick means the files dont't have standard licence
headers.

Based on a patch by: Martin Vignali <martin.vignali@gmail.com>
2018-11-17 08:18:51 -08:00