diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c index 393d5a1d00..e00f7344cc 100644 --- a/sys/msdk/gstmsdkdec.c +++ b/sys/msdk/gstmsdkdec.c @@ -318,7 +318,7 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz) * dealing with different allocators */ /* Fixme: msdk sometimes only requires 16 bit rounding, optimization possible */ thiz->param.mfx.FrameInfo.Width = - GST_ROUND_UP_32 (thiz->param.mfx.FrameInfo.Width); + GST_ROUND_UP_16 (thiz->param.mfx.FrameInfo.Width); thiz->param.mfx.FrameInfo.Height = GST_ROUND_UP_32 (thiz->param.mfx.FrameInfo.Height); /* Set framerate only if provided. @@ -521,7 +521,7 @@ gst_msdkdec_set_src_caps (GstMsdkDec * thiz, gboolean need_allocation) if (need_allocation) { /* Find allocation width and height */ width = - GST_ROUND_UP_32 (thiz->param.mfx.FrameInfo.Width ? thiz->param.mfx. + GST_ROUND_UP_16 (thiz->param.mfx.FrameInfo.Width ? thiz->param.mfx. FrameInfo.Width : GST_VIDEO_INFO_WIDTH (&output_state->info)); height = GST_ROUND_UP_32 (thiz->param.mfx.FrameInfo.Height ? thiz->param.mfx. @@ -1055,7 +1055,7 @@ gst_msdkdec_create_buffer_pool (GstMsdkDec * thiz, GstVideoInfo * info, if (!pool) goto error_no_pool; - if (G_UNLIKELY (!IS_ALIGNED (GST_VIDEO_INFO_WIDTH (info), 32) + if (G_UNLIKELY (!IS_ALIGNED (GST_VIDEO_INFO_WIDTH (info), 16) || !IS_ALIGNED (GST_VIDEO_INFO_HEIGHT (info), 32))) { gst_msdk_set_video_alignment (info, &align); gst_video_info_align (info, &align); diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index 4493293642..69acdf59f2 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -262,7 +262,7 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) thiz->vpp_param.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY; - thiz->vpp_param.vpp.In.Width = GST_ROUND_UP_32 (info->width); + thiz->vpp_param.vpp.In.Width = GST_ROUND_UP_16 (info->width); thiz->vpp_param.vpp.In.Height = GST_ROUND_UP_32 (info->height); thiz->vpp_param.vpp.In.CropW = info->width; thiz->vpp_param.vpp.In.CropH = info->height; @@ -370,7 +370,7 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) thiz->param.mfx.NumRefFrame = thiz->ref_frames; thiz->param.mfx.EncodedOrder = 0; /* Take input frames in display order */ - thiz->param.mfx.FrameInfo.Width = GST_ROUND_UP_32 (info->width); + thiz->param.mfx.FrameInfo.Width = GST_ROUND_UP_16 (info->width); thiz->param.mfx.FrameInfo.Height = GST_ROUND_UP_32 (info->height); thiz->param.mfx.FrameInfo.CropW = info->width; thiz->param.mfx.FrameInfo.CropH = info->height; diff --git a/sys/msdk/msdk.c b/sys/msdk/msdk.c index 062644e698..d5050795aa 100644 --- a/sys/msdk/msdk.c +++ b/sys/msdk/msdk.c @@ -37,7 +37,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdk_debug); #define GST_CAT_DEFAULT gst_msdk_debug #define INVALID_INDEX ((guint) -1) -#define GST_MSDK_ALIGNMENT_PADDING(num) (32 - ((num) & 31)) +#define GST_MSDK_ALIGNMENT_PADDING(num,padding) ((padding) - ((num) & ((padding) - 1))) struct map { @@ -215,12 +215,12 @@ gst_msdk_set_video_alignment (GstVideoInfo * info, gst_video_alignment_reset (alignment); for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) - alignment->stride_align[i] = 31; /* 32-byte alignment */ + alignment->stride_align[i] = 15; /* 16-byte alignment */ - if (width & 31) - alignment->padding_right = GST_MSDK_ALIGNMENT_PADDING (width); + if (width & 15) + alignment->padding_right = GST_MSDK_ALIGNMENT_PADDING (width, 16); if (height & 31) - alignment->padding_bottom = GST_MSDK_ALIGNMENT_PADDING (height); + alignment->padding_bottom = GST_MSDK_ALIGNMENT_PADDING (height, 32); } static const struct map * @@ -257,7 +257,7 @@ gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info, { g_return_if_fail (info && mfx_info); - mfx_info->Width = GST_ROUND_UP_32 (GST_VIDEO_INFO_WIDTH (info)); + mfx_info->Width = GST_ROUND_UP_16 (GST_VIDEO_INFO_WIDTH (info)); mfx_info->Height = GST_ROUND_UP_32 (GST_VIDEO_INFO_HEIGHT (info)); mfx_info->CropW = GST_VIDEO_INFO_WIDTH (info); mfx_info->CropH = GST_VIDEO_INFO_HEIGHT (info);