mpeg2dec: Copy planes in one go when possible

This commit is contained in:
Edward Hervey 2011-01-14 18:50:41 +01:00
parent 425e6e395f
commit 4a4d652dd4

View file

@ -357,12 +357,22 @@ gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstBuffer ** buf)
gst_video_format_get_component_height (dec->format, c, dec->height); gst_video_format_get_component_height (dec->format, c, dec->height);
c_width = gst_video_format_get_component_width (dec->format, c, dec->width); c_width = gst_video_format_get_component_width (dec->format, c, dec->width);
GST_DEBUG ("stride_in:%d _out:%d c_width:%d c_height:%d",
stride_in, stride_out, c_width, c_height);
if (stride_in == stride_out && stride_in == c_width) {
/* FAST PATH */
memcpy (dest, src, c_height * stride_out);
dest += stride_out * c_height;
src += stride_out * c_height;
} else {
for (line = 0; line < c_height; line++) { for (line = 0; line < c_height; line++) {
memcpy (dest, src, c_width); memcpy (dest, src, c_width);
dest += stride_out; dest += stride_out;
src += stride_in; src += stride_in;
} }
} }
}
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (dec->srcpad)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (dec->srcpad));
gst_buffer_copy_metadata (outbuf, inbuf, gst_buffer_copy_metadata (outbuf, inbuf,