31#define DENOISE_DEFAULT 0
34#define SHARPNESS_MIN 0
35#define SHARPNESS_MAX 64
36#define SHARPNESS_DEFAULT 44
50static float map(
int x,
int in_min,
int in_max,
float out_min,
float out_max)
54 slope = 1.0 * (out_max - out_min) / (in_max - in_min);
55 output = out_min + slope * (x - in_min);
68 uint32_t num_caps = 1;
70 VAProcFilterParameterBuffer
denoise;
73 VAProcFilterNoiseReduction,
75 if (vas != VA_STATUS_SUCCESS) {
77 "context: %d (%s).\n", vas, vaErrorStr(vas));
81 denoise.type = VAProcFilterNoiseReduction;
84 caps.range.max_value);
86 VAProcFilterParameterBufferType,
98 uint32_t num_caps = 1;
100 VAProcFilterParameterBuffer sharpness;
103 VAProcFilterSharpening,
105 if (vas != VA_STATUS_SUCCESS) {
107 "context: %d (%s).\n", vas, vaErrorStr(vas));
111 sharpness.type = VAProcFilterSharpening;
112 sharpness.value =
map(
ctx->sharpness,
114 caps.range.min_value,
115 caps.range.max_value);
117 VAProcFilterParameterBufferType,
118 &sharpness,
sizeof(sharpness), 1);
127 VAProcPipelineParameterBuffer
params;
209#define DOFFSET(x) offsetof(DenoiseVAAPIContext, x)
210#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
212 {
"denoise",
"denoise level",
217#define SOFFSET(x) offsetof(SharpnessVAAPIContext, x)
219 {
"sharpness",
"sharpness level",
245 .p.name =
"denoise_vaapi",
247 .p.priv_class = &denoise_vaapi_class,
258 .p.name =
"sharpness_vaapi",
260 .p.priv_class = &sharpness_vaapi_class,
SwsAArch64OpImplParams params
const FFFilter ff_vf_denoise_vaapi
const FFFilter ff_vf_sharpness_vaapi
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const VDPAUPixFmtMap * map
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
VADisplay display
The VADisplay handle, to be filled by the user.
VABufferID filter_buffers[VAProcFilterCount]
void(* pipeline_uninit)(AVFilterContext *avctx)
enum AVPixelFormat output_format
int(* build_filter_params)(AVFilterContext *avctx)
AVVAAPIDeviceContext * hwctx
static AVFormatContext * ctx
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, int type, const void *data, size_t size, int count)
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
static int denoise_vaapi_build_filter_params(AVFilterContext *avctx)
#define SHARPNESS_DEFAULT
static const AVOption sharpness_vaapi_options[]
static av_cold int sharpness_vaapi_init(AVFilterContext *avctx)
static const AVFilterPad misc_vaapi_outputs[]
static av_cold int denoise_vaapi_init(AVFilterContext *avctx)
static const AVFilterPad misc_vaapi_inputs[]
static const AVOption denoise_vaapi_options[]
static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
static int sharpness_vaapi_build_filter_params(AVFilterContext *avctx)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.