summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* avutil/mathematics: Document av_rescale_rnd() behavior on non int64 resultsMichael Niedermayer2021-10-21
| | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/detection_bbox: Fix av_detection_bbox_alloc failed if nb_bboxes == 0Limin Wang2021-10-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/detection_bbox: use offsetof for bboxes_offsetLimin Wang2021-10-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/md5: Avoid av_unused variableAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/utils: Remove racy check from avutil_version()Andreas Rheinhardt2021-09-29
| | | | | | | | | | | | | | | | avutil_version() currently performs several checks before just returning the version. There is a static int that aims to ensure that these tests are run only once. The reason is that there used to be a slightly expensive check, but it has been removed in 92e3a6fdac73f7e1d69d69717219a7538877d7a0. Today running only once is unnecessary and can be counterproductive: GCC 10 optimizes all the actual checks away, but the checks_done variable and the code setting it has been kept. Given that this check is inherently racy (it uses non-atomic variables), it is best to just remove it. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/tests/opt: Set AVClass.versionAndreas Rheinhardt2021-09-27
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/opt: Remove outdated version checkAndreas Rheinhardt2021-09-27
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/pix_fmt: add pixel format for x2bgr10Manuel Stoeckl2021-09-26
| | | | | | | | | | | The new format (given in big/little endian forms) matches the existing X2RGB10 format, except with B and R channels switched. AV_PIX_FMT_X2BGR10 data often is created by OpenGL programs whose buffers use the GL_RGB10 internal format. Signed-off-by: Manuel Stoeckl <code@mstoeckl.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/hwcontext_qsv: fix a bug for mapping qsv frame to vaapiWenbin Chen2021-09-23
| | | | | | | | | | | | | | Command below failed. ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device qsv=qs@va -hwaccel qsv -hwaccel_device qs -filter_hw_device va -c:v h264_qsv -i 1080P.264 -vf "hwmap,format=vaapi" -c:v h264_vaapi output.264 Cause: Assign pair->first directly to data[3] in vaapi frame. pair->first is *VASurfaceID while data[3] in vaapi frame is VASurfaceID. I fix this line of code. Now the command above works. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* avutil/mem: Deprecate av_mallocz_array()Andreas Rheinhardt2021-09-20
| | | | | | | | It does the same as av_calloc(), so one of them should be removed. Given that av_calloc() has the shorter name, it is retained. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/opt: Simplify av_opt_set_dict2()Andreas Rheinhardt2021-09-20
| | | | | | Make it clearer that the ordinary exit always returns 0. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/opt: Also warn for deprecated named constantsAndreas Rheinhardt2021-09-20
| | | | | | Intended for the "truncated" AVCodecContext flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/buffer: Avoid allocation of AVBuffer when using buffer poolAndreas Rheinhardt2021-09-18
| | | | | | | | Do this by putting an AVBuffer structure into BufferPoolEntry and reuse it for all subsequent uses of said BufferPoolEntry. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/buffer: constify some function parametersJames Almer2021-09-17
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 ↵Artem Galin2021-09-08
| | | | | | | | | | | | hwcontext API Microsoft VideoProcessor requires texture with D3DUSAGE_RENDERTARGET flag as output. There is no way to allocate array of textures with D3D11_BIND_RENDER_TARGET flag and .ArraySize > 2 by ID3D11Device_CreateTexture2D due to the Microsoft limitation. Adding AVD3D11FrameDescriptors array to store array of single textures instead of texture with multiple slices resolves this. Signed-off-by: Artem Galin <artem.galin@intel.com>
* libavutil/hwcontext_qsv: add usage child_device_type argument to explicitly ↵Artem Galin2021-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | select d3d11va/DX11 device type UPD: Rebase of last patch set over current master and use DX9 as default device type. Makes selection of dxva2/DX9 device type by default as before with explicit d3d11va/DX11 usage to cover more HW configurations. Added warning message to expect changing default device type in the future. Fixes TGL / AV1 decode as requires DX11 with explicit DX11 type selection. Add headless/multi adapter support and fixes: https://trac.ffmpeg.org/ticket/7511 https://trac.ffmpeg.org/ticket/6827 http://ffmpeg.org/pipermail/ffmpeg-trac/2017-November/041901.html https://trac.ffmpeg.org/ticket/7933 https://github.com/InitialForce/FFmpeg/commit/338fbcd5bba1de0e1b3e3bad8985eee2fdfbeca1 https://github.com/jellyfin/jellyfin/issues/2626#issuecomment-602153952 Any other fixes are welcome including OpenCL interop patch since I don't have proper setup to validate this use case Decoding, encoding, transcoding have been validated. child_device_type option is responsible for d3d11va/dxva2 device selection Usage examples: DirectX 11: -init_hw_device qsv:hw,child_device_type=d3d11va -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 OR -init_hw_device d3d11va=dx -init_hw_device qsv@dx DirectX 9 is still supported but requires explicit selection: -init_hw_device qsv:hw,child_device_type=dxva2 OR -init_hw_device dxva2=dx -init_hw_device qsv@dx Signed-off-by: Artem Galin <artem.galin@intel.com>
* libavutil/hwcontext_qsv: supporting d3d11va device typeArtem Galin2021-09-08
| | | | | | | This enables usage of non-powered/headless GPU, better HDR support. Pool of resources is allocated as one texture with array of slices. Signed-off-by: Artem Galin <artem.galin@intel.com>
* lavu/slicethread: return ENOSYS rather than EINVAL in the dummy funcAnton Khirnov2021-08-29
| | | | | | EINVAL is the wrong error code here, since the arguments passed to the function are valid. The error is that the function is not implemented in the build, which corresponds to ENOSYS.
* avutil/log: Reorder elements of AVClass to make it smallerAndreas Rheinhardt2021-08-25
| | | | | | Putting child_next besides child_class_iterate is actually nicer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_slice: compute and export film grain seedNiklas Haas2021-08-24
| | | | | | | | | | | | | | | | | | | | | | | | From SMPTE RDD 5-2006, the grain seed is to be computed from the following definition of `pic_offset`: > When decoding H.264 | MPEG-4 AVC bitstreams, pic_offset is defined as > follows: > - pic_offset = PicOrderCnt(CurrPic) + (PicOrderCnt_offset << 5) > where: > - PicOrderCnt(CurrPic) is the picture order count of the current frame, > which shall be derived from [the video stream]. > > - PicOrderCnt_offset is set to idr_pic_id on IDR frames. idr_pic_id > shall be read from the slice header of [the video stream]. On non-IDR I > frames, PicOrderCnt_offset is set to 0. A frame shall be classified as I > frame when all its slices are I slices, which may be optionally > designated by setting primary_pic_type to 0 in the access delimiter NAL > unit. Otherwise, PicOrderCnt_offset it not changed. PicOrderCnt_offset is > updated in decoding order. Co-authored-by: James Almer <jamrial@gmail.com> Signed-off-by: Niklas Haas <git@haasn.dev> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/opt: Document actual behaviour of av_opt_copy a bit moreAndreas Rheinhardt2021-08-17
| | | | | | | | | In particular, document that av_opt_copy() always disentangles allocated options even on error; this guarantee is needed to e.g. properly free duplicated thread contexts in libavcodec on error. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/internal: add FF_FIELD_AT().Nicolas George2021-08-14
|
* hwcontext_vulkan: use GPU memcpy when copying to system RAMLynne2021-08-14
| | | | This should speed it up significantly on systems where it matters.
* imgutils: expose av_image_copy_plane_uc_from()Lynne2021-08-14
| | | | | | | | | | | | The reason why the generic av_image_copy_uc_from() doesn't really fit in the case for Vulkan is because some planes may be copied via other methods (such as mapping GPU memory), and if they don't satisfy the strict alignment requirements, a gpu image->gpu buffer->cpu ram copy is performed. We need this for hwcontext_vulkan, and I think this will also be useful to API users like libplacebo who would rather not write a custom SIMD memcpy.
* avutil/mem: Correct av_calloc() documentationAndreas Rheinhardt2021-08-12
| | | | | | Incorrect since 4959f18a8e11ad7d3529b1c4fc429f1b6b76ad7c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/mem: Reinline av_size_mult() internallyAndreas Rheinhardt2021-08-12
| | | | | | | | | | | | | Since 580e168a945b65100ec2c25433f33bfacfe9f7be, av_size_mult() is no longer inlined; on systems where interposing is a thing, this also inhibits the compiler from inlining said function into the internal callers of said function, although inlining such a small function is typically beneficial: With GCC 10.3 on Ubuntu x64 and -O3 this decreases the size of av_realloc_array from 91B to 23B, from 129B to 81B for av_realloc_f and from 77B to 23B for each of av_malloc_array, av_mallocz_array and av_calloc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/tx: add a return at the end of non-void functionsJames Almer2021-08-06
| | | | | | Fixes compilation with GCC 11 when configured with --disable-optimizations Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/internal: Move MAKE_ACCESSORS to its only userAndreas Rheinhardt2021-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Move ff_tlog() from lavc/internal.h to lavu/internal.hAndreas Rheinhardt2021-08-05
| | | | | | | It is also used by libavfilter and it is only natural to define it alongside ff_dlog(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/Makefile: Apply CFLAGS for compilationAndreas Rheinhardt2021-08-04
| | | | | | | Fixes "make tools/crypto_bench.o". Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/error: Include macros.h for MKTAGAndreas Rheinhardt2021-07-29
| | | | | | | | | Up until now, including error.h alone does not make the AVERROR_* defines usable, because they just expand to something involving MKTAG, but without the header providing MKTAG. So include macros.h, the header providing MKTAG. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common, macros: Move several macros from common.h to macros.hAndreas Rheinhardt2021-07-29
| | | | | | | | | | | | common.h currently contains several things: Math macros, UTF-8 macros, other fundamental macros; furthermore it also contains miscellaneous math functions and it (directly and indirectly) includes lots of other headers. This commit moves the "other fundamental macros" to macros.h which is a more fitting place. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/mips: Use $at as MMI macro temporary registerJiaxun Yang2021-07-28
| | | | | | | | | | | | | Some function had exceed 30 inline assembly register oprands limiation when using LOONGSON2 version of MMI macros. We can avoid that by take $at, which is register reserved for assembler, as temporary register. As none of instructions used in these macros is pseudo, it is safe to utilize $at here. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/mips: Use MMI_{L, S}QC1 macro in {SAVE, RECOVER}_REGJiaxun Yang2021-07-28
| | | | | | | | | {SAVE,RECOVER}_REG will be available for Loongson2 again, also comment about the magic. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/film_grain_params: add support for H.274 Film Grain CharacteristicsJames Almer2021-07-23
| | | | | | Used by codecs like H.264, HEVC, and VVC. Signed-off-by: James Almer <jamrial@gmail.com>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary mem.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove obsolete version.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | These have mostly been added because of FF_API_*; yet when these were removed, removing the header has been forgotten. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/internal, swresample/audioconvert: Remove cpu.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | | | | These inclusions are not necessary, as cpu.h is already included wherever it is needed (via direct inclusion or via the arch-specific headers). Also remove other unnecessary cpu.h inclusions from ordinary non-headers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Don't include cpu.hAndreas Rheinhardt2021-07-22
| | | | | | | It is not used here at all; instead, add it where it is used without including it or any of the arch-specific CPU headers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/kperf: use ff_thread_once()J. Dekker2021-07-21
| | | | Signed-off-by: J. Dekker <jdek@itanimul.li>
* avutil/macos_kperf: add missing header guardsJames Almer2021-07-20
| | | | | | Fixes fate-source Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/checkasm: add (private) kperf timing for macOSJ. Dekker2021-07-20
| | | | Signed-off-by: J. Dekker <jdek@itanimul.li>
* lavu/cpu: Use av_cpu_ prefixThilo Borgmann2021-07-20
|
* avutil/hwcontext_videotoolbox: implement hwupload to convert AVFrame to ↵Aman Karmani2021-07-18
| | | | | | | | | | | | CVPixelBuffer Teach AV_HWDEVICE_TYPE_VIDEOTOOLBOX to be able to create AVFrames of type AV_PIX_FMT_VIDEOTOOLBOX. This can be used to hwupload a regular AVFrame into its CVPixelBuffer equivalent. ffmpeg -init_hw_device videotoolbox -f lavfi -i color=black:640x480 -vf hwupload -c:v h264_videotoolbox -f null -y /dev/null Signed-off-by: Aman Karmani <aman@tmm1.net>
* x86/tx_float: correctly load the transform lengthLynne2021-07-18
| | | | | | | | The field is a standard field, yet we were loading it as if it was a quadword. This worked for forward transforms by chance, but broke when the transform was inverse. checkasm couldn't catch that because we only test forward transforms, which are identical to inverse transforms but with a different revtab.
* lavu/cpu.c: Add av_force_cpu_count() to override auto-detection.Thilo Borgmann2021-07-16
|
* avutil/tx: avoid negative left shiftsMichael Niedermayer2021-06-18
| | | | | | | | Fixes: left shift of negative value -1 Fixes: 33736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SIREN_fuzzer-6657785795313664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/samplefmt: don't add offsets to NULL pointersJames Almer2021-06-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>