Commit Graph

111632 Commits

Author SHA1 Message Date
Marton Balint f983303af4 avcodec: fix misleading indentation warnings after ticks_per_frame deprecation
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-27 21:24:23 +02:00
Richard Acayan 4fa1d3e791 avcodec/v4l2_context: suppress POLLERR and fix crash when buffers are uninitialized
A POLLERR occurs when libavcodec attempts to dequeue output buffers
before enqueuing capture buffers. This could happen to an application
deciding to send the first coded packet. Suppress these POLLERRs when
the buffers are uninitialized and avoid crashing because of enumerating
uninitialized buffers.

See https://trac.ffmpeg.org/ticket/9957 for the original bug report.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-27 21:23:39 +02:00
Jan Ekström 91e1d11d14 avcodec/hevcdec: simplify decrementing of MDCV/CLL flags
Mostly done to be able to update the comment so that it no longer
mentions the same flag twice.
2023-07-27 21:45:43 +03:00
Jan Ekström 43e63ff20a avcodec: move content light level SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Jan Ekström 33358b862c avcodec: move mastering display colour volume SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Michael Niedermayer 0ba719f726
avcodec/cbs_h2645: Avoid an unchecked bytesteram read
The unchecked read caused the 2nd subsequent tell call to move backward resulting
in a negative length

Fixes: assertion failure
Fixes: 60276/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5434126636023808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Michael Niedermayer ac3e6b74bd
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
Suggested-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Michael Niedermayer 509ce40f18
avformat/imf_cpl: xmlNodeListGetString() can return NULL
Fixes: NULL pointer dereference
Fixes: 60166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5998301577871360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Michael Niedermayer c5c719f030
avcodec/h266_metadata_bsf: Check if there are CodedBitstreamFragment units
Fixes: NULL pointer dereference
Fixes: 60269/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-5215449416335360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:28 +02:00
Michael Niedermayer 574f3aaeff
avcodec/vmixdec: Fix several integer anomalies
Fixes: vmixdec.c:132:34: runtime error: signed integer overflow: -2147483648 * 1856 cannot be represented in type 'int'
Fixes: vmixdec.c:119:20: runtime error: signed integer overflow: -1256 + -2147483648 cannot be represented in type 'int'
Fixes: vmixdec.c:137:36: runtime error: signed integer overflow: 2147483416 * 16 cannot be represented in type 'int'
Fixes: 59843/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-4857434624360448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:28 +02:00
James Almer 673862e947 avcodec/cbs_h266_syntax_template: add missing checks to subpic dimension values
Fixes: division by zero
Fixes: 60306/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5538913553612800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-25 18:06:57 -03:00
James Almer c92948de40 avcodec/decode: consistently set channel info when parsing param change side data
avctx->ch_layout was being left unchanged.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-25 14:13:42 -03:00
James Almer d383ae43c2 avcodec/codec_par: always free side data in the destination AVCodecContext
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-25 14:13:42 -03:00
Arnie Chang 8d1316e515 lavc/h264chroma: RISC-V V add motion compensation for 4xH and 2xH chroma blocks
Optimize the put and avg filtering for 4xH and 2xH blocks

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-07-25 19:10:40 +03:00
Hendrik Leppkes 6dd5f95093 avformat/flvdec: fix size desync when reading timestamp offsets
The size offset was previously being accounted for in flv_set_video_codec
for h264 and mpeg4, instead of being directly accounted for in the spot
where its read, which desynced on HEVC streams.

For clarity, move the size offset directly to the parsing, similar to
how its done for all other header fields.
2023-07-25 13:37:32 +02:00
Timo Rothenpieler f8035bc426 avformat/flvenc: write proper timestamps when muxing hevc 2023-07-25 02:13:37 +02:00
Paul B Mahol 60244d0bec avfilter/af_afir: fix possible array read-overflow 2023-07-24 11:01:21 +02:00
Paul B Mahol 9fb2efe3b3 avfilter/avf_showcwt: make read only variable const 2023-07-24 11:01:21 +02:00
Andreas Rheinhardt 6e5e74c55b avcodec/evc*: Improve included headers
In particular, don't include avcodec.h in evc_frame_merge_bsf.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-24 10:37:07 +02:00
Andreas Rheinhardt 3fe98db7bb avcodec/vvc_mp4toannexb_bsf: Improve included headers
A BSF should never include avcodec.h at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-24 10:37:07 +02:00
Haihao Xiang 5b11ee9429 lavd/opengl_enc: fix a compiler error
glcontext was added under CONFIG_SDL2

libavdevice/opengl_enc.c: In function ‘opengl_draw’:
libavdevice/opengl_enc.c:1204:15: error: ‘OpenGLContext’ has no member
named ‘glcontext’

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-07-24 10:17:51 +08:00
Wenbin Chen 13f49a7c62 libavfilter/vf_dnn_detect: bbox index may bigger than bbox number
Fix a bug that queried bbox index may bigger than bbox's total number.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-07-24 09:34:11 +08:00
Michael Niedermayer 87f76d3bee
avcodec/aacdec_template: Fix undefined signed interger operations
Fixed: signed integer overflow: -2 * -1085502286 cannot be represented in type 'int'
Fixed: 57986/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5123651145170944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-23 18:08:15 +02:00
Michael Niedermayer 40cec0b465
avcodec/wavarc: Fix k limit
The implementation does not support k=32

Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 57976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5911925807775744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-23 18:07:36 +02:00
Andreas Rheinhardt 071c625ad7 fftools/ffmpeg_opt: Reduce scope of variables for deprecated code
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-23 17:55:38 +02:00
Andreas Rheinhardt 8bb1bcf47d fftools/ffmpeg_opt: Fix leak on error
Fixes Coverity id #1539096.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-23 17:55:38 +02:00
Andreas Rheinhardt 0368ded1a9 fftools/opt_common: Fix leak on error
Fixes Coverity issue #743443.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-23 17:55:38 +02:00
Andreas Rheinhardt 2654347d7a fftools/ffmpeg_opt: Fix leak on error
Fixes Coverity issue #1539097.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-23 17:55:38 +02:00
Andreas Rheinhardt 2a44c4bc9e fftools/ffmpeg_mux_init: Fix leak on error
Fixes Coverity issue #1539098.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-23 17:55:38 +02:00
Niklas Haas e9e37ea2f1 avfilter/vf_libplacebo: fix skip_aa option range
Max incorrectly specified as 0, should be 1.
2023-07-23 17:50:41 +02:00
Zhao Zhili 89f5124d0a avfilter: add transpose_vt for videotoolbox pix_fmt
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-23 11:52:28 +08:00
Zhao Zhili c2c96c4c24 avfilter: add scale_vt for videotoolbox pix_fmt
For example,

./ffmpeg -hwaccel videotoolbox \
	-hwaccel_output_format videotoolbox_vld \
	-i ios-265.mov \
	-c:v hevc_videotoolbox \
	-profile:v main \
	-b:v 3M \
	-vf scale_vt=w=iw/2:h=ih/2:color_matrix=bt709:color_primaries=bt709:color_transfer=bt709 \
	-c:a copy \
	-tag:v hvc1 \
	/tmp/test.mp4

Input: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 3840x2160
Output: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709, progressive), 1920x1080
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-23 11:51:57 +08:00
Zhao Zhili 6c90fcd9e6 avcodec/videotoolboxenc: use color parameters conversion from avutil
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-23 11:51:42 +08:00
Paul B Mahol b2ceed406b avfilter/avf_showcwt: reduce memory usage 2023-07-22 22:27:57 +02:00
Rémi Denis-Courmont f25ad0fe02 checkasm: improve Linux perf error message
Report the failing system call name, as is convention, rather than just
a rather unhelpful "syscall".
2023-07-22 21:35:15 +03:00
Rémi Denis-Courmont 983af74452 macos_kperf: fix incomplete prototype 2023-07-22 21:35:15 +03:00
Rémi Denis-Courmont c644aabec8 timer: don't leak perf FD if zero 2023-07-22 21:35:15 +03:00
Paul B Mahol ffa3edbf51 avfilter/avf_showcwt: extend min frequency accepted range
Also always check that min frequency is lower than max frequency.
2023-07-22 18:05:38 +02:00
Paul B Mahol c24c7bcc95 avfilter/avf_showcwt: no need for big forward FFT with small sample rates 2023-07-22 18:05:38 +02:00
Paul B Mahol e6168e43a2 avfilter/avf_showcwt: improve analysis
Make inverse FFT step always power of 2 in size.
2023-07-22 18:05:38 +02:00
Michael Niedermayer c41ab871c7
avformat/id3v2: Free buffer in decode_str()
Fixes: memleak
Fixes: 60058/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5665259244093440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 17:05:47 +02:00
Michael Niedermayer f9b29451e4
avcodec/rka: Fix integer overflow in decode_filter()
Fixes: signed integer overflow: 2147443649 + 65535 cannot be represented in type 'int'
Fixes: 60054/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5095674572832768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 17:05:47 +02:00
Michael Niedermayer 167b4f56f1
avformat/rka: bps < 8 is invalid
Fixes: division by zero
Fixes: 57828/clusterfuzz-testcase-minimized-ffmpeg_dem_RKA_fuzzer-6571818338353152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Michael Niedermayer fd5aa93a37
avcodec: Rename ff_kbd_window_init() as it will be needed from outside libavcodec
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Michael Niedermayer cf00f60bab
avcodec/kbdwin: Support arbitrary sized windows
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Michael Niedermayer 94d44dbe21
avcodec/pcm: allow Changing parameters
SDR needs this for switching between mono and stereo stations

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Michael Niedermayer 8f48a62151
avutil/tx_template: extend to 2M
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Kieran Kunhya a4e616824b libavutil: Remove TOMI CPU 2023-07-22 00:36:53 +01:00
Rémi Denis-Courmont c2b38619c0 swscale/rgb2rgb2: rework RISC-V V shuffle_bytes_{1230,3012}
This avoids strided loads.

Before:
shuffle_bytes_1230_rvv_i32: 308.7
shuffle_bytes_3012_rvv_i32: 308.7

After:
shuffle_bytes_1230_rvv_i32: 46.7
shuffle_bytes_3012_rvv_i32: 46.7
2023-07-21 22:18:02 +03:00
Rémi Denis-Courmont 15982554e6 swscale/rgb2rgb2: rework RISC-V V shuffle_bytes_{0321,2103}
This avoids strided loads.

Before:
shuffle_bytes_0321_rvv_i32: 307.7
shuffle_bytes_2103_rvv_i32: 308.7

After:
shuffle_bytes_0321_rvv_i32: 59.7
shuffle_bytes_2103_rvv_i32: 61.5
2023-07-21 22:18:02 +03:00