[FFmpeg-cvslog] Merge commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b'

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:06:07 2017 +0000| [723a542d6c67de2946dbb7f782393c8c2bee8e0b] | committer: Mark Thompson

Merge commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b'

* commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b':
  qsvenc: take only the allocated dimensions from the frames context

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

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

 libavcodec/qsvenc.c | 50 +++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index f794e3a..6e67a24 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -347,6 +347,9 @@ static int rc_supported(QSVEncContext *q)
 
 static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
 {
+    enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ?
+                                   avctx->sw_pix_fmt : avctx->pix_fmt;
+    const AVPixFmtDescriptor *desc;
     float quant;
     int ret;
 
@@ -372,34 +375,31 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
     q->param.mfx.EncodedOrder       = 0;
     q->param.mfx.BufferSizeInKB     = 0;
 
+    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;
+    q->param.mfx.FrameInfo.CropY          = 0;
+    q->param.mfx.FrameInfo.CropW          = avctx->width;
+    q->param.mfx.FrameInfo.CropH          = avctx->height;
+    q->param.mfx.FrameInfo.AspectRatioW   = avctx->sample_aspect_ratio.num;
+    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   = 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->hw_frames_ctx) {
         AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
         AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx;
-        q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info;
-    } else {
-        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;
-        q->param.mfx.FrameInfo.CropY          = 0;
-        q->param.mfx.FrameInfo.CropW          = avctx->width;
-        q->param.mfx.FrameInfo.CropH          = avctx->height;
-        q->param.mfx.FrameInfo.AspectRatioW   = avctx->sample_aspect_ratio.num;
-        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   = desc->comp[0].depth;
-        q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
-        q->param.mfx.FrameInfo.Shift          = desc->comp[0].depth > 8;
+        q->param.mfx.FrameInfo.Width  = frames_hwctx->surfaces[0].Info.Width;
+        q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height;
     }
 
     if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {


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




More information about the ffmpeg-cvslog mailing list