Commit Graph

109041 Commits

Author SHA1 Message Date
Anton Khirnov ccab823559 fftools/ffmpeg_mux_init: constify metadata specifier arguments 2022-10-25 11:04:42 +02:00
Anton Khirnov aa0ce91f57 fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_file
Use a local variable instead. This will allow making OptionsContext
const in future commits.
2022-10-25 11:04:42 +02:00
Anton Khirnov 5ccc151bf2 fftools/ffmpeg: factor out copying metadata/chapters from of_open()
This code shares variables like OptionsContext.metadata_*_manual, so it
makes sense to group it together.
2022-10-25 11:04:42 +02:00
Anton Khirnov 21ef1f2cec fftools/ffmpeg_demux: log when the demuxer thread terminates
Similar to what is done for muxing, may be useful for debugging.
2022-10-25 11:04:42 +02:00
Anton Khirnov 5c1a096d02 fftools/ffmpeg: move nb_streams_warn from InputFile to Demuxer
It is private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov d8f7ce38da fftools/ffmpeg_demux: do not log to the demuxer context
Only the demuxer itself is supposed to do that.
2022-10-25 11:04:42 +02:00
Anton Khirnov 541104f3a3 fftools/ffmpeg: move duration/time_base from InputFile to Demuxer
They are private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov 5bc1f177d3 fftools/ffmpeg: move threading fields from InputFile to Demuxer
They are private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov c20977c4e0 fftools/ffmpeg: drop free_input_threads()
Stop demuxer threads in ifile_close() instead. Simplifies the demuxer
API.
2022-10-25 11:04:42 +02:00
Anton Khirnov 295848bacb fftools/ffmpeg: move closing the input file into a separate function
For now this is just closing the format context and freeing InputFile,
but will contain more in the future.
2022-10-25 11:04:42 +02:00
Anton Khirnov 09cd147dcc fftools/ffmpeg: drop init_input_threads()
Start threads implicitly when ifile_get_packet() is called. Simplifies
the demuxer API.
2022-10-25 11:04:42 +02:00
Anton Khirnov 6975320506 fftools/ffmpeg_demux: add demuxer private data
Move InputFile.loop into it.
2022-10-25 11:04:42 +02:00
Anton Khirnov 78efefa9a5 fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.c
This is similar to what was done before for output files and will allow
introducing demuxer-private state in future commits

Unlike for muxing, the code is moved to existing ffmpeg_demux.c rather
than to a new file. The reason is just file size - the demuxing code is
much smaller than muxing.
2022-10-25 11:04:42 +02:00
Haihao Xiang 1af499cde0 lavc/qsvenc_hevc: accept HDR metadata if have
The SDK may accept HDR metadata via mfxEncodeCtrl::ExtParam

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-25 08:49:48 +08:00
Haihao Xiang dc26bd8e6d lavc/qsvenc: enlarge the maximum number of ExtParam buffers on mfxEncodeCtrl
The next commit and other commits in future will use more ExtParam
buffers.

And combine 2 free functions into single one

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-25 08:49:48 +08:00
Haihao Xiang 76965fa411 lavc/qsvenc: fix check to avoid segfault
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-25 08:49:48 +08:00
Andreas Rheinhardt d7c3e52fbf avutil/integer: Use '|' instead of '+' where it is more natural
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 20:11:20 +02:00
Andreas Rheinhardt 9a6cdd1ba3 avutil/integer: Fix undefined left shifts of negative numbers
Affected the integers FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 18:04:24 +02:00
Andreas Rheinhardt f49375f28f avutil/aes: Don't use out-of-bounds index
Up until now, av_aes_init() uses a->round_key[0].u8 + t
as dst of memcpy where it is intended for t to greater
than 16 (u8 is an uint8_t[16]); given that round_key itself
is an array, it is actually intended for the dst to be
in a latter round_key member. To do this properly,
just cast a->round_key to unsigned char*.

This fixes the srtp, aes, aes_ctr, mov-3elist-encrypted,
mov-frag-encrypted and mov-tenc-only-encrypted
FATE-tests with (Clang-)UBSan.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 16:28:14 +02:00
Andreas Rheinhardt 73930e4f93 avutil/aes: Don't use misaligned pointers
The AES code uses av_aes_block, a union consisting of
uint64_t[2], uint32_t[4], uint8_t[4][4] and uint8_t[16].
subshift() performs byte-wise manipulations of two av_aes_blocks,
but when encrypting, it does so with a shift of two bytes;
more precisely, it uses
"av_aes_block *s1 = (av_aes_block *) (s0[0].u8 - s)"
and lateron uses the uint8_t[16] member to access s0.
Yet av_aes_block requires to be suitably aligned for
the uint64_t[2] member, which s0[0].u8 - 2 is certainly
not. This is in violation of 6.3.2.3 (7) of C11. UBSan
reports this in the aes_ctr, mov-3elist-encrypted,
mov-frag-encrypted, mov-tenc-only-encrypted and srtp
tests.
Furthermore, there is another issue here: The pointer points
outside of s0; this works, because all the accesses lateron
use an index >= 3. (Clang-)UBSan reports this as
"runtime error: index -2 out of bounds for type 'uint8_t[16]'".

This commit fixes both of these issues: The latter issue
is fixed by applying an offset of "+ 3" during the cast
and subtracting this from the indices used lateron.
The former issue is solved by not casting to av_aes_block*
at all; instead simply cast to unsigned char*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 16:28:14 +02:00
Andreas Rheinhardt 7c5d256c9c avcodec/motion_est_template: Avoid using last + 1 element of array
For an int array[8][2] using &array[8][0] (which is an int*
pointing to the element beyond the last element of array)
triggers a "runtime error: index 8 out of bounds for type 'int[8][2]'"
from (Clang-)UBSan in the fate-vsynth(1|2|_lena)-snow tests.

I don't know whether this is really undefined behaviour or does not
actually fall under the "pointer arithmetic with the element beyond
the last element of the array is allowed as long as it is not
accessed" exception". All I know is that the code itself does not
read from beyond the last element of the array.

Nevertheless rewrite the code to a form that UBSan does not complain
about.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 16:28:14 +02:00
Andreas Rheinhardt c76155236f avcodec/snow_dwt: Fix left shifts of negative numbers
Affected the vsynth(1|2|_lena)-snow(|-hpel) tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 16:28:14 +02:00
Wenbin Chen d79c240196 doc/encoders: Add doc for av1_qsv
Add doc for av1_qsv.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-10-24 13:30:22 +08:00
Wenbin Chen dc9e4789a3 libavcodec/qsvenc_av1: add av1_qsv encoder
It is available only when libvpl is enabled. MSDK doesn't support av1
encoding.

sample command:
ffmpeg -f rawvideo -pix_fmt nv12 -s 1920x1080 -i input.yuv \
-c:v av1_qsv output.ivf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-24 13:30:22 +08:00
Anton Khirnov 874a6f2090 fftools/ffmpeg: set thread names 2022-10-24 02:00:31 +02:00
Anton Khirnov a2f5913857 lavf: set internal thread names 2022-10-24 02:00:31 +02:00
Anton Khirnov 5f82447dfc lavc/pthread_frame: set worker thread names 2022-10-24 02:00:31 +02:00
Anton Khirnov f66e794672 lavu/thread: add an internal function for setting thread name
Linux-only for now.
2022-10-24 02:00:31 +02:00
Andreas Rheinhardt 5ec9d26b2b avcodec/mpegvideo: Don't use ScanTable where unnecessary
For the intra_[hv]_scantables, only ScanTable.permutated
is used, so one only needs to keep that.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 01:23:59 +02:00
Andreas Rheinhardt 33b838aad6 avcodec/mpegvideo: Move ASM-offset warning to its proper place
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:16 +02:00
Andreas Rheinhardt b76f07b8c3 avcodec/eatgq: Move transient GetByteContext from context to stack
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:15 +02:00
Andreas Rheinhardt 7f45691769 avcodec/idctdsp: Move ScanTable to mpegvideo
Only used there.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:14 +02:00
Andreas Rheinhardt de133d22da avcodec/wmv2dec: Remove unnecessary ScanTables
Only ScanTable.scantable is used for the abt_scantables.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:13 +02:00
Andreas Rheinhardt da93e4fb27 avcodec/speedhqdec: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:12 +02:00
Andreas Rheinhardt 69f46ff586 avcodec/mjpegenc_common: Only pass what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:11 +02:00
Andreas Rheinhardt 3cdfb146b2 avcodec/mjpegdec: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:10 +02:00
Andreas Rheinhardt 5975bb7f81 avcodec/mimic: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:09 +02:00
Andreas Rheinhardt 60c3516941 avcodec/mdec: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:08 +02:00
Andreas Rheinhardt ec2b07db79 avcodec/intrax8: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:07 +02:00
Andreas Rheinhardt 9f64b06758 avcodec/g2meet: Pre-permute quantization tables
Allows to avoid a permutation lateron.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:06 +02:00
Andreas Rheinhardt f1a7bf0227 avcodec/g2meet: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:05 +02:00
Andreas Rheinhardt 250d556343 avcodec/cavs: Only keep what is needed from IDCTDSP-API
Namely ScanTable.permutated. The rest of the IDCTDSP-API
is unused as cavs has its own idct.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:03 +02:00
Andreas Rheinhardt b1bcff3ac0 avcodec/dnxhddec: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:02 +02:00
Andreas Rheinhardt 1da5da19b1 avcodec/asvdec: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:01 +02:00
Andreas Rheinhardt 0702fefd88 avcodec/agm: Only keep what is used from ScanTable
Namely ScanTable.permutated.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:47:00 +02:00
Andreas Rheinhardt ee0e03fe77 avcodec/idctdsp: Add function to apply permutation to array
It is the part of ff_init_scantable() that is used
by all users of said function.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:59 +02:00
Andreas Rheinhardt 0d53d92e3a avcodec/imm4: Remove useless ScanTable
Also rename the scantable variable to idct_permutation
to better reflect what it actually is.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:58 +02:00
Andreas Rheinhardt 4c9dee6e8d avcodec/aic: Remove useless ScanTable
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:56 +02:00
Andreas Rheinhardt 3cabe958a7 avcodec/eatqi: Don't use IDCTDSP-API unnecessarily
The eatqi decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:53 +02:00
Andreas Rheinhardt a8f34f0877 avcodec/eatgq: Don't use IDCTDSP-API unnecessarily
The eatgq decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so. It also renames perm to scantable,
because it is only the scantable as given by the spec without
any further permutation performed by us.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:49 +02:00