Go to the documentation of this file.
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)
176 static 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;
210 static mfxStatus
frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp)
216 static mfxStatus
frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
218 return MFX_ERR_UNSUPPORTED;
221 static 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];
310 frames_hwctx = frames_ctx->
hwctx;
311 *frameinfo = frames_hwctx->
surfaces[0].Info;
318 frameinfo->CropX = 0;
319 frameinfo->CropY = 0;
322 frameinfo->PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
324 frameinfo->BitDepthLuma =
desc->comp[0].depth;
325 frameinfo->BitDepthChroma =
desc->comp[0].depth;
326 frameinfo->Shift =
desc->comp[0].depth > 8;
327 if (
desc->log2_chroma_w &&
desc->log2_chroma_h)
328 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV420;
329 else if (
desc->log2_chroma_w)
330 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV422;
332 frameinfo->ChromaFormat = MFX_CHROMAFORMAT_YUV444;
335 frameinfo->CropW =
link->w;
336 frameinfo->CropH =
link->h;
337 frameinfo->FrameRateExtN =
link->frame_rate.num;
338 frameinfo->FrameRateExtD =
link->frame_rate.den;
342 if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN == 0) {
343 frameinfo->FrameRateExtN = 25;
344 frameinfo->FrameRateExtD = 1;
358 if ((
list->queued == 1) && !
list->surface.Data.Locked) {
372 *
list = (*list)->next;
434 if (!qsv_frame->
frame)
463 qsv_frame->
surface.Info.PicStruct =
466 MFX_PICSTRUCT_FIELD_BFF);
468 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED;
470 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING;
472 qsv_frame->
surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING;
494 if (!out_frame->
frame)
516 if (!out_frame->
frame)
538 out_frame->
surface.Info =
s->vpp_param.vpp.Out;
540 for (
int i = 0;
i <
s->vpp_param.NumExtParam;
i++) {
541 mfxExtBuffer *extbuf =
s->vpp_param.ExtParam[
i];
543 if (extbuf->BufferId == MFX_EXTBUFF_VPP_DEINTERLACING) {
544 #if FF_API_INTERLACED_FRAME
554 out_frame->
surface.Info.PicStruct =
557 MFX_PICSTRUCT_FIELD_BFF);
574 mfxHandleType handle_type;
579 if (
inlink->hw_frames_ctx) {
583 in_frames_hwctx = frames_ctx->
hwctx;
588 sizeof(*
s->surface_ptrs_in));
589 if (!
s->surface_ptrs_in)
593 s->surface_ptrs_in[
i] = in_frames_hwctx->
surfaces +
i;
598 s->in_mem_mode = MFX_MEMTYPE_SYSTEM_MEMORY;
605 device_hwctx = device_ctx->
hwctx;
615 MFX_MEMTYPE_OPAQUE_FRAME :
616 MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
618 s->out_mem_mode = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
622 out_frames_hwctx = out_frames_ctx->
hwctx;
641 sizeof(*
s->surface_ptrs_out));
642 if (!
s->surface_ptrs_out) {
648 s->surface_ptrs_out[
i] = out_frames_hwctx->
surfaces +
i;
654 s->out_mem_mode = MFX_MEMTYPE_SYSTEM_MEMORY;
657 ret = MFXQueryIMPL(device_hwctx->
session, &impl);
658 if (
ret == MFX_ERR_NONE)
659 ret = MFXQueryVersion(device_hwctx->
session, &ver);
660 if (
ret != MFX_ERR_NONE) {
666 handle_type = MFX_HANDLE_VA_DISPLAY;
668 handle_type = MFX_HANDLE_D3D11_DEVICE;
670 handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
676 ret = MFXVideoCORE_GetHandle(device_hwctx->
session, handle_type, &handle);
690 ret = MFXQueryVersion(
s->session, &
s->ver);
691 if (
ret != MFX_ERR_NONE) {
697 ret = MFXVideoCORE_SetHandle(
s->session, handle_type, handle);
698 if (
ret != MFX_ERR_NONE)
703 ret = MFXJoinSession(device_hwctx->
session,
s->session);
704 if (
ret != MFX_ERR_NONE)
710 s->opaque_alloc.In.Surfaces =
s->surface_ptrs_in;
711 s->opaque_alloc.In.NumSurface =
s->nb_surface_ptrs_in;
712 s->opaque_alloc.In.Type =
s->in_mem_mode;
714 s->opaque_alloc.Out.Surfaces =
s->surface_ptrs_out;
715 s->opaque_alloc.Out.NumSurface =
s->nb_surface_ptrs_out;
716 s->opaque_alloc.Out.Type =
s->out_mem_mode;
718 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
719 s->opaque_alloc.Header.BufferSz =
sizeof(
s->opaque_alloc);
723 mfxFrameAllocator frame_allocator = {
732 ret = MFXVideoCORE_SetFrameAllocator(
s->session, &frame_allocator);
733 if (
ret != MFX_ERR_NONE)
752 if (!
s->filter_frame)
757 if (!
s->set_frame_ext_params)
766 if (!
s->frame_infos) {
785 s->frame_infos[crop->
in_idx].CropX = crop->
x;
786 s->frame_infos[crop->
in_idx].CropY = crop->
y;
787 s->frame_infos[crop->
in_idx].CropW = crop->
w;
788 s->frame_infos[crop->
in_idx].CropH = crop->
h;
791 s->vpp_param.vpp.In =
s->frame_infos[0];
805 if (
s->nb_seq_buffers) {
806 s->seq_buffers =
av_calloc(
s->nb_seq_buffers,
sizeof(*
s->seq_buffers));
807 if (!
s->seq_buffers) {
817 s->seq_buffers[
i] = (mfxExtBuffer *)&
s->opaque_alloc;
820 s->nb_ext_buffers =
s->nb_seq_buffers;
821 s->ext_buffers =
av_calloc(
s->nb_ext_buffers,
sizeof(*
s->ext_buffers));
822 if (!
s->ext_buffers) {
827 memcpy(
s->ext_buffers,
s->seq_buffers,
s->nb_seq_buffers *
sizeof(*
s->seq_buffers));
830 s->vpp_param.ExtParam =
s->ext_buffers;
831 s->vpp_param.NumExtParam =
s->nb_ext_buffers;
837 if (!
s->async_fifo) {
842 s->vpp_param.AsyncDepth =
s->async_depth;
845 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_SYSTEM_MEMORY;
847 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_VIDEO_MEMORY;
850 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_OPAQUE_MEMORY;
854 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
856 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_VIDEO_MEMORY;
859 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
868 ret = MFXVideoVPP_Query(
s->session, &
s->vpp_param, &
s->vpp_param);
893 if (
fp.num_ext_buf) {
895 s->nb_ext_buffers =
s->nb_seq_buffers +
fp.num_ext_buf;
897 s->ext_buffers =
av_calloc(
s->nb_ext_buffers,
sizeof(*
s->ext_buffers));
901 memcpy(&
s->ext_buffers[0],
s->seq_buffers,
s->nb_seq_buffers *
sizeof(*
s->seq_buffers));
902 memcpy(&
s->ext_buffers[
s->nb_seq_buffers],
fp.ext_buf,
fp.num_ext_buf *
sizeof(*
fp.ext_buf));
903 s->vpp_param.ExtParam =
s->ext_buffers;
904 s->vpp_param.NumExtParam =
s->nb_ext_buffers;
907 if (!
s->vpp_initted) {
908 s->vpp_param.vpp.In.PicStruct = in->
surface.Info.PicStruct;
909 s->vpp_param.vpp.Out.PicStruct =
out->surface.Info.PicStruct;
912 ret = MFXVideoVPP_Query(
s->session, &
s->vpp_param, &
s->vpp_param);
918 ret = MFXVideoVPP_Init(
s->session, &
s->vpp_param);
925 }
else if (
fp.num_ext_buf) {
926 ret = MFXVideoVPP_Reset(
s->session, &
s->vpp_param);
942 MFXVideoVPP_Close(
s->session);
943 MFXClose(
s->session);
968 int ret, ret1, filter_ret;
971 if (MFXVideoCORE_SyncOperation(
s->session, aframe.
sync, 1000) < 0)
974 filter_ret =
s->filter_frame(outlink, aframe.
frame->
frame);
975 if (filter_ret < 0) {
1006 ret = MFXVideoVPP_RunFrameVPPAsync(
s->session, &in_frame->
surface,
1008 if (
ret == MFX_WRN_DEVICE_BUSY)
1010 }
while (
ret == MFX_WRN_DEVICE_BUSY);
1012 if (
ret < 0 &&
ret != MFX_ERR_MORE_SURFACE) {
1014 if (
ret == MFX_ERR_MORE_DATA)
1029 ret1 = MFXVideoCORE_SyncOperation(
s->session, aframe.
sync, 1000);
1030 }
while (ret1 == MFX_WRN_IN_EXECUTION);
1037 filter_ret =
s->filter_frame(outlink, aframe.
frame->
frame);
1038 if (filter_ret < 0) {
1047 }
while(
ret == MFX_ERR_MORE_SURFACE);
1061 mfxIMPL implementation,
1063 mfxSession *psession)
1066 mfxSession session =
NULL;
1067 uint32_t impl_idx = 0;
1070 "Use Intel(R) oneVPL to create MFX session with the specified MFX loader\n");
1079 mfxImplDescription *impl_desc;
1081 sts = MFXEnumImplementations(loader, impl_idx,
1082 MFX_IMPLCAPS_IMPLDESCSTRUCTURE,
1083 (mfxHDL *)&impl_desc);
1085 if (sts == MFX_ERR_NOT_FOUND)
1087 else if (sts != MFX_ERR_NONE) {
1092 sts = MFXCreateSession(loader, impl_idx, &session);
1093 MFXDispReleaseImplDescription(loader, impl_desc);
1094 if (sts == MFX_ERR_NONE)
1102 "Error creating a MFX session");
1105 "Warning in MFX session creation");
1109 *psession = session;
1118 mfxIMPL implementation,
1120 mfxSession *psession)
1122 mfxSession session =
NULL;
1126 "Use Intel(R) Media SDK to create MFX session, API version is "
1127 "%d.%d, the required implementation version is %d.%d\n",
1128 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor);
1131 sts = MFXInit(implementation, pver, &session);
1134 "Error initializing an MFX session");
1140 *psession = session;
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.
static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
#define FF_ENABLE_DEPRECATION_WARNINGS
int frame_type
A combination of MFX_MEMTYPE_* describing the frame pool.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
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
#define IS_OPAQUE_MEMORY(mode)
static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp)
enum AVPixelFormat out_sw_format
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t duration
Duration of the frame, in the same units as pts.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
uint8_t * data
The data buffer.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
static QSVFrame * query_frame(QSVVPPContext *s, AVFilterLink *outlink, const AVFrame *in)
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
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).
This struct is allocated as AVHWDeviceContext.hwctx.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
#define AV_LOG_VERBOSE
Detailed information.
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int width
The allocated dimensions of the frames in this pool.
A link between two filters.
static const struct @270 qsv_errors[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#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 * priv
private data for use by the filter
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
static void clear_unused_frames(QSVFrame *list)
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string)
#define MFX_IMPL_VIA_MASK(impl)
attribute_deprecated int interlaced_frame
The content of the picture is interlaced.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static enum AVPixelFormat pix_fmt
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
#define QSVVPP_MAX_FRAME_EXTBUFS
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static const AVRational default_tb
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int av_usleep(unsigned usec)
Sleep for a period of time.
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
static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, AVFilterLink *link)
int ff_qsvvpp_close(AVFilterContext *avctx)
mfxFrameSurface1 * surfaces
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Rational number (pair of numerator and denominator).
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
static int pix_fmt_to_mfx_fourcc(int format)
int ff_qsvvpp_print_error(void *log_ctx, mfxStatus err, const char *error_string)
AVFilterLink ** inputs
array of pointers to input links
size_t av_fifo_can_read(const AVFifo *f)
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 list
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
unsigned nb_inputs
number of input pads
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
int format
agreed upon media format
#define IS_VIDEO_MEMORY(mode)
static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
AVFilterContext * src
source filter
static int set_frame_ext_params_null(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
void * loader
The mfxLoader handle used for mfxSession creation.
static const struct @269 qsv_iopatterns[]
#define i(width, name, range_min, range_max)
int w
agreed upon image width
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
static mfxStatus frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param)
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
void * av_calloc(size_t nmemb, size_t size)
static int map_frame_to_surface(AVFrame *frame, mfxFrameSurface1 *surface)
This struct describes a set or pool of "hardware" frames (i.e.
@ 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...
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
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
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.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
int h
agreed upon image height
#define FF_INLINK_IDX(link)
Find the index of a link.
static int qsv_map_error(mfxStatus mfx_err, const char **desc)
static void clear_frame_list(QSVFrame **list)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
#define FF_DISABLE_DEPRECATION_WARNINGS
This struct is allocated as AVHWFramesContext.hwctx.
int initial_pool_size
Initial size of the frame pool.
static int qsvvpp_init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s, const QSVFrame *in, QSVFrame *out)
A reference to a data buffer.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define IS_SYSTEM_MEMORY(mode)
static QSVFrame * get_free_frame(QSVFrame **list)
int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation, mfxVersion *pver, mfxSession *psession)
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
static mfxStatus frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp)
int(* set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
callbak
int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err, const char *warning_string)
int repeat_pict
Number of fields in this frame which should be repeated, i.e.
static QSVFrame * submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
AVFilterLink ** outputs
array of pointers to output links