Commit Graph

5050 Commits

Author SHA1 Message Date
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
Paul B Mahol 4b30726dd3 lavu: add locale-independent sscanf implementation
Copied and adopted from musl implementation.
 * converted all 'long double' to 'double'
 * removed %m support
2018-11-16 20:24:52 +01:00
Philip Langdale 19d3d0c057 avutil/hwcontext_cuda: Define and use common CHECK_CU()
We have a pattern of wrapping CUDA calls to print errors and
normalise return values that is used in a couple of places. To
avoid duplication and increase consistency, let's put the wrapper
implementation in a shared place and use it everywhere.

Affects:

* avcodec/cuviddec
* avcodec/nvdec
* avcodec/nvenc
* avfilter/vf_scale_cuda
* avfilter/vf_scale_npp
* avfilter/vf_thumbnail_cuda
* avfilter/vf_transpose_npp
* avfilter/vf_yadif_cuda
2018-11-14 17:39:42 -08:00
Carl Eugen Hoyos ee3f62a90c pixfmt: Add GRAY10
Based on 7471352f by Luca Barbato.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-06 12:39:15 -03:00
Martin Storsjö 4e9cff2824 libavutil: Undeprecate the AVFrame reordered_opaque field
This was marked as deprecated (but only in the doxygen, not with an
actual deprecation attribute) in 81c623fae0 in 2011, but was
undeprecated in ad1ee5fa7.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-11-05 15:52:08 +02:00
Martin Storsjö a3a501df24 libavutil: Undeprecate the AVFrame reordered_opaque field
This was marked as deprecated (but only in the doxygen, not with an
actual deprecation attribute) in 81c623fae0 in 2011, but was
undeprecated in ad1ee5fa7.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-11-05 15:41:08 +02:00
Michael Niedermayer 517573a670 Bump minor version for master after 4.1 branchpoint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-02 00:53:07 +01:00
Michael Niedermayer 780d5e30a0 Bump minor versions for branching 4.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-02 00:15:32 +01:00
Jun Zhao f3bcb9c16a lavu/frame: Add error report if av_image_fill_pointers fail.
Add error handle if av_image_fill_pointers fail.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-30 13:17:09 +08:00
Michael Niedermayer 718044dc19 avutil/pixdesc: Add av_write_image_line2(), av_read_image_line2()
This is needed because of 32bit float formats (which are difficult to
store in 16bits)

This also fixes undefined behavior found by fate

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-27 22:39:27 +02:00
Michael Niedermayer 3cc3cb663b avutil/integer: Fix integer overflow in av_mul_i()
Found-by: fate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-24 23:15:24 +02:00
Josh de Kock f9d4126f28 lavu: bump version, add Changelog entry 2018-10-24 11:25:19 +01:00
Devin Heitmueller 4241e44a3c lavc/h264: create AVFrame side data from H.264 timecodes
Create SMPTE ST 12-1 timecodes based on H.264 SEI picture timing
info.

For framerates > 30 FPS, the field flag is used in conjunction with
pairs of frames which contain the same frame timestamp in S12M.
Ensure the field is properly set per the spec.
2018-10-23 15:46:30 +01:00
Martin Storsjö 5584abf69d arm: Emit .thumb_func directives
Prior to Xcode 9.3, the clang built-in assembler didn't support
altmacro, and gas-preprocessor was used for assembling for arm/darwin.

For thumb functions, gas-preprocessor took care of adding the .thumb_func
directives, but when now being able to assemble without gas-preprocessor,
we need to add these directives ourselves.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-10-12 23:25:53 +03:00
Zhong Li 681aa7d14f lavu/qsv: make a copy as libmfx alignment requirement for uploading
Libmfx requires 16 bytes aligned input/output for uploading.
Currently only output is 16 byte aligned and assigning same width/height to
input with smaller buffer size actually, thus definitely will cause segment fault.

Can reproduce with any 1080p nv12 rawvideo input:
ffmpeg -init_hw_device qsv=qsv:hw -hwaccel qsv -filter_hw_device qsv -f rawvideo -pix_fmt nv12 -s:v 1920x1080
-i 1080p_nv12.yuv -vf 'format=nv12,hwupload=extra_hw_frames=16,hwdownload,format=nv12' -an -y out_nv12.yuv

It can fix #7418

Signed-off-by: Zhong Li <zhong.li@intel.com>
2018-10-11 13:26:59 +08:00
Zhong Li a5e1cb9e96 lavu/hwcontext_qsv: Add support for AV_PIX_FMT_BGRA.
RGB32(AV_PIX_FMT_BGRA on intel platforms) format may be used as overlay with alpha blending.
So add AV_PIX_FMT_BGRA format support.

One example of alpha blending overlay: ffmpeg -hwaccel qsv -c:v h264_qsv -i BA1_Sony_D.jsv
-filter_complex 'movie=lena-rgba.png,hwupload=extra_hw_frames=16[a];[0:v][a]overlay_qsv=x=10:y=10'
-c:v h264_qsv -y out.mp4

Rename RGB32 to be BGRA to make it clearer as Mark Thompson's suggestion.

V2: Add P010 format support else will introduce HEVC 10bit encoding regression.
    Thanks for LinJie's discovery.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Verified-by: Fu, Linjie <linjie.fu@intel.com>
2018-10-11 13:26:59 +08:00
Marton Balint 416804fe41 avutil/tests/parseutils: add some big duration tests
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-07 20:26:29 +02:00
Marton Balint 4c777d52b9 avutil/parseutils: fix some overflows in duration calculations
Also properly return AVERROR(ERANGE) in case of actual overflows.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-07 20:26:29 +02:00
Marton Balint d40dc64173 avutil/opt: check for minimum and maximum values when setting AV_OPT_TYPE_DURATION fields
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-07 20:26:29 +02:00
Mark Thompson 1f1ec958f6 Merge commit '21733b39d0af5211d7b9f168ff3667ea86362e2b'
* commit '21733b39d0af5211d7b9f168ff3667ea86362e2b':
  lavu/qsv: fix a random hwupload failure regression

Fixes CID #1439585.

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-10-06 18:46:52 +01:00
Zhong Li 21733b39d0 lavu/qsv: fix a random hwupload failure regression
Variable 'ret' hasn't been initialized,thus introducing a random
hwupload failure regression due to qsv session uninitialized.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-10-03 11:10:02 +00:00
Mark Thompson 40724026b7 hwcontext_vaapi: Improve format mapping
Give the entries in the VAAPI format map table an explicit type and add
functions to do the necessary lookups.  Add another field to this table
indicating whether the chroma planes are swapped (as in YV12), and use
that rather than explicit comparisons where swapping is needed.
2018-09-23 14:42:34 +01:00
Mark Thompson 852c7ba3f8 hwcontext_vaapi: Improve logging around quirk detection
Clarify that the list is the naughty list, and therefore being on it is
not desirable.  The i965 driver does not need to be on the list after
version 2.0 (when the standard parameter buffer rendering behaviour was
changed).
2018-09-23 14:42:34 +01:00
Jun Zhao 04cbaae2aa lavu/frame: Add missing conversions from side data enum to name
Add missing conversions from side data enum to name.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-09-21 18:09:26 +08:00
Michael Bunk 0d7e0f25ca Fix typos 2018-09-14 21:36:21 +02:00
James Almer 9d002d7818 x86/float_dsp: add ff_vector_dmul_{sse2,avx}
~3x to 5x faster.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-14 12:54:42 -03:00
Paul B Mahol bb16a0624a avutil: add float_dsp.vector_dmul 2018-09-12 19:15:09 +02:00
James Almer f8377ffce3 Merge commit '642fd4769becc2f4827f8375a3d9e8edd2f5df77'
* commit '642fd4769becc2f4827f8375a3d9e8edd2f5df77':
  qsvvpp: Perform full init only when needed

Merged-by: James Almer <jamrial@gmail.com>
2018-09-11 14:04:20 -03:00
James Almer 8822e2b954 Merge commit 'f89ec87afaf0d1abb6d450253b0b348fd554533b'
* commit 'f89ec87afaf0d1abb6d450253b0b348fd554533b':
  frame: Simplify the video allocation

Merged-by: James Almer <jamrial@gmail.com>
Padding-Remixed-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-11 13:08:50 -03:00
Marton Balint 4737387d28 avutil/file: allow mapping 0 byte files with av_file_map
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-09 21:21:42 +02:00
Shiyou Yin 5161f7bcfd avutil/mips: [loongson] simplify macro TRANSPOSE_4H and TRANSPOSE_8B
Simplify macro TRANSPOSE_4H in mmiutils.h and add TRANSPOSE_8B as a common macro.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-09 12:01:07 +02:00
gxw 090647da84 avcodec/mips: [loongson] optimize vp8 decoding in vp8dsp.
Optimize vp8 loop filter with mmi, four functions optimized:
1. ff_vp8_h_loop_filter8uv_mmi.
2. ff_vp8_v_loop_filter8uv_mmi.
3. ff_vp8_h_loop_filter16_mmi.
4. ff_vp8_v_loop_filter16_mmi.

Vp8 decoding speed improved about 50%(from 73fps to 110fps, Tested on loongson 3A3000).

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-09 12:01:07 +02:00
Joe Olivas 642fd4769b qsvvpp: Perform full init only when needed
Removing unused VPP sessions by initializing only when used in order to help
reduce CPU utilization.

Thanks to Maxym for the guidance.

Signed-off-by: Joe Olivas <joseph.k.olivas@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-09-04 12:32:22 +00:00
Shiyou Yin df13b75aa1 avcodec/mips: [loongson] reoptimize simple idct with mmi.
Performance of mpeg4 decoding improved about 23%(from 128fps to 158fps, tested on loongson 3A3000).
Reoptimized following functions with mmi.
1. ff_simple_idct_put_8_mmi
2. ff_simple_idct_add_8_mmi
3. ff_simple_idct_8_mmi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-02 03:37:32 +02:00
Jacob Trimble 67599812a3 avutil/encryption_info: Fix size calculation.
Found by Chrome's ClusterFuzz: https://crbug.com/873693

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-15 01:33:45 +02:00
Sergey Lavrushkin 00ae3498bf libavutil: Adds gray floating-point pixel formats.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-11 02:37:42 +02:00
Luca Barbato f89ec87afa frame: Simplify the video allocation 2018-08-05 22:45:08 +02:00
James Almer 481741ece0 x86/pixelutils: don't use the AVX2 functions on CPUs known to be slow with them
Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-31 22:14:53 -03:00
James Almer d5b3077ecf x86/pixelutils: add missing preprocessor wrapper to the AVX2 functions
Should fix compilation with old yasm/nasm

Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-31 22:14:42 -03:00
Jun Zhao d36b8394f4 avutil/pixelutils: sad_32x32 sse2/avx2 optimizations.
add ff_pixelutils_sad_32x32_sse2, ff_pixelutils_sad_{a,u}_32x32_sse2,
ff_pixelutils_sad_32x32_avx22, ff_pixelutils_sad_{a,u}_32x32_avx2

use perf record/report profiling, get instructions:u for avx2 sad_32x32:

  72.05%  pixelutils  pixelutils     [.] block_sad_32x32_c
  18.50%  pixelutils  pixelutils     [.] block_sad_16x16_c
   4.78%  pixelutils  pixelutils     [.] block_sad_8x8_c
   2.69%  pixelutils  pixelutils     [.] block_sad_4x4_c
   0.89%  pixelutils  pixelutils     [.] block_sad_2x2_c
   0.16%  pixelutils  pixelutils     [.] ff_pixelutils_sad_32x32_avx2
   0.16%  pixelutils  pixelutils     [.] ff_pixelutils_sad_u_32x32_avx2
   0.12%  pixelutils  pixelutils     [.] ff_pixelutils_sad_a_32x32_avx2

sse2 sad_32x32 instructions:u like:

  71.86%  pixelutils  pixelutils     [.] block_sad_32x32_c
  18.42%  pixelutils  pixelutils     [.] block_sad_16x16_c
   4.81%  pixelutils  pixelutils     [.] block_sad_8x8_c
   2.68%  pixelutils  pixelutils     [.] block_sad_4x4_c
   0.88%  pixelutils  pixelutils     [.] block_sad_2x2_c
   0.29%  pixelutils  pixelutils     [.] ff_pixelutils_sad_32x32_sse2
   0.26%  pixelutils  pixelutils     [.] ff_pixelutils_sad_u_32x32_sse2
   0.23%  pixelutils  pixelutils     [.] ff_pixelutils_sad_a_32x32_sse2

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-31 19:17:51 +08:00
Jun Zhao b8bf7408dc lavutil/pixelutils: add sad_32x32 in pixelutils API.
add sad_32x32 in pixelutils API, and update the fate.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-31 19:09:35 +08:00
James Almer 81a18f219e avutil/hwcontext_d3d11va: fix type arguments passed to IDXGIAdapter2_GetDesc()
libavutil/hwcontext_d3d11va.c: In function 'd3d11va_device_create':
libavutil/hwcontext_d3d11va.c:554:46: warning: passing argument 2 of 'pAdapter->lpVtbl->GetDesc' from incompatible pointer type [-Wincompatible-pointer-types]
         hr = IDXGIAdapter2_GetDesc(pAdapter, &desc);
                                              ^
libavutil/hwcontext_d3d11va.c:554:46: note: expected 'DXGI_ADAPTER_DESC * {aka struct DXGI_ADAPTER_DESC *}' but argument is of type 'DXGI_ADAPTER_DESC2 * {aka struct DXGI_ADAPTER_DESC2 *}'

Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-25 15:22:30 -03:00
Michael Niedermayer be0b77e6e8 avutil/pixfmt: Document chroma plane size for odd resolutions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-20 13:13:52 +02:00
alexander schmid b23c4a9dbd lavu/x86/cpu: Fix aesni detection 2018-07-19 20:17:44 +02:00
Jun Zhao 09628cb1b4 avutil/pixelutils: correct the function name in comments
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-11 20:12:33 +08:00
Jun Zhao 6b453a81bc hwcontext_opencl: remove an unused variable
remove an unused variable

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-29 05:23:49 +08:00
Jun Zhao e6ac328b79 hwcontext_opencl: Remove the opencl_device_init in opencl_device_derive
In opencl device derived case, don't need to call opencl_device_init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-29 05:23:20 +08:00
Jun Zhao 2730a0fdf4 configure: fix check for opencl_vaapi_intel_media.
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers
and Runtimes for Intel® Architectureis is a standalone release, more
information can be found in the link:
https://software.intel.com/en-us/articles/opencl-drivers.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-29 05:17:36 +08:00
Jacob Trimble 69bd73b3ff libavutil/encryption_info: Add unit tests.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-27 13:43:39 +02:00
Jacob Trimble 96281ed689 avutil/gitignore: Ignore integer test binary.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-27 13:43:38 +02:00
Jacob Trimble ad2ae21010 avutil/encryption_info: Fix documentation problem.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-27 13:43:38 +02:00
Mark Thompson 7ff5310068 hwcontext_opencl: Remove unused variable
Unused since a2613647c4.
2018-06-24 19:37:39 +01:00
Jacob Trimble b86c5757a2 libavutil/encryption_info: Allow multiple init info.
It is possible for there to be multiple encryption init info structure.
For example, to support multiple key systems or in key rotation.  This
changes the AVEncryptionInitInfo struct to be a linked list so there
can be multiple structs without breaking ABI.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-23 01:06:29 +02:00
Rostislav Pehlivanov a2613647c4 hwcontext_opencl: use ff_hwframe_map_replace()
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-06-21 16:34:10 +01:00
Rostislav Pehlivanov 7062e4dbc8 hwcontext_internal: add ff_hwframe_map_replace
Used to fix unmapping when no direct interop exists between APIs.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-06-21 16:34:06 +01:00
Jun Zhao 7f5b8f0883 tests/bprint: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 09:59:33 +08:00
Jun Zhao 9ba94ac57a avutil/log: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 09:59:33 +08:00
Michael Niedermayer aa41d322be avutil/common: Fix undefined behavior in av_clip_uintp2_c()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 8521/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5639024952737792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-15 21:52:29 +02:00
Derek Buitenhuis 238a8ae92f pixdesc: Only check against valid entries when iterating over lists of enums
Some of these enums have gaps in between their values, since they correspond
to the values in various specs, instead of being an incrementing list.

Fixes segfaults when, for example, using the valid API call:

   av_color_primaries_from_name("jecdec-p22");

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2018-06-12 16:10:31 +01:00
Jun Zhao 3bab7b70da lavu/hwcontext_opecl: fix the build warning
fix the build warning when use Portable Computing Language (pocl).

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-07 19:38:58 +08:00
Ruiling Song e4006a474f lavu: add calling convention for OpenCL callback.
This fix a build error on Windows:
C2440: connot convert from 'void (__cdecl *) (...)' to 'void (__stdcall *)(...)'.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-06-06 23:13:00 +01:00
Vittorio Giovara c9fcdac118 Use the same name for stereo3d frame/packet side data 2018-06-05 21:47:59 -04:00
Mark Thompson 8ef51a4092 hwcontext_vaapi: Fix mapping from DRM
This was broken by bed670a1de, which added
an assert that always failed.
2018-05-24 01:20:31 +01:00
Mark Thompson ba7d1377e8 hwcontext: Add test for device creation and derivation
This uses any devices it can find on the host system - on a system with no
hardware device support or in builds with no support included it will do
nothing and pass.
2018-05-21 20:54:52 +01:00
Mark Thompson 989c5a84ac lavu/Makefile: Fix alignment and ordering 2018-05-15 22:16:03 +01:00
Mark Thompson 136260eb88 hwcontext: Do not call device_init again when deriving an existing device
The change in 309d660775 to call device_init
when doing derivation missed this case - we should only call it if we
actually made a new device.
2018-05-15 22:16:03 +01:00
Marton Balint 1b2471039b avutil/hwcontext_cuda: fix YUV420P cuda_get_buffer
Regression since ece068a771.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-15 22:18:58 +02:00
Haihao Xiang bed670a1de hwcontext_vaapi: Add an assert in vaapi_map_from_drm()
Every fourcc in vaapi_drm_format_map should be in
vaapi_format_map, so add an assert to ensure we have the right maps.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2018-05-10 19:52:53 +01:00
Timo Rothenpieler ece068a771 avutil/hwcontext_cuda: use generic size and pointer assignment functions 2018-05-10 00:34:22 +02:00
Timo Rothenpieler 41a18982d0 avutil/hwcontext_cuda: add support for nvenc rgb formats 2018-05-10 00:34:22 +02:00
Timo Rothenpieler 9b82e333b7 avutil/hwcontext_cuda: explicitly synchronize cuMemcpy calls 2018-05-10 00:34:22 +02:00
Timo Rothenpieler c855683427 avutil/hwcontext_cuda: add CUstream in cuda hwctx 2018-05-10 00:34:22 +02:00
Paul B Mahol aef93c6aa5 avutil: add gray14 pixel format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-05 21:35:31 +02:00
Paul B Mahol f43fd68f28 avfilter/drawutils: add support for full range
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-03 21:43:57 +02:00
Marton Balint 7033654f7f Use AV_PIX_FMT_FLAG_ALPHA for detecting transparency where nb_components was used
Temporarily keep the old method for ffmpeg_filters.c choose_pix_fmt and
avfiltergraph.c pick_format() until a paletted pixel format without alpha is
introduced.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 21:51:31 +02:00
Marton Balint 56b081da57 avutil/pixdesc: add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 21:51:31 +02:00
Mark Thompson 92a0a6bea9 hwcontext_vaapi: Fix compilation with libva versions < 1.4.0
The BufferHandle API was added in libva 1.4.0 / VAAPI 0.36.0.
2018-04-27 23:29:51 +01:00
Clément Bœsch 5be0410cb3 lavu/opt: add AV_OPT_FLAG_DEPRECATED 2018-04-26 19:50:29 +02:00
Clément Bœsch 71fa82bed6 lavu/threadmessage: add av_thread_message_queue_nb_elems() 2018-04-26 19:41:19 +02:00
Steve Lhomme abf806f7f1 random_seed: use bcrypt instead of the old wincrypt API
Remove the wincrypt API calls since we don't support XP anymore and
bcrypt is available since Vista, even on Windows Store builds.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-04-19 10:54:26 +03:00
Jacob Trimble f7221d8e67 avformat/mov: Increase support for common encryption.
- Parse schm atom to get different encryption schemes.
- Allow senc atom to appear in track fragments.
- Allow 16-byte IVs.
- Allow constant IVs (specified in tenc).
- Allow only tenc to specify encryption (i.e. no senc/saiz/saio).
- Use sample descriptor to detect clear fragments.

This doesn't support:
- Different sample descriptor holding different encryption info.
  - Only first sample descriptor can be encrypted.
- Encrypted sample groups (i.e. seig).
- Non-'cenc' encryption scheme when using -decryption_key.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 03:15:32 +02:00
Michael Niedermayer 3c1ecb057d Bump minor versions after release/4.0 branching
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Michael Niedermayer 7e3a070d9a Bump minor versions for branching release/4.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Steve Lhomme aedbf1640c avutil/random_seed: use bcrypt instead of the old wincrypt API
Remove the wincrypt API calls since we don't support XP anymore and bcrypt is
available since Vista, even on Windows Store builds.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-14 18:31:25 -03:00
James Almer b14761d1f8 Merge commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce'
* commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce':
  Drop Windows XP support remnants

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 20:59:12 -03:00
James Almer f790410b6b Merge commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42'
* commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42':
  qsv: adding Multi Frame Encode support

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 20:34:23 -03:00
Diego Biurrun 8f144d9e3d Drop Windows XP support remnants 2018-04-09 21:58:39 +02:00
Maxym Dmytrychenko cca5e4f040 qsv: adding Multi Frame Encode support
Starting from API 1.25 helps to improve performance of the simultaneous
encode, 1:N scenario, like:

./avconv  -y -hwaccel qsv -c:v h264_qsv -r 30000/1001 -i
~/bbb_sunflower_1080p_60fps_normal.mp4  -vframes 600 -an \
    -filter_complex "split=2[s1][s2]; [s1]scale_qsv=1280:720[o1];
[s2]scale_qsv=960:540[o2]" \
    -map [o1] -c:v h264_qsv -b:v 3200k -minrate 3200k -maxrate 3200k -f
rawvideo /tmp/3200a.264 \
    -map [o2] -c:v h264_qsv -b:v 1750k -minrate 1750k -maxrate 1750k -f
rawvideo /tmp/1750a.264

Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2018-04-08 20:47:59 +02:00
wm4 d6fc031caf avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPAL
PSEUDOPAL pixel formats are not paletted, but carried a palette with the
intention of allowing code to treat unpaletted formats as paletted. The
palette simply mapped the byte values to the resulting RGB values,
making it some sort of LUT for RGB conversion.

It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8,
GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap
formats. The last one, GRAY8, is more common, but its treatment is
grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming
from typical Y video planes was not mapped to the correct RGB values.
This cannot be fixed, because AVFrame.color_range can be freely changed
at runtime, and there is nothing to ensure the pseudo palette is
updated.

Also, nothing actually used the PSEUDOPAL palette data, except xwdenc
(trivially changed in the previous commit). All other code had to treat
it as a special case, just to ignore or to propagate palette data.

In conclusion, this was just a very strange old mechnaism that has no
real justification to exist anymore (although it may have been nice and
useful in the past). Now it's an artifact that makes the API harder to
use: API users who allocate their own pixel data have to be aware that
they need to allocate the palette, or FFmpeg will crash on them in
_some_ situations. On top of this, there was no API to allocate the
pseuo palette outside of av_frame_get_buffer().

This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes
the pseudo palette optional. Nothing accesses it anymore, though if it's
set, it's propagated. It's still allocated and initialized for
compatibility with API users that rely on this feature. But new API
users do not need to allocate it. This was an explicit goal of this
patch.

Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I
first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL
macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0.

Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition,
FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation
functions manually changed to not allocating a palette.
2018-04-03 17:53:00 +02:00
James Almer 33bd2b99a1 Merge commit '3a7b4ae62c798edbd82bcd8fef863c74ed2acd4a'
* commit '3a7b4ae62c798edbd82bcd8fef863c74ed2acd4a':
  arm: Produce .const_data instead of .section .rodata for Mach-O

Merged-by: James Almer <jamrial@gmail.com>
2018-03-30 15:48:17 -03:00
Martin Storsjö 3a7b4ae62c arm: Produce .const_data instead of .section .rodata for Mach-O
This is the same combination of .section directives as used in
aarch64/asm.S.

Since Xcode 9.3, the bundled clang supports altmacro and doesn't
require using gas-preprocessor any longer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-03-30 15:49:30 +03:00
James Almer be6749c719 Merge commit '86499771d1228d8303c8eb6509e20c0caaa02da5'
* commit '86499771d1228d8303c8eb6509e20c0caaa02da5':
  qsv: align surface width/height to 16.

Merged-by: James Almer <jamrial@gmail.com>
2018-03-29 21:02:02 -03:00
Mark Thompson 44000b7744 hwcontext_d3d11: Fix crash with valid adapter but no device
This crash was introduced by 8bbf2dacbf,
which could incorrectly overwrite the failure result from creating the
device.

Fixes ticket #7108.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
2018-03-28 00:19:45 +01:00
Jacob Trimble db2a7c947e avcodec/avcodec.h: Add encryption info side data.
This new side-data will contain info on how a packet is encrypted.
This allows the app to handle packet decryption.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-24 03:11:08 +01:00
Mark Thompson ac993e73de hwcontext_opencl: Add support for mapping DRM objects to Beignet
Also use that to support mapping VAAPI to Beignet.
2018-03-22 23:19:00 +00:00
Mark Thompson ca9f13bbce hwcontext_vaapi: Pass correct read/write flags when exporting surfaces 2018-03-22 23:18:57 +00:00
Mark Thompson c6bbb8cca7 hwcontext_vaapi: Add support for legacy DRM mapping
The old vaAcquireBufferHandle() API works in fewer cases and provides
less information than the current vaExportSurfaceHandle(), but it exists
on older versions and is already used by the OpenCL code.
2018-03-22 23:18:55 +00:00
Mark Thompson f86e8c91d0 hwcontext_drm: Clarify value for unknown format modifiers 2018-03-22 23:18:53 +00:00
Mark Thompson 9313422dfc hwcontext_opencl: Avoid deprecation warnings when built with post-1.2 headers
Matching the previous commit.  This is not applied to the installed header
because it could incorrectly suppress the warning inside user programs.
2018-03-22 23:14:30 +00:00
Ruiling Song 86499771d1 qsv: align surface width/height to 16.
Per MediaSDK documentation, it requires width/height to 16 alignment.
Without this patch, hwupload pipeline may fail if 16 alignment is
not met. Although this patch also apply 16 alignment to qsv encoder/decoder,
it will not bring any side-effect to them as they are already aligned.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-03-21 08:42:47 +01:00
James Almer 72bb955625 avutil/integer: move the test to the corresponding subdirectory
And actually enable it.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-20 23:27:58 -03:00
Mark Thompson 0f3d1c69b5 hwcontext_vaapi: Always include DRM hwcontext header
Fixes building with VAAPI but not libdrm, which was broken by
389f4c3e0d.  Just unconditionally include
the header, since it doesn't depend on libdrm being present.
2018-03-18 18:34:38 +00:00
Mark Thompson 389f4c3e0d hwcontext_vaapi: Fix condition for DRM device derivation
vaGetDisplayDRM() is required for this code to work, libdrm is not.
2018-03-18 17:55:00 +00:00
wm4 4b86ac27a0 lavu/frame: add QP side data
This adds a way for an API user to transfer QP data and metadata without
having to keep the reference to AVFrame, and without having to
explicitly care about QP APIs. It might also provide a way to finally
remove the deprecated QP related fields. In the end, the QP table should
be handled in a very similar way to e.g. AV_FRAME_DATA_MOTION_VECTORS.

There are two side data types, because I didn't care about having to
repack the QP data so the table and the metadata are in a single
AVBufferRef. Otherwise it would have either required a copy on decoding
(extra slowdown for something as obscure as the QP data), or would have
required making intrusive changes to the codecs which support export of
this data.

The new side data types are added under deprecation guards, because I
don't intend to change the status of the QP export as being deprecated
(as it was before this patch too).
2018-03-18 12:36:24 +01:00
wm4 36855abc0e lavu/frame: fix inconsistent qp_table_buf deprecation
Everything related to the QP data is deprecated, with qp_table_buf being
an inconsistent exception. Some parts were under the deprecation guards,
some not. It probably didn't even compile.
2018-03-18 12:36:24 +01:00
Tobias Rapp 1296a718dc avutil/log: print level prefix also when no AVClass context is available
Adds the level prefix to all log messages, except those with level <=
AV_LOG_QUIET as they seem to be used for flushing the log buffer.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-03-16 09:08:17 +01:00
James Almer 7af2336598 avutil: bump version after the latest AVOption flag addition
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-16 00:19:45 -03:00
Jun Zhao 7b5cf0a410 lavu/opt: add bit stream filter option dump support.
enable dump bit stream filter and update opt fate test ref.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-16 02:09:59 +01:00
Jun Zhao e0e72539cf lavu/opt: add AV_OPT_FLAG_BSF_PARAM
add AV_OPT_FLAG_BSF_PARAM for bit stream filter options.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-16 02:09:59 +01:00
James Almer 950170bd3b avutil: add missing version bump for AV_CRC_8_EBU
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-10 01:15:05 -03:00
Marton Balint 8d37dd6ed3 avutil/parseutils: only accept full us duration, do not accept mss duration
Accepting 'u' suffix for a time specification is neither intuitive nor
consistent (now that we don't accept m). Also there was a bug in the code
accepting an extra 's' even after 'ms'.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 22:01:38 +01:00
Aurelien Jacobs 0b4ad86959 crc: add AV_CRC_8_SBC as a 8 bits CRC with polynomial 0x1D 2018-03-07 22:26:53 +01:00
Mark Thompson 085a2eb8e2 Merge commit '8ca39b855a7b0e4d9f726fa9d285bc8edcb953e6'
* commit '8ca39b855a7b0e4d9f726fa9d285bc8edcb953e6':
  qsv: Default PicStruct to progressive

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-03-05 22:31:03 +00:00
Rostislav Pehlivanov 8218249f1f parseutils: accept only full "ms" suffix
The commit which added those was pushed prematurely before anyone could object
to illogical suffixes like just m for milliseconds. Without this, we'd be locked
into never being able to implement the "m" suffix for minutes.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-03-05 20:38:35 +00:00
Aurelien Jacobs 61c972384d parseutils: add support for ms and us suffix for AV_OPT_TYPE_DURATION
supported suffixes are:
- s: seconds (default when no suffix specified)
- m or ms: milliseconds
- u or us: microseconds
2018-03-02 22:57:08 +01:00
Rostislav Pehlivanov 6731f60598 frame: add an av_frame_new_side_data_from_buf function
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-03-01 20:37:18 +00:00
Gyan Doshi b6652f5100 avutil/timecode: fix starting frame number for 59.94 fps
The existing code for adjusting starting frame number assumes 29.97 as
stream fps.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-23 01:53:34 +01:00
Ruiling Song 8ca39b855a qsv: Default PicStruct to progressive
The PicStruct is required by MediaSDK, so give a default value.
hwupload does not work without this.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-02-22 11:24:12 +01:00
Mark Thompson 193e43e619 hwcontext_vaapi: Fix frames context creation with external attributes 2018-02-21 23:38:10 +00:00
Mark Thompson fabcbfba38 hwcontext_vaapi: Add more surface formats
Adds YUV 4:1:1, 4:4:0 and 4:4:4 - these will be needed for JPEG decoding.
2018-02-21 23:38:10 +00:00
Michael Niedermayer ab6f571ef7 avutil/common: Fix integer overflow in av_clip_uint8_c() and av_clip_uint16_c()
Fixes: 5567/clusterfuzz-testcase-minimized-5769966247739392
Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 15:56:55 +01:00
James Almer 8a8d0b319a avutil/crypto: change length parameter to size_t on the remaining modules
See 651ee93461
fcc4ed1efa

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-15 11:21:28 -03:00
wm4 474194a8d0 avutil/opt: remove ABI hacks
These were needed for ABI compatibility with Libav. We don't need them
anymore.
2018-02-13 04:46:04 +01:00
James Almer 35347e7e9b Merge commit '4cf84e254ae75b524e1cacae499a97d7cc9e5906'
* commit '4cf84e254ae75b524e1cacae499a97d7cc9e5906':
  Drop some unnecessary config.h #includes

Merged-by: James Almer <jamrial@gmail.com>
2018-02-11 23:08:48 -03:00
James Almer 0a320f7e7a Merge commit '2eb396b175e55e515aa6a13c5b1789a2a18d3935'
* commit '2eb396b175e55e515aa6a13c5b1789a2a18d3935':
  hwcontext: Fix memory leak on derived frame allocation failure

Merged-by: James Almer <jamrial@gmail.com>
2018-02-11 22:50:57 -03:00
Mark Thompson e412d683fe hwcontext: Perform usual uninitialisation on derived frames contexts 2018-02-11 22:11:10 +00:00
Mark Thompson caecb85014 hwcontext: Perform usual initialisation on derived device contexts
The initialisation should be common.  For libmfx, it was previously
happening in the derivation function and this moves it out.
2018-02-11 22:11:10 +00:00
Diego Biurrun 4cf84e254a Drop some unnecessary config.h #includes 2018-02-06 10:03:15 +01:00
Mark Thompson 2eb396b175 hwcontext: Fix memory leak on derived frame allocation failure 2018-02-04 13:47:25 +00:00
Jun Zhao 96e476cc9d hwcontext: Fix documentation for av_hwdevice_ctx_alloc()
From ffmpeg commit 9365dfcbf6.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-02-04 13:47:19 +00:00
Mark Thompson 8e9be8ffba Merge commit '85e10c0a9321bfe0d2afe0f3983ab6a8df6e3fba'
* commit '85e10c0a9321bfe0d2afe0f3983ab6a8df6e3fba':
  intreadwrite: Use __unaligned in MSVC for ARM64 as well

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-25 22:45:45 +00:00
Jacob Trimble 9f07cf7c00 avutil/aes_ctr: Add method to set 16-byte IV.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-23 21:48:31 +01:00
Henrik Gramner 6f62b0bd4f x86inc: Drop cpuflags_slowctz 2018-01-20 19:23:37 +01:00
Henrik Gramner eb5f063e7c x86inc: Correctly set mmreg variables 2018-01-20 19:23:37 +01:00
Henrik Gramner 6b6edd1216 x86inc: Support creating global symbols from local labels
On ELF platforms such symbols needs to be flagged as functions with the
correct visibility to please certain linkers in some scenarios.
2018-01-20 19:23:37 +01:00
Henrik Gramner 9e4b3675f2 x86inc: Use .rdata instead of .rodata on Windows
The standard section for read-only data on Windows is .rdata. Nasm will
flag non-standard sections as executable by default which isn't ideal.
2018-01-20 19:23:37 +01:00
Henrik Gramner 3a02cbe3fa x86inc: Enable AVX emulation for floating-point pseudo-instructions
There are 32 pseudo-instructions for each floating-point comparison
instruction, but only 8 of them are actually valid in legacy-encoded mode.
The remaining 24 requires the use of VEX-encoded (v-prefixed) instructions
and can therefore be disregarded for this purpose.
2018-01-20 19:23:37 +01:00
Mark Thompson d204b7ff61 Merge commit 'e23190269fb6e8217d080918893641ba3e0e3556'
* commit 'e23190269fb6e8217d080918893641ba3e0e3556':
  lavu/qsv: add log message for libmfx version

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-16 22:57:02 +00:00
Martin Storsjö 85e10c0a93 intreadwrite: Use __unaligned in MSVC for ARM64 as well
This attribute is supported for this architecture in MSVC as well
(but produces errors if used for 32 bit x86).

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-01-16 22:52:11 +02:00
wm4 27b9f82e2c hwcontext_d3d11va: implement av_hwdevice_get_hwframe_constraints()
D3D11 has rather fine grained per format capabilities for different uses
that can be queried at runtime. Since we don't know what the user wants
to do with the formats when av_hwdevice_get_hwframe_constraints() is
called, we simply return all formats that have the most basic support.
2018-01-16 17:40:24 +01:00
wm4 cbbb206734 hwcontext_vdpau: implement av_hwdevice_get_hwframe_constraints()
In addition, this does not allow creating frames contexts with sw_format
for which no known transfer formats exist. In theory, we should check
whether the chroma format (i.e. the sw_format) is supported at all by
the vdpau driver, but checking for transfer formats has the same effect.

Note that the pre-existing code adds 1 to priv->nb_pix_fmts[i] for
unknown reason, and some checks need to account for that to check for
empty lists. They are not off-by-one errors.
2018-01-15 12:37:30 +01:00
James Almer ef21033c32 avutil/mastering_display_metadata: fix copyright header wrongly formated as doxy
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-11 11:35:51 -03:00
Anton Khirnov 89b84cb18b It has been replaced by C11 stdatomic.h and is now unused.
(cherry picked from commit 5cc0057f49)
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-05 14:06:02 -03:00
James Almer 8d9c9775b2 avutil/log: use thread wrappers for the locking functionality
w32threads and os2threads both support static mutex initialization now,
so don't limit it to pthreads only.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-04 15:22:19 -03:00
wm4 18fbfd7bf8 hwcontext_dxva2: initialize D3DDISPLAYMODEEX correctly 2018-01-04 15:52:46 +01:00
Humberto Ribeiro 59b126f922 libavutil/hwcontext_dxva2: Add check for possible errors from GetAdapterDisplayModeEx
This prevents a possible crash in CreateDeviceEx when using faulty
response from GetAdapterDisplayModeEx and allows ffmpeg to fallback to
classic d3d9.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2018-01-04 15:41:40 +01:00
Carl Eugen Hoyos 695b1d8111 lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc(). 2018-01-04 05:39:18 +01:00
Carl Eugen Hoyos 21b5990da4 lavu/mem: Do not realloc in av_fast_realloc() if size == min_size.
This can avoid OOM for min_size close to FFmpeg's arbitrary alloc limits.
2018-01-01 22:30:22 +01:00
Zhong Li e23190269f lavu/qsv: add log message for libmfx version
It is benefit to diagnose issues related to different libmfx version.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-12-29 16:12:16 +00:00
wm4 a04c2c707d lavc: replace and deprecate the lock manager
Use static mutexes instead of requiring a lock manager. The behavior
should be roughly the same before and after this change for API users
which did not set the lock manager at all (except that a minor memory
leak disappears).
2017-12-26 02:50:00 +01:00
wm4 9b121dfc32 w32pthreads: always use Vista+ API, drop XP support
This removes the XP compatibility code, and switches entirely to SWR
locks, which are available starting at Windows Vista.

This removes CRITICAL_SECTION use, which allows us to add
PTHREAD_MUTEX_INITIALIZER, which will be useful later.

Windows XP is hereby not a supported build target anymore. It was
decided in a project vote that this is OK.
2017-12-26 02:49:48 +01:00
James Almer 90d216cb90 x86inc: set the correct amount of simd regs in x86_64 when avx512 is enabled but not used
Fixes compilation of libavresample/x86/audio_mix.asm

Reviewed-by: Gramner
Signed-off-by: James Almer <jamrial@gmail.com>
2017-12-24 23:02:54 -03:00
Henrik Gramner f7197f68dc x86inc: AVX-512 support
AVX-512 consists of a plethora of different extensions, but in order to keep
things a bit more manageable we group together the following extensions
under a single baseline cpu flag which should cover SKL-X and future CPUs:
 * AVX-512 Foundation (F)
 * AVX-512 Conflict Detection Instructions (CD)
 * AVX-512 Byte and Word Instructions (BW)
 * AVX-512 Doubleword and Quadword Instructions (DQ)
 * AVX-512 Vector Length Extensions (VL)

On x86-64 AVX-512 provides 16 additional vector registers, prefer using
those over existing ones since it allows us to avoid using `vzeroupper`
unless more than 16 vector registers are required. They also happen to
be volatile on Windows which means that we don't need to save and restore
existing xmm register contents unless more than 22 vector registers are
required.

Big thanks to Intel for their support.
2017-12-24 22:02:41 +01:00
James Darnley e2218ed8ce avutil: add alignment needed for AVX-512 2017-12-24 22:02:41 +01:00
James Darnley 4783a01c11 avutil: detect when AVX-512 is available 2017-12-24 22:02:41 +01:00
James Darnley 8b81eabe57 avutil: add AVX-512 flags 2017-12-24 22:02:41 +01:00
Carl Eugen Hoyos 9b79c65ec0 lavu/lavc/lavf/lavfi: Do not use type modifier %zu on Windows MSVCRT. 2017-12-17 18:05:42 +01:00
Aman Gupta e4d9f05ca7 lavu/hwcontext: add AV_HWDEVICE_TYPE_MEDIACODEC
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2017-12-16 00:52:00 +01:00
Andrew D'Addesio 9b45bcf713 libavutil: Add saturating subtraction functions
Add av_sat_sub32 and av_sat_dsub32 as the subtraction analogues to
av_sat_add32/av_sat_dadd32.

Also clarify the formulas for dadd32/dsub32.

Signed-off-by: Andrew D'Addesio <modchipv12@gmail.com>
2017-12-04 07:28:45 +00:00
Thomas Köppe 53c492640c avutil/mem: Add DECLARE_ASM_ALIGNED macro for DJGPP architecture.
The macro was added in 43171a2a73, but I forgot to add it to the DJGPP architecture in that change.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-02 19:14:09 +01:00
Martin Vignali b37196adff avutil/x86util : add macro for loading a 128 bits constants in an xmm or in each part of an ymm in order to simplify avx2 asm func 2017-12-02 18:25:15 +01:00
James Almer d268094f88 Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
  stereo3d: Support view type for frame sequence type

Merged-by: James Almer <jamrial@gmail.com>
2017-11-29 21:06:49 -03:00
Vittorio Giovara 99e9697e3a stereo3d: Support view type for frame sequence type
Implement detection in h264 and hevc and insertion in framepack filter.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-11-28 14:56:51 -05:00
Rodger Combs 1204ce0b63 lavu/hwcontext_opencl.h: fix build on macOS 2017-11-28 00:23:42 -06:00
Mark Thompson 6e0e3e1d8d hwcontext_vaapi: Do not assume that sw_format is transferable
Drivers can support a format for surfaces without also supporting it for
images, so we can't assume that sw_format is usable for transfer.  This
would previously hit an assert in cases where it isn't.
2017-11-26 15:40:24 +00:00
Jan Ekström f6d49a0dc8 hwcontext_d3d11va: properly reset values after release/close
Makes the uninit function re-entrable, which can be a common case
when an API user first tries to initialize its context, fails, and
then finally unrefs the AVHWDevice.

Fixes a crash reported by sm2345 on IRC.
2017-11-25 18:51:41 +02:00
Mark Thompson f4e319d8a9 hwcontext_opencl: Reset internal command queue on device_uninit
device_uninit can be called twice if device_init fails.
2017-11-25 15:44:31 +00:00
Mark Thompson 8bbf2dacbf hwcontext_d3d11: Log adapter details on device creation
This is helpful to know what device has actually been used.
2017-11-25 15:44:31 +00:00
Mark Thompson e1d1924427 lavu/pixfmt: Remove gap in the middle of enum AVPixelFormat
This was added for compatibility with libav, by leaving a space for
formats added in libav to be merged.  Since that feature has been
removed, we don't need a gap here.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-25 14:42:10 +00:00
Mark Thompson 3650cb2dfa lavu,lavfi,ffmpeg: Remove experimental OpenCL API
This was added in early 2013 and abandoned several months later; as far as
I can tell, there are no external users.  Future OpenCL use will be via
hwcontext, which requires neither special OpenCL-only API nor global state
in libavutil.

All internal users are also deleted - this is just the unsharp filter
(replaced by unsharp_opencl, which is more flexible) and the deshake filter
(no replacement).
2017-11-22 23:20:39 +00:00
Mark Thompson 0f93cef2d6 hwcontext: Perform usual uninitialisation on derived frames contexts 2017-11-22 23:20:32 +00:00
Mark Thompson 7faae6e745 hwcontext_opencl: DRM to OpenCL mapping for ARM
Using cl_arm_import_memory.  Unfortunately, despite this not being a
standard extension, the function clImportMemoryARM() is not accessible
via clGetExtensionFunctionAddressForPlatform().  This means that it has
to be linked directly to the ARM OpenCL binary, so making a portable
binary is not possible as it is with all other mapping extensions.
2017-11-22 23:02:33 +00:00
Mark Thompson f06754e4f3 hwcontext_opencl: D3D11 to OpenCL mapping
Using cl_khr_d3d11_sharing and cl_intel_d3d11_nv12_media_sharing.
2017-11-22 23:02:33 +00:00