Commit Graph

4904 Commits

Author SHA1 Message Date
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
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