From 631379bea9a6f490f221a1326b1fe674e2651203 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 20 Oct 2019 19:39:10 +0200 Subject: [PATCH] zimg: move component order arrays to top of file --- video/zimg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/video/zimg.c b/video/zimg.c index d9fde65f19..fcd1034cd0 100644 --- a/video/zimg.c +++ b/video/zimg.c @@ -51,6 +51,10 @@ const struct m_sub_options zimg_conf = { }, }; +// Component ID (see struct mp_regular_imgfmt_plane.components) to plane index. +static const int corder_gbrp[4] = {0, 2, 0, 1}; +static const int corder_yuv[4] = {0, 0, 1, 2}; + struct mp_zimg_repack { bool pack; // if false, this is for unpacking struct mp_image_params fmt; // original mp format (possibly packed format) @@ -339,12 +343,10 @@ static void setup_regular_rgb_packer(struct mp_zimg_repack *r) enum mp_csp forced_csp = mp_imgfmt_get_forced_csp(r->zimgfmt); if (forced_csp == MP_CSP_RGB || forced_csp == MP_CSP_XYZ) { typeflag = MP_IMGFLAG_RGB_P; - static const int gbrp[4] = {0, 2, 0, 1}; - corder = gbrp; + corder = corder_gbrp; } else { typeflag = MP_IMGFLAG_YUV_P; - static const int yuv[4] = {0, 0, 1, 2}; - corder = yuv; + corder = corder_yuv; } // Find a compatible planar format (typically AV_PIX_FMT_GBRP).