35#include <mfxdispatcher.h>
37#define MFXUnload(a) do { } while(0)
40#define IS_VIDEO_MEMORY(mode) (mode & (MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | \
41 MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))
43#define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
45#define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
46#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
48#define QSV_HAVE_AUDIO !QSV_ONEVPL
61 {MFX_IOPATTERN_IN_VIDEO_MEMORY,
"input is video memory surface" },
62 {MFX_IOPATTERN_IN_SYSTEM_MEMORY,
"input is system memory surface" },
64 {MFX_IOPATTERN_IN_OPAQUE_MEMORY,
"input is opaque memory surface" },
66 {MFX_IOPATTERN_OUT_VIDEO_MEMORY,
"output is video memory surface" },
67 {MFX_IOPATTERN_OUT_SYSTEM_MEMORY,
"output is system memory surface" },
69 {MFX_IOPATTERN_OUT_OPAQUE_MEMORY,
"output is opaque memory surface" },
74 const char *extra_string)
84 desc =
"unknown iopattern";
95 { MFX_ERR_NONE, 0,
"success" },
97 { MFX_ERR_NULL_PTR,
AVERROR(EINVAL),
"NULL pointer" },
98 { MFX_ERR_UNSUPPORTED,
AVERROR(ENOSYS),
"unsupported" },
99 { MFX_ERR_MEMORY_ALLOC,
AVERROR(ENOMEM),
"failed to allocate memory" },
100 { MFX_ERR_NOT_ENOUGH_BUFFER,
AVERROR(ENOMEM),
"insufficient input/output buffer" },
101 { MFX_ERR_INVALID_HANDLE,
AVERROR(EINVAL),
"invalid handle" },
102 { MFX_ERR_LOCK_MEMORY,
AVERROR(EIO),
"failed to lock the memory block" },
103 { MFX_ERR_NOT_INITIALIZED,
AVERROR_BUG,
"not initialized" },
104 { MFX_ERR_NOT_FOUND,
AVERROR(ENOSYS),
"specified object was not found" },
108 { MFX_ERR_MORE_SURFACE,
AVERROR_UNKNOWN,
"expect more surface at output" },
109 { MFX_ERR_MORE_BITSTREAM,
AVERROR_UNKNOWN,
"expect more bitstream at output" },
111 { MFX_ERR_DEVICE_LOST,
AVERROR(EIO),
"device lost" },
112 { MFX_ERR_INCOMPATIBLE_VIDEO_PARAM,
AVERROR(EINVAL),
"incompatible video parameters" },
113 { MFX_ERR_INVALID_VIDEO_PARAM,
AVERROR(EINVAL),
"invalid video parameters" },
114 { MFX_ERR_UNDEFINED_BEHAVIOR,
AVERROR_BUG,
"undefined behavior" },
115 { MFX_ERR_DEVICE_FAILED,
AVERROR(EIO),
"device failed" },
117 { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM,
AVERROR(EINVAL),
"incompatible audio parameters" },
118 { MFX_ERR_INVALID_AUDIO_PARAM,
AVERROR(EINVAL),
"invalid audio parameters" },
120 { MFX_ERR_GPU_HANG,
AVERROR(EIO),
"GPU Hang" },
121 { MFX_ERR_REALLOC_SURFACE,
AVERROR_UNKNOWN,
"need bigger surface for output" },
123 { MFX_WRN_IN_EXECUTION, 0,
"operation in execution" },
124 { MFX_WRN_DEVICE_BUSY, 0,
"device busy" },
125 { MFX_WRN_VIDEO_PARAM_CHANGED, 0,
"video parameters changed" },
126 { MFX_WRN_PARTIAL_ACCELERATION, 0,
"partial acceleration" },
127 { MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, 0,
"incompatible video parameters" },
128 { MFX_WRN_VALUE_NOT_CHANGED, 0,
"value is saturated" },
129 { MFX_WRN_OUT_OF_RANGE, 0,
"value out of range" },
130 { MFX_WRN_FILTER_SKIPPED, 0,
"filter skipped" },
132 { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,
"incompatible audio parameters" },
135#if QSV_VERSION_ATLEAST(1, 31)
136 { MFX_ERR_NONE_PARTIAL_OUTPUT, 0,
"partial output" },
151 *
desc =
"unknown error";
156 const char *error_string)
166 const char *warning_string)
176static mfxStatus
frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req,
177 mfxFrameAllocResponse *resp)
182 if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET) ||
183 !(req->Type & (MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT)) ||
184 !(req->Type & MFX_MEMTYPE_EXTERNAL_FRAME))
185 return MFX_ERR_UNSUPPORTED;
187 if (req->Type & MFX_MEMTYPE_FROM_VPPIN) {
188 resp->mids =
av_mallocz(
s->nb_surface_ptrs_in *
sizeof(*resp->mids));
192 for (
i = 0;
i <
s->nb_surface_ptrs_in;
i++)
193 resp->mids[
i] =
s->surface_ptrs_in[
i]->Data.MemId;
195 resp->NumFrameActual =
s->nb_surface_ptrs_in;
197 resp->mids =
av_mallocz(
s->nb_surface_ptrs_out *
sizeof(*resp->mids));
201 for (
i = 0;
i <
s->nb_surface_ptrs_out;
i++)
202 resp->mids[
i] =
s->surface_ptrs_out[
i]->Data.MemId;
204 resp->NumFrameActual =
s->nb_surface_ptrs_out;
210static mfxStatus
frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp)
216static mfxStatus
frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
218 return MFX_ERR_UNSUPPORTED;
221static mfxStatus
frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
223 return MFX_ERR_UNSUPPORTED;
228 mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
229 mfxHDLPair *pair_src = (mfxHDLPair*)mid;
231 pair_dst->first = pair_src->first;
233 if (pair_src->second != (mfxMemId)MFX_INFINITE)
234 pair_dst->second = pair_src->second;
242 return MFX_FOURCC_YV12;
244 return MFX_FOURCC_NV12;
246 return MFX_FOURCC_YUY2;
248 return MFX_FOURCC_RGB4;
250 return MFX_FOURCC_P010;
253 return MFX_FOURCC_UYVY;
257 return MFX_FOURCC_NV12;
262 switch (
frame->format) {
265 surface->Data.Y =
frame->data[0];
266 surface->Data.UV =
frame->data[1];
269 surface->Data.Y =
frame->data[0];
270 surface->Data.U =
frame->data[1];
271 surface->Data.V =
frame->data[2];
274 surface->Data.Y =
frame->data[0];
275 surface->Data.U =
frame->data[0] + 1;
276 surface->Data.V =
frame->data[0] + 3;
279 surface->Data.B =
frame->data[0];
280 surface->Data.G =
frame->data[0] + 1;
281 surface->Data.R =
frame->data[0] + 2;
282 surface->Data.A =
frame->data[0] + 3;
285 surface->Data.Y =
frame->data[0] + 1;
286 surface->Data.U =
frame->data[0];
287 surface->Data.V =
frame->data[0] + 2;
290 return MFX_ERR_UNSUPPORTED;
292 surface->Data.Pitch =
frame->linesize[0];
311 frames_hwctx = frames_ctx->
hwctx;
319 frameinfo->CropX = 0;
320 frameinfo->CropY = 0;
321 frameinfo->Width =
FFALIGN(link->
w, 32);
322 frameinfo->Height =
FFALIGN(link->
h, 32);
323 frameinfo->PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
325 frameinfo->BitDepthLuma =
desc->comp[0].depth;
326 frameinfo->BitDepthChroma =
desc->comp[0].depth;
327 frameinfo->Shift =
desc->comp[0].depth > 8;
328 if (
desc->log2_chroma_w &&
desc->log2_chroma_h)
329 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV420;
330 else if (
desc->log2_chroma_w)
331 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV422;
333 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV444;
336 frameinfo->CropW = link->
w;
337 frameinfo->CropH = link->
h;
343 if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN == 0) {
344 frameinfo->FrameRateExtN = 25;
345 frameinfo->FrameRateExtD = 1;
373 *list = (*list)->
next;
435 if (!qsv_frame->
frame)
459 qsv_frame->
surface.Info.PicStruct =
462 MFX_PICSTRUCT_FIELD_BFF);
464 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED;
466 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING;
468 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING;
492 if (!out_frame->
frame)
508 if (!out_frame->
frame)
533 out_frame->
surface.Info =
s->vpp_param.vpp.Out;
535 for (
int i = 0;
i <
s->vpp_param.NumExtParam;
i++) {
536 mfxExtBuffer *extbuf =
s->vpp_param.ExtParam[
i];
538 if (extbuf->BufferId == MFX_EXTBUFF_VPP_DEINTERLACING) {
544 out_frame->
surface.Info.PicStruct =
547 MFX_PICSTRUCT_FIELD_BFF);
566 mfxHandleType handle_type;
575 in_frames_hwctx = frames_ctx->
hwctx;
580 sizeof(*
s->surface_ptrs_in));
581 if (!
s->surface_ptrs_in)
585 s->surface_ptrs_in[
i] = in_frames_hwctx->
surfaces +
i;
590 s->in_mem_mode = MFX_MEMTYPE_SYSTEM_MEMORY;
597 device_hwctx = device_ctx->
hwctx;
600 ret = MFXQueryIMPL(device_hwctx->
session, &impl);
601 if (ret == MFX_ERR_NONE)
602 ret = MFXQueryVersion(device_hwctx->
session, &ver);
603 if (ret != MFX_ERR_NONE) {
609 handle_type = MFX_HANDLE_VA_DISPLAY;
611 handle_type = MFX_HANDLE_D3D11_DEVICE;
613 handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
626 s->out_mem_mode = IS_OPAQUE_MEMORY(
s->in_mem_mode) ?
627 MFX_MEMTYPE_OPAQUE_FRAME :
628 MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
630 s->out_mem_mode = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
634 out_frames_hwctx = out_frames_ctx->
hwctx;
659 sizeof(*
s->surface_ptrs_out));
660 if (!
s->surface_ptrs_out) {
666 s->surface_ptrs_out[
i] = out_frames_hwctx->
surfaces +
i;
672 s->out_mem_mode = MFX_MEMTYPE_SYSTEM_MEMORY;
674 ret = MFXVideoCORE_GetHandle(device_hwctx->
session, handle_type, &handle);
688 ret = MFXQueryVersion(
s->session, &
s->ver);
689 if (ret != MFX_ERR_NONE) {
695 ret = MFXVideoCORE_SetHandle(
s->session, handle_type, handle);
696 if (ret != MFX_ERR_NONE)
701 ret = MFXJoinSession(device_hwctx->
session,
s->session);
702 if (ret != MFX_ERR_NONE)
707 if (IS_OPAQUE_MEMORY(
s->in_mem_mode) || IS_OPAQUE_MEMORY(
s->out_mem_mode)) {
708 s->opaque_alloc.In.Surfaces =
s->surface_ptrs_in;
709 s->opaque_alloc.In.NumSurface =
s->nb_surface_ptrs_in;
710 s->opaque_alloc.In.Type =
s->in_mem_mode;
712 s->opaque_alloc.Out.Surfaces =
s->surface_ptrs_out;
713 s->opaque_alloc.Out.NumSurface =
s->nb_surface_ptrs_out;
714 s->opaque_alloc.Out.Type =
s->out_mem_mode;
716 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
717 s->opaque_alloc.Header.BufferSz =
sizeof(
s->opaque_alloc);
721 mfxFrameAllocator frame_allocator = {
730 ret = MFXVideoCORE_SetFrameAllocator(
s->session, &frame_allocator);
731 if (ret != MFX_ERR_NONE)
750 if (!
s->filter_frame)
755 if (!
s->set_frame_ext_params)
764 if (!
s->frame_infos) {
783 s->frame_infos[crop->
in_idx].CropX = crop->
x;
784 s->frame_infos[crop->
in_idx].CropY = crop->
y;
785 s->frame_infos[crop->
in_idx].CropW = crop->
w;
786 s->frame_infos[crop->
in_idx].CropH = crop->
h;
789 s->vpp_param.vpp.In =
s->frame_infos[0];
799 if (IS_OPAQUE_MEMORY(
s->in_mem_mode) || IS_OPAQUE_MEMORY(
s->out_mem_mode))
803 if (
s->nb_seq_buffers) {
804 s->seq_buffers =
av_calloc(
s->nb_seq_buffers,
sizeof(*
s->seq_buffers));
805 if (!
s->seq_buffers) {
814 if (IS_OPAQUE_MEMORY(
s->in_mem_mode) || IS_OPAQUE_MEMORY(
s->out_mem_mode))
815 s->seq_buffers[
i] = (mfxExtBuffer *)&
s->opaque_alloc;
818 s->nb_ext_buffers =
s->nb_seq_buffers;
819 s->ext_buffers =
av_calloc(
s->nb_ext_buffers,
sizeof(*
s->ext_buffers));
820 if (!
s->ext_buffers) {
825 memcpy(
s->ext_buffers,
s->seq_buffers,
s->nb_seq_buffers *
sizeof(*
s->seq_buffers));
828 s->vpp_param.ExtParam =
s->ext_buffers;
829 s->vpp_param.NumExtParam =
s->nb_ext_buffers;
835 if (!
s->async_fifo) {
840 s->vpp_param.AsyncDepth =
s->async_depth;
843 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_SYSTEM_MEMORY;
845 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_VIDEO_MEMORY;
847 else if (IS_OPAQUE_MEMORY(
s->in_mem_mode))
848 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_OPAQUE_MEMORY;
852 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
854 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_VIDEO_MEMORY;
856 else if (IS_OPAQUE_MEMORY(
s->out_mem_mode))
857 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
866 ret = MFXVideoVPP_Query(
s->session, &
s->vpp_param, &
s->vpp_param);
887 ret =
s->set_frame_ext_params(avctx, in->
frame,
out->frame, &fp);
895 s->ext_buffers =
av_calloc(
s->nb_ext_buffers,
sizeof(*
s->ext_buffers));
899 memcpy(&
s->ext_buffers[0],
s->seq_buffers,
s->nb_seq_buffers *
sizeof(*
s->seq_buffers));
901 s->vpp_param.ExtParam =
s->ext_buffers;
902 s->vpp_param.NumExtParam =
s->nb_ext_buffers;
905 if (!
s->vpp_initted) {
906 s->vpp_param.vpp.In.PicStruct = in->
surface.Info.PicStruct;
907 s->vpp_param.vpp.Out.PicStruct =
out->surface.Info.PicStruct;
910 ret = MFXVideoVPP_Query(
s->session, &
s->vpp_param, &
s->vpp_param);
916 ret = MFXVideoVPP_Init(
s->session, &
s->vpp_param);
924 ret = MFXVideoVPP_Reset(
s->session, &
s->vpp_param);
940 MFXVideoVPP_Close(
s->session);
941 MFXClose(
s->session);
966 int ret, ret1, filter_ret;
969 if (MFXVideoCORE_SyncOperation(
s->session, aframe.
sync, 1000) < 0)
972 filter_ret =
s->filter_frame(outlink, aframe.
frame->
frame);
973 if (filter_ret < 0) {
1004 ret = MFXVideoVPP_RunFrameVPPAsync(
s->session, &in_frame->
surface,
1006 if (ret == MFX_WRN_DEVICE_BUSY)
1008 }
while (ret == MFX_WRN_DEVICE_BUSY);
1010 if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) {
1012 if (ret == MFX_ERR_MORE_DATA)
1028 ret1 = MFXVideoCORE_SyncOperation(
s->session, aframe.
sync, 1000);
1029 }
while (ret1 == MFX_WRN_IN_EXECUTION);
1036 filter_ret =
s->filter_frame(outlink, aframe.
frame->
frame);
1037 if (filter_ret < 0) {
1046 }
while(ret == MFX_ERR_MORE_SURFACE);
1060 mfxIMPL implementation,
1062 mfxSession *psession)
1065 mfxSession session =
NULL;
1066 uint32_t impl_idx = 0;
1069 "Use Intel(R) oneVPL to create MFX session with the specified MFX loader\n");
1078 mfxImplDescription *impl_desc;
1080 sts = MFXEnumImplementations(loader, impl_idx,
1081 MFX_IMPLCAPS_IMPLDESCSTRUCTURE,
1082 (mfxHDL *)&impl_desc);
1084 if (sts == MFX_ERR_NOT_FOUND)
1086 else if (sts != MFX_ERR_NONE) {
1091 sts = MFXCreateSession(loader, impl_idx, &session);
1092 MFXDispReleaseImplDescription(loader, impl_desc);
1093 if (sts == MFX_ERR_NONE)
1101 "Error creating a MFX session");
1103 *psession = session;
1112 mfxIMPL implementation,
1114 mfxSession *psession)
1116 mfxSession session =
NULL;
1120 "Use Intel(R) Media SDK to create MFX session, API version is "
1121 "%d.%d, the required implementation version is %d.%d\n",
1122 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor);
1125 sts = MFXInit(implementation, pver, &session);
1128 "Error initializing an MFX session");
1134 *psession = session;
static const char *const format[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define i(width, name, range_min, range_max)
common internal and external API header
static enum AVPixelFormat pix_fmt
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
size_t av_fifo_can_read(const AVFifo *f)
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define FF_INLINK_IDX(link)
Find the index of a link.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
static const struct @263361020336145376152124322306240314177011071374 qsv_iopatterns[]
static const struct @313360353265145032047314164301105156143154063363 qsv_errors[]
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
static const AVRational default_tb
#define IS_VIDEO_MEMORY(mode)
static int qsv_map_error(mfxStatus mfx_err, const char **desc)
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
static int pix_fmt_to_mfx_fourcc(int format)
static void clear_frame_list(QSVFrame **list)
int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string)
static QSVFrame * get_free_frame(QSVFrame **list)
static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp)
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref, AVFrame *propref)
static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation, mfxVersion *pver, mfxSession *psession)
static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, AVFilterLink *link)
static mfxStatus frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
#define IS_SYSTEM_MEMORY(mode)
static int map_frame_to_surface(AVFrame *frame, mfxFrameSurface1 *surface)
static QSVFrame * query_frame(QSVVPPContext *s, AVFilterLink *outlink, const AVFrame *in, const AVFrame *propref)
static void clear_unused_frames(QSVFrame *list)
int ff_qsvvpp_print_error(void *log_ctx, mfxStatus err, const char *error_string)
static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
#define MFX_IMPL_VIA_MASK(impl)
int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err, const char *warning_string)
static mfxStatus frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp)
static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
static int qsvvpp_init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s, const QSVFrame *in, QSVFrame *out)
static QSVFrame * submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
int ff_qsvvpp_close(AVFilterContext *avctx)
static int set_frame_ext_params_null(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param)
Intel Quick Sync Video VPP base function.
#define QSVVPP_MAX_FRAME_EXTBUFS
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
unsigned nb_inputs
number of input pads
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
int format
agreed upon media format
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int64_t duration
Duration of the frame, in the same units as pts.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
int repeat_pict
Number of fields in this frame which should be repeated, i.e.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int initial_pool_size
Initial size of the frame pool.
int width
The allocated dimensions of the frames in this pool.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
This struct is allocated as AVHWDeviceContext.hwctx.
void * loader
The mfxLoader handle used for mfxSession creation.
This struct is allocated as AVHWFramesContext.hwctx.
mfxFrameSurface1 * surfaces
A pointer to a mfxFrameSurface1 struct.
int nb_surfaces
Number of frames in the pool.
int frame_type
A combination of MFX_MEMTYPE_* describing the frame pool.
mfxFrameInfo * info
A pointer to a mfxFrameInfo struct.
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
int(* set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
callback
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
enum AVPixelFormat out_sw_format
static AVFormatContext * ctx
int av_usleep(unsigned usec)
Sleep for a period of time.
AVFrame * ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.