History

qsv: restrict OPAQUE memory to MFX_VERSION < 2.0

OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL

Haihao Xiang committed 6 years ago

Commit c77149b1 parent 63cda4011 files · +181 −74Browse files

Showing the changes to libavfilter (4 of 11 files). Show all

Unified · Split

4 files
  1. libavfilter/qsvvpp.c +25 −1
  2. libavfilter/qsvvpp.h +3 −0
  3. libavfilter/vf_deinterlace_qsv.c +32 −25
  4. libavfilter/vf_scale_qsv.c +41 −33
libavfilter/qsvvpp.c+25−1
@@ -34,7 +34,9 @@ · 33 unmodified lines
34 34
35#define IS_VIDEO_MEMORY(mode) (mode & (MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | \35#define IS_VIDEO_MEMORY(mode) (mode & (MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | \
36 MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))36 MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))
37#if QSV_HAVE_OPAQUE
37#define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)38#define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
39#endif
38#define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)40#define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
39#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))41#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
40 42
@@ -53,10 +55,14 @@ static const struct { · 12 unmodified lines
53} qsv_iopatterns[] = {55} qsv_iopatterns[] = {
54 {MFX_IOPATTERN_IN_VIDEO_MEMORY, "input is video memory surface" },56 {MFX_IOPATTERN_IN_VIDEO_MEMORY, "input is video memory surface" },
55 {MFX_IOPATTERN_IN_SYSTEM_MEMORY, "input is system memory surface" },57 {MFX_IOPATTERN_IN_SYSTEM_MEMORY, "input is system memory surface" },
58#if QSV_HAVE_OPAQUE
56 {MFX_IOPATTERN_IN_OPAQUE_MEMORY, "input is opaque memory surface" },59 {MFX_IOPATTERN_IN_OPAQUE_MEMORY, "input is opaque memory surface" },
60#endif
57 {MFX_IOPATTERN_OUT_VIDEO_MEMORY, "output is video memory surface" },61 {MFX_IOPATTERN_OUT_VIDEO_MEMORY, "output is video memory surface" },
58 {MFX_IOPATTERN_OUT_SYSTEM_MEMORY, "output is system memory surface" },62 {MFX_IOPATTERN_OUT_SYSTEM_MEMORY, "output is system memory surface" },
63#if QSV_HAVE_OPAQUE
59 {MFX_IOPATTERN_OUT_OPAQUE_MEMORY, "output is opaque memory surface" },64 {MFX_IOPATTERN_OUT_OPAQUE_MEMORY, "output is opaque memory surface" },
65#endif
60};66};
61 67
62int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern,68int ff_qsvvpp_print_iopattern(void *log_ctx, int mfx_iopattern,
@@ -542,9 +548,13 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) · 479 unmodified lines
542 if (!out_frames_ref)548 if (!out_frames_ref)
543 return AVERROR(ENOMEM);549 return AVERROR(ENOMEM);
544 550
551#if QSV_HAVE_OPAQUE
545 s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ?552 s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ?
546 MFX_MEMTYPE_OPAQUE_FRAME :553 MFX_MEMTYPE_OPAQUE_FRAME :
547 MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;554 MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
555#else
556 s->out_mem_mode = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT;
557#endif
548 558
549 out_frames_ctx = (AVHWFramesContext *)out_frames_ref->data;559 out_frames_ctx = (AVHWFramesContext *)out_frames_ref->data;
550 out_frames_hwctx = out_frames_ctx->hwctx;560 out_frames_hwctx = out_frames_ctx->hwctx;
@@ -630,6 +640,7 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) · 79 unmodified lines
630 return AVERROR_UNKNOWN;640 return AVERROR_UNKNOWN;
631 }641 }
632 642
643#if QSV_HAVE_OPAQUE
633 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) {644 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) {
634 s->opaque_alloc.In.Surfaces = s->surface_ptrs_in;645 s->opaque_alloc.In.Surfaces = s->surface_ptrs_in;
635 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs_in;646 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs_in;
@@ -641,7 +652,9 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) · 5 unmodified lines
641 652
642 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;653 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
643 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);654 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);
644 } else if (IS_VIDEO_MEMORY(s->in_mem_mode) || IS_VIDEO_MEMORY(s->out_mem_mode)) {655 } else
656#endif
657 if (IS_VIDEO_MEMORY(s->in_mem_mode) || IS_VIDEO_MEMORY(s->out_mem_mode)) {
645 mfxFrameAllocator frame_allocator = {658 mfxFrameAllocator frame_allocator = {
646 .pthis = s,659 .pthis = s,
647 .Alloc = frame_alloc,660 .Alloc = frame_alloc,
@@ -713,6 +726,7 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p · 65 unmodified lines
713 goto failed;726 goto failed;
714 }727 }
715 728
729#if QSV_HAVE_OPAQUE
716 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) {730 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) {
717 s->nb_ext_buffers = param->num_ext_buf + 1;731 s->nb_ext_buffers = param->num_ext_buf + 1;
718 s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers));732 s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers));
@@ -730,6 +744,10 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p · 11 unmodified lines
730 s->vpp_param.NumExtParam = param->num_ext_buf;744 s->vpp_param.NumExtParam = param->num_ext_buf;
731 s->vpp_param.ExtParam = param->ext_buf;745 s->vpp_param.ExtParam = param->ext_buf;
732 }746 }
747#else
748 s->vpp_param.NumExtParam = param->num_ext_buf;
749 s->vpp_param.ExtParam = param->ext_buf;
750#endif
733 751
734 s->got_frame = 0;752 s->got_frame = 0;
735 753
@@ -747,15 +765,19 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p · 11 unmodified lines
747 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_SYSTEM_MEMORY;765 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_SYSTEM_MEMORY;
748 else if (IS_VIDEO_MEMORY(s->in_mem_mode))766 else if (IS_VIDEO_MEMORY(s->in_mem_mode))
749 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_VIDEO_MEMORY;767 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_VIDEO_MEMORY;
768#if QSV_HAVE_OPAQUE
750 else if (IS_OPAQUE_MEMORY(s->in_mem_mode))769 else if (IS_OPAQUE_MEMORY(s->in_mem_mode))
751 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_OPAQUE_MEMORY;770 s->vpp_param.IOPattern |= MFX_IOPATTERN_IN_OPAQUE_MEMORY;
771#endif
752 772
753 if (IS_SYSTEM_MEMORY(s->out_mem_mode))773 if (IS_SYSTEM_MEMORY(s->out_mem_mode))
754 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_SYSTEM_MEMORY;774 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
755 else if (IS_VIDEO_MEMORY(s->out_mem_mode))775 else if (IS_VIDEO_MEMORY(s->out_mem_mode))
756 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_VIDEO_MEMORY;776 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_VIDEO_MEMORY;
777#if QSV_HAVE_OPAQUE
757 else if (IS_OPAQUE_MEMORY(s->out_mem_mode))778 else if (IS_OPAQUE_MEMORY(s->out_mem_mode))
758 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;779 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
780#endif
759 781
760 /* Print input memory mode */782 /* Print input memory mode */
761 ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0x0F, "VPP");783 ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0x0F, "VPP");
@@ -794,7 +816,9 @@ int ff_qsvvpp_free(QSVVPPContext **vpp) · 32 unmodified lines
794 clear_frame_list(&s->out_frame_list);816 clear_frame_list(&s->out_frame_list);
795 av_freep(&s->surface_ptrs_in);817 av_freep(&s->surface_ptrs_in);
796 av_freep(&s->surface_ptrs_out);818 av_freep(&s->surface_ptrs_out);
819#if QSV_HAVE_OPAQUE
797 av_freep(&s->ext_buffers);820 av_freep(&s->ext_buffers);
821#endif
798 av_freep(&s->frame_infos);822 av_freep(&s->frame_infos);
799 av_fifo_freep2(&s->async_fifo);823 av_fifo_freep2(&s->async_fifo);
800 av_freep(vpp);824 av_freep(vpp);
libavfilter/qsvvpp.h+3−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))41 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
42 42
43#define QSV_ONEVPL QSV_VERSION_ATLEAST(2, 0)43#define QSV_ONEVPL QSV_VERSION_ATLEAST(2, 0)
44#define QSV_HAVE_OPAQUE !QSV_ONEVPL
44 45
45typedef struct QSVFrame {46typedef struct QSVFrame {
46 AVFrame *frame;47 AVFrame *frame;
@@ -66,10 +67,12 @@ typedef struct QSVVPPContext { · 19 unmodified lines
66 mfxFrameSurface1 **surface_ptrs_in;67 mfxFrameSurface1 **surface_ptrs_in;
67 mfxFrameSurface1 **surface_ptrs_out;68 mfxFrameSurface1 **surface_ptrs_out;
68 69
70#if QSV_HAVE_OPAQUE
69 /** MFXVPP extern parameters */71 /** MFXVPP extern parameters */
70 mfxExtOpaqueSurfaceAlloc opaque_alloc;72 mfxExtOpaqueSurfaceAlloc opaque_alloc;
71 mfxExtBuffer **ext_buffers;73 mfxExtBuffer **ext_buffers;
72 int nb_ext_buffers;74 int nb_ext_buffers;
75#endif
73 76
74 int got_frame;77 int got_frame;
75 int async_depth;78 int async_depth;
libavfilter/vf_deinterlace_qsv.c+32−25
@@ -62,7 +62,9 @@ typedef struct QSVDeintContext { · 61 unmodified lines
62 mfxFrameSurface1 **surface_ptrs;62 mfxFrameSurface1 **surface_ptrs;
63 int nb_surface_ptrs;63 int nb_surface_ptrs;
64 64
65#if QSV_HAVE_OPAQUE
65 mfxExtOpaqueSurfaceAlloc opaque_alloc;66 mfxExtOpaqueSurfaceAlloc opaque_alloc;
67#endif
66 mfxExtVPPDeinterlacing deint_conf;68 mfxExtVPPDeinterlacing deint_conf;
67 mfxExtBuffer *ext_buffers[2];69 mfxExtBuffer *ext_buffers[2];
68 int num_ext_buffers;70 int num_ext_buffers;
@@ -154,9 +156,7 @@ static int init_out_session(AVFilterContext *ctx) · 85 unmodified lines
154 AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)s->hw_frames_ctx->data;156 AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)s->hw_frames_ctx->data;
155 AVQSVFramesContext *hw_frames_hwctx = hw_frames_ctx->hwctx;157 AVQSVFramesContext *hw_frames_hwctx = hw_frames_ctx->hwctx;
156 AVQSVDeviceContext *device_hwctx = hw_frames_ctx->device_ctx->hwctx;158 AVQSVDeviceContext *device_hwctx = hw_frames_ctx->device_ctx->hwctx;
157 159 int opaque = 0;
158 int opaque = !!(hw_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
159
160 mfxHDL handle = NULL;160 mfxHDL handle = NULL;
161 mfxHandleType handle_type;161 mfxHandleType handle_type;
162 mfxVersion ver;162 mfxVersion ver;
@@ -165,6 +165,9 @@ static int init_out_session(AVFilterContext *ctx) · 2 unmodified lines
165 mfxStatus err;165 mfxStatus err;
166 int i;166 int i;
167 167
168#if QSV_HAVE_OPAQUE
169 opaque = !!(hw_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
170#endif
168 /* extract the properties of the "master" session given to us */171 /* extract the properties of the "master" session given to us */
169 err = MFXQueryIMPL(device_hwctx->session, &impl);172 err = MFXQueryIMPL(device_hwctx->session, &impl);
170 if (err == MFX_ERR_NONE)173 if (err == MFX_ERR_NONE)
@@ -223,28 +226,7 @@ static int init_out_session(AVFilterContext *ctx) · 52 unmodified lines
223 226
224 s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->deint_conf;227 s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->deint_conf;
225 228
226 if (opaque) {229 if (!opaque) {
227 s->surface_ptrs = av_calloc(hw_frames_hwctx->nb_surfaces,
228 sizeof(*s->surface_ptrs));
229 if (!s->surface_ptrs)
230 return AVERROR(ENOMEM);
231 for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++)
232 s->surface_ptrs[i] = hw_frames_hwctx->surfaces + i;
233 s->nb_surface_ptrs = hw_frames_hwctx->nb_surfaces;
234
235 s->opaque_alloc.In.Surfaces = s->surface_ptrs;
236 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs;
237 s->opaque_alloc.In.Type = hw_frames_hwctx->frame_type;
238
239 s->opaque_alloc.Out = s->opaque_alloc.In;
240
241 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
242 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);
243
244 s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->opaque_alloc;
245
246 par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
247 } else {
248 mfxFrameAllocator frame_allocator = {230 mfxFrameAllocator frame_allocator = {
249 .pthis = ctx,231 .pthis = ctx,
250 .Alloc = frame_alloc,232 .Alloc = frame_alloc,
@@ -268,6 +250,31 @@ static int init_out_session(AVFilterContext *ctx) · 17 unmodified lines
268 250
269 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;251 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;
270 }252 }
253#if QSV_HAVE_OPAQUE
254 else {
255 s->surface_ptrs = av_calloc(hw_frames_hwctx->nb_surfaces,
256 sizeof(*s->surface_ptrs));
257
258 if (!s->surface_ptrs)
259 return AVERROR(ENOMEM);
260 for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++)
261 s->surface_ptrs[i] = hw_frames_hwctx->surfaces + i;
262 s->nb_surface_ptrs = hw_frames_hwctx->nb_surfaces;
263
264 s->opaque_alloc.In.Surfaces = s->surface_ptrs;
265 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs;
266 s->opaque_alloc.In.Type = hw_frames_hwctx->frame_type;
267
268 s->opaque_alloc.Out = s->opaque_alloc.In;
269
270 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
271 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);
272
273 s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->opaque_alloc;
274
275 par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
276 }
277#endif
271 278
272 par.ExtParam = s->ext_buffers;279 par.ExtParam = s->ext_buffers;
273 par.NumExtParam = s->num_ext_buffers;280 par.NumExtParam = s->num_ext_buffers;
libavfilter/vf_scale_qsv.c+41−33
@@ -89,7 +89,9 @@ typedef struct QSVScaleContext { · 88 unmodified lines
89 mfxFrameSurface1 **surface_ptrs_out;89 mfxFrameSurface1 **surface_ptrs_out;
90 int nb_surface_ptrs_out;90 int nb_surface_ptrs_out;
91 91
92#if QSV_HAVE_OPAQUE
92 mfxExtOpaqueSurfaceAlloc opaque_alloc;93 mfxExtOpaqueSurfaceAlloc opaque_alloc;
94#endif
93 95
94 mfxExtVPPScaling scale_conf;96 mfxExtVPPScaling scale_conf;
95 int mode;97 int mode;
@@ -268,7 +270,7 @@ static int init_out_session(AVFilterContext *ctx) · 172 unmodified lines
268 AVQSVFramesContext *out_frames_hwctx = out_frames_ctx->hwctx;270 AVQSVFramesContext *out_frames_hwctx = out_frames_ctx->hwctx;
269 AVQSVDeviceContext *device_hwctx = in_frames_ctx->device_ctx->hwctx;271 AVQSVDeviceContext *device_hwctx = in_frames_ctx->device_ctx->hwctx;
270 272
271 int opaque = !!(in_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);273 int opaque = 0;
272 274
273 mfxHDL handle = NULL;275 mfxHDL handle = NULL;
274 mfxHandleType handle_type;276 mfxHandleType handle_type;
@@ -278,6 +280,9 @@ static int init_out_session(AVFilterContext *ctx) · 3 unmodified lines
278 mfxStatus err;280 mfxStatus err;
279 int i;281 int i;
280 282
283#if QSV_HAVE_OPAQUE
284 opaque = !!(in_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
285#endif
281 s->num_ext_buf = 0;286 s->num_ext_buf = 0;
282 287
283 /* extract the properties of the "master" session given to us */288 /* extract the properties of the "master" session given to us */
@@ -330,38 +335,7 @@ static int init_out_session(AVFilterContext *ctx) · 46 unmodified lines
330 335
331 memset(&par, 0, sizeof(par));336 memset(&par, 0, sizeof(par));
332 337
333 if (opaque) {338 if (!opaque) {
334 s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces,
335 sizeof(*s->surface_ptrs_in));
336 if (!s->surface_ptrs_in)
337 return AVERROR(ENOMEM);
338 for (i = 0; i < in_frames_hwctx->nb_surfaces; i++)
339 s->surface_ptrs_in[i] = in_frames_hwctx->surfaces + i;
340 s->nb_surface_ptrs_in = in_frames_hwctx->nb_surfaces;
341
342 s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces,
343 sizeof(*s->surface_ptrs_out));
344 if (!s->surface_ptrs_out)
345 return AVERROR(ENOMEM);
346 for (i = 0; i < out_frames_hwctx->nb_surfaces; i++)
347 s->surface_ptrs_out[i] = out_frames_hwctx->surfaces + i;
348 s->nb_surface_ptrs_out = out_frames_hwctx->nb_surfaces;
349
350 s->opaque_alloc.In.Surfaces = s->surface_ptrs_in;
351 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs_in;
352 s->opaque_alloc.In.Type = in_frames_hwctx->frame_type;
353
354 s->opaque_alloc.Out.Surfaces = s->surface_ptrs_out;
355 s->opaque_alloc.Out.NumSurface = s->nb_surface_ptrs_out;
356 s->opaque_alloc.Out.Type = out_frames_hwctx->frame_type;
357
358 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
359 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);
360
361 s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->opaque_alloc;
362
363 par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
364 } else {
365 mfxFrameAllocator frame_allocator = {339 mfxFrameAllocator frame_allocator = {
366 .pthis = ctx,340 .pthis = ctx,
367 .Alloc = frame_alloc,341 .Alloc = frame_alloc,
@@ -393,6 +367,40 @@ static int init_out_session(AVFilterContext *ctx) · 25 unmodified lines
393 367
394 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;368 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;
395 }369 }
370#if QSV_HAVE_OPAQUE
371 else {
372 s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces,
373 sizeof(*s->surface_ptrs_in));
374 if (!s->surface_ptrs_in)
375 return AVERROR(ENOMEM);
376 for (i = 0; i < in_frames_hwctx->nb_surfaces; i++)
377 s->surface_ptrs_in[i] = in_frames_hwctx->surfaces + i;
378 s->nb_surface_ptrs_in = in_frames_hwctx->nb_surfaces;
379
380 s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces,
381 sizeof(*s->surface_ptrs_out));
382 if (!s->surface_ptrs_out)
383 return AVERROR(ENOMEM);
384 for (i = 0; i < out_frames_hwctx->nb_surfaces; i++)
385 s->surface_ptrs_out[i] = out_frames_hwctx->surfaces + i;
386 s->nb_surface_ptrs_out = out_frames_hwctx->nb_surfaces;
387
388 s->opaque_alloc.In.Surfaces = s->surface_ptrs_in;
389 s->opaque_alloc.In.NumSurface = s->nb_surface_ptrs_in;
390 s->opaque_alloc.In.Type = in_frames_hwctx->frame_type;
391
392 s->opaque_alloc.Out.Surfaces = s->surface_ptrs_out;
393 s->opaque_alloc.Out.NumSurface = s->nb_surface_ptrs_out;
394 s->opaque_alloc.Out.Type = out_frames_hwctx->frame_type;
395
396 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
397 s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc);
398
399 s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->opaque_alloc;
400
401 par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
402 }
403#endif
396 404
397 memset(&s->scale_conf, 0, sizeof(mfxExtVPPScaling));405 memset(&s->scale_conf, 0, sizeof(mfxExtVPPScaling));
398 s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING;406 s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t