gst/videobox/gstvideobox.c: Fix the stride issue when boxing to AYUV.

Original commit message from CVS:
2005-10-26  Julien MOUTTE  <julien@moutte.net>

* gst/videobox/gstvideobox.c: (gst_video_box_class_init),
(gst_video_box_transform_caps), (gst_video_box_get_unit_size),
(gst_video_box_ayuv): Fix the stride issue when boxing to AYUV.
This commit is contained in:
Julien Moutte 2005-10-26 14:08:49 +00:00
parent 6b9cda6ee9
commit eb21c9bf1c
2 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2005-10-26 Julien MOUTTE <julien@moutte.net>
* gst/videobox/gstvideobox.c: (gst_video_box_class_init),
(gst_video_box_transform_caps), (gst_video_box_get_unit_size),
(gst_video_box_ayuv): Fix the stride issue when boxing to AYUV.
2005-10-26 Tim-Philipp Müller <tim at centricular dot net> 2005-10-26 Tim-Philipp Müller <tim at centricular dot net>
* sys/oss/gstossaudio.c: * sys/oss/gstossaudio.c:

View file

@ -303,6 +303,7 @@ gst_video_box_set_property (GObject * object, guint prop_id,
else else
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box), FALSE); gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box), FALSE);
} }
static void static void
gst_video_box_get_property (GObject * object, guint prop_id, GValue * value, gst_video_box_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
@ -561,7 +562,7 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
guint8 *srcY, *srcU, *srcV; guint8 *srcY, *srcU, *srcV;
gint crop_width, crop_width2, crop_height; gint crop_width, crop_width2, crop_height;
gint out_width, out_height; gint out_width, out_height;
gint src_stride, src_stride2; gint src_stridey, src_strideu, src_stridev;
gint br, bl, bt, bb; gint br, bl, bt, bb;
gint colorY, colorU, colorV; gint colorY, colorU, colorV;
gint i, j; gint i, j;
@ -570,6 +571,8 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
guint32 *destp = (guint32 *) dest; guint32 *destp = (guint32 *) dest;
guint32 ayuv; guint32 ayuv;
GST_LOG ("blending AYUV");
br = video_box->border_right; br = video_box->border_right;
bl = video_box->border_left; bl = video_box->border_left;
bt = video_box->border_top; bt = video_box->border_top;
@ -578,8 +581,9 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
out_width = video_box->out_width; out_width = video_box->out_width;
out_height = video_box->out_height; out_height = video_box->out_height;
src_stride = GST_VIDEO_I420_Y_ROWSTRIDE (video_box->in_width); src_stridey = GST_VIDEO_I420_Y_ROWSTRIDE (video_box->in_width);
src_stride2 = src_stride / 2; src_strideu = GST_VIDEO_I420_U_ROWSTRIDE (video_box->in_width);
src_stridev = GST_VIDEO_I420_V_ROWSTRIDE (video_box->in_width);
crop_width = crop_width =
video_box->in_width - (video_box->crop_left + video_box->crop_right); video_box->in_width - (video_box->crop_left + video_box->crop_right);
@ -589,13 +593,13 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
srcY = srcY =
src + GST_VIDEO_I420_Y_OFFSET (video_box->in_width, video_box->in_height); src + GST_VIDEO_I420_Y_OFFSET (video_box->in_width, video_box->in_height);
srcY += src_stride * video_box->crop_top + video_box->crop_left; srcY += src_stridey * video_box->crop_top + video_box->crop_left;
srcU = srcU =
src + GST_VIDEO_I420_U_OFFSET (video_box->in_width, video_box->in_height); src + GST_VIDEO_I420_U_OFFSET (video_box->in_width, video_box->in_height);
srcU += src_stride2 * (video_box->crop_top / 2) + (video_box->crop_left / 2); srcU += src_strideu * (video_box->crop_top / 2) + (video_box->crop_left / 2);
srcV = srcV =
src + GST_VIDEO_I420_V_OFFSET (video_box->in_width, video_box->in_height); src + GST_VIDEO_I420_V_OFFSET (video_box->in_width, video_box->in_height);
srcV += src_stride2 * (video_box->crop_top / 2) + (video_box->crop_left / 2); srcV += src_stridev * (video_box->crop_top / 2) + (video_box->crop_left / 2);
colorY = yuv_colors_Y[video_box->fill_type]; colorY = yuv_colors_Y[video_box->fill_type];
colorU = yuv_colors_U[video_box->fill_type]; colorU = yuv_colors_U[video_box->fill_type];
@ -632,10 +636,10 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
srcU -= crop_width2; srcU -= crop_width2;
srcV -= crop_width2; srcV -= crop_width2;
} else { } else {
srcU += src_stride2 - crop_width2; srcU += src_strideu - crop_width2;
srcV += src_stride2 - crop_width2; srcV += src_stridev - crop_width2;
} }
srcY += src_stride - crop_width; srcY += src_stridey - crop_width;
destp = (guint32 *) dest; destp = (guint32 *) dest;
/* right border */ /* right border */