diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-04-16 21:11:05 +0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-04-17 19:06:41 +0300 |
commit | 327013770260db747f129e4ab97cb37d610a675c (patch) | |
tree | 1cb3134030f5429a07b7d9c5b818633d21546ce1 /ext | |
parent | 6e3835594c0f2b9f1c700d7f2ea6f6d403f0c6f0 (diff) |
vp9dec: optimize vpx image to gstbuffer copy when strides match
Solving this FIXME. Copy the full plane when strides are the same
Diffstat (limited to 'ext')
-rw-r--r-- | ext/vpx/gstvp9dec.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/vpx/gstvp9dec.c b/ext/vpx/gstvp9dec.c index 5a18f3a57..db65c9f0d 100644 --- a/ext/vpx/gstvp9dec.c +++ b/ext/vpx/gstvp9dec.c @@ -387,12 +387,18 @@ gst_vp9_dec_image_to_buffer (GstVP9Dec * dec, const vpx_image_t * img, deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp); srcstride = img->stride[comp]; - /* FIXME (Edward) : Do a plane memcpy is srcstride == deststride instead - * of copying line by line */ - for (line = 0; line < height; line++) { - memcpy (dest, src, width); - dest += deststride; - src += srcstride; + if (srcstride == deststride) { + GST_TRACE_OBJECT (dec, "Stride matches. Comp %d: %d, copying full plane", + comp, srcstride); + memcpy (dest, src, srcstride * height); + } else { + GST_TRACE_OBJECT (dec, "Stride mismatch. Comp %d: %d != %d, copying " + "line by line.", comp, srcstride, deststride); + for (line = 0; line < height; line++) { + memcpy (dest, src, width); + dest += deststride; + src += srcstride; + } } } |