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 
73 
75 
77 
79  VAProcPipelineParameterBuffer *params,
80  const AVFrame *input_frame,
82 
84  int type,
85  const void *data,
86  size_t size,
87  int count);
88 
90  VAProcPipelineParameterBuffer *params,
92 
94  VAProcPipelineParameterBuffer *params_list,
95  int count,
97 
98 #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:528
ff_vaapi_vpp_ctx_init
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
Definition: vaapi_vpp.c:709
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:577
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:340
VAAPIVPPContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_vpp.h:49
data
const char data[16]
Definition: mxf.c:148
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:361
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:723
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
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_vaapi_vpp_config_input
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
Definition: vaapi_vpp.c:74
ff_vaapi_vpp_pipeline_uninit
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:48
size
int size
Definition: twinvq_data.h:10344
output_frame
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
Definition: h264dec.c:874
VAAPIVPPContext::valid_ids
int valid_ids
Definition: vaapi_vpp.h:44
ff_vaapi_vpp_query_formats
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
Definition: vaapi_vpp.c:27
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:99
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:634
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
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:407
VAAPIVPPContext::nb_filter_buffers
int nb_filter_buffers
Definition: vaapi_vpp.h:57
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
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:702
hwcontext.h
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68
VAAPIVPPContext::device_ref
AVBufferRef * device_ref
Definition: vaapi_vpp.h:42
int
int
Definition: ffmpeg_filter.c:425