From bb72efb2e730b29fb8cb36ca1defccb9b963c4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 27 Jan 2020 11:44:49 +0100 Subject: [PATCH] libs: surface: merge two loops into one Merge two loops into one for setting offsets and strides in the external buffer descriptor. --- gst-libs/gst/vaapi/gstvaapisurface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index fac1174eec..6ee8e17825 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; }