Commit Graph

10755 Commits

Author SHA1 Message Date
Anton Khirnov 632c349931 lavfi: add a flag for filters able to work with hw_device_ctx
This way the caller can set it just on the filters that can make use of
it.
2023-03-24 10:16:51 +01:00
Anton Khirnov 27f8c9b27b lavu/frame: deprecate AVFrame.pkt_{pos,size}
These fields are supposed to store information about the packet the
frame was decoded from, specifically the byte offset it was stored at
and its size.

However,
- the fields are highly ad-hoc - there is no strong reason why
  specifically those (and not any other) packet properties should have a
  dedicated field in AVFrame; unlike e.g. the timestamps, there is no
  fundamental link between coded packet offset/size and decoded frames
- they only make sense for frames produced by decoding demuxed packets,
  and even then it is not always the case that the encoded data was
  stored in the file as a contiguous sequence of bytes (in order for pos
  to be well-defined)
- pkt_pos was added without much explanation, apparently to allow
  passthrough of this information through lavfi in order to handle byte
  seeking in ffplay. That is now implemented using arbitrary user data
  passthrough in AVFrame.opaque_ref.
- several filters use pkt_pos as a variable available to user-supplied
  expressions, but there seems to be no established motivation for using them.
- pkt_size was added for use in ffprobe, but that too is now handled
  without using this field. Additonally, the values of this field
  produced by libavcodec are flawed, as described in the previous
  ffprobe conversion commit.

In summary - these fields are ill-defined and insufficiently motivated,
so deprecate them.
2023-03-20 10:42:09 +01:00
Haihao Xiang 57afccc0ef lavfi/vf_vpp_qsv: set the right timestamp for AVERROR_EOF
Rescale the timestamp for AVERROR_EOF. This can fix tickets 10261 and
10262.

Tested-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-03-20 09:58:41 +08:00
Michael Niedermayer 3ead1fe413
avfilter/vf_uspp: about 10x the speed with threads
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 22:36:51 +01:00
Michael Niedermayer cee4b99d41
avfilter/vf_uspp: Support any codec
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 18:20:14 +01:00
Michael Niedermayer 771c27119d
avfilter/vf_uspp: update to new APIs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 18:20:02 +01:00
Zhao Zhili 4ec2861559 avfilter/vf_showinfo: fix HDR vivid info
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-03-17 18:52:12 +08:00
James Almer dc61d5cf19 avfilter/vf_untile: swap the chroma shift values used for plane offsets
Fixes ticket #10265

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-16 16:07:40 -03:00
Andreas Rheinhardt 2732d0507c avfilter/vf_ssim360: Remove dead code
Fixes Coverity issue #1520669.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-03-14 07:16:45 +01:00
Andreas Rheinhardt 1091963d38 avfilter/vf_ssim360: Use correct type in sizeof
SSIM360Context.ssim360_hist is an array of four pointers to double;
so sizeof(*ssim360_hist[0]) (=sizeof(double)) is the correct size
to use to calculate the amount of memory to allocate, not
sizeof(*ssim360_hist) (which is sizeof(double*)).

Use FF_ALLOCZ_TYPED_ARRAY to avoid this issue altogether.

Fixes Coverity issue #1520671.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-03-14 07:16:06 +01:00
Niklas Haas 1231003c3c avfilter/vf_libplacebo: remove deprecated field
This has not been functional since a year ago, including in our current
minimum dependency of libplacebo (v4.192.0). It also causes build errors
against libplacebo v6, so it needs to be removed from the code. We can
keep the option around for now, but it should also be removed soon.

Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-13 11:30:58 -03:00
Niklas Haas 11eca6018c avfilter/vf_libplacebo: wrap deprecated opts in FF_API define
Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-13 11:30:58 -03:00
James Almer 358588c820 Revert "avfilter/stack_internal: add missing header includes"
This reverts commit 205117d87f.

This didn't fix make checkheaders after all, and also broke compilation in some
scenarios.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-11 10:05:47 -03:00
James Almer 205117d87f avfilter/stack_internal: add missing header includes
Fixes make checkheaders

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-10 16:27:05 -03:00
Anton Khirnov fefcba1c1b lavfi/graphparser: use correct logging context 2023-03-10 13:04:25 +01:00
James Almer 2fd86d9afa avfilter/graphparser: fix filter instance name when an id is provided
Restores the behavior of naming the instance filter@id, which was accidentally changed
to simpy id in commit f17051eaae.

Fixes ticket #10226.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-06 08:42:18 -03:00
Stefano Sabatini ad17e29224 lavfi/buffersrc: issue more specific error in case of invalid parameters 2023-03-05 12:21:45 +01:00
James Almer 4561232b1a avfilter/af_pan: use the new swr used channel layout option
Fixes ticket #10180

Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-19 18:28:52 -03:00
Michael Niedermayer 47ac3e6065
version.h: Bump minor post 6.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-19 18:37:36 +01:00
Michael Niedermayer 62efa096af
version.h: Bump minor for 6.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-19 18:32:07 +01:00
Niklas Haas eabc304d12 avfilter/vf_libplacebo: add SMPTE ST2094 tone-mappers
libplacebo gained these exciting new functions upstream.
2023-02-17 18:35:39 +01:00
Wenbin Chen b7a335c5e9 libavfilter/qsvvpp: check the return value
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-02-16 11:15:50 +08:00
Haihao Xiang 0f407cdea2 avfilter: add QSV variants of the stack filters
Include hstack_qsv, vstack_qsv and xstack_qsv. They may accept input
streams with different sizes.

Examples:
$ ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][0:v]hstack_qsv" -f null -

$ ffmpeg \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_qsv=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-16 11:15:50 +08:00
Haihao Xiang 742dfa2815 lavfi/vf_stack_vaapi: factor out the common code for stack setting
The common code will be used in QSV based stack filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-16 11:15:41 +08:00
Kieran Kunhya 264cf75214 vf_yadif: Remove unused emms_c 2023-02-14 19:09:19 +00:00
Paul B Mahol e506ea3ce1 avfilter: use ff_inlink_make_frame_writable() 2023-02-12 13:32:00 +01:00
Anton Khirnov f17051eaae lavfi/graphparser: reimplement avfilter_graph_parse* using new API 2023-02-12 10:33:52 +01:00
Anton Khirnov d1b9a3ddb4 lavfi: add a new filtergraph parsing API
Callers currently have two ways of adding filters to a graph - they can
either
- create, initialize, and link them manually
- use one of the avfilter_graph_parse*() functions, which take a
  (typically end-user-written) string, split it into individual filter
  definitions+options, then create filters, apply options, initialize
  filters, and finally link them - all based on information from this
  string.

A major problem with the second approach is that it performs many
actions as a single atomic unit, leaving the caller no space to
intervene in between. Such intervention would be useful e.g. to
- modify filter options;
- supply hardware device contexts;
both of which typically must be done before the filter is initialized.

Callers who need such intervention are then forced to invent their own
filtergraph parsing, which is clearly suboptimal.

This commit aims to address this problem by adding a new modular
filtergraph parsing API. It adds a new  avfilter_graph_segment_parse()
function to parse a string filtergraph description into an intermediate
tree-like representation (AVFilterGraphSegment and its children).

This intermediate form may then be applied step by step using further
new avfilter_graph_segment*() functions, with user intervention possible
between each step.
2023-02-12 10:28:06 +01:00
Anton Khirnov 4310b66b98 lavfi/avfilter: track whether a filter has been initialized
Refuse to link uninitialized filters or initialize a filter twice.
2023-02-12 10:17:26 +01:00
Anton Khirnov 80cf509e73 lavfi/avfilter: export process_options()
Also, replace an AVFilterContext argument with a logging context+private
class, as those are the only things needed in this function.

Will be useful in future commits.
2023-02-12 10:16:41 +01:00
Stefano Sabatini abfe8456a2 lavfi/astats: sort measures keys by name 2023-02-11 17:30:20 +01:00
Paul B Mahol 725328672a avfilter/vf_vibrance: reduce copy operations 2023-02-11 10:36:56 +01:00
Paul B Mahol acd87d41f2 avfilter/vf_exposure: reduce copy operations 2023-02-11 10:36:56 +01:00
James Almer 5bad485603 Bump major versions of all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 8bc0d31320 avfilter: remove FF_API_PAD_COUNT
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer 863822bfaf avfilter: remove FF_API_BUFFERSINK_ALLOC
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer a9e77b42e3 avfilter: remove FF_API_SWS_PARAM_OPTION
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
Paul B Mahol 458ae405ef Revert "avfilter/af_pan: fix regression introduced with switch to new channel layout API"
This reverts commit 93a9ee7afd.

Was not fixing real problem, issue is probably outside of pan filter.
2023-02-09 13:40:00 +01:00
Paul B Mahol 7e1d474021 avfilter/af_compand: simplify frame allocation 2023-02-08 18:56:57 +01:00
Paul B Mahol 068ad04908 avfilter/af_compensationdelay: simplify frame allocation 2023-02-08 18:56:56 +01:00
Paul B Mahol 93a9ee7afd avfilter/af_pan: fix regression introduced with switch to new channel layout API
Fixes #10168
2023-02-07 18:28:57 +01:00
Niklas Haas 62dfa54688 avfilter/vf_libplacebo: fix format query
We need to construct the output format list separatedly from the input
format list, because we need to adhere to two extra requirements:

1. Big-endian output formats are always unsupported (runtime error)
2. Combining 'vulkan' with an explicit out_format that is not supported
   by the vulkan frame allocation code is illegal and will crash (abort)

As a free side benefit, this rewrite fixes a possible memory leak in the
`fail` path that was present in the old code.

Signed-off-by: Niklas Haas <git@haasn.dev>
2023-02-07 15:11:49 +01:00
Haihao Xiang 58d6426870 lavfi/vf_vpp_qsv: add support for new scaling modes
The new modes work on new platforms and are avaialable only for oneVPL.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-07 09:51:37 +08:00
Haihao Xiang 36016c5596 lavfi/vf_vpp_qsv: support UYVY in system memory
It only works on Linux

$ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \
yuvtestsrc -vf "format=uyvy422,vpp_qsv=format=nv12" -f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-07 09:51:37 +08:00
Haihao Xiang b92028346c lavfi/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter
QSVDeintContext and VPPContext have the same base context, and all
features in deinterlace_qsv are implemented in vpp_qsv filter,  so
deinterlace_qsv can be taken as a special case of vpp_qsv filter, and we
may use VPPContext with a different option array, preinit callback and
support pixel formats to implement deinterlace_qsv, then remove
QSVDeintContext.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang a48c95d3c9 lavfi/deinterlace_qsv: simplify deinterlace_qsv filter
Like what we did for scale_qsv filter, we use QSVVPPContext as a base
context to manage MFX session for deinterlace_qsv filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang 077e634965 lavfi/vpp_qsv: add rate option
This is used to control the output at frame rate or field rate when
deinterlace is expected and framerate is not specified.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:57 +08:00
Lynne bbe95f7353
x86: replace explicit REP_RETs with RETs
From x86inc:
> On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
> a branch or a branch target. So switch to a 2-byte form of ret in that case.
> We can automatically detect "follows a branch", but not a branch target.
> (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

x86inc can automatically determine whether to use REP_RET rather than
REP in most of these cases, so impact is minimal. Additionally, a few
REP_RETs were used unnecessary, despite the return being nowhere near a
branch.

The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
years ago and 12 years ago, respectively.

In the future, everyone involved with x86inc should consider dropping
REP_RETs altogether.
2023-02-01 04:23:55 +01:00
Niklas Haas 9bfdd8524e avfilter/vf_libplacebo: suppress cast warning
This warning was introduced when ee65039 removed the cast.
2023-01-30 20:34:55 +01:00
Paul B Mahol 5508e04c7b avfilter/vf_colorlevels: add support for gbrpf32 format 2023-01-30 18:42:49 +01:00