Commit Graph

105390 Commits

Author SHA1 Message Date
Lynne 7e35e0224c
lavu/tx: do not unconditionally free subcontexts if initialization fails
If a codelet initializes 2 subtransforms, and the second one fails,
the failure would free all subcontexts.
Instead, if there are subcontexts still left, don't free the array.
If all initializations fail, the init() function will return,
and reset_ctx() from the previous step will clean up all contained
subtransforms.
2022-01-29 01:02:37 +01:00
Lynne 265731f201
lavu/tx: reset subcontext pointer if initialization fails
Thanks to mkver for pointing this out.
2022-01-29 00:53:35 +01:00
Lynne 95f02e43e1
lavu/tx: print debug info even if no transforms are found 2022-01-28 08:28:02 +01:00
Steven Liu 9887ec3e9b avutil/tx: add null pointer check after av_mallocz
Fix CID: 1497863
there will get null pointer in attempt to initialize each if alloc memory failed.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-01-28 08:27:48 +01:00
Steven Liu f0044d886f avutil/tx: remove deadcode of the control flow
Fix CID: 1497864
The control flow should return ENOSYS if nb_cd_matches is 0 at before
and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
control flow if (ret >= 0) before end label.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-01-28 08:27:46 +01:00
Lynne 3c831847a8
hwcontext_vulkan: avoid using 64-bit enums
MSVC (2016, but possibly more) still force enums to be basic ints.
2022-01-27 10:27:09 +01:00
Lynne 238e11b71f
lavu/tx: avoid using 64-bit enums
MSVC (2016, but possibly more) still force enums to be basic ints.
2022-01-27 10:21:25 +01:00
Zhao Zhili 2b15acb96a configure: add libplacebo to help message 2022-01-27 10:05:27 +01:00
Wenbin Chen e102fd98d6 libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter
Add intra refresh support to hevc_qsv as well.
Add an new intra refresh type: "horizontal", and an new param
ref_cycle_dist. This param specify the distance between the
beginnings of the intra-refresh cycles in frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:39 +08:00
Wenbin Chen 2ecc4fde5f libavcodec/qsvenc: Add b_strategy option to hevc_qsv
Add b_strategy option to hevc_qsv. By enabling this option, encoder can
use b frames as reference.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:33 +08:00
Wenbin Chen 168c6e23a5 libavcodec/qsvenc: Add max slice size support to hevc_qsv
Add max_slice_size option to hevc_qsv as well.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-27 10:26:26 +08:00
Andreas Rheinhardt 5e9ac1ebec avcodec/h264data: Add missing rational.h inclusion
Fixes checkheaders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-27 02:45:19 +01:00
Lynne 6c397f6bb5
x86/tx_float: add missing FF_TX_OUT_OF_PLACE flag to functions
This caused smaller length dedicated transforms to not be picked up.
2022-01-27 02:18:35 +01:00
Lynne 008c131d68
lavu/tx: clean up CPU flags check
Just makes it more readable.
2022-01-27 02:18:06 +01:00
Lynne 9787005846
x86/tx_float: do not build tx_float_init.c if x86 assembly is disabled
This broke builds with --disable-mmx, which also disabled assembly
entirely, but ARCH_X86 was still true, so the init file tried to find
assembly that didn't exist.
Instead of checking for architecture, check if external x86 assembly
is enabled.
2022-01-27 02:17:46 +01:00
Andreas Rheinhardt b2421c4f26 avcodec/h264_parse: Move ff_h264_get_profile() to h264_ps.h
It is a more fitting place for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:30:54 +01:00
Andreas Rheinhardt c3ff716808 avcodec/h264_*: Remove unnecessary internal.h inclusions
Also remove some other unnecessary headers while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:30:54 +01:00
Andreas Rheinhardt c793e05381 avcodec/h264dec: Remove unnecessary headers
E.g. the inclusion of parser.h comes from a time when
the parser used a H264Context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:30:54 +01:00
Andreas Rheinhardt 5fef87f140 avcodec/h264*: Remove unnecessary h264_mvpred.h inclusions
This is only needed by h264_cabac.c and h264_cavlc.c.
Also fix up the other headers while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:30:54 +01:00
Anton Khirnov d0f0d61392 lavc/svq3: stop including h264dec.h
The only thing that is actually used directly from there is the
PART_NOT_AVAILABLE constant, which can be moved to h264pred.h.

Otherwise it only depends on other indirectly included headers.
2022-01-26 15:30:28 +01:00
Anton Khirnov 359912f0df lavc/x86/h264_qpel: stop unnecessarily including h264dec 2022-01-26 15:23:30 +01:00
Anton Khirnov 76b8ae2e22 lavc/vdpau: stop unnecessarily including h264dec 2022-01-26 15:23:30 +01:00
Anton Khirnov ded77f5654 lavc/h264: move MB_TYPE defs from h264dec.h to h264_parse
Allows to stop including h264dec.h in h264data.c.
2022-01-26 15:23:30 +01:00
Anton Khirnov 2f1716dcd6 lavc/h264_parse: stop including h264dec.h
It is unnecessary and only files that are parts of the decoder (as
opposed to standalone code called by the decoder) are allowed to include
h264dec.h
2022-01-26 15:23:30 +01:00
Anton Khirnov e1027aba68 lavc/h264data.h: stop including h264dec.h
This header does not need anything from there.
2022-01-26 15:23:30 +01:00
Anton Khirnov d552f2535b lavc/h264: move some shared code from h264dec to h264_parse 2022-01-26 15:23:30 +01:00
Anton Khirnov df2ee38178 lavc/h264_parser: add missing headers 2022-01-26 15:23:30 +01:00
Anton Khirnov b6f3334a13 lavc/h264: replace MAX_DELAYED_PIC_COUNT by H264_MAX_DPB_FRAMES 2022-01-26 15:23:30 +01:00
Anton Khirnov ef4537bd1b lavc/h264: replace MAX_DELAYED_PIC_COUNT with FF_ARRAY_ELEMS where appropriate 2022-01-26 15:23:29 +01:00
Anton Khirnov 5484c502db lavc/h264dec.h: Move MMCOOpcode to h264_parse.h
Both parser and decoder use it, so h264_parse is the proper place
for it.
2022-01-26 15:23:08 +01:00
Anton Khirnov b05cebe602 lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNT
They apparently serve the same purpose; the latter is one larger and has
a comment explaining how the value is derived, so seems more
trustworthy.
2022-01-26 15:23:08 +01:00
Andreas Rheinhardt 0ebfd64858 avcodec/h264dec: Move pack8to16 to its only user
Namely to h264_cabac.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:23:08 +01:00
Andreas Rheinhardt b531b58b2c avcodec/h264dec: Move find_start_code() to its only user
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:23:08 +01:00
Lynne 6c8e841824
lavu/tx: do not mix declarations and code 2022-01-26 04:55:23 +01:00
Lynne 28bff6ae54
x86/tx_float: add permute-free FFT versions
These are used in the PFA transforms and MDCTs.
2022-01-26 04:13:58 +01:00
Lynne 350142560b
lavu: bump minor and add APIchanges for new lavu/tx additions 2022-01-26 04:13:57 +01:00
Lynne af94ab7c7c
lavu/tx: add an RDFT implementation
RDFTs are full of conventions that vary between implementations.
What I've gone for here is what's most common between
both fftw, avcodec's rdft and what we use, the equivalent of
which is DFT_R2C for forward and IDFT_C2R for inverse. The
other 2 conventions (IDFT_R2C and DFT_C2R) were not used at
all in our code, and their names are also not appropriate.
If there's a use for either, we can easily add a flag which
would just flip the sign on one exptab.

For some unknown reason, possibly to allow reusing FFT's exp tables,
av_rdft's C2R output is 0.5x lower than what it should be to ensure
a proper back-and-forth conversion.
This code outputs its real samples at the correct level, which
matches FFTW's level, and allows the user to change the level
and insert arbitrary multiplies for free by setting the scale option.
2022-01-26 04:12:46 +01:00
Lynne ef4bd81615
lavu/tx: rewrite internal code as a tree-based codelet constructor
This commit rewrites the internal transform code into a constructor
that stitches transforms (codelets).
This allows for transforms to reuse arbitrary parts of other
transforms, and allows transforms to be stacked onto one
another (such as a full iMDCT using a half-iMDCT which in turn
uses an FFT). It also permits for each step to be individually
replaced by assembly or a custom implementation (such as an ASIC).
2022-01-26 04:12:44 +01:00
Lynne c14976be04
lavu/tx: improve documentation for existing transforms 2022-01-26 04:12:37 +01:00
James Almer 3c804fdd4a avcodec/h264_parser: don't alter decoder private data
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-24 14:14:24 -03:00
Jan Ekström 0a83ecbf48 tests: add test for ffmpeg's fix_sub_duration feature
This long-existing feature calculates subtitle durations by keeping
it around until the following subtitle is decoded, and then utilizes
the following subtitle's pts as the end point of the previous one.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-01-24 12:57:03 +02:00
Gyan Doshi b635ac126f doc/filters: note format constraint for volumedetect 2022-01-24 09:51:07 +05:30
Wenbin Chen 05ba0ffca9 libavcodec/qsvenc: fix a memory leak problem
"qf->frame" ref to input frame but it isn't released. av_frame_unref()
is added before refering qf->frame to new frame to make sure the previous
reference is released.

Reported-by: Mark Samuelson <Mark.Samuelson@sonicfoundry.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-24 10:18:11 +08:00
Kyle Swanson 3d29724c00 avfilter/vf_libvmaf: update filter for libvmaf v2.0.0 2022-01-23 11:41:30 -08:00
Paul B Mahol 06a54a4ec7 avfilter/vf_v360: improve xyz_to_dfisheye() 2022-01-22 18:32:58 +01:00
Andreas Rheinhardt 741b5061ea fate/ffmpeg: Add test for autorotating video
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-22 17:01:16 +01:00
Andreas Rheinhardt 71e2825150 swscale/x86/swscale: Remove superfluous and invalid ';'
Inside a function an unnecessary ';' is just a null statement;
yet outside of it it is actually illegal (but compilers happen
to accept it without warning except when using -pedantic).
So modify the macros to always expect the user to add a ';'.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-22 17:00:45 +01:00
Andreas Rheinhardt ed18b8d79f avformat/hls: Remove redundant cast
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-21 16:47:38 +01:00
Andreas Rheinhardt c24ee7c275 avformat/mux: Peek into the muxing queue for avoid_negative_ts
Peeking into the muxing queue can improve the estimate of
the lowest timestamp needed for avoid_negative_ts in case
the lowest timestamp is in a packet other than the first packet
to be muxed.
This fixes tickets #4536 and #5784 as well as the output from
the matroska-avoid-negative-ts FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-21 16:47:38 +01:00
Andreas Rheinhardt c602deb138 avformat/mux: Preserve sync even if later packet has negative ts
write_packet() has code to shift the packets timestamps
to make them nonnegative or even make them start at ts zero;
this code inspects every packet that is written and if a packet
with negative timestamp (whether this is dts or pts depends upon
another flag; basically: Matroska uses pts, everyone else dts)
is encountered, this is offset to make the timestamp zero.
All further packets will be offset accordingly (with the offset
converted according to the streams' timebases).

This is based around an assumption, namely that the timestamps
are indeed non-decreasing, so that the first packet with negative
timestamps is the first packet with timestamps. This assumption
is often fulfilled given that the default interleavement function
by default interleaves per dts; yet there are scenarios in which
it may not be fulfilled:
a) av_write_frame() instead of av_interleaved_write_frame() is used.
b) The audio_preload option is used.
c) When the timestamps that are made nonnegative/zero are pts
(i.e. with Matroska), because the packet with the smallest dts
is not necessarily the packet with the smallest pts.
d) Possibly with custom interleavement functions.
In these cases the relative sync of the first few packet(s) is offset
relative to the later packets. This contradicts the documentation
("When shifting is enabled, all output timestamps are shifted by
the same amount").

Therefore this commit changes this: As soon as the first packet
with valid timestamps is output, it is checked and recorded whether
the timestamps need to be shifted. Further packets are no longer
checked for needing to be offset; instead they are simply offset.
In the cases above this leads to packets with negative timestamps
(and the appropriate warnings) instead of desync. This will mostly
be fixed in the next commit.

This commit also factors handling the avoid_negative_ts stuff out
of write_packet() in order to be able to return immediately.

Tickets #4536 and #5784 as well as the matroska-avoid-negative-ts-test
are examples of c); as has been said, some timestamps are now negative,
yet the ref file update does not show it because ffmpeg.c sanitizes
the timestamps (-copyts disables it; ffprobe and mkvinfo also show
the original timestamps).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-21 16:47:38 +01:00