FFmpeg
vf_deinterlace_vaapi.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <string.h>
20 
21 #include "libavutil/common.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/pixdesc.h"
24 
25 #include "avfilter.h"
26 #include "internal.h"
27 #include "video.h"
28 #include "vaapi_vpp.h"
29 
30 #define MAX_REFERENCES 8
31 
32 typedef struct DeintVAAPIContext {
33  VAAPIVPPContext vpp_ctx; // must be the first field
34 
35  int mode;
38 
39  VAProcFilterCapDeinterlacing
40  deint_caps[VAProcDeinterlacingCount];
42  VAProcPipelineCaps pipeline_caps;
43 
48 
49  int eof;
50  int prev_pts;
52 
53 static const char *deint_vaapi_mode_name(int mode)
54 {
55  switch (mode) {
56 #define D(name) case VAProcDeinterlacing ## name: return #name
57  D(Bob);
58  D(Weave);
59  D(MotionAdaptive);
60  D(MotionCompensated);
61 #undef D
62  default:
63  return "Invalid";
64  }
65 }
66 
68 {
69  DeintVAAPIContext *ctx = avctx->priv;
70  int i;
71 
72  for (i = 0; i < ctx->queue_count; i++)
73  av_frame_free(&ctx->frame_queue[i]);
74  ctx->queue_count = 0;
75 
77 }
78 
80 {
81  VAAPIVPPContext *vpp_ctx = avctx->priv;
82  DeintVAAPIContext *ctx = avctx->priv;
83  VAStatus vas;
84  VAProcFilterParameterBufferDeinterlacing params;
85  int i;
86 
87  ctx->nb_deint_caps = VAProcDeinterlacingCount;
88  vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display,
89  vpp_ctx->va_context,
90  VAProcFilterDeinterlacing,
91  &ctx->deint_caps,
92  &ctx->nb_deint_caps);
93  if (vas != VA_STATUS_SUCCESS) {
94  av_log(avctx, AV_LOG_ERROR, "Failed to query deinterlacing "
95  "caps: %d (%s).\n", vas, vaErrorStr(vas));
96  return AVERROR(EIO);
97  }
98 
99  if (ctx->mode == VAProcDeinterlacingNone) {
100  for (i = 0; i < ctx->nb_deint_caps; i++) {
101  if (ctx->deint_caps[i].type > ctx->mode)
102  ctx->mode = ctx->deint_caps[i].type;
103  }
104  av_log(avctx, AV_LOG_VERBOSE, "Picking %d (%s) as default "
105  "deinterlacing mode.\n", ctx->mode,
106  deint_vaapi_mode_name(ctx->mode));
107  } else {
108  for (i = 0; i < ctx->nb_deint_caps; i++) {
109  if (ctx->deint_caps[i].type == ctx->mode)
110  break;
111  }
112  if (i >= ctx->nb_deint_caps) {
113  av_log(avctx, AV_LOG_ERROR, "Deinterlacing mode %d (%s) is "
114  "not supported.\n", ctx->mode,
115  deint_vaapi_mode_name(ctx->mode));
116  return AVERROR(EINVAL);
117  }
118  }
119 
120  params.type = VAProcFilterDeinterlacing;
121  params.algorithm = ctx->mode;
122  params.flags = 0;
123 
125  VAProcFilterParameterBufferType,
126  &params,
127  sizeof(params),
128  1);
129  if (vas)
130  return vas;
131 
132  vas = vaQueryVideoProcPipelineCaps(vpp_ctx->hwctx->display,
133  vpp_ctx->va_context,
134  &vpp_ctx->filter_buffers[0], 1,
135  &ctx->pipeline_caps);
136  if (vas != VA_STATUS_SUCCESS) {
137  av_log(avctx, AV_LOG_ERROR, "Failed to query pipeline "
138  "caps: %d (%s).\n", vas, vaErrorStr(vas));
139  return AVERROR(EIO);
140  }
141 
142  ctx->extra_delay_for_timestamps = ctx->field_rate == 2 &&
143  ctx->pipeline_caps.num_backward_references == 0;
144 
145  ctx->queue_depth = ctx->pipeline_caps.num_backward_references +
146  ctx->pipeline_caps.num_forward_references +
147  ctx->extra_delay_for_timestamps + 1;
148  if (ctx->queue_depth > MAX_REFERENCES) {
149  av_log(avctx, AV_LOG_ERROR, "Pipeline requires too many "
150  "references (%u forward, %u back).\n",
151  ctx->pipeline_caps.num_forward_references,
152  ctx->pipeline_caps.num_backward_references);
153  return AVERROR(ENOSYS);
154  }
155 
156  return 0;
157 }
158 
160 {
161  AVFilterLink *inlink = outlink->src->inputs[0];
162  AVFilterContext *avctx = outlink->src;
163  DeintVAAPIContext *ctx = avctx->priv;
164  int err;
165 
166  err = ff_vaapi_vpp_config_output(outlink);
167  if (err < 0)
168  return err;
169  outlink->time_base = av_mul_q(inlink->time_base,
170  (AVRational) { 1, ctx->field_rate });
171  outlink->frame_rate = av_mul_q(inlink->frame_rate,
172  (AVRational) { ctx->field_rate, 1 });
173 
174  return 0;
175 }
176 
178 {
179  AVFilterContext *avctx = inlink->dst;
180  AVFilterLink *outlink = avctx->outputs[0];
181  VAAPIVPPContext *vpp_ctx = avctx->priv;
182  DeintVAAPIContext *ctx = avctx->priv;
184  VASurfaceID input_surface;
185  VASurfaceID backward_references[MAX_REFERENCES];
186  VASurfaceID forward_references[MAX_REFERENCES];
187  VAProcPipelineParameterBuffer params;
188  VAProcFilterParameterBufferDeinterlacing *filter_params;
189  VAStatus vas;
190  void *filter_params_addr = NULL;
191  int err, i, field, current_frame_index;
192 
193  // NULL frame is used to flush the queue in field mode
194  if (input_frame)
195  av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
196  av_get_pix_fmt_name(input_frame->format),
197  input_frame->width, input_frame->height, input_frame->pts);
198 
199  if (ctx->queue_count < ctx->queue_depth) {
200  ctx->frame_queue[ctx->queue_count++] = input_frame;
201  if (ctx->queue_count < ctx->queue_depth) {
202  // Need more reference surfaces before we can continue.
203  return 0;
204  }
205  } else {
206  av_frame_free(&ctx->frame_queue[0]);
207  for (i = 0; i + 1 < ctx->queue_count; i++)
208  ctx->frame_queue[i] = ctx->frame_queue[i + 1];
209  ctx->frame_queue[i] = input_frame;
210  }
211 
212  current_frame_index = ctx->pipeline_caps.num_forward_references;
213 
214  input_frame = ctx->frame_queue[current_frame_index];
215  if (!input_frame)
216  return 0;
217 
218  input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
219  for (i = 0; i < ctx->pipeline_caps.num_forward_references; i++)
220  forward_references[i] = (VASurfaceID)(uintptr_t)
221  ctx->frame_queue[current_frame_index - i - 1]->data[3];
222  for (i = 0; i < ctx->pipeline_caps.num_backward_references; i++)
223  backward_references[i] = (VASurfaceID)(uintptr_t)
224  ctx->frame_queue[current_frame_index + i + 1]->data[3];
225 
226  av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for "
227  "deinterlace input.\n", input_surface);
228  av_log(avctx, AV_LOG_DEBUG, "Backward references:");
229  for (i = 0; i < ctx->pipeline_caps.num_backward_references; i++)
230  av_log(avctx, AV_LOG_DEBUG, " %#x", backward_references[i]);
231  av_log(avctx, AV_LOG_DEBUG, "\n");
232  av_log(avctx, AV_LOG_DEBUG, "Forward references:");
233  for (i = 0; i < ctx->pipeline_caps.num_forward_references; i++)
234  av_log(avctx, AV_LOG_DEBUG, " %#x", forward_references[i]);
235  av_log(avctx, AV_LOG_DEBUG, "\n");
236 
237  for (field = 0; field < ctx->field_rate; field++) {
238  output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
239  vpp_ctx->output_height);
240  if (!output_frame) {
241  err = AVERROR(ENOMEM);
242  goto fail;
243  }
244 
245  err = av_frame_copy_props(output_frame, input_frame);
246  if (err < 0)
247  goto fail;
248 
249  err = ff_vaapi_vpp_init_params(avctx, &params,
250  input_frame, output_frame);
251  if (err < 0)
252  goto fail;
253 
254  if (!ctx->auto_enable || (input_frame->flags & AV_FRAME_FLAG_INTERLACED)) {
255  vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
256  &filter_params_addr);
257  if (vas != VA_STATUS_SUCCESS) {
258  av_log(avctx, AV_LOG_ERROR, "Failed to map filter parameter "
259  "buffer: %d (%s).\n", vas, vaErrorStr(vas));
260  err = AVERROR(EIO);
261  goto fail;
262  }
263  filter_params = filter_params_addr;
264  filter_params->flags = 0;
265  if (input_frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) {
266  filter_params->flags |= field ? VA_DEINTERLACING_BOTTOM_FIELD : 0;
267  } else {
268  filter_params->flags |= VA_DEINTERLACING_BOTTOM_FIELD_FIRST;
269  filter_params->flags |= field ? 0 : VA_DEINTERLACING_BOTTOM_FIELD;
270  }
271  filter_params_addr = NULL;
272  vas = vaUnmapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0]);
273  if (vas != VA_STATUS_SUCCESS)
274  av_log(avctx, AV_LOG_ERROR, "Failed to unmap filter parameter "
275  "buffer: %d (%s).\n", vas, vaErrorStr(vas));
276 
277  params.filters = &vpp_ctx->filter_buffers[0];
278  params.num_filters = 1;
279 
280  params.forward_references = forward_references;
281  params.num_forward_references =
282  ctx->pipeline_caps.num_forward_references;
283  params.backward_references = backward_references;
284  params.num_backward_references =
285  ctx->pipeline_caps.num_backward_references;
286 
287  } else {
288  params.filters = NULL;
289  params.num_filters = 0;
290  }
291 
292  err = ff_vaapi_vpp_render_picture(avctx, &params, output_frame);
293  if (err < 0)
294  goto fail;
295 
296  if (ctx->field_rate == 2) {
297  if (field == 0)
298  output_frame->pts = 2 * input_frame->pts;
299  else if (ctx->eof)
300  output_frame->pts = 3 * input_frame->pts - ctx->prev_pts;
301  else
302  output_frame->pts = input_frame->pts +
303  ctx->frame_queue[current_frame_index + 1]->pts;
304  }
305 #if FF_API_INTERLACED_FRAME
307  output_frame->interlaced_frame = 0;
309 #endif
311 
312  av_log(avctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n",
314  output_frame->width, output_frame->height, output_frame->pts);
315 
316  err = ff_filter_frame(outlink, output_frame);
317  if (err < 0)
318  break;
319  }
320 
321  ctx->prev_pts = input_frame->pts;
322 
323  return err;
324 
325 fail:
326  if (filter_params_addr)
327  vaUnmapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0]);
329  return err;
330 }
331 
333 {
334  AVFilterContext *avctx = link->src;
335  DeintVAAPIContext *ctx = avctx->priv;
336  int ret;
337 
338  if (ctx->eof)
339  return AVERROR_EOF;
340 
341  ret = ff_request_frame(link->src->inputs[0]);
342  if (ret == AVERROR_EOF && ctx->extra_delay_for_timestamps) {
343  ctx->eof = 1;
344  deint_vaapi_filter_frame(link->src->inputs[0], NULL);
345  } else if (ret < 0)
346  return ret;
347 
348  return 0;
349 }
350 
352 {
353  VAAPIVPPContext *vpp_ctx = avctx->priv;
354 
355  ff_vaapi_vpp_ctx_init(avctx);
358  vpp_ctx->output_format = AV_PIX_FMT_NONE;
359 
360  return 0;
361 }
362 
363 #define OFFSET(x) offsetof(DeintVAAPIContext, x)
364 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
365 static const AVOption deint_vaapi_options[] = {
366  { "mode", "Deinterlacing mode",
367  OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = VAProcDeinterlacingNone },
368  VAProcDeinterlacingNone, VAProcDeinterlacingCount - 1, FLAGS, .unit = "mode" },
369  { "default", "Use the highest-numbered (and therefore possibly most advanced) deinterlacing algorithm",
370  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, 0, 0, FLAGS, .unit = "mode" },
371  { "bob", "Use the bob deinterlacing algorithm",
372  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, 0, 0, FLAGS, .unit = "mode" },
373  { "weave", "Use the weave deinterlacing algorithm",
374  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, 0, 0, FLAGS, .unit = "mode" },
375  { "motion_adaptive", "Use the motion adaptive deinterlacing algorithm",
376  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 0, 0, FLAGS, .unit = "mode" },
377  { "motion_compensated", "Use the motion compensated deinterlacing algorithm",
378  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 0, 0, FLAGS, .unit = "mode" },
379 
380  { "rate", "Generate output at frame rate or field rate",
381  OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS, .unit = "rate" },
382  { "frame", "Output at frame rate (one frame of output for each field-pair)",
383  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "rate" },
384  { "field", "Output at field rate (one frame of output for each field)",
385  0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, .unit = "rate" },
386 
387  { "auto", "Only deinterlace fields, passing frames through unchanged",
388  OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
389 
390  { NULL },
391 };
392 
393 static const AVClass deint_vaapi_class = {
394  .class_name = "deinterlace_vaapi",
395  .item_name = av_default_item_name,
396  .option = deint_vaapi_options,
397  .version = LIBAVUTIL_VERSION_INT,
398 };
399 
400 static const AVFilterPad deint_vaapi_inputs[] = {
401  {
402  .name = "default",
403  .type = AVMEDIA_TYPE_VIDEO,
404  .filter_frame = &deint_vaapi_filter_frame,
405  .config_props = &ff_vaapi_vpp_config_input,
406  },
407 };
408 
410  {
411  .name = "default",
412  .type = AVMEDIA_TYPE_VIDEO,
413  .request_frame = &deint_vaapi_request_frame,
414  .config_props = &deint_vaapi_config_output,
415  },
416 };
417 
419  .name = "deinterlace_vaapi",
420  .description = NULL_IF_CONFIG_SMALL("Deinterlacing of VAAPI surfaces"),
421  .priv_size = sizeof(DeintVAAPIContext),
427  .priv_class = &deint_vaapi_class,
428  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
429 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:112
ff_vaapi_vpp_pipeline_uninit
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:49
ff_vaapi_vpp_ctx_init
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
Definition: vaapi_vpp.c:715
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
AVERROR
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
opt.h
OFFSET
#define OFFSET(x)
Definition: vf_deinterlace_vaapi.c:363
ff_vaapi_vpp_render_picture
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
Definition: vaapi_vpp.c:708
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:351
D
#define D(name)
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
DeintVAAPIContext::auto_enable
int auto_enable
Definition: vf_deinterlace_vaapi.c:37
inlink
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
Definition: filter_design.txt:212
FLAGS
#define FLAGS
Definition: vf_deinterlace_vaapi.c:364
deint_vaapi_config_output
static int deint_vaapi_config_output(AVFilterLink *outlink)
Definition: vf_deinterlace_vaapi.c:159
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
deint_vaapi_pipeline_uninit
static void deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
Definition: vf_deinterlace_vaapi.c:67
deint_vaapi_init
static av_cold int deint_vaapi_init(AVFilterContext *avctx)
Definition: vf_deinterlace_vaapi.c:351
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:486
AVFrame::width
int width
Definition: frame.h:446
AVOption
AVOption.
Definition: opt.h:357
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:463
DeintVAAPIContext::frame_queue
AVFrame * frame_queue[MAX_REFERENCES]
Definition: vf_deinterlace_vaapi.c:46
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
AVVAAPIDeviceContext::display
VADisplay display
The VADisplay handle, to be filled by the user.
Definition: hwcontext_vaapi.h:72
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:646
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
AV_FRAME_FLAG_TOP_FIELD_FIRST
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
Definition: frame.h:638
VAAPIVPPContext::build_filter_params
int(* build_filter_params)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:61
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:422
deint_vaapi_mode_name
static const char * deint_vaapi_mode_name(int mode)
Definition: vf_deinterlace_vaapi.c:53
fail
#define fail()
Definition: checkasm.h:182
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
DeintVAAPIContext::field_rate
int field_rate
Definition: vf_deinterlace_vaapi.c:36
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
DeintVAAPIContext::nb_deint_caps
int nb_deint_caps
Definition: vf_deinterlace_vaapi.c:41
AVFormatContext::flags
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1406
ff_vf_deinterlace_vaapi
const AVFilter ff_vf_deinterlace_vaapi
Definition: vf_deinterlace_vaapi.c:418
VAAPIVPPContext::output_width
int output_width
Definition: vaapi_vpp.h:53
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:49
VAAPIVPPContext::output_format
enum AVPixelFormat output_format
Definition: vaapi_vpp.h:52
ff_vaapi_vpp_make_param_buffers
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, int type, const void *data, size_t size, int count)
Definition: vaapi_vpp.c:583
DeintVAAPIContext::deint_caps
VAProcFilterCapDeinterlacing deint_caps[VAProcDeinterlacingCount]
Definition: vf_deinterlace_vaapi.c:40
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
VAAPIVPPContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_vpp.h:41
deint_vaapi_outputs
static const AVFilterPad deint_vaapi_outputs[]
Definition: vf_deinterlace_vaapi.c:409
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
link
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
Definition: filter_design.txt:23
deint_vaapi_request_frame
static int deint_vaapi_request_frame(AVFilterLink *link)
Definition: vf_deinterlace_vaapi.c:332
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
deint_vaapi_class
static const AVClass deint_vaapi_class
Definition: vf_deinterlace_vaapi.c:393
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:415
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
DeintVAAPIContext::eof
int eof
Definition: vf_deinterlace_vaapi.c:49
DeintVAAPIContext::extra_delay_for_timestamps
int extra_delay_for_timestamps
Definition: vf_deinterlace_vaapi.c:47
MAX_REFERENCES
#define MAX_REFERENCES
Definition: vf_deinterlace_vaapi.c:30
deint_vaapi_build_filter_params
static int deint_vaapi_build_filter_params(AVFilterContext *avctx)
Definition: vf_deinterlace_vaapi.c:79
ff_vaapi_vpp_config_input
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
Definition: vaapi_vpp.c:75
DeintVAAPIContext::queue_count
int queue_count
Definition: vf_deinterlace_vaapi.c:45
ff_vaapi_vpp_ctx_uninit
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:729
ff_vaapi_vpp_query_formats
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
Definition: vaapi_vpp.c:28
vaapi_vpp.h
DeintVAAPIContext::queue_depth
int queue_depth
Definition: vf_deinterlace_vaapi.c:44
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
deint_vaapi_options
static const AVOption deint_vaapi_options[]
Definition: vf_deinterlace_vaapi.c:365
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
DeintVAAPIContext::prev_pts
int prev_pts
Definition: vf_deinterlace_vaapi.c:50
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:461
output_frame
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
Definition: h264dec.c:875
internal.h
VAAPIVPPContext::output_height
int output_height
Definition: vaapi_vpp.h:54
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
DeintVAAPIContext::mode
int mode
Definition: vf_deinterlace_vaapi.c:35
VAAPIVPPContext::filter_buffers
VABufferID filter_buffers[VAProcFilterCount]
Definition: vaapi_vpp.h:56
common.h
DeintVAAPIContext::vpp_ctx
VAAPIVPPContext vpp_ctx
Definition: vf_deinterlace_vaapi.c:33
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
AV_FRAME_FLAG_INTERLACED
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition: frame.h:633
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
DeintVAAPIContext::pipeline_caps
VAProcPipelineCaps pipeline_caps
Definition: vf_deinterlace_vaapi.c:42
VAAPIVPPContext
Definition: vaapi_vpp.h:38
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
VAAPIVPPContext::va_context
VAContextID va_context
Definition: vaapi_vpp.h:46
AVFrame::height
int height
Definition: frame.h:446
ff_vaapi_vpp_config_output
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
Definition: vaapi_vpp.c:100
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245
avfilter.h
VAAPIVPPContext::pipeline_uninit
void(* pipeline_uninit)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:63
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
deint_vaapi_filter_frame
static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
Definition: vf_deinterlace_vaapi.c:177
DeintVAAPIContext
Definition: vf_deinterlace_vaapi.c:32
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:254
deint_vaapi_inputs
static const AVFilterPad deint_vaapi_inputs[]
Definition: vf_deinterlace_vaapi.c:400
av_get_pix_fmt_name
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.
Definition: pixdesc.c:2885
ff_vaapi_vpp_init_params
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
Definition: vaapi_vpp.c:534
AVFilterContext::outputs
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:419