Commit Graph

107759 Commits

Author SHA1 Message Date
Anton Khirnov 6353b28042 fftools/ffmpeg: drop unused hwaccel variables 2022-07-28 16:37:16 +02:00
Anton Khirnov cb045f7f5a fftools/ffmpeg_opt: drop a redundant assignment
The codec type will be set by avcodec_alloc_context3(), there is no
reason to set it manually.
2022-07-28 16:37:16 +02:00
Anton Khirnov 8384d8403f fftools/ffmpeg: stop allocating an encoder context when not encoding 2022-07-28 16:37:16 +02:00
Anton Khirnov 1a378b8274 fftools/ffmpeg: deprecate -psnr
It is entirely redundant with -flags +psnr.
2022-07-28 16:37:16 +02:00
Anton Khirnov 1eae0ee02e fftools/ffmpeg: do not use the encoder context for streamcopy
The streamcopy initialization code briefly needs an AVCodecContext to
apply AVOptions to. Allocate a temporary codec context, do not use the
encoding one.
2022-07-28 16:37:16 +02:00
Anton Khirnov 61e42e04ed fftools/ffmpeg: drop OutputStream.ref_par
It serves no purpose, codec parameters can be written directly to
AVStream.codecpar with the same effect.
2022-07-28 16:37:16 +02:00
Anton Khirnov 8cbf229c94 fftools/ffmpeg: drop the -vol option
It has been deprecated in favor of the volume filter since 2012.
2022-07-28 16:37:16 +02:00
Anton Khirnov a04d83181a fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt()
It only uses strict_std_compliance, so pass just that value. Makes it
more clear what fields are accessed.
2022-07-28 16:37:16 +02:00
Anton Khirnov 7650d34367 fftools/ffmpeg_filter: remove unused function argument 2022-07-28 16:37:16 +02:00
Anton Khirnov 1cd60d3b35 fftools/ffmpeg: remove an unnecessary avcodec_close() call
No encoders can possibly be opened at this point. And even if some were,
they would be closed in ffmpeg_cleanup().
2022-07-28 16:37:16 +02:00
Anton Khirnov c2f2dd0296 fftools/ffmpeg: stop accessing the encoder context unnecessarily
The same information is available from AVStream.codecpar. This will
allow to stop allocating an encoder unless encoding is actually
performed.
2022-07-28 16:37:16 +02:00
Mattias Wadman 1ec1a48458 avfilter/vf_zscale: Add smpte240m transfer option and fix matrix option typo
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-07-28 16:17:23 +02:00
Andreas Rheinhardt 6f7d3bde11 avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9
Instead replace VP56mv by new and identical structures VP8mv and VP9mv.
Also replace VP56Frame by VP8FrameType in vp8.h and use that
in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only
been used by VP8, and use VP8_FRAME_ALTREF as replacement for
its usage in VP8 as this is more in line with VP8 verbiage.

This allows to remove all inclusions of vp56.h from everything
that is not VP5/6. This also removes implicit inclusions
of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9
files.

(This also fixes a build issue: If one compiles with -O0 and disables
everything except the VP8-VAAPI encoder, the file containing
ff_vpx_norm_shift is not compiled, yet this is used implicitly
by vp56_rac_gets_nn() which is defined in vp56.h; it is unused
by the VP8-VAAPI encoder and declared as av_unused, yet with -O0
unused noninline functions are not optimized away, leading to
linking failures. With this patch, said function is not included
in vaapi_encode_vp8.c any more.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt 7ab9b30800 avcodec/vp56: Move VP5-9 range coder functions to a header of their own
Also use a vpx prefix for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt 80ad06ab1b avcodec/vp56: Move VP8/9-only rac functions to a header of their own
Also rename these functions from vp8_rac_* to vp89_rac_*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt 062599d786 avcodec/vp56.h: Move VP8-only functions to vp8.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt f3fef1259c avcodec/hq_hqa: Remove transient GetByteContext from context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Xu Guangxin 81ebf40efa lavc/hevcdec: respect the value of no_output_of_prior_pics_flag
Even resolution or number of picture stores changes, we still need
follow no_output_of_prior_pics_flag in next IDR.

Tested-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2022-07-27 10:54:38 +08:00
Xu Guangxin 2191f9a6af lavc/hevc_refs: exclude current frame from long term refs
suppose
a. You have 3 frames, 0, 1, 4096.
b. The ltMask is 0xfff and use_msb is 0.
c. The 0, 1 are lt refs for 4096.
d. you are decoding frame 4096, and get the 0 frame.
Since 4096 & ltMask is 0 too, even you want get 0, find_ref_idx may give you 4096.
add_candidate_ref will report an error for this

Tested-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2022-07-27 10:54:38 +08:00
Xu Guangxin 99501b5015 lavc/hevcdec: do not let missing ref frames invovled in dpb process
We will generate a new frame for a missed reference. The frame can only
be used for reference. We assign an invalid decode sequence to it, so
it will not be involved in any dpb process.

Tested-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2022-07-27 10:54:38 +08:00
Xu Guangxin 6c12fe0dda lavc/hevc_refs: fix dpb logical for IRAP
According to C.5.2.2, item 2. When we got an IRAP, and the
NoOutputOfPriorPicsFlag = 0, we need bump all outputable frames.

Tested-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2022-07-27 10:54:38 +08:00
Andreas Rheinhardt 3b923116e5 fate/imf: Rename IMF fate-target
It conflicts with the name of the test using the testtool
in libavformat.mak.

Fixes ticket #9841.

Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-26 20:45:18 +02:00
James Almer 8daa0fea9f tools/target_dec_fuzzer: set avctx->workaround_bugs flags
Signed-off-by: James Almer <jamrial@gmail.com>
2022-07-26 09:15:16 -03:00
James Almer 5a27aa7dc7 tools/target_dec_fuzzer: set AV_EF_CRCCHECK in avctx->err_recognition
Signed-off-by: James Almer <jamrial@gmail.com>
2022-07-26 09:15:16 -03:00
James Almer ae4c364e92 tools/target_dec_fuzzer: set some avctx->export_side_data flags
Signed-off-by: James Almer <jamrial@gmail.com>
2022-07-26 09:15:16 -03:00
Andreas Rheinhardt 247d513beb avcodec/hevcdec: Avoid allocation of common CABAC state
It used to be allocated separately, so that the pointer to it
is copied to all HEVCContexts, so that all slice-threads
use the same. This is completely unnecessary now that there
is only one HEVCContext any more. There is just one minor
complication left: The slice-threads only get a pointer to
const HEVCContext, but they need to modify the common CABAC
state. Fix this by adding a pointer to the common CABAC state
to HEVCLocalContext and document why it exists.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:35:45 +02:00
Andreas Rheinhardt 5bf4ac9113 avcodec/hevcdec: Move allocation after error checks
While just at it, also use av_calloc() instead of zeroing
the array ourselves in a loop.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:35:39 +02:00
Andreas Rheinhardt 571e4055dc avcodec/pthread_slice: Reuse buffer if possible
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:35:22 +02:00
Andreas Rheinhardt b4ca3c7e4e avcodec/pthread_slice: Combine allocating and zeroing entries
Actually, ff_slice_thread_allocz_entries() always already
allocates zeroed entries, so ff_reset_entries() was already
unnecessary. Make this more clear by renaming it to
ff_slice_thread_allocz_entries().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:34 +02:00
Andreas Rheinhardt db99ca2150 avcodec/hevcdec: Check allocation
Also postpone it after the checks for invalid input.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:34 +02:00
Andreas Rheinhardt ad2b755d3f avcodec/hevcdec: Don't allocate redundant HEVCContexts
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet up until now that is not how it is handled in practice:
Each HEVCLocalContext has a unique HEVCContext allocated for it
and each of these coincides except in exactly one field: The
corresponding HEVCLocalContext. This makes it possible to pass
the HEVCContext everywhere where logically a HEVCLocalContext
should be used. And up until recently, this is how it has been done.

Yet the preceding patches changed this, making it possible
to avoid allocating redundant HEVCContexts.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:08 +02:00
Andreas Rheinhardt 09393130a0 avcodec/hevcdec: Pass HEVCLocalContext** via execute2
Right now the code passes a list of ints whose entry #i
is just i as opaque parameter to hls_decode_entry_wpp
via execute2; said list is even constantly allocated and freed.

This commit stops doing so and instead passes the list of
HEVCLocalContext* instead, so that the main HEVCContext
can be avoided in accessing the HEVCLocalContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:08 +02:00
Andreas Rheinhardt 05b763a4a4 avcodec/hevcdec: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides except in exactly one field: The corresponding
HEVCLocalContext. This makes it possible to pass the HEVCContext
everywhere where logically a HEVCLocalContext should be used.

This commit stops doing this for lavc/hevcdec.c itself.
It also constifies what can be constified in order to make
the nonconst stuff stand out more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:08 +02:00
Andreas Rheinhardt 6265b155bc avcodec/hevcpred: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides except in exactly one field: The corresponding
HEVCLocalContext. This makes it possible to pass the HEVCContext
everywhere where logically a HEVCLocalContext should be used.

This commit stops doing this for lavc/hevcpred as well as
the corresponding mips code; the latter is untested.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:32:08 +02:00
Andreas Rheinhardt 13b3e84a4f avcodec/hevc_cabac: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides except in exactly one field: The corresponding
HEVCLocalContext. This makes it possible to pass the HEVCContext
everywhere where logically a HEVCLocalContext should be used.

This commit stops doing this for lavc/hevc_cabac.c; it also constifies
everything that is possible in order to ensure that no slice thread
accidentally modifies the main HEVCContext state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:31:37 +02:00
Andreas Rheinhardt 72d5ce9fa6 avcodec/hevcdec: Add stat_coeffs to HEVCABACState
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides with the main HEVCContext except in exactly one field:
The corresponding HEVCLocalContext.
This makes it possible to pass the HEVCContext everywhere where
logically a HEVCLocalContext should be used.

This led to confusion in the first version of what eventually became
commit c8bc0f66a875bc3708d8dc11b757f2198606ffd7:
Before said commit, the initialization of the Rice parameter derivation
state was incorrect; the fix for single-threaded as well as
frame-threaded decoding was to add backup stats to HEVCContext
that are used when the cabac state is updated*, see
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-August/268861.html
Yet due to what has been said above, this does not work for
slice-threading, because the each HEVCLocalContext has its own
HEVCContext, so the Rice parameter state would not be transferred
between threads.

This is fixed in c8bc0f66a8
by a hack: It rederives what the previous thread was and accesses
the corresponding HEVCContext.

Fix this by treating the Rice parameter state the same way
the ordinary CABAC parameters are shared between threads:
Make them part of the same struct that is shared between
slice threads. This does not cause races, because
the parts of the code that access these Rice parameters
are a subset of the parts of code that access the CABAC parameters.

*: And if the persistent_rice_adaptation_enabled_flag is set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:31:37 +02:00
Andreas Rheinhardt 8c4f95e1e1 avcodec/hevc_filter: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides with the main HEVCContext except in exactly one field:
The corresponding HEVCLocalContext.
This makes it possible to pass the HEVCContext everywhere where
logically a HEVCLocalContext should be used.

This commit stops doing this for lavc/hevc_filter.c; it also constifies
everything that is possible in order to ensure that no slice thread
accidentally modifies the main HEVCContext state.

There are places where this was not possible, namely with the SAOParams
in sao_filter_CTB() or with sao_pixels_buffer_h in copy_CTB_to_hv().
Both of these instances lead to data races, see
https://fate.ffmpeg.org/report.cgi?time=20220629145651&slot=x86_64-archlinux-gcc-tsan-slices

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:31:37 +02:00
Andreas Rheinhardt 136ada2fc3 avcodec/hevc_mvs: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.

Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides except in exactly one field: The corresponding
HEVCLocalContext. This makes it possible to pass the HEVCContext
everywhere where logically a HEVCLocalContext should be used.

This commit stops doing this for lavc/hevc_mvs.c; it also constifies
everything that is possible in order to ensure that no slice thread
accidentally modifies the main HEVCContext state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 23:31:12 +02:00
Andreas Rheinhardt 1837ae9d5f avcodec/hevcdec: Add pointers to logctx and parent ctx to HEVCLocalCtx
It is safe for a slice thread to read the main context
and therefore it is safe to add a pointer to const HEVCContext
(namely the parent context) to each HEVCLocalContext.
It is also safe (and actually redundant) to add a pointer
to a logcontext to HEVCLocalContext.

Doing so allows to pass the HEVCLocalContext as context in
the parts of the code that is run slice-threaded when slice-threading
is in use (currently these parts of the code use ordinary
HEVCContext*). This way one is not tempted to modify
the main context from the slice contexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 17:54:16 +02:00
Andreas Rheinhardt c8d9d15f5e avcodec/hevcdec: Don't initialize HEVCContexts twice
The slicethread contexts need to be initialized for
every frame, not only the first one, so one can
remove the initialization when allocating these contexts,
because the ordinary per-frame initialization will
initialize them again just a few lines below.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 17:54:16 +02:00
Xu Guangxin 26ab6afcac fate/hevc: add clip for persistent_rice_adaptation_enabled_flag
Tests the issue fixed in c8bc0f66a8.

Signed-off-by: Xu Guangxin <oddstone@gmail.com>
2022-07-25 17:54:16 +02:00
Andreas Rheinhardt cddb25c848 avcodec/x86/pngdsp: Remove obsolete ff_add_bytes_l2_mmx()
It is overridden by ff_add_bytes_l2_sse2() on any non-ancient CPU.

Reviewed-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-25 16:00:57 +02:00
Andreas Rheinhardt 39a538f430 avcodec/hevcdec: Output MD5-message in one piece
Otherwise, there is no guarantee that the various av_log-messages
are not interrupted by another log statement. The latter may originate
from anywhere else, even the HEVC decoder itself, as happens when
one uses frame-threading to decode the BUMPING_A_ericsson_1.bit
sample from the FATE-suite.

Furthermore, the earlier approach suffered from the fact that
various parts of the logmsg were output with different loglevels
and that checking stopped after having encountered the first
plane with MD5 mismatch, although it is probably interesting to
know whether other planes are incorrect, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-24 18:42:32 +02:00
Marvin Scholz 564d7946de configure: properly require libx264 if enabled
When libx264 can not be found even though it is enabled, it should error
out properly instead of silently disabling it.
2022-07-24 17:41:21 +03:00
Zane van Iperen 8adbecc88e
avformat/argo_cvg: expose loop/reverb/checksum via metadata
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-07-24 19:24:00 +10:00
Zane van Iperen 9054a99fea
avformat/argo_cvg: remove trace logging
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-07-24 19:23:57 +10:00
Zane van Iperen 23f0c55ff8
avformat/argo_cvg: add -loop and -reverb options
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-07-24 19:23:54 +10:00
Zane van Iperen 4dfa8341e0
avformat/argo_cvg: name unk{1,2} fields correctly
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-07-24 19:23:18 +10:00
Anton Khirnov 34cbda3ee1 fftools/ffmpeg: replace AVFrame.pkt_duration with duration
Mistakenly reintroduced in 4740fea7dd.
2022-07-24 08:46:16 +02:00
Ting Fu 23953b9eb7 lavf/dnn: dump OpenVINO model input/output names to OVMdel struct.
Dump all input/output names to OVModel struct. In case other funcs use
them for reporting errors or locating issues.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2022-07-24 08:38:50 +08:00