32 #define DENOISE_MAX 64 33 #define DENOISE_DEFAULT 0 36 #define SHARPNESS_MIN 0 37 #define SHARPNESS_MAX 64 38 #define SHARPNESS_DEFAULT 44 52 static float map(
int x,
int in_min,
int in_max,
float out_min,
float out_max)
56 slope = 1.0 * (out_max - out_min) / (in_max - in_min);
57 output = out_min + slope * (x - in_min);
70 uint32_t num_caps = 1;
72 VAProcFilterParameterBuffer
denoise;
75 VAProcFilterNoiseReduction,
77 if (vas != VA_STATUS_SUCCESS) {
79 "context: %d (%s).\n", vas, vaErrorStr(vas));
83 denoise.type = VAProcFilterNoiseReduction;
86 caps.range.max_value);
88 &denoise,
sizeof(denoise), 1);
101 uint32_t num_caps = 1;
103 VAProcFilterParameterBuffer sharpness;
106 VAProcFilterSharpening,
108 if (vas != VA_STATUS_SUCCESS) {
110 "context: %d (%s).\n", vas, vaErrorStr(vas));
114 sharpness.type = VAProcFilterSharpening;
117 caps.range.min_value,
118 caps.range.max_value);
120 VAProcFilterParameterBufferType,
121 &sharpness,
sizeof(sharpness), 1);
132 VASurfaceID input_surface, output_surface;
133 VARectangle input_region;
135 VAProcPipelineParameterBuffer
params;
145 input_surface = (VASurfaceID)(uintptr_t)input_frame->
data[3];
156 output_surface = (VASurfaceID)(uintptr_t)output_frame->
data[3];
159 memset(¶ms, 0,
sizeof(params));
160 input_region = (VARectangle) {
163 .width = input_frame->
width,
164 .height = input_frame->
height,
171 params.surface = input_surface;
172 params.surface_region = &input_region;
173 params.surface_color_standard =
176 params.output_region =
NULL;
177 params.output_background_color = 0xff000000;
178 params.output_color_standard = params.surface_color_standard;
180 params.pipeline_flags = 0;
181 params.filter_flags = VA_FRAME_PICTURE;
228 #define DOFFSET(x) offsetof(DenoiseVAAPIContext, x) 229 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) 231 {
"denoise",
"denoise level",
236 #define SOFFSET(x) offsetof(SharpnessVAAPIContext, x) 238 {
"sharpness",
"sharpness level",
266 .
name =
"denoise_vaapi",
272 .
inputs = misc_vaapi_inputs,
274 .priv_class = &denoise_vaapi_class,
279 .
name =
"sharpness_vaapi",
285 .
inputs = misc_vaapi_inputs,
287 .priv_class = &sharpness_vaapi_class,
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
static const AVFilterPad misc_vaapi_inputs[]
This structure describes decoded (raw) audio or video data.
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
#define SHARPNESS_DEFAULT
Main libavfilter public API header.
Memory handling functions.
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
static av_cold int init(AVCodecContext *avctx)
static const AVOption sharpness_vaapi_options[]
static const AVFilterPad misc_vaapi_outputs[]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold int uninit(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, VASurfaceID output_surface)
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static av_cold int sharpness_vaapi_init(AVFilterContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVFILTER_DEFINE_CLASS(denoise_vaapi)
enum AVColorSpace colorspace
YUV colorspace type.
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, int type, const void *data, size_t size, int count)
static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
AVFilter ff_vf_sharpness_vaapi
static av_cold int denoise_vaapi_init(AVFilterContext *avctx)
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
VADisplay display
The VADisplay handle, to be filled by the user.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
VABufferID filter_buffers[VAProcFilterCount]
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
enum AVPixelFormat output_format
AVVAAPIDeviceContext * hwctx
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const char const char * params
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
static int query_formats(AVFilterContext *ctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
static int sharpness_vaapi_build_filter_params(AVFilterContext *avctx)
int ff_vaapi_vpp_colour_standard(enum AVColorSpace av_cs)
AVFilterContext * dst
dest filter
static int denoise_vaapi_build_filter_params(AVFilterContext *avctx)
static const AVOption denoise_vaapi_options[]
static float map(int x, int in_min, int in_max, float out_min, float out_max)
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.
int(* build_filter_params)(AVFilterContext *avctx)
void(* pipeline_uninit)(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFilter ff_vf_denoise_vaapi