convert_fill_border (convert, dest);
}
+ #ifdef USE_TBM
static void
convert_I420_SN12 (GstVideoConverter * convert, const GstVideoFrame * src,
- GstVideoFrame * dest )
+ GstVideoFrame * dst)
{
- guint8 *mY, *mUV, *Y, *U, *V;
- gint l1, l2;
- int i, j;
- gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
+ guint8 *src_Y = NULL;
+ guint8 *src_U = NULL;
+ guint8 *src_V = NULL;
+ guint8 *dst_Y = NULL;
+ guint8 *dst_UV = NULL;
+ int i = 0;
+ int j = 0;
gint width = convert->in_width;
gint height = convert->in_height;
+ gint loop_count_Y = GST_ROUND_DOWN_2 (height);
+ gint loop_count_UV = GST_ROUND_UP_2 (width) >> 1;
+
+ gint src_stride_Y = GST_VIDEO_FRAME_PLANE_STRIDE (src, 0);
+ gint src_stride_U = GST_VIDEO_FRAME_PLANE_STRIDE (src, 1);
+ gint src_stride_diff = src_stride_U - loop_count_UV;
+
+ gint dst_stride_Y = GST_VIDEO_FRAME_PLANE_STRIDE (dst, 0);
+ gint dst_stride_UV = GST_VIDEO_FRAME_PLANE_STRIDE (dst, 1);
+ gint dst_stride_diff = GST_ROUND_DOWN_2 (dst_stride_UV - width);
+
+ src_Y = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
+ src_U = GST_VIDEO_FRAME_PLANE_DATA (src, 1);
+ src_V = GST_VIDEO_FRAME_PLANE_DATA (src, 2);
+
+ dst_Y = GST_VIDEO_FRAME_PLANE_DATA (dst, 0);
+ dst_UV = GST_VIDEO_FRAME_PLANE_DATA (dst, 1);
+
+ GST_DEBUG_OBJECT (convert, "size %dx%d, stride src[0:%d,1:%d], dst[0:%d,1:%d]",
+ width, height, src_stride_Y, src_stride_U, dst_stride_Y, dst_stride_UV);
+
+ for (i = 0 ; i < loop_count_Y ; i += 2) {
+ memcpy (dst_Y, src_Y, width);
+ src_Y += src_stride_Y;
+ dst_Y += dst_stride_Y;
+
+ memcpy (dst_Y, src_Y, width);
+ src_Y += src_stride_Y;
+ dst_Y += dst_stride_Y;
- mY = mUV = Y = U = V = NULL;
- mY = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
- mUV = GST_VIDEO_FRAME_PLANE_DATA (dest, 1);
-
- for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
- GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
- Y = FRAME_GET_Y_LINE (src, l1);
- memcpy(mY, Y, width);
- mY += width;
- Y = FRAME_GET_Y_LINE (src, l2);
- memcpy(mY, Y, width);
- mY += width;
-
- U = FRAME_GET_U_LINE (src, i >> 1);
- V = FRAME_GET_V_LINE (src, i >> 1);
- for (j = 0; j < (width + 1) / 2; j++) {
- *mUV++ = *U++;
- *mUV++ = *V++;
+ for (j = 0 ; j < loop_count_UV ; j++) {
+ *dst_UV++ = *src_U++;
+ *dst_UV++ = *src_V++;
}
+ src_U += src_stride_diff;
+ src_V += src_stride_diff;
+ dst_UV += dst_stride_diff;
}
}
+ #endif
static GstVideoFormat
get_scale_format (GstVideoFormat format, gint plane)