FFmpeg
Loading...
Searching...
No Matches
qsvvpp.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/**
20 * @file
21 * Intel Quick Sync Video VPP base function
22 */
23
24#ifndef AVFILTER_QSVVPP_H
25#define AVFILTER_QSVVPP_H
26
27#include <mfxvideo.h>
28
29#include "avfilter.h"
30#include "libavutil/fifo.h"
31#include "libavutil/hwcontext.h"
33
34#define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
35#define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
36
37#define QSV_VERSION_ATLEAST(MAJOR, MINOR) \
38 (MFX_VERSION_MAJOR > (MAJOR) || \
39 MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
40
41#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR) \
42 ((MFX_VERSION.Major > (MAJOR)) || \
43 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
44
45#define QSV_ONEVPL QSV_VERSION_ATLEAST(2, 0)
46#define QSV_HAVE_OPAQUE !QSV_ONEVPL
47
48typedef struct QSVFrame {
50 mfxFrameSurface1 surface;
51 struct QSVFrame *next;
52 int queued;
53} QSVFrame;
54
55#define QSVVPP_MAX_FRAME_EXTBUFS 8
56
57typedef struct QSVVPPFrameParam {
58 /* To fill with MFX enhanced filter configurations */
60 mfxExtBuffer **ext_buf;
62
63typedef struct QSVVPPContext {
64 const AVClass *class;
65
66 mfxSession session;
67 int (*filter_frame) (AVFilterLink *outlink, AVFrame *frame); /**< callback */
68 int (*set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp); /**< callback */
69 enum AVPixelFormat out_sw_format; /**< Real output format */
70 mfxVideoParam vpp_param;
71 mfxFrameInfo *frame_infos; /**< frame info for each input */
72
73 /** members related to the input/output surface */
80 mfxFrameSurface1 **surface_ptrs_in;
81 mfxFrameSurface1 **surface_ptrs_out;
82
83#if QSV_HAVE_OPAQUE
84 /** MFXVPP extern parameters */
85 mfxExtOpaqueSurfaceAlloc opaque_alloc;
86#endif
87 /** store sequence parameters */
88 mfxExtBuffer **seq_buffers;
90
91 /** store all parameters for vpp execution, including parameters per frame */
92 mfxExtBuffer **ext_buffers;
94
97 int eof;
98 /** order with frame_out, sync */
100
101 mfxVersion ver;
104
105typedef struct QSVVPPCrop {
106 int in_idx; ///< Input index
107 int x, y, w, h; ///< Crop rectangle
108} QSVVPPCrop;
109
110typedef struct QSVVPPParam {
111 /* default is ff_filter_frame */
113 int (*set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp); /**< callback */
114
115 /* To fill with MFX enhanced filter configurations */
117 mfxExtBuffer **ext_buf;
118
119 /* Real output format */
121
122 /* Crop information for each input, if needed */
126
127/* create and initialize the QSV session */
128int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param);
129
130/* release the resources (eg.surfaces) */
132
133/* vpp filter frame and call the cb if needed */
135
136int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern,
137 const char *extra_string);
138
139int ff_qsvvpp_print_error(void *log_ctx, mfxStatus err,
140 const char *error_string);
141
142int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err,
143 const char *warning_string);
144
145int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation,
146 mfxVersion *pver, mfxSession *psession);
147
149#endif /* AVFILTER_QSVVPP_H */
static FILE * out
static AVFormatContext * ctx
Main libavfilter public API header.
static AVFrame * frame
A generic FIFO API.
An API-specific header for AV_HWDEVICE_TYPE_QSV.
uint8_t w
Definition llvidencdsp.c:39
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
int mfx_iopattern
Definition qsv.c:89
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition qsvvpp.c:1141
int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string)
Definition qsvvpp.c:73
int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation, mfxVersion *pver, mfxSession *psession)
Definition qsvvpp.c:1110
int ff_qsvvpp_print_error(void *log_ctx, mfxStatus err, const char *error_string)
Definition qsvvpp.c:155
int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err, const char *warning_string)
Definition qsvvpp.c:165
int ff_qsvvpp_filter_frame(QSVVPPContext *vpp, AVFilterLink *inlink, AVFrame *frame, AVFrame *propref)
Definition qsvvpp.c:959
int ff_qsvvpp_close(AVFilterContext *avctx)
Definition qsvvpp.c:935
int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param)
Definition qsvvpp.c:743
Describe the class of an AVClass context structure.
Definition log.h:76
Definition fifo.c:35
An instance of a filter.
Definition avfilter.h:273
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
struct QSVFrame * next
mfxFrameSurface1 surface
int nb_seq_buffers
Definition qsvvpp.h:89
mfxFrameSurface1 ** surface_ptrs_in
Definition qsvvpp.h:80
mfxSession session
Definition qsvvpp.h:66
int nb_surface_ptrs_out
Definition qsvvpp.h:79
int nb_surface_ptrs_in
Definition qsvvpp.h:78
enum AVPixelFormat out_sw_format
Real output format.
Definition qsvvpp.h:69
mfxFrameSurface1 ** surface_ptrs_out
Definition qsvvpp.h:81
mfxVideoParam vpp_param
Definition qsvvpp.h:70
mfxVersion ver
Definition qsvvpp.h:101
int vpp_initted
Definition qsvvpp.h:102
mfxExtBuffer ** seq_buffers
store sequence parameters
Definition qsvvpp.h:88
QSVFrame * in_frame_list
Definition qsvvpp.h:76
mfxFrameInfo * frame_infos
frame info for each input
Definition qsvvpp.h:71
AVFifo * async_fifo
order with frame_out, sync
Definition qsvvpp.h:99
int out_mem_mode
Definition qsvvpp.h:75
QSVFrame * out_frame_list
Definition qsvvpp.h:77
int async_depth
Definition qsvvpp.h:96
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
callback
Definition qsvvpp.h:67
int got_frame
Definition qsvvpp.h:95
mfxExtBuffer ** ext_buffers
store all parameters for vpp execution, including parameters per frame
Definition qsvvpp.h:92
int(* set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
callback
Definition qsvvpp.h:68
int in_mem_mode
members related to the input/output surface
Definition qsvvpp.h:74
int nb_ext_buffers
Definition qsvvpp.h:93
int h
Crop rectangle.
Definition qsvvpp.h:107
int in_idx
Input index.
Definition qsvvpp.h:106
mfxExtBuffer ** ext_buf
Definition qsvvpp.h:60
int(* set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
callback
Definition qsvvpp.h:113
int num_crop
Definition qsvvpp.h:123
QSVVPPCrop * crop
Definition qsvvpp.h:124
mfxExtBuffer ** ext_buf
Definition qsvvpp.h:117
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
Definition qsvvpp.h:112
enum AVPixelFormat out_sw_format
Definition qsvvpp.h:120
int num_ext_buf
Definition qsvvpp.h:116