]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/qsvvpp.c
avfilter/af_aiir: check if frame clone is set
[ffmpeg] / libavfilter / qsvvpp.c
index 75966b352d5e62c20961c0fe93750c1d857f1c13..8d5ff2eb653c398361efe567394caf0f363041e6 100644 (file)
@@ -1,18 +1,18 @@
 /*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -142,7 +142,7 @@ static int pix_fmt_to_mfx_fourcc(int format)
         return MFX_FOURCC_NV12;
     case AV_PIX_FMT_YUYV422:
         return MFX_FOURCC_YUY2;
-    case AV_PIX_FMT_RGB32:
+    case AV_PIX_FMT_BGRA:
         return MFX_FOURCC_RGB4;
     }
 
@@ -153,6 +153,7 @@ static int map_frame_to_surface(AVFrame *frame, mfxFrameSurface1 *surface)
 {
     switch (frame->format) {
     case AV_PIX_FMT_NV12:
+    case AV_PIX_FMT_P010:
         surface->Data.Y  = frame->data[0];
         surface->Data.UV = frame->data[1];
         break;
@@ -296,7 +297,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
             av_log(ctx, AV_LOG_ERROR, "QSVVPP gets a wrong frame.\n");
             return NULL;
         }
-        qsv_frame->frame   = picref;
+        qsv_frame->frame   = av_frame_clone(picref);
         qsv_frame->surface = (mfxFrameSurface1 *)qsv_frame->frame->data[3];
     } else {
         /* make a copy if the input is not padded as libmfx requires */
@@ -316,9 +317,8 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
             }
 
             av_frame_copy_props(qsv_frame->frame, picref);
-            av_frame_free(&picref);
         } else
-            qsv_frame->frame = picref;
+            qsv_frame->frame = av_frame_clone(picref);
 
         if (map_frame_to_surface(qsv_frame->frame,
                                 &qsv_frame->surface_internal) < 0) {
@@ -461,6 +461,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
         out_frames_ctx->height            = FFALIGN(outlink->h, 32);
         out_frames_ctx->sw_format         = s->out_sw_format;
         out_frames_ctx->initial_pool_size = 64;
+        if (avctx->extra_hw_frames > 0)
+            out_frames_ctx->initial_pool_size += avctx->extra_hw_frames;
         out_frames_hwctx->frame_type      = s->out_mem_mode;
 
         ret = av_hwframe_ctx_init(out_frames_ref);