[FFmpeg-cvslog] Merge commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2'

Mark Thompson git at videolan.org
Sun Mar 12 18:03:39 EET 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sun Mar 12 15:04:45 2017 +0000| [562f386c77151d5d59151071106170589bce8e63] | committer: Mark Thompson

Merge commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2'

* commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2':
  qsvenc: add support for p010

Merged-by: Mark Thompson <sw at jkqxz.net>

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

 libavcodec/qsvenc.c      | 16 +++++++++++++---
 libavcodec/qsvenc_h264.c |  1 +
 libavcodec/qsvenc_hevc.c |  1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index ac443c1..f794e3a 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -377,7 +377,16 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx;
         q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info;
     } else {
-        q->param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12;
+        enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ?
+                                       avctx->sw_pix_fmt : avctx->pix_fmt;
+        const AVPixFmtDescriptor *desc;
+
+        desc = av_pix_fmt_desc_get(sw_format);
+        if (!desc)
+            return AVERROR_BUG;
+
+        ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
+
         q->param.mfx.FrameInfo.Width          = FFALIGN(avctx->width, q->width_align);
         q->param.mfx.FrameInfo.Height         = FFALIGN(avctx->height, 32);
         q->param.mfx.FrameInfo.CropX          = 0;
@@ -388,8 +397,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         q->param.mfx.FrameInfo.AspectRatioH   = avctx->sample_aspect_ratio.den;
         q->param.mfx.FrameInfo.PicStruct      = MFX_PICSTRUCT_PROGRESSIVE;
         q->param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;
-        q->param.mfx.FrameInfo.BitDepthLuma   = 8;
-        q->param.mfx.FrameInfo.BitDepthChroma = 8;
+        q->param.mfx.FrameInfo.BitDepthLuma   = desc->comp[0].depth;
+        q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
+        q->param.mfx.FrameInfo.Shift          = desc->comp[0].depth > 8;
     }
 
     if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 7ff1a98..389335f 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -174,6 +174,7 @@ AVCodec ff_h264_qsv_encoder = {
     .close          = qsv_enc_close,
     .capabilities   = AV_CODEC_CAP_DELAY,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_P010,
                                                     AV_PIX_FMT_QSV,
                                                     AV_PIX_FMT_NONE },
     .priv_class     = &class,
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index b775ef1..55e2e25 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -262,6 +262,7 @@ AVCodec ff_hevc_qsv_encoder = {
     .close          = qsv_enc_close,
     .capabilities   = AV_CODEC_CAP_DELAY,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_P010,
                                                     AV_PIX_FMT_QSV,
                                                     AV_PIX_FMT_NONE },
     .priv_class     = &class,


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




More information about the ffmpeg-cvslog mailing list