History

lavfi/qsvvpp: store a copy of the sequence parameters

We will postpone the vpp session initialization to when input and output frames are ready, this copy of the sequence parameters will be used to initialize vpp session.

Haihao Xiang committed 3 years ago

Commit cf21ca91 parent 579711c2 files · +32 −17Browse files

Unified · Split

2 files
  1. libavfilter/qsvvpp.c +26 −16
  2. libavfilter/qsvvpp.h +6 −1
libavfilter/qsvvpp.c+26−16
@@ -767,28 +767,39 @@ int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param) · 766 unmodified lines
767 goto failed;767 goto failed;
768 }768 }
769 769
770 s->nb_seq_buffers = param->num_ext_buf;
770#if QSV_HAVE_OPAQUE771#if QSV_HAVE_OPAQUE
771 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) {772 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode))
772 s->nb_ext_buffers = param->num_ext_buf + 1;773 s->nb_seq_buffers++;
774#endif
775
776 if (s->nb_seq_buffers) {
777 s->seq_buffers = av_calloc(s->nb_seq_buffers, sizeof(*s->seq_buffers));
778 if (!s->seq_buffers) {
779 ret = AVERROR(ENOMEM);
780 goto failed;
781 }
782
783 for (i = 0; i < param->num_ext_buf; i++)
784 s->seq_buffers[i] = param->ext_buf[i];
785
786#if QSV_HAVE_OPAQUE
787 if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode))
788 s->seq_buffers[i] = (mfxExtBuffer *)&s->opaque_alloc;
789#endif
790
791 s->nb_ext_buffers = s->nb_seq_buffers;
773 s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers));792 s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers));
774 if (!s->ext_buffers) {793 if (!s->ext_buffers) {
775 ret = AVERROR(ENOMEM);794 ret = AVERROR(ENOMEM);
776 goto failed;795 goto failed;
777 }796 }
778 797
779 s->ext_buffers[0] = (mfxExtBuffer *)&s->opaque_alloc;798 memcpy(s->ext_buffers, s->seq_buffers, s->nb_seq_buffers * sizeof(*s->seq_buffers));
780 for (i = 1; i < param->num_ext_buf; i++)
781 s->ext_buffers[i] = param->ext_buf[i - 1];
782 s->vpp_param.ExtParam = s->ext_buffers;
783 s->vpp_param.NumExtParam = s->nb_ext_buffers;
784 } else {
785 s->vpp_param.NumExtParam = param->num_ext_buf;
786 s->vpp_param.ExtParam = param->ext_buf;
787 }799 }
788#else800
789 s->vpp_param.NumExtParam = param->num_ext_buf;801 s->vpp_param.ExtParam = s->ext_buffers;
790 s->vpp_param.ExtParam = param->ext_buf;802 s->vpp_param.NumExtParam = s->nb_ext_buffers;
791#endif
792 803
793 s->got_frame = 0;804 s->got_frame = 0;
794 805
@@ -861,9 +872,8 @@ int ff_qsvvpp_close(AVFilterContext *avctx) · 66 unmodified lines
861 clear_frame_list(&s->out_frame_list);872 clear_frame_list(&s->out_frame_list);
862 av_freep(&s->surface_ptrs_in);873 av_freep(&s->surface_ptrs_in);
863 av_freep(&s->surface_ptrs_out);874 av_freep(&s->surface_ptrs_out);
864#if QSV_HAVE_OPAQUE875 av_freep(&s->seq_buffers);
865 av_freep(&s->ext_buffers);876 av_freep(&s->ext_buffers);
866#endif
867 av_freep(&s->frame_infos);877 av_freep(&s->frame_infos);
868 av_fifo_freep2(&s->async_fifo);878 av_fifo_freep2(&s->async_fifo);
869 879
libavfilter/qsvvpp.h+6−1
@@ -74,9 +74,14 @@ typedef struct QSVVPPContext { · 73 unmodified lines
74#if QSV_HAVE_OPAQUE74#if QSV_HAVE_OPAQUE
75 /** MFXVPP extern parameters */75 /** MFXVPP extern parameters */
76 mfxExtOpaqueSurfaceAlloc opaque_alloc;76 mfxExtOpaqueSurfaceAlloc opaque_alloc;
77#endif
78 /** store sequence parameters */
79 mfxExtBuffer **seq_buffers;
80 int nb_seq_buffers;
81
82 /** store all parameters for vpp execution, including parameters per frame */
77 mfxExtBuffer **ext_buffers;83 mfxExtBuffer **ext_buffers;
78 int nb_ext_buffers;84 int nb_ext_buffers;
79#endif
80 85
81 int got_frame;86 int got_frame;
82 int async_depth;87 int async_depth;

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