msdkvp9enc: fix width and height
authorHaihao Xiang <haihao.xiang@intel.com>
Wed, 25 Dec 2019 02:51:36 +0000 (10:51 +0800)
committerHaihao Xiang <haihao.xiang@intel.com>
Mon, 6 Jan 2020 03:54:57 +0000 (03:54 +0000)
The frame width and height is rounded up to 128 and 32 since commit
8daac1c, so the width, height for initialization should be rounded up to
128 and 32 too because the MSDK VP9 encoder will do some check on width
and height.

Sample pipeline:
gst-launch-1.0 videotestsrc ! \
video/x-raw,width=320,height=240,format=NV12 ! msdkvp9enc ! fakesink

sys/msdk/gstmsdkvp9enc.c

index 8aaa817..a456d7a 100644 (file)
@@ -125,6 +125,15 @@ gst_msdkvp9enc_configure (GstMsdkEnc * encoder)
   encoder->param.mfx.CodecId = MFX_CODEC_VP9;
   encoder->param.mfx.CodecLevel = 0;
   encoder->param.mfx.CodecProfile = thiz->profile;
+  /* As the frame width and height is rounded up to 128 and 32 since commit 8daac1c,
+   * so the width, height for initialization should be rounded up to 128 and 32
+   * too because VP9 encoder in MSDK will do some check on width and height.
+   */
+  encoder->param.mfx.FrameInfo.Width =
+      GST_ROUND_UP_128 (encoder->param.mfx.FrameInfo.CropW);
+  encoder->param.mfx.FrameInfo.Height =
+      GST_ROUND_UP_32 (encoder->param.mfx.FrameInfo.CropH);
+
   /* Always turn on this flag for VP9 */
   encoder->param.mfx.LowPower = MFX_CODINGOPTION_ON;