FFmpeg
vaapi_vpp.h
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 #ifndef AVFILTER_VAAPI_VPP_H
20 #define AVFILTER_VAAPI_VPP_H
21 
22 #include <va/va.h>
23 #include <va/va_vpp.h>
24 
25 #include "libavutil/hwcontext.h"
27 
28 #include "avfilter.h"
29 
30 static inline VASurfaceID ff_vaapi_vpp_get_surface_id(const AVFrame *frame)
31 {
32  return (uintptr_t)frame->data[3];
33 }
34 
35 // ARGB black, for VAProcPipelineParameterBuffer.output_background_color.
36 #define VAAPI_VPP_BACKGROUND_BLACK 0xff000000
37 
38 typedef struct VAAPIVPPContext {
39  const AVClass *class;
40 
43 
44  int valid_ids;
45  VAConfigID va_config;
46  VAContextID va_context;
47 
50  VARectangle input_region;
51 
53  int output_width; // computed width
54  int output_height; // computed height
55 
56  VABufferID filter_buffers[VAProcFilterCount];
58 
60 
62 
65 
67 
69 
71  AVFilterFormatsConfig **cfg_in,
72  AVFilterFormatsConfig **cfg_out);
73 
75 
77 
79 
81  VAProcPipelineParameterBuffer *params,
82  const AVFrame *input_frame,
84 
86  int type,
87  const void *data,
88  size_t size,
89  int count);
90 
92  VAProcPipelineParameterBuffer *params,
94 
96  VAProcPipelineParameterBuffer *params_list,
97  int count,
99 
100 #endif /* AVFILTER_VAAPI_VPP_H */
ff_vaapi_vpp_get_surface_id
static VASurfaceID ff_vaapi_vpp_get_surface_id(const AVFrame *frame)
Definition: vaapi_vpp.h:30
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
VAAPIVPPContext::input_frames_ref
AVBufferRef * input_frames_ref
Definition: vaapi_vpp.h:48
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:533
ff_vaapi_vpp_ctx_init
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
Definition: vaapi_vpp.c:714
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:582
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
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
VAAPIVPPContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_vpp.h:49
data
const char data[16]
Definition: mxf.c:149
VAAPIVPPContext::build_filter_params
int(* build_filter_params)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:61
type
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 just let it vf type
Definition: writing_filters.txt:86
ff_vaapi_vpp_ctx_uninit
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:728
VAAPIVPPContext::output_width
int output_width
Definition: vaapi_vpp.h:53
VAAPIVPPContext::output_format
enum AVPixelFormat output_format
Definition: vaapi_vpp.h:52
VAAPIVPPContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_vpp.h:41
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
ff_vaapi_vpp_config_input
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
Definition: vaapi_vpp.c:71
ff_vaapi_vpp_pipeline_uninit
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:45
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:111
size
int size
Definition: twinvq_data.h:10344
output_frame
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
Definition: h264dec.c:875
VAAPIVPPContext::valid_ids
int valid_ids
Definition: vaapi_vpp.h:44
VAAPIVPPContext::output_height
int output_height
Definition: vaapi_vpp.h:54
ff_vaapi_vpp_config_output
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
Definition: vaapi_vpp.c:97
ff_vaapi_vpp_render_pictures
int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params_list, int count, AVFrame *output_frame)
Definition: vaapi_vpp.c:639
VAAPIVPPContext::filter_buffers
VABufferID filter_buffers[VAProcFilterCount]
Definition: vaapi_vpp.h:56
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:115
hwcontext_vaapi.h
VAAPIVPPContext
Definition: vaapi_vpp.h:38
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
VAAPIVPPContext::va_context
VAContextID va_context
Definition: vaapi_vpp.h:46
avfilter.h
VAAPIVPPContext::va_config
VAConfigID va_config
Definition: vaapi_vpp.h:45
VAAPIVPPContext::passthrough
int passthrough
Definition: vaapi_vpp.h:59
VAAPIVPPContext::pipeline_uninit
void(* pipeline_uninit)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:63
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
VAAPIVPPContext::nb_filter_buffers
int nb_filter_buffers
Definition: vaapi_vpp.h:57
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
ff_vaapi_vpp_query_formats
int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: vaapi_vpp.c:29
VAAPIVPPContext::input_region
VARectangle input_region
Definition: vaapi_vpp.h:50
ff_vaapi_vpp_render_picture
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
Definition: vaapi_vpp.c:707
hwcontext.h
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68
VAAPIVPPContext::device_ref
AVBufferRef * device_ref
Definition: vaapi_vpp.h:42