From: Víctor Manuel Jáquez Leal Date: Mon, 27 Jan 2020 10:44:49 +0000 (+0100) Subject: libs: surface: merge two loops into one X-Git-Tag: 1.19.3~503^2~277 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb72efb2e730b29fb8cb36ca1defccb9b963c4e3;p=platform%2Fupstream%2Fgstreamer.git libs: surface: merge two loops into one Merge two loops into one for setting offsets and strides in the external buffer descriptor. --- diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index fac1174..6ee8e17 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -165,14 +165,14 @@ gst_vaapi_surface_init_full (GstVaapiSurface * surface, } extbuf.num_planes = GST_VIDEO_INFO_N_PLANES (vip); - if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) { - for (i = 0; i < extbuf.num_planes; i++) - extbuf.pitches[i] = GST_VIDEO_INFO_PLANE_STRIDE (vip, i); - extbuf_needed = TRUE; - } - if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS) { - for (i = 0; i < extbuf.num_planes; i++) - extbuf.offsets[i] = GST_VIDEO_INFO_PLANE_OFFSET (vip, i); + if (surface_allocation_flags & (GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES | + GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS)) { + for (i = 0; i < extbuf.num_planes; i++) { + if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) + extbuf.pitches[i] = GST_VIDEO_INFO_PLANE_STRIDE (vip, i); + if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS) + extbuf.offsets[i] = GST_VIDEO_INFO_PLANE_OFFSET (vip, i); + } extbuf_needed = TRUE; }