[FFmpeg-cvslog] Merge commit '92736c74fb1633e36f7134a880422a9b7db14d3f'

Hendrik Leppkes git at videolan.org
Mon Nov 14 16:20:23 EET 2016


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Mon Nov 14 15:20:00 2016 +0100| [3c81fa9a9c5f56078e09b564a27821031876ad61] | committer: Hendrik Leppkes

Merge commit '92736c74fb1633e36f7134a880422a9b7db14d3f'

* commit '92736c74fb1633e36f7134a880422a9b7db14d3f':
  qsvdec: add support for P010 (10-bit 420) decoding

Merged-by: Hendrik Leppkes <h.leppkes at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c81fa9a9c5f56078e09b564a27821031876ad61
---

 libavcodec/qsv.c          |  3 +++
 libavcodec/qsvdec.c       | 15 +++++++++++----
 libavcodec/qsvdec_h2645.c |  2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 041daa5..aac6ce6 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -112,6 +112,9 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
     case AV_PIX_FMT_YUVJ420P:
         *fourcc = MFX_FOURCC_NV12;
         return AV_PIX_FMT_NV12;
+    case AV_PIX_FMT_YUV420P10:
+        *fourcc = MFX_FOURCC_P010;
+        return AV_PIX_FMT_P010;
     default:
         return AVERROR(ENOSYS);
     }
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index e166336..e71af59 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -31,6 +31,7 @@
 #include "libavutil/hwcontext_qsv.h"
 #include "libavutil/mem.h"
 #include "libavutil/log.h"
+#include "libavutil/pixdesc.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/time.h"
 
@@ -86,11 +87,16 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
 
 static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
 {
+    const AVPixFmtDescriptor *desc;
     mfxSession session = NULL;
     int iopattern = 0;
     mfxVideoParam param = { { 0 } };
     int ret;
 
+    desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
+    if (!desc)
+        return AVERROR_BUG;
+
     if (!q->async_fifo) {
         q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
                                       (sizeof(mfxSyncPoint*) + sizeof(QSVFrame*)));
@@ -136,9 +142,9 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
     param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile);
     param.mfx.CodecLevel   = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level;
 
-    param.mfx.FrameInfo.BitDepthLuma   = 8;
-    param.mfx.FrameInfo.BitDepthChroma = 8;
-    param.mfx.FrameInfo.Shift          = 0;
+    param.mfx.FrameInfo.BitDepthLuma   = desc->comp[0].depth;
+    param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
+    param.mfx.FrameInfo.Shift          = desc->comp[0].depth > 8;
     param.mfx.FrameInfo.FourCC         = q->fourcc;
     param.mfx.FrameInfo.Width          = avctx->coded_width;
     param.mfx.FrameInfo.Height         = avctx->coded_height;
@@ -463,7 +469,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
         qsv_format = ff_qsv_map_pixfmt(q->parser->format, &q->fourcc);
         if (qsv_format < 0) {
             av_log(avctx, AV_LOG_ERROR,
-                   "Only 8-bit YUV420 streams are supported.\n");
+                   "Decoding pixel format '%s' is not supported\n",
+                   av_get_pix_fmt_name(q->parser->format));
             ret = AVERROR(ENOSYS);
             goto reinit_fail;
         }
diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index 94fbd07..aa7aded 100644
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -269,6 +269,7 @@ AVCodec ff_hevc_qsv_decoder = {
     .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
     .priv_class     = &hevc_class,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_P010,
                                                     AV_PIX_FMT_QSV,
                                                     AV_PIX_FMT_NONE },
 };
@@ -307,6 +308,7 @@ AVCodec ff_h264_qsv_decoder = {
     .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
     .priv_class     = &class,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_P010,
                                                     AV_PIX_FMT_QSV,
                                                     AV_PIX_FMT_NONE },
 };


======================================================================

diff --cc libavcodec/qsvdec.c
index e166336,929b9af..e71af59
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@@ -133,12 -139,12 +139,12 @@@ static int qsv_decode_init(AVCodecConte
          return ret;
  
      param.mfx.CodecId      = ret;
 -    param.mfx.CodecProfile = avctx->profile;
 -    param.mfx.CodecLevel   = avctx->level;
 +    param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile);
 +    param.mfx.CodecLevel   = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level;
  
-     param.mfx.FrameInfo.BitDepthLuma   = 8;
-     param.mfx.FrameInfo.BitDepthChroma = 8;
-     param.mfx.FrameInfo.Shift          = 0;
+     param.mfx.FrameInfo.BitDepthLuma   = desc->comp[0].depth;
+     param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
+     param.mfx.FrameInfo.Shift          = desc->comp[0].depth > 8;
      param.mfx.FrameInfo.FourCC         = q->fourcc;
      param.mfx.FrameInfo.Width          = avctx->coded_width;
      param.mfx.FrameInfo.Height         = avctx->coded_height;
diff --cc libavcodec/qsvdec_h2645.c
index 94fbd07,a26f150..aa7aded
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@@ -266,9 -266,10 +266,10 @@@ AVCodec ff_hevc_qsv_decoder = 
      .decode         = qsv_decode_frame,
      .flush          = qsv_decode_flush,
      .close          = qsv_decode_close,
 -    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
 +    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
      .priv_class     = &hevc_class,
      .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                     AV_PIX_FMT_P010,
                                                      AV_PIX_FMT_QSV,
                                                      AV_PIX_FMT_NONE },
  };
@@@ -304,9 -305,10 +305,10 @@@ AVCodec ff_h264_qsv_decoder = 
      .decode         = qsv_decode_frame,
      .flush          = qsv_decode_flush,
      .close          = qsv_decode_close,
 -    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
 +    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
      .priv_class     = &class,
      .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                     AV_PIX_FMT_P010,
                                                      AV_PIX_FMT_QSV,
                                                      AV_PIX_FMT_NONE },
  };



More information about the ffmpeg-cvslog mailing list