[Spice-devel] [PATCH v7 2/3] gstreamer: Avoid memory copy if strides are different

Christophe Fergeau cfergeau at redhat.com
Tue Jan 24 13:45:18 UTC 2017


On Tue, Jan 24, 2017 at 07:35:25AM -0500, Frediano Ziglio wrote:
> > > +         * stride is different simply passing appropriate offset and
> > > stride */
> > > +        gsize offset = src->left * encoder->format->bpp / 8;
> > > +        gint stride = bitmap->stride;
> > > +        gst_buffer_add_video_meta_full(buffer, GST_VIDEO_FRAME_FLAG_NONE,
> > > +                                       encoder->format->gst_format,
> > > bitmap->x, bitmap->y,
> > > +                                       1, &offset, &stride);
> > 
> > and here, I'd go with something inbetween the initial patch and my first
> > suggestion, ie
> > gsize offset[] = { src->left * encoder->format->bpp / 8 };
> > gint stride[] = { bitmap->stride };
> > Sorry for that :-/
> > 
> 
> I don't see this as much as an improvement, unless you don't
> know much C language.
> And at least I'd use plural for the arrays.

When I see
int some_int;
foo(&some_int);
it usually means that foo() is going to modify some_int, it rarely means
that foo() expects an array of int, hence the suggestions to make the
array more explicit. Feel free to ignore it.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170124/d11117dd/attachment.sig>


More information about the Spice-devel mailing list