Go to the documentation of this file.
25 #include <nppi_filtering_functions.h>
34 #define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
77 if (!
ctx->inputs[0]->hw_frames_ctx) {
115 if (!
ctx->outputs[0]->hw_frames_ctx)
141 if (
inlink->sample_aspect_ratio.num)
144 inlink->sample_aspect_ratio);
165 NppStatus err = nppiFilterSharpenBorder_8u_C1R(
166 in->
data[
i], in->
linesize[
i], (NppiSize){ow, oh}, (NppiPoint){0, 0},
167 out->data[
i],
out->linesize[
i], (NppiSize){ow, oh},
s->border_type);
168 if (err != NPP_SUCCESS) {
196 ret =
CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(
197 device_hwctx->cuda_ctx));
219 CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&
dummy));
228 #define OFFSET(x) offsetof(NPPSharpenContext, x)
229 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
231 {
"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" },
232 {
"replicate",
"replicate pixels", 0,
AV_OPT_TYPE_CONST, { .i64 = NPP_BORDER_REPLICATE }, 0, 0,
FLAGS, .unit =
"border_type" },
256 .
name =
"sharpen_npp",
258 "sharpening filter."),
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const AVOption options[]
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
uint8_t * data
The data buffer.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
This structure describes decoded (raw) audio or video data.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
const char * name
Filter name.
int width
The allocated dimensions of the frames in this pool.
NppiBorderType border_type
static const AVFilterPad nppsharpen_inputs[]
A link between two filters.
static void nppsharpen_uninit(AVFilterContext *ctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int nppsharpen_filter_frame(AVFilterLink *link, AVFrame *in)
A filter pad used for either input or output.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int nppsharpen_init(AVFilterContext *ctx)
#define AV_CEIL_RSHIFT(a, b)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_INPUTS(array)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Rational number (pair of numerator and denominator).
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
AVFilterLink ** inputs
array of pointers to input links
const char * av_default_item_name(void *ptr)
Return the context name.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFilterContext * src
source filter
#define AVERROR_EXTERNAL
Generic error in an external library.
static enum AVPixelFormat supported_formats[]
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
#define i(width, name, range_min, range_max)
static int nppsharpen_config(AVFilterContext *ctx, int width, int height)
int w
agreed upon image width
static int nppsharpen_config_props(AVFilterLink *outlink)
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
const char * name
Pad name.
static const AVFilterPad nppsharpen_outputs[]
This struct describes a set or pool of "hardware" frames (i.e.
This struct is allocated as AVHWDeviceContext.hwctx.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
static const AVClass nppsharpen_class
int h
agreed upon image height
static int nppsharpen_sharpen(AVFilterContext *ctx, AVFrame *out, AVFrame *in)
const AVFilter ff_vf_sharpen_npp
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
A reference to a data buffer.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define supported_format(d)
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.