summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon@igalia.com>2018-02-13 12:36:46 -0900
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>2018-02-13 12:36:46 -0900
commit8f0450dad4d861fcae9e264dd672d276f04f5181 (patch)
treef4b447a22f4f36455cf7c18f5f31ac9d1d70f413
parent5b1a96884032fe0e9421169caca0b3edae915a75 (diff)
downloadgstreamer-plugins-bad-8f0450dad4d861fcae9e264dd672d276f04f5181.tar.gz
msdk: move and rename the function msdk_video_alignment
Move the msdk_video_alignment function from decoder to msdk.c and rename so that others could call this function without duplicated declaration. https://bugzilla.gnome.org/show_bug.cgi?id=790752
-rw-r--r--sys/msdk/gstmsdkdec.c17
-rw-r--r--sys/msdk/msdk.c20
-rw-r--r--sys/msdk/msdk.h3
3 files changed, 25 insertions, 15 deletions
diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c
index b51851cee..619a5eae2 100644
--- a/sys/msdk/gstmsdkdec.c
+++ b/sys/msdk/gstmsdkdec.c
@@ -70,19 +70,6 @@ typedef struct _MsdkSurface
GstVideoFrame copy;
} MsdkSurface;
-static void
-msdk_video_alignment (GstVideoAlignment * alignment, GstVideoInfo * info)
-{
- guint i, height;
-
- height = GST_VIDEO_INFO_HEIGHT (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 */
- if (height & 31)
- alignment->padding_bottom = 32 - (height & 31);
-}
-
static GstFlowReturn
allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer)
{
@@ -356,7 +343,7 @@ gst_msdkdec_set_src_caps (GstMsdkDec * thiz)
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (thiz),
GST_VIDEO_FORMAT_NV12, width, height, thiz->input_state);
- msdk_video_alignment (&align, &output_state->info);
+ gst_msdk_set_video_alignment (&output_state->info, &align);
gst_video_info_align (&output_state->info, &align);
memcpy (&thiz->output_info, &output_state->info, sizeof (GstVideoInfo));
if (output_state->caps)
@@ -616,7 +603,7 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
requirements by default. */
gst_video_info_from_caps (&info_from_caps, pool_caps);
memcpy (&info_aligned, &info_from_caps, sizeof (info_aligned));
- msdk_video_alignment (&alignment, &info_from_caps);
+ gst_msdk_set_video_alignment (&info_from_caps, &alignment);
gst_video_info_align (&info_aligned, &alignment);
need_aligned = !gst_video_info_is_equal (&info_from_caps, &info_aligned);
diff --git a/sys/msdk/msdk.c b/sys/msdk/msdk.c
index 19ce04c61..bfc66e056 100644
--- a/sys/msdk/msdk.c
+++ b/sys/msdk/msdk.c
@@ -35,6 +35,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdkenc_debug);
#define GST_CAT_DEFAULT gst_msdkenc_debug
#define INVALID_INDEX ((guint) -1)
+#define GST_MSDK_ALIGNMENT_PADDING(num) (32 - ((num) & 31))
static inline guint
msdk_get_free_surface_index (mfxFrameSurface1 * surfaces, guint size)
@@ -362,3 +363,22 @@ msdk_is_available (void)
msdk_close_session (session);
return TRUE;
}
+
+void
+gst_msdk_set_video_alignment (GstVideoInfo * info,
+ GstVideoAlignment * alignment)
+{
+ guint i, width, height;
+
+ width = GST_VIDEO_INFO_WIDTH (info);
+ height = GST_VIDEO_INFO_HEIGHT (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 */
+
+ if (width & 31)
+ alignment->padding_right = GST_MSDK_ALIGNMENT_PADDING (width);
+ if (height & 31)
+ alignment->padding_bottom = GST_MSDK_ALIGNMENT_PADDING (height);
+}
diff --git a/sys/msdk/msdk.h b/sys/msdk/msdk.h
index 6a30eec44..13db9fff8 100644
--- a/sys/msdk/msdk.h
+++ b/sys/msdk/msdk.h
@@ -66,6 +66,9 @@ void msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface);
const gchar *msdk_status_to_string (mfxStatus status);
+void gst_msdk_set_video_alignment (GstVideoInfo * info,
+ GstVideoAlignment * alignment);
+
G_END_DECLS
#endif /* __MSDK_H__ */