avfilter: Remove FF_API_LIBNPP_SUPPORT

libnpp and the corresponding filters have been deprecated
in commit 994a368451
on 2025-09-26. By the time of our next release,
a year will have passed, so they are removed immediately.

Note: Passing --enable-libnpp to configure results in
a warning about the deprecation and is otherwise a no-op.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt committed 2026-06-23 17:15:02 +02:00
1 parent 7116138857
commit 9f58e3014c
7 files changed
+31 -1082

No files matched your search

Vendored
+3 -13
View File
@@ -361,7 +361,6 @@ External library support:
--disable-libdrm disable DRM code (Linux) [autodetect]
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
--enable-libvpl enable Intel oneVPL code via libvpl if libmfx is not used [no]
--enable-libnpp enable Nvidia Performance Primitives-based code [no]
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
--disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
--disable-nvenc disable Nvidia video encoding code [autodetect]
@@ -2199,7 +2198,6 @@ EXTRALIBS_LIST="
HWACCEL_LIBRARY_NONFREE_LIST="
cuda_nvcc
cuda_sdk
libnpp
"
HWACCEL_LIBRARY_LIST="
@@ -2874,6 +2872,7 @@ CMDLINE_SELECT="
cross_compile
debug
extra_warnings
libnpp
logging
optimizations
response_files
@@ -3588,20 +3587,16 @@ chromakey_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
colorspace_cuda_filter_deps="ffnvcodec"
colorspace_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
hwupload_cuda_filter_deps="ffnvcodec"
scale_npp_filter_deps="ffnvcodec libnpp"
scale2ref_npp_filter_deps="ffnvcodec libnpp"
scale_cuda_filter_deps="ffnvcodec"
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps="ffnvcodec"
thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
transpose_cuda_filter_deps="ffnvcodec"
transpose_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
transpose_npp_filter_deps="ffnvcodec libnpp"
overlay_cuda_filter_deps="ffnvcodec"
overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
pad_cuda_filter_deps="ffnvcodec"
pad_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
sharpen_npp_filter_deps="ffnvcodec libnpp"
ddagrab_filter_deps="d3d11va IDXGIOutput1 DXGI_OUTDUPL_FRAME_INFO"
gfxcapture_filter_deps="cxx17 threads d3d11va IGraphicsCaptureItemInterop __x_ABI_CWindows_CGraphics_CCapture_CIGraphicsCaptureSession3"
@@ -4803,6 +4798,8 @@ for opt do
esac
done
enabled libnpp && warn "libnpp has been removed and enabling it does nothing."
for e in $env; do
eval "export $e"
done
@@ -7442,13 +7439,6 @@ enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set
enabled libmpeghdec && require_pkg_config libmpeghdec "mpeghdec >= 3.0.0" mpeghdec/mpeghdecoder.h mpeghdecoder_init
enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
enabled libnpp && { test_cpp_condition "$(cd "$source_path"; pwd)/libavfilter/version_major.h" FF_API_LIBNPP_SUPPORT ||
die "ERROR: libnpp support is removed in this version"; } &&
{ check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei -lnppif ||
check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppif -lnppc -lnppidei ||
die "ERROR: libnpp not found"; } &&
{ check_func_headers "nppi.h" nppiYCbCr420_8u_P2P3R $libnpp_extralibs ||
die "ERROR: libnpp support is deprecated, version 13.0 and up are not supported"; }
enabled libonnxruntime && require libonnxruntime onnxruntime_c_api.h OrtGetApiBase -lonnxruntime
enabled libopencore_amrnb && { check_pkg_config libopencore_amrnb opencore-amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init ||
require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb; }
+28 -300
View File
@@ -27115,7 +27115,19 @@ value.
@chapter CUDA Video Filters
@c man begin CUDA Video Filters
To enable CUDA and/or NPP filters please refer to configuration guidelines for @ref{CUDA} and for @ref{CUDA NPP} filters.
Below is a description of the currently available Nvidia CUDA video filters.
Prerequisites:
@itemize
@item Install Nvidia CUDA Toolkit
@end itemize
Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
@itemize
@item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
@item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
@end itemize
Running CUDA filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
@table @option
@@ -27150,23 +27162,7 @@ Since CUDA filters operate exclusively on GPU memory, frame data must sometimes
@end itemize
Note that @ref{hwupload} uploads data to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before @ref{hwupload} to ensure the input is in the correct format. Similarly, @ref{hwdownload} may not support all output formats, so an additional @ref{format} filter may need to be inserted immediately after @ref{hwdownload} in the filter graph to ensure compatibility.
@anchor{CUDA}
@section CUDA
Below is a description of the currently available Nvidia CUDA video filters.
Prerequisites:
@itemize
@item Install Nvidia CUDA Toolkit
@end itemize
Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
@itemize
@item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
@item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
@end itemize
@subsection bilateral_cuda
@section bilateral_cuda
CUDA accelerated bilateral filter, an edge preserving filter.
This filter is mathematically accurate thanks to the use of GPU acceleration.
For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
@@ -27186,7 +27182,7 @@ Set window size of the bilateral function to determine the number of neighbours
If the number entered is even, one will be added automatically.
Allowed range is 1 to 255. Default is 1.
@end table
@subsubsection Examples
@subsection Examples
@itemize
@item
@@ -27205,7 +27201,7 @@ Apply the bilateral filter on a video.
@end itemize
@subsection bwdif_cuda
@section bwdif_cuda
Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
@@ -27257,13 +27253,13 @@ Only deinterlace frames marked as interlaced.
The default value is @code{all}.
@end table
@subsection chromakey_cuda
@section chromakey_cuda
CUDA accelerated YUV colorspace color/chroma keying.
This filter works like normal chromakey filter but operates on CUDA frames.
for more details and parameters see @ref{chromakey}.
@subsubsection Examples
@subsection Examples
@itemize
@item
@@ -27299,7 +27295,7 @@ Process two software sources, explicitly uploading the frames:
@end itemize
@subsection colorspace_cuda
@section colorspace_cuda
CUDA accelerated implementation of the colorspace filter.
@@ -27332,7 +27328,7 @@ JPEG (full) range
@end table
@anchor{overlay_cuda}
@subsection overlay_cuda
@section overlay_cuda
Overlay one video on top of another.
@@ -27411,13 +27407,13 @@ This filter also supports the @ref{framesync} options.
@anchor{pad_cuda}
@subsection pad_cuda
@section pad_cuda
Add paddings to an input video stream using CUDA.
This filter is the CUDA-accelerated version of the @ref{pad} filter. It accepts the same options and expressions and provides the same core functionality.
For a detailed description of available options, please see the documentation for the @ref{pad} filter.
@subsubsection Examples
@subsection Examples
@itemize
@item
@@ -27434,7 +27430,7 @@ ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf "pad_cuda=w=ih
@end itemize
@anchor{scale_cuda}
@subsection scale_cuda
@section scale_cuda
Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
Setting the output width and height works in the same way as for the @ref{scale} filter.
@@ -27497,7 +27493,7 @@ Works the same as the identical @ref{scale} filter option.
@end table
@subsubsection Examples
@subsection Examples
@itemize
@item
@@ -27521,7 +27517,7 @@ scale_cuda=passthrough=0
@end example
@end itemize
@subsection thumbnail_cuda
@section thumbnail_cuda
Select the most representative frame in a given sequence of consecutive frames using CUDA.
@@ -27537,7 +27533,7 @@ the end. Default is @code{100}.
Since the filter keeps track of the whole frames sequence, a bigger @var{n}
value will result in a higher memory usage, so a high value is not recommended.
@subsubsection Example
@subsection Example
@itemize
@@ -27549,7 +27545,7 @@ Thumbnails are extracted from every @var{n}=150-frame batch, selecting one per b
@end itemize
@subsection transpose_cuda
@section transpose_cuda
Transpose rows with columns in the input video and optionally flip it.
For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
@@ -27599,7 +27595,7 @@ Preserve landscape geometry (when @var{width} >= @var{height}).
@end table
@subsection yadif_cuda
@section yadif_cuda
Deinterlace the input video using the @ref{yadif} algorithm, but implemented
in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
@@ -27657,274 +27653,6 @@ Only deinterlace frames marked as interlaced.
The default value is @code{all}.
@end table
@anchor{CUDA NPP}
@section CUDA NPP
Below is a description of the currently available NVIDIA Performance Primitives (libnpp) video filters.
Prerequisites:
@itemize
@item Install Nvidia CUDA Toolkit
@item Install libnpp
@end itemize
To enable CUDA NPP filters:
@itemize
@item Configure FFmpeg with @code{--enable-nonfree --enable-libnpp}.
@end itemize
@anchor{scale_npp}
@subsection scale_npp
Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
format conversion on CUDA video frames. Setting the output width and height
works in the same way as for the @var{scale} filter.
The following additional options are accepted:
@table @option
@item format
The pixel format of the output CUDA frames. If set to the string "same" (the
default), the input format will be kept. Note that automatic format negotiation
and conversion is not yet supported for hardware frames
@item interp_algo
The interpolation algorithm used for resizing. One of the following:
@table @option
@item nn
Nearest neighbour.
@item linear
@item cubic
@item cubic2p_bspline
2-parameter cubic (B=1, C=0)
@item cubic2p_catmullrom
2-parameter cubic (B=0, C=1/2)
@item cubic2p_b05c03
2-parameter cubic (B=1/2, C=3/10)
@item super
Supersampling
@item lanczos
@end table
@item force_original_aspect_ratio
Enable decreasing or increasing output video width or height if necessary to
keep the original aspect ratio. Possible values:
@table @samp
@item disable
Scale the video as specified and disable this feature.
@item decrease
The output video dimensions will automatically be decreased if needed.
@item increase
The output video dimensions will automatically be increased if needed.
@end table
One useful instance of this option is that when you know a specific device's
maximum allowed resolution, you can use this to limit the output video to
that, while retaining the aspect ratio. For example, device A allows
1280x720 playback, and your video is 1920x800. Using this option (set it to
decrease) and specifying 1280x720 to the command line makes the output
1280x533.
Please note that this is a different thing than specifying -1 for @option{w}
or @option{h}, you still need to specify the output resolution for this option
to work.
@item force_divisible_by
Ensures that both the output dimensions, width and height, are divisible by the
given integer when used together with @option{force_original_aspect_ratio}. This
works similar to using @code{-n} in the @option{w} and @option{h} options.
This option respects the value set for @option{force_original_aspect_ratio},
increasing or decreasing the resolution accordingly. The video's aspect ratio
may be slightly modified.
This option can be handy if you need to have a video fit within or exceed
a defined resolution using @option{force_original_aspect_ratio} but also have
encoder restrictions on width or height divisibility.
@item reset_sar
Works the same as the identical @ref{scale} filter option.
@item eval
Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
@table @samp
@item init
Only evaluate expressions once during the filter initialization or when a command is processed.
@item frame
Evaluate expressions for each incoming frame.
@end table
@end table
The values of the @option{w} and @option{h} options are expressions
containing the following constants:
@table @var
@item in_w
@item in_h
The input width and height
@item iw
@item ih
These are the same as @var{in_w} and @var{in_h}.
@item out_w
@item out_h
The output (scaled) width and height
@item ow
@item oh
These are the same as @var{out_w} and @var{out_h}
@item a
The same as @var{iw} / @var{ih}
@item sar
input sample aspect ratio
@item dar
The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
@item n
The (sequential) number of the input frame, starting from 0.
Only available with @code{eval=frame}.
@item t
The presentation timestamp of the input frame, expressed as a number of
seconds. Only available with @code{eval=frame}.
@item pos
The position (byte offset) of the frame in the input stream, or NaN if
this information is unavailable and/or meaningless (for example in case of synthetic video).
Only available with @code{eval=frame}.
Deprecated, do not use.
@end table
@subsection scale2ref_npp
Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
video, based on a reference video.
See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
but uses the reference video instead of the main input as basis. scale2ref_npp
also supports the following additional constants for the @option{w} and
@option{h} options:
@table @var
@item main_w
@item main_h
The main input video's width and height
@item main_a
The same as @var{main_w} / @var{main_h}
@item main_sar
The main input video's sample aspect ratio
@item main_dar, mdar
The main input video's display aspect ratio. Calculated from
@code{(main_w / main_h) * main_sar}.
@item main_n
The (sequential) number of the main input frame, starting from 0.
Only available with @code{eval=frame}.
@item main_t
The presentation timestamp of the main input frame, expressed as a number of
seconds. Only available with @code{eval=frame}.
@item main_pos
The position (byte offset) of the frame in the main input stream, or NaN if
this information is unavailable and/or meaningless (for example in case of synthetic video).
Only available with @code{eval=frame}.
@end table
@subsubsection Examples
@itemize
@item
Scale a subtitle stream (b) to match the main video (a) in size before overlaying
@example
'scale2ref_npp[b][a];[a][b]overlay_cuda'
@end example
@item
Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
@example
[logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
@end example
@end itemize
@subsection sharpen_npp
Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
border control.
The following additional options are accepted:
@table @option
@item border_type
Type of sampling to be used ad frame borders. One of the following:
@table @option
@item replicate
Replicate pixel values.
@end table
@end table
@subsection transpose_npp
Transpose rows with columns in the input video and optionally flip it.
For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
It accepts the following parameters:
@table @option
@item dir
Specify the transposition direction.
Can assume the following values:
@table @samp
@item cclock_flip
Rotate by 90 degrees counterclockwise and vertically flip. (default)
@item clock
Rotate by 90 degrees clockwise.
@item cclock
Rotate by 90 degrees counterclockwise.
@item clock_flip
Rotate by 90 degrees clockwise and vertically flip.
@end table
@item passthrough
Do not apply the transposition if the input geometry matches the one
specified by the specified value. It accepts the following values:
@table @samp
@item none
Always apply transposition. (default)
@item portrait
Preserve portrait geometry (when @var{height} >= @var{width}).
@item landscape
Preserve landscape geometry (when @var{width} >= @var{height}).
@end table
@end table
@c man end CUDA Video Filters
@chapter OpenCL Video Filters
-4
View File
@@ -475,13 +475,11 @@ OBJS-$(CONFIG_SCALE_D3D11_FILTER) += vf_scale_d3d11.o scale_eval.o
OBJS-$(CONFIG_SCALE_D3D12_FILTER) += vf_scale_d3d12.o scale_eval.o
OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o scale_eval.o \
vf_scale_cuda.ptx.o cuda/load_helper.o
OBJS-$(CONFIG_SCALE_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_vpp_qsv.o
OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o scale_eval.o vaapi_vpp.o
OBJS-$(CONFIG_SCALE_VT_FILTER) += vf_scale_vt.o scale_eval.o
OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale_eval.o framesync.o
OBJS-$(CONFIG_SCALE2REF_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCDET_FILTER) += vf_scdet.o
OBJS-$(CONFIG_SCDET_VULKAN_FILTER) += vf_scdet_vulkan.o
OBJS-$(CONFIG_SCHARR_FILTER) += vf_convolution.o
@@ -498,7 +496,6 @@ OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o
OBJS-$(CONFIG_SETRANGE_FILTER) += vf_setparams.o
OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
OBJS-$(CONFIG_SETTB_FILTER) += settb.o
OBJS-$(CONFIG_SHARPEN_NPP_FILTER) += vf_sharpen_npp.o
OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_SHEAR_FILTER) += vf_shear.o
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o
@@ -548,7 +545,6 @@ OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o
OBJS-$(CONFIG_TRANSPOSE_CUDA_FILTER) += vf_transpose_cuda.o vf_transpose_cuda.ptx.o \
cuda/load_helper.o
OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o
OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) += vf_transpose_opencl.o opencl.o opencl/transpose.o
OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_TRANSPOSE_VT_FILTER) += vf_transpose_vt.o
-4
View File
@@ -447,13 +447,11 @@ extern const FFFilter ff_vf_frc_amf;
extern const FFFilter ff_vf_scale_cuda;
extern const FFFilter ff_vf_scale_d3d11;
extern const FFFilter ff_vf_scale_d3d12;
extern const FFFilter ff_vf_scale_npp;
extern const FFFilter ff_vf_scale_qsv;
extern const FFFilter ff_vf_scale_vaapi;
extern const FFFilter ff_vf_scale_vt;
extern const FFFilter ff_vf_scale_vulkan;
extern const FFFilter ff_vf_scale2ref;
extern const FFFilter ff_vf_scale2ref_npp;
extern const FFFilter ff_vf_scdet;
extern const FFFilter ff_vf_scdet_vulkan;
extern const FFFilter ff_vf_scharr;
@@ -470,7 +468,6 @@ extern const FFFilter ff_vf_setpts;
extern const FFFilter ff_vf_setrange;
extern const FFFilter ff_vf_setsar;
extern const FFFilter ff_vf_settb;
extern const FFFilter ff_vf_sharpen_npp;
extern const FFFilter ff_vf_sharpness_vaapi;
extern const FFFilter ff_vf_shear;
extern const FFFilter ff_vf_showinfo;
@@ -515,7 +512,6 @@ extern const FFFilter ff_vf_tonemap_vaapi;
extern const FFFilter ff_vf_tpad;
extern const FFFilter ff_vf_transpose;
extern const FFFilter ff_vf_transpose_cuda;
extern const FFFilter ff_vf_transpose_npp;
extern const FFFilter ff_vf_transpose_opencl;
extern const FFFilter ff_vf_transpose_vaapi;
extern const FFFilter ff_vf_transpose_vt;
-2
View File
@@ -35,6 +35,4 @@
* the public API and may change, break or disappear at any time.
*/
#define FF_API_LIBNPP_SUPPORT (LIBAVFILTER_VERSION_MAJOR < 12)
#endif /* AVFILTER_VERSION_MAJOR_H */
-277
View File
@@ -1,277 +0,0 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* NPP sharpen video filter
*/
#include <nppi.h>
#include <nppi_filtering_functions.h>
#include "filters.h"
#include "libavutil/pixdesc.h"
#include "libavutil/cuda_check.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
#include "libavutil/opt.h"
#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV444P,
};
typedef struct NPPSharpenContext {
const AVClass* class;
AVBufferRef* frames_ctx;
AVFrame* own_frame;
AVFrame* tmp_frame;
NppiBorderType border_type;
} NPPSharpenContext;
static int nppsharpen_init(AVFilterContext* ctx)
{
NPPSharpenContext* s = ctx->priv;
av_log(ctx, AV_LOG_WARNING, "The libnpp based filters are deprecated.\n");
s->own_frame = av_frame_alloc();
if (!s->own_frame)
goto fail;
s->tmp_frame = av_frame_alloc();
if (!s->tmp_frame)
goto fail;
return 0;
fail:
av_frame_free(&s->own_frame);
av_frame_free(&s->tmp_frame);
return AVERROR(ENOMEM);
}
static int nppsharpen_config(AVFilterContext* ctx, int width, int height)
{
FilterLink *inl = ff_filter_link(ctx->inputs[0]);
FilterLink *outl = ff_filter_link(ctx->outputs[0]);
NPPSharpenContext* s = ctx->priv;
AVHWFramesContext *out_ctx, *in_ctx;
int i, ret, supported_format = 0;
if (!inl->hw_frames_ctx) {
av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
goto fail;
}
in_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
s->frames_ctx = av_hwframe_ctx_alloc(in_ctx->device_ref);
if (!s->frames_ctx)
goto fail;
out_ctx = (AVHWFramesContext*)s->frames_ctx->data;
out_ctx->format = AV_PIX_FMT_CUDA;
out_ctx->sw_format = in_ctx->sw_format;
out_ctx->width = FFALIGN(width, 32);
out_ctx->height = FFALIGN(height, 32);
for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++) {
if (in_ctx->sw_format == supported_formats[i]) {
supported_format = 1;
break;
}
}
if (!supported_format) {
av_log(ctx, AV_LOG_ERROR, "Unsupported pixel format\n");
goto fail;
}
ret = av_hwframe_ctx_init(s->frames_ctx);
if (ret < 0)
goto fail;
ret = av_hwframe_get_buffer(s->frames_ctx, s->own_frame, 0);
if (ret < 0)
goto fail;
outl->hw_frames_ctx = av_buffer_ref(s->frames_ctx);
if (!outl->hw_frames_ctx)
goto fail;
return 0;
fail:
av_buffer_unref(&s->frames_ctx);
return AVERROR(ENOMEM);
}
static void nppsharpen_uninit(AVFilterContext* ctx)
{
NPPSharpenContext* s = ctx->priv;
av_buffer_unref(&s->frames_ctx);
av_frame_free(&s->own_frame);
av_frame_free(&s->tmp_frame);
}
static int nppsharpen_config_props(AVFilterLink* outlink)
{
AVFilterLink* inlink = outlink->src->inputs[0];
outlink->w = inlink->w;
outlink->h = inlink->h;
if (inlink->sample_aspect_ratio.num)
outlink->sample_aspect_ratio = av_mul_q(
(AVRational){outlink->h * inlink->w, outlink->w * inlink->h},
inlink->sample_aspect_ratio);
else
outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
nppsharpen_config(outlink->src, inlink->w, inlink->h);
return 0;
}
static int nppsharpen_sharpen(AVFilterContext* ctx, AVFrame* out, AVFrame* in)
{
FilterLink *inl = ff_filter_link(ctx->inputs[0]);
AVHWFramesContext* in_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
NPPSharpenContext* s = ctx->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(in_ctx->sw_format);
for (int i = 0; i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
int ow = AV_CEIL_RSHIFT(in->width, (i == 1 || i == 2) ? desc->log2_chroma_w : 0);
int oh = AV_CEIL_RSHIFT(in->height, (i == 1 || i == 2) ? desc->log2_chroma_h : 0);
NppStatus err = nppiFilterSharpenBorder_8u_C1R(
in->data[i], in->linesize[i], (NppiSize){ow, oh}, (NppiPoint){0, 0},
out->data[i], out->linesize[i], (NppiSize){ow, oh}, s->border_type);
if (err != NPP_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "NPP sharpen error: %d\n", err);
return AVERROR_EXTERNAL;
}
}
return 0;
}
static int nppsharpen_filter_frame(AVFilterLink* link, AVFrame* in)
{
AVFilterContext* ctx = link->dst;
NPPSharpenContext* s = ctx->priv;
AVFilterLink* outlink = ctx->outputs[0];
FilterLink *outl = ff_filter_link(outlink);
AVHWFramesContext* frames_ctx =
(AVHWFramesContext*)outl->hw_frames_ctx->data;
AVCUDADeviceContext* device_hwctx = frames_ctx->device_ctx->hwctx;
AVFrame* out = NULL;
CUcontext dummy;
int ret = 0;
out = av_frame_alloc();
if (!out) {
ret = AVERROR(ENOMEM);
goto fail;
}
ret = CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(
device_hwctx->cuda_ctx));
if (ret < 0)
goto fail;
ret = nppsharpen_sharpen(ctx, s->own_frame, in);
if (ret < 0)
goto pop_ctx;
ret = av_hwframe_get_buffer(s->own_frame->hw_frames_ctx, s->tmp_frame, 0);
if (ret < 0)
goto pop_ctx;
av_frame_move_ref(out, s->own_frame);
av_frame_move_ref(s->own_frame, s->tmp_frame);
ret = av_frame_copy_props(out, in);
if (ret < 0)
goto pop_ctx;
av_frame_free(&in);
pop_ctx:
CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy));
if (!ret)
return ff_filter_frame(outlink, out);
fail:
av_frame_free(&in);
av_frame_free(&out);
return ret;
}
#define OFFSET(x) offsetof(NPPSharpenContext, x)
#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption options[] = {
{ "border_type", "Type of operation to be performed on image border", OFFSET(border_type), AV_OPT_TYPE_INT, { .i64 = NPP_BORDER_REPLICATE }, NPP_BORDER_REPLICATE, NPP_BORDER_REPLICATE, FLAGS, .unit = "border_type" },
{ "replicate", "replicate pixels", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_BORDER_REPLICATE }, 0, 0, FLAGS, .unit = "border_type" },
{NULL},
};
static const AVClass nppsharpen_class = {
.class_name = "nppsharpen",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVFilterPad nppsharpen_inputs[] = {{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = nppsharpen_filter_frame,
}};
static const AVFilterPad nppsharpen_outputs[] = {{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = nppsharpen_config_props,
}};
const FFFilter ff_vf_sharpen_npp = {
.p.name = "sharpen_npp",
.p.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video "
"sharpening filter."),
.p.priv_class = &nppsharpen_class,
.init = nppsharpen_init,
.uninit = nppsharpen_uninit,
.priv_size = sizeof(NPPSharpenContext),
FILTER_INPUTS(nppsharpen_inputs),
FILTER_OUTPUTS(nppsharpen_outputs),
FILTER_SINGLE_PIXFMT(AV_PIX_FMT_CUDA),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
};
-482
View File
@@ -1,482 +0,0 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <nppi.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
#include "libavutil/cuda_check.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "video.h"
#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV444P
};
enum TransposeStage {
STAGE_ROTATE,
STAGE_TRANSPOSE,
STAGE_NB
};
enum Transpose {
NPP_TRANSPOSE_CCLOCK_FLIP = 0,
NPP_TRANSPOSE_CLOCK = 1,
NPP_TRANSPOSE_CCLOCK = 2,
NPP_TRANSPOSE_CLOCK_FLIP = 3
};
enum Passthrough {
NPP_TRANSPOSE_PT_TYPE_NONE = 0,
NPP_TRANSPOSE_PT_TYPE_LANDSCAPE,
NPP_TRANSPOSE_PT_TYPE_PORTRAIT
};
typedef struct NPPTransposeStageContext {
int stage_needed;
enum AVPixelFormat in_fmt;
enum AVPixelFormat out_fmt;
struct {
int width;
int height;
} planes_in[3], planes_out[3];
AVBufferRef *frames_ctx;
AVFrame *frame;
} NPPTransposeStageContext;
typedef struct NPPTransposeContext {
const AVClass *class;
NPPTransposeStageContext stages[STAGE_NB];
AVFrame *tmp_frame;
int passthrough; ///< PassthroughType, landscape passthrough mode enabled
int dir; ///< TransposeDir
} NPPTransposeContext;
static int npptranspose_init(AVFilterContext *ctx)
{
NPPTransposeContext *s = ctx->priv;
int i;
av_log(ctx, AV_LOG_WARNING, "The libnpp based filters are deprecated.\n");
for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
s->stages[i].frame = av_frame_alloc();
if (!s->stages[i].frame)
return AVERROR(ENOMEM);
}
s->tmp_frame = av_frame_alloc();
if (!s->tmp_frame)
return AVERROR(ENOMEM);
return 0;
}
static void npptranspose_uninit(AVFilterContext *ctx)
{
NPPTransposeContext *s = ctx->priv;
int i;
for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
av_frame_free(&s->stages[i].frame);
av_buffer_unref(&s->stages[i].frames_ctx);
}
av_frame_free(&s->tmp_frame);
}
static int init_stage(NPPTransposeStageContext *stage, AVBufferRef *device_ctx)
{
AVBufferRef *out_ref = NULL;
AVHWFramesContext *out_ctx;
int in_sw, in_sh, out_sw, out_sh;
int ret, i;
av_pix_fmt_get_chroma_sub_sample(stage->in_fmt, &in_sw, &in_sh);
av_pix_fmt_get_chroma_sub_sample(stage->out_fmt, &out_sw, &out_sh);
if (!stage->planes_out[0].width) {
stage->planes_out[0].width = stage->planes_in[0].width;
stage->planes_out[0].height = stage->planes_in[0].height;
}
for (i = 1; i < FF_ARRAY_ELEMS(stage->planes_in); i++) {
stage->planes_in[i].width = stage->planes_in[0].width >> in_sw;
stage->planes_in[i].height = stage->planes_in[0].height >> in_sh;
stage->planes_out[i].width = stage->planes_out[0].width >> out_sw;
stage->planes_out[i].height = stage->planes_out[0].height >> out_sh;
}
out_ref = av_hwframe_ctx_alloc(device_ctx);
if (!out_ref)
return AVERROR(ENOMEM);
out_ctx = (AVHWFramesContext*)out_ref->data;
out_ctx->format = AV_PIX_FMT_CUDA;
out_ctx->sw_format = stage->out_fmt;
out_ctx->width = FFALIGN(stage->planes_out[0].width, 32);
out_ctx->height = FFALIGN(stage->planes_out[0].height, 32);
ret = av_hwframe_ctx_init(out_ref);
if (ret < 0)
goto fail;
av_frame_unref(stage->frame);
ret = av_hwframe_get_buffer(out_ref, stage->frame, 0);
if (ret < 0)
goto fail;
stage->frame->width = stage->planes_out[0].width;
stage->frame->height = stage->planes_out[0].height;
av_buffer_unref(&stage->frames_ctx);
stage->frames_ctx = out_ref;
return 0;
fail:
av_buffer_unref(&out_ref);
return ret;
}
static int format_is_supported(enum AVPixelFormat fmt)
{
int i;
for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
if (supported_formats[i] == fmt)
return 1;
return 0;
}
static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_height,
int out_width, int out_height)
{
FilterLink *inl = ff_filter_link(ctx->inputs[0]);
FilterLink *outl = ff_filter_link(ctx->outputs[0]);
NPPTransposeContext *s = ctx->priv;
AVHWFramesContext *in_frames_ctx;
enum AVPixelFormat format;
int i, ret, last_stage = -1;
int rot_width = out_width, rot_height = out_height;
/* check that we have a hw context */
if (!inl->hw_frames_ctx) {
av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
return AVERROR(EINVAL);
}
in_frames_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
format = in_frames_ctx->sw_format;
if (!format_is_supported(format)) {
av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n",
av_get_pix_fmt_name(format));
return AVERROR(ENOSYS);
}
if (s->dir != NPP_TRANSPOSE_CCLOCK_FLIP) {
s->stages[STAGE_ROTATE].stage_needed = 1;
}
if (s->dir == NPP_TRANSPOSE_CCLOCK_FLIP || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) {
s->stages[STAGE_TRANSPOSE].stage_needed = 1;
/* Rotating by 180° in case of clock_flip, or not at all for cclock_flip, so width/height unchanged by rotation */
rot_width = in_width;
rot_height = in_height;
}
s->stages[STAGE_ROTATE].in_fmt = format;
s->stages[STAGE_ROTATE].out_fmt = format;
s->stages[STAGE_ROTATE].planes_in[0].width = in_width;
s->stages[STAGE_ROTATE].planes_in[0].height = in_height;
s->stages[STAGE_ROTATE].planes_out[0].width = rot_width;
s->stages[STAGE_ROTATE].planes_out[0].height = rot_height;
s->stages[STAGE_TRANSPOSE].in_fmt = format;
s->stages[STAGE_TRANSPOSE].out_fmt = format;
s->stages[STAGE_TRANSPOSE].planes_in[0].width = rot_width;
s->stages[STAGE_TRANSPOSE].planes_in[0].height = rot_height;
s->stages[STAGE_TRANSPOSE].planes_out[0].width = out_width;
s->stages[STAGE_TRANSPOSE].planes_out[0].height = out_height;
/* init the hardware contexts */
for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
if (!s->stages[i].stage_needed)
continue;
ret = init_stage(&s->stages[i], in_frames_ctx->device_ref);
if (ret < 0)
return ret;
last_stage = i;
}
if (last_stage >= 0) {
outl->hw_frames_ctx = av_buffer_ref(s->stages[last_stage].frames_ctx);
} else {
outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx);
s->passthrough = 1;
}
if (!outl->hw_frames_ctx)
return AVERROR(ENOMEM);
return 0;
}
static int npptranspose_config_props(AVFilterLink *outlink)
{
FilterLink *outl = ff_filter_link(outlink);
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
FilterLink *inl = ff_filter_link(inlink);
NPPTransposeContext *s = ctx->priv;
int ret;
if ((inlink->w >= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_LANDSCAPE) ||
(inlink->w <= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_PORTRAIT))
{
if (inl->hw_frames_ctx) {
outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx);
if (!outl->hw_frames_ctx)
return AVERROR(ENOMEM);
}
av_log(ctx, AV_LOG_VERBOSE,
"w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
inlink->w, inlink->h, inlink->w, inlink->h);
return 0;
} else {
s->passthrough = NPP_TRANSPOSE_PT_TYPE_NONE;
}
outlink->w = inlink->h;
outlink->h = inlink->w;
outlink->sample_aspect_ratio = (AVRational){inlink->sample_aspect_ratio.den, inlink->sample_aspect_ratio.num};
ret = init_processing_chain(ctx, inlink->w, inlink->h, outlink->w, outlink->h);
if (ret < 0)
return ret;
av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -transpose-> w:%d h:%d\n",
inlink->w, inlink->h, outlink->w, outlink->h);
return 0;
}
static int npptranspose_rotate(AVFilterContext *ctx, NPPTransposeStageContext *stage,
AVFrame *out, AVFrame *in)
{
NPPTransposeContext *s = ctx->priv;
NppStatus err;
int i;
for (i = 0; i < FF_ARRAY_ELEMS(stage->planes_in) && i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
int iw = stage->planes_in[i].width;
int ih = stage->planes_in[i].height;
int ow = stage->planes_out[i].width;
int oh = stage->planes_out[i].height;
// nppRotate uses 0,0 as the rotation point
// need to shift the image accordingly after rotation
// need to subtract 1 to get the correct coordinates
double angle = s->dir == NPP_TRANSPOSE_CLOCK ? -90.0 : s->dir == NPP_TRANSPOSE_CCLOCK ? 90.0 : 180.0;
int shiftw = (s->dir == NPP_TRANSPOSE_CLOCK || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) ? ow - 1 : 0;
int shifth = (s->dir == NPP_TRANSPOSE_CCLOCK || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) ? oh - 1 : 0;
err = nppiRotate_8u_C1R(in->data[i], (NppiSize){ iw, ih },
in->linesize[i], (NppiRect){ 0, 0, iw, ih },
out->data[i], out->linesize[i],
(NppiRect){ 0, 0, ow, oh },
angle, shiftw, shifth, NPPI_INTER_NN);
if (err != NPP_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "NPP rotate error: %d\n", err);
return AVERROR_UNKNOWN;
}
}
return 0;
}
static int npptranspose_transpose(AVFilterContext *ctx, NPPTransposeStageContext *stage,
AVFrame *out, AVFrame *in)
{
NppStatus err;
int i;
for (i = 0; i < FF_ARRAY_ELEMS(stage->planes_in) && i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
int iw = stage->planes_in[i].width;
int ih = stage->planes_in[i].height;
err = nppiTranspose_8u_C1R(in->data[i], in->linesize[i],
out->data[i], out->linesize[i],
(NppiSize){ iw, ih });
if (err != NPP_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "NPP transpose error: %d\n", err);
return AVERROR_UNKNOWN;
}
}
return 0;
}
static int (*const npptranspose_process[])(AVFilterContext *ctx, NPPTransposeStageContext *stage,
AVFrame *out, AVFrame *in) = {
[STAGE_ROTATE] = npptranspose_rotate,
[STAGE_TRANSPOSE] = npptranspose_transpose
};
static int npptranspose_filter(AVFilterContext *ctx, AVFrame *out, AVFrame *in)
{
NPPTransposeContext *s = ctx->priv;
AVFrame *src = in;
int i, ret, last_stage = -1;
for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
if (!s->stages[i].stage_needed)
continue;
ret = npptranspose_process[i](ctx, &s->stages[i], s->stages[i].frame, src);
if (ret < 0)
return ret;
src = s->stages[i].frame;
last_stage = i;
}
if (last_stage < 0)
return AVERROR_BUG;
ret = av_hwframe_get_buffer(src->hw_frames_ctx, s->tmp_frame, 0);
if (ret < 0)
return ret;
av_frame_move_ref(out, src);
av_frame_move_ref(src, s->tmp_frame);
ret = av_frame_copy_props(out, in);
if (ret < 0)
return ret;
return 0;
}
static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
{
AVFilterContext *ctx = link->dst;
NPPTransposeContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
FilterLink *outl = ff_filter_link(outlink);
AVHWFramesContext *frames_ctx = (AVHWFramesContext*)outl->hw_frames_ctx->data;
AVCUDADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx;
AVFrame *out = NULL;
CUcontext dummy;
int ret = 0;
if (s->passthrough)
return ff_filter_frame(outlink, in);
out = av_frame_alloc();
if (!out) {
ret = AVERROR(ENOMEM);
goto fail;
}
ret = CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(device_hwctx->cuda_ctx));
if (ret < 0)
goto fail;
ret = npptranspose_filter(ctx, out, in);
CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy));
if (ret < 0)
goto fail;
av_frame_free(&in);
return ff_filter_frame(outlink, out);
fail:
av_frame_free(&in);
av_frame_free(&out);
return ret;
}
#define OFFSET(x) offsetof(NPPTransposeContext, x)
#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption options[] = {
{ "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 3, FLAGS, .unit = "dir" },
{ "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 0, FLAGS, .unit = "dir" },
{ "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK }, 0, 0, FLAGS, .unit = "dir" },
{ "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK }, 0, 0, FLAGS, .unit = "dir" },
{ "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK_FLIP }, 0, 0, FLAGS, .unit = "dir" },
{ "passthrough", "do not apply transposition if the input matches the specified geometry", OFFSET(passthrough), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 2, FLAGS, .unit = "passthrough" },
{ "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 0, FLAGS, .unit = "passthrough" },
{ "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_LANDSCAPE }, 0, 0, FLAGS, .unit = "passthrough" },
{ "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_PORTRAIT }, 0, 0, FLAGS, .unit = "passthrough" },
{ NULL },
};
static const AVClass npptranspose_class = {
.class_name = "npptranspose",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVFilterPad npptranspose_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = npptranspose_filter_frame,
},
};
static const AVFilterPad npptranspose_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = npptranspose_config_props,
},
};
const FFFilter ff_vf_transpose_npp = {
.p.name = "transpose_npp",
.p.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video transpose"),
.p.priv_class = &npptranspose_class,
.init = npptranspose_init,
.uninit = npptranspose_uninit,
.priv_size = sizeof(NPPTransposeContext),
FILTER_INPUTS(npptranspose_inputs),
FILTER_OUTPUTS(npptranspose_outputs),
FILTER_SINGLE_PIXFMT(AV_PIX_FMT_CUDA),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
};