1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

109406 Commits

Author SHA1 Message Date
Paul B Mahol
8556006984 avfilter/af_afir: improve output quality with small minp
Remove direct convolution implementation as its give worse
results. Simplifies code too.
2022-12-11 18:33:24 +01:00
Andreas Rheinhardt
07e0732a9a avcodec/mjpegdec: Move smv_process_frame() to other SMV stuff
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
05086a6c93 avcodec/mjpegdec: Only use receive_frame for SMVJPEG
Only one codec using mjpegdec.c actually creates multiple
frames from a single packet, namely SMVJPEG. The other can
use the ordinary decode callback just fine. This e.g. has
the advantage of confining the special SP5X/AMV code to sp5xdec.c.

This reverts most of commit e9a2a8777317d91af658f774c68442ac4aa726ec;
of course it is not a simple revert: Way too much has changed;
furthermore, outright reverting the sp5xdec.c changes would readd
a stack packet to sp5x_decode_frame() which is not desired.
In order to avoid this without modifying the given AVPacket,
a variant of ff_mjpeg_decode_frame() with explicit buf and size
parameters has been added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
ec2d582cb0 avcodec/mjpegdec: Avoid checks whose results are known at compile-time
Namely the result of the check for smv_next_frame > 0 in
smv_process_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
b640cda95d avcodec/mjpegdec: Move special SMVJPEG-code to SMVJPEG-only function
This automatically avoids runtime checks for whether
the decoder is SMVJPEG.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
9cdecba3bd avcodec/mjpegdec: Restrict AVID MJPEG to non-SMVJPEG
AVID content is not supposed to be SMVJPEG; given that
both these codecs involve manipulating image dimensions
and cropping dimensions, it makes sense to restrict
the AVID codepaths to non-SMVJPEG codecs in order not
to have to think about what if SMVJPEG happens to
have a codec tag indicating AVID.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:14:48 +01:00
Paul B Mahol
442bbdb3c5 avfilter/drawutils: rgb48/bgr48 is supported 2022-12-10 14:57:05 +01:00
Timo Rothenpieler
7e8b539389 avcodec/nvdec: make explicit copy of frames unless user requested otherwise 2022-12-10 00:52:34 +01:00
Timo Rothenpieler
7a8d78f7e3 lavc: add new unsafe_output hwaccel_flag 2022-12-10 00:52:33 +01:00
Philip Langdale
9651f873f8 lavu/pixdesc: handle xv30be in av_[read|write]_image_line
xv30be is an obnoxious format that I shouldn't have included in the
first place. xv30 packs 3 10bit channels into 32bits and while our
byte-oriented logic can handle Little Endian correctly, it cannot
handle Big Endian. To avoid that, I marked xv30be as a bitstream
format, but while that didn't produce FATE errors, it turns out that
the existing read/write code silently produces incorrect results, which
can be revealed via ubsan.

In all likelyhood, the correct fix here is to remove the format. As
this format is only used by Intel vaapi, it's only going to show up
in LE form, so we could just drop the BE version. But I don't want to
deal with creating a hole in the pixfmt list and all the weirdness that
comes from that. Instead, I decided to write the correct read/write
code for it.

And that code isn't too bad, as long as it's specialised for this
format, as the channels are all bit-aligned inside a 32bit word.
2022-12-08 21:15:44 -08:00
Paul B Mahol
55753fc712 avcodec/mjpegdec: check that component linesize is always valid 2022-12-08 23:54:07 +01:00
Michael Niedermayer
a9d15d43eb
avcodec/vqcdec: Check width & 15
Various parts of the code assume that width can be divided by various powers of 2
without rounding

Fixes: out of array access
Fixes: 53623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-6209269924233216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-12-08 17:48:21 +01:00
Zhao Zhili
2401494e96 avcodec/mediacodecenc: configure profile
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-08 23:55:37 +08:00
Zhao Zhili
0da8802e95 avcodec/mediacodec_wrapper: use hardcoded value of profiles from MediaCodecInfo
Those are static const values and documented at
https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel
No runtime query is needed. Now the method can be used without JVM.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-08 23:55:06 +08:00
Zhao Zhili
3dcb630ca1 avcodec/mediacodecenc: add option to select codec by name
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-08 23:54:50 +08:00
Zhao Zhili
567633895b avcodec/mediacodecenc: check missing Surface
It's an invalid combination of Java MediaCodec with ANativeWindow.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-08 23:53:20 +08:00
Zhao Zhili
a63834b236 avcodec/mediacodec: fix missing crop info when use NDK MediaCodec
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-08 23:52:39 +08:00
Paul B Mahol
f0f19f3d3d avfilter: add corr video filter 2022-12-08 13:03:42 +01:00
Timo Rothenpieler
9ca139b2aa avcodec/nvenc: fix vbv buffer size in cq mode
The CQ calculation gets thrown off and behaves very nonsensical
if it isn't set to 0.
2022-12-08 12:31:02 +01:00
Brian Norris
b62940bec3 lavu/hwcontext_vaapi: Skip 'vgem' driver
There can be more than one available render node, and it's not
guaranteed the first node we come across is the correct one. In
particular, 'vgem' devices are common, and are
never VAAPI-enabled and thus not valid here.

We have a 'kernel_driver' arg already for specifying a single driver we
*do* want, but it doesn't support a negation, nor a list. It's easier
just to automatically skip 'vgem' anyway, to avoid foisting this burden
on users.

This has precedent in libva-utils already:

  bfb6b98ed62a exclude vgem node and invalid drm node in vainfo
  bfb6b98ed6

Signed-off-by: Brian Norris <briannorris@chromium.org>
2022-12-08 14:30:04 +08:00
Haihao Xiang
4061c22428 lavfi/vf_scale_qsv: remove PI, PHI and E
PI, PHI and E are defined in libavutil/eval.c, and user may use these
constants for scale_qsv filter, so we needn't re-define these variables
in vf_scale_qsv.c

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:29:23 +08:00
Haihao Xiang
3552dba0e1 lavfi/vf_vpp_qsv: accept P010 input in system memory
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:25:52 +08:00
Haihao Xiang
e5faa1d50c lavfi/vf_vpp_qsv: allow user to set scale_mode with constants
$ ffmpeg -f lavfi -i testsrc -vf "format=nv12,vpp_qsv=scale_mode=hq" -f
null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:24:21 +08:00
Haihao Xiang
d51edd225d lavfi/vf_vpp_qsv: use macros for extra mfx parameter
Make it easy to add new extra mfx parameter buffer. No functional
change.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:22:12 +08:00
Wenbin Chen
20f2941191 libavfilter/qsvvpp: Change the alignment to meet the requirement of YUV420P format
When process yuv420 frames, FFmpeg uses same alignment on Y/U/V
planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's
pitch, which makes U/V planes 16-bytes aligned. We need to set
a separate alignment to meet runtime's behaviour.

Now alignment is changed to 16 so that the linesizes of U/V planes
meet the requirment of VPL/MSDK. Add get_buffer.video callback to
qsv filters to change the default get_buffer behaviour.

Now the commandline works fine:
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 3082x1884 \
-i ./3082x1884.yuv -vf 'vpp_qsv=w=2466:h=1508' -f rawvideo \
-pix_fmt yuv420p 2466_1508.yuv

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-12-08 14:21:07 +08:00
James Almer
d4f853f4ed doc/filters.texi: add documentation for the ts_sync_mode framesync option
Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 14:37:11 -03:00
James Almer
2eb7151261 avcodec/pthread_frame.c: keep the last_pkt_props from worker threads in sync with the user context
Making it point to the input packet results in different behavior during flush,
where its contents will be that of an empty packet instead of containing the
props from the last input packet fed to the decoder.
After this change, decoding with more than one thread will shield the same
results as using a single thread.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 09:01:24 -03:00
James Almer
0afdc398ce avcodec/decode: don't set last_pkt_props->size
Use the opaque field instead to keep this value.
No functional change, but removes the hack that made the packet technically
invalid, allowing the safe usage of functions like av_packet_ref() on it
if required.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 08:55:38 -03:00
James Almer
b1fdb0b347 Revert "avcodec/decode: use a packet list to store packet properties"
The idea behind last_pkt_props was to store the properties of the last packet
fed to the decoder. Any sort of queueing required by CODEC_CAP_DELAY decoders
that consume several packets before they start outputting frames should be done
by the decoders in question. An example of this is libdav1d.

This is required for the following commits that will fix last_pkt_props in
frame threading scenarios, as well as maintain its contents during flush.

This revers commit 022a12b306.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 08:55:33 -03:00
James Almer
c06e88e05c avcodec/wmadec: clear pts when returning a frame during flush
This will be needed for the following commit, after which ff_get_buffer() will
stop setting frame->pts to AV_NOPTS_VALUE.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 08:48:47 -03:00
James Almer
8dcb8d1b80 avcodec/binkaudio: clear pts when returning more than one frame per input packet
This will be needed for a following commit, after which ff_get_buffer() will
stop setting frame->pts to AV_NOPTS_VALUE.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 08:48:47 -03:00
James Almer
c2a870222d avcodec/rawdec: remove redundant code setting frame properties
These same values were already set in the ff_decode_frame_props() call above.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-07 08:46:32 -03:00
Paul B Mahol
b08e8d520e doc/filters: link framesync options for msad/identity/vif 2022-12-07 12:23:16 +01:00
Paul B Mahol
f2e0351b77 avfilter/vf_vif: add missing framesync options 2022-12-07 12:23:16 +01:00
Andreas Rheinhardt
6aa7b0c463 avutil/tests/dict: Explicitly test av_dict_iterate()
This commit tests it in a way that automatically checks
that using av_dict_iterate() is equivalent to using
av_dict_get() with key "" and AV_DICT_IGNORE_SUFFIX.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-07 10:22:02 +01:00
Marvin Scholz
81747b5259 avutil: use av_dict_iterate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-07 10:22:02 +01:00
Paul B Mahol
cb9ab38c52 avfilter/vf_chromanr: split inner loops
Makes overall faster processing in default case.
2022-12-07 00:57:25 +01:00
Paul B Mahol
cc11afe502 avfilter/avf_showvolume: make rms meter actually get rms of whole frame 2022-12-06 17:31:56 +01:00
Timo Rothenpieler
45216e33e2 avcodec/nvenc: notify users about rc_lookahead clipping 2022-12-05 21:21:41 +01:00
Timo Rothenpieler
ac0f42d893 avcodec/nvenc: explicitly disable lookahead if lacking sufficient surfaces
It could already be enabled by the preset, so it needs explicitly
disabled in this case.
2022-12-05 21:21:41 +01:00
Paul B Mahol
520111c610 avfilter/vf_thumbnail: allow to change stats log level 2022-12-05 21:08:02 +01:00
Paul B Mahol
46642ceeaf avfilter/vf_thumbnail: optimize planar processing path 2022-12-05 21:07:11 +01:00
Paul B Mahol
6c814093d8 avfilter/vf_bm3d: switch to TX from lavu 2022-12-04 23:02:07 +01:00
Michael Niedermayer
9bfae83856
avcodec/wavpack: Fix overflow in p=31
Untested with "non fuzzed" samples as i have no such file
The reference 5.6.0 decoder appears to also have undefined behavior in the lossless codepath for this

Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 50930/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6319201949712384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-12-04 21:45:19 +01:00
Timo Rothenpieler
ee650398ec avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one
Before this, the filter blindly casts to AVVulkanDeviceContext and
passes invalid values to libplacebo if it's not.
2022-12-04 15:22:13 +01:00
Paul B Mahol
fc016fd665 avfilter/vf_exposure: ensure that scale is always > 0 2022-12-04 13:22:36 +01:00
Paul B Mahol
ec32c62cad avfilter/avf_showcwt: write also to alpha plane if available 2022-12-04 11:18:48 +01:00
Paul B Mahol
7bf74f909d avfilter/af_afftdn: fix invalid duplicated use of sizeof() 2022-12-03 21:28:54 +01:00
Lynne
710d83bdde
lavu/tx: zero-out imaginary of last coefficient in forward RDFTs
We didn't do this, because it's zero anyway, but it prevents users from using
uninitialized memory in calculations.
2022-12-03 21:02:00 +01:00
Paul B Mahol
0c6e40c174 avcodec/cfhdenc: stop crashing on heights not multiple of 8
Fixes overreads and artifacts for some heights not multiple of 16.
2022-12-03 20:11:43 +01:00