summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Fix integer overflow in av_ceil_log2_c()Michael Niedermayer2020-07-011-1/+1
| | | | | | | | | | Fixes: left shift of 1913647649 by 1 places cannot be represented in type 'int' Fixes: 23572/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5082619795734528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit e409262837712016097c187e97bf99aadf6a4cdf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/lfg: Correct index increment type to avoid undefined behaviorMichael Niedermayer2020-07-011-3/+6
| | | | | | | | | | Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 18333/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COMFORTNOISE_fuzzer-5668481831272448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 6014bcf1b74e903f535461ade4aa5fb44dbf5d8b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/lfg: Document the AVLFG structMichael Niedermayer2019-11-111-0/+6
| | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit d6fea2ef221a2f438cc55e82c61d0375750edf94) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/softfloat_ieee754: Fix odd bit position for exponent and sign in ↵Michael Niedermayer2019-11-111-1/+1
| | | | | | | | av_bits2sf_ieee754() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 82e389d066923412dd945543418e8cb6c63d0997) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/avstring: Fix bug and undefined behavior in av_strncasecmp()Michael Niedermayer2019-11-111-2/+3
| | | | | | | | | | | 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> (cherry picked from commit 6f0e9a863466bfcbd75ee15d4d8a6aad2a5126a4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/mem: Fix invalid use of av_alloc_sizeMark Harris2019-07-231-1/+1
| | | | | | | | | | | | 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> (cherry picked from commit 4361293fcf59edb56879c36edcd25f0a91e0edf8)
* avutil/imgutils: Optimize memset_bytes() by using av_memcpy_backptr()Michael Niedermayer2019-03-211-22/+5
| | | | | | | | | | | | | | | 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> (cherry picked from commit f64c0dffa13e6263de3fdff0058ab2fdb03ac1d6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/mem: Optimize fill32() by unrolling and using 64bitMichael Niedermayer2019-03-211-0/+12
| | | | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 12b1338be376a3e5fb606d9fe41b58dc4a9e62c7) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/integer: Fix integer overflow in av_mul_i()Michael Niedermayer2018-11-031-1/+1
| | | | | | | Found-by: fate Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3cc3cb663bf3061e40356392d2f7638de6a479fe) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/pixfmt: Document chroma plane size for odd resolutionsMichael Niedermayer2018-10-071-0/+4
| | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit be0b77e6e83b61c2da338201b5ddfae1c9acedc5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/common: Fix undefined behavior in av_clip_uintp2_c()Michael Niedermayer2018-06-151-1/+1
| | | | | | | | | | 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> (cherry picked from commit aa41d322be71106ce147445f2b42bb763f1eff86) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* hwcontext_vaapi: Fix compilation with libva versions < 1.4.0Mark Thompson2018-04-271-0/+5
| | | | | | The BufferHandle API was added in libva 1.4.0 / VAAPI 0.36.0. (cherry picked from commit 92a0a6bea9dc3087fa8d232b750db1dd0d70b157)
* Bump minor versions for branching release/4.0Michael Niedermayer2018-04-161-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/random_seed: use bcrypt instead of the old wincrypt APISteve Lhomme2018-04-141-9/+10
| | | | | | | | 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>
* Merge commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce'James Almer2018-04-132-12/+1
|\ | | | | | | | | | | | | * commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce': Drop Windows XP support remnants Merged-by: James Almer <jamrial@gmail.com>
| * Drop Windows XP support remnantsDiego Biurrun2018-04-092-12/+1
| |
* | Merge commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42'James Almer2018-04-131-0/+5
|\ \ | |/ | | | | | | | | | | * commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42': qsv: adding Multi Frame Encode support Merged-by: James Almer <jamrial@gmail.com>
| * qsv: adding Multi Frame Encode supportMaxym Dmytrychenko2018-04-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPALwm42018-04-036-14/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge commit '3a7b4ae62c798edbd82bcd8fef863c74ed2acd4a'James Almer2018-03-301-1/+7
|\ \ | |/ | | | | | | | | | | * commit '3a7b4ae62c798edbd82bcd8fef863c74ed2acd4a': arm: Produce .const_data instead of .section .rodata for Mach-O Merged-by: James Almer <jamrial@gmail.com>
| * arm: Produce .const_data instead of .section .rodata for Mach-OMartin Storsjö2018-03-301-1/+7
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge commit '86499771d1228d8303c8eb6509e20c0caaa02da5'James Almer2018-03-291-4/+4
|\ \ | |/ | | | | | | | | | | * commit '86499771d1228d8303c8eb6509e20c0caaa02da5': qsv: align surface width/height to 16. Merged-by: James Almer <jamrial@gmail.com>
| * qsv: align surface width/height to 16.Ruiling Song2018-03-211-4/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | hwcontext_d3d11: Fix crash with valid adapter but no deviceMark Thompson2018-03-281-3/+5
| | | | | | | | | | | | | | | | | | | | This crash was introduced by 8bbf2dacbfb4ead1535dea411035994f507f517d, which could incorrectly overwrite the failure result from creating the device. Fixes ticket #7108. Reviewed-by: wm4 <nfxjfg@googlemail.com>
* | avcodec/avcodec.h: Add encryption info side data.Jacob Trimble2018-03-244-1/+498
| | | | | | | | | | | | | | | | 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>
* | hwcontext_opencl: Add support for mapping DRM objects to BeignetMark Thompson2018-03-221-135/+130
| | | | | | | | Also use that to support mapping VAAPI to Beignet.
* | hwcontext_vaapi: Pass correct read/write flags when exporting surfacesMark Thompson2018-03-221-3/+8
| |
* | hwcontext_vaapi: Add support for legacy DRM mappingMark Thompson2018-03-221-12/+182
| | | | | | | | | | | | 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.
* | hwcontext_drm: Clarify value for unknown format modifiersMark Thompson2018-03-221-0/+3
| |
* | hwcontext_opencl: Avoid deprecation warnings when built with post-1.2 headersMark Thompson2018-03-221-0/+2
| | | | | | | | | | Matching the previous commit. This is not applied to the installed header because it could incorrectly suppress the warning inside user programs.
* | avutil/integer: move the test to the corresponding subdirectoryJames Almer2018-03-203-38/+50
| | | | | | | | | | | | | | And actually enable it. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | hwcontext_vaapi: Always include DRM hwcontext headerMark Thompson2018-03-181-3/+1
| | | | | | | | | | | | Fixes building with VAAPI but not libdrm, which was broken by 389f4c3e0d0a26a7d3d2696017384874cf5e93fa. Just unconditionally include the header, since it doesn't depend on libdrm being present.
* | hwcontext_vaapi: Fix condition for DRM device derivationMark Thompson2018-03-181-1/+1
| | | | | | | | vaGetDisplayDRM() is required for this code to work, libdrm is not.
* | lavu/frame: add QP side datawm42018-03-183-7/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | lavu/frame: fix inconsistent qp_table_buf deprecationwm42018-03-182-3/+5
| | | | | | | | | | | | 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.
* | avutil/log: print level prefix also when no AVClass context is availableTobias Rapp2018-03-161-3/+3
| | | | | | | | | | | | | | | | 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>
* | avutil: bump version after the latest AVOption flag additionJames Almer2018-03-161-1/+1
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | lavu/opt: add bit stream filter option dump support.Jun Zhao2018-03-161-0/+1
| | | | | | | | | | | | | | 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>
* | lavu/opt: add AV_OPT_FLAG_BSF_PARAMJun Zhao2018-03-161-0/+1
| | | | | | | | | | | | | | 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>
* | avutil: add missing version bump for AV_CRC_8_EBUJames Almer2018-03-101-1/+1
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | avutil/parseutils: only accept full us duration, do not accept mss durationMarton Balint2018-03-091-4/+3
| | | | | | | | | | | | | | | | 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>
* | crc: add AV_CRC_8_SBC as a 8 bits CRC with polynomial 0x1DAurelien Jacobs2018-03-073-3/+31
| |
* | Merge commit '8ca39b855a7b0e4d9f726fa9d285bc8edcb953e6'Mark Thompson2018-03-051-0/+1
|\ \ | |/ | | | | | | | | | | * commit '8ca39b855a7b0e4d9f726fa9d285bc8edcb953e6': qsv: Default PicStruct to progressive Merged-by: Mark Thompson <sw@jkqxz.net>
| * qsv: Default PicStruct to progressiveRuiling Song2018-02-221-0/+1
| | | | | | | | | | | | | | | | 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>
| * hwcontext: Perform usual uninitialisation on derived frames contextsMark Thompson2018-02-111-10/+7
| |
| * hwcontext: Perform usual initialisation on derived device contextsMark Thompson2018-02-112-11/+4
| | | | | | | | | | The initialisation should be common. For libmfx, it was previously happening in the derivation function and this moves it out.
* | parseutils: accept only full "ms" suffixRostislav Pehlivanov2018-03-051-2/+2
| | | | | | | | | | | | | | | | 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>
* | parseutils: add support for ms and us suffix for AV_OPT_TYPE_DURATIONAurelien Jacobs2018-03-021-2/+13
| | | | | | | | | | | | | | supported suffixes are: - s: seconds (default when no suffix specified) - m or ms: milliseconds - u or us: microseconds
* | frame: add an av_frame_new_side_data_from_buf functionRostislav Pehlivanov2018-03-013-19/+33
| | | | | | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* | avutil/timecode: fix starting frame number for 59.94 fpsGyan Doshi2018-02-231-1/+1
| | | | | | | | | | | | | | The existing code for adjusting starting frame number assumes 29.97 as stream fps. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>