From patchwork Tue Jul 23 12:46:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramiro Polla X-Patchwork-Id: 50708 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2600650vqm; Tue, 23 Jul 2024 05:46:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/AYs248fVTOGF+XxiV1gmySORsoJojpSdvavYKWNt5KvGy5qq3ocIwNwVP3AezQQ6Ch8ZtN9bTbyf3CqAMT42o58yc35ql1OJFw== X-Google-Smtp-Source: AGHT+IEIZ6miExIK5ctYapg8Bo89AWepDrQz3cwRUGylKVAU5RUZGPlca1DO1EyH1FD48WDXgwVU X-Received: by 2002:a05:6402:430a:b0:5a3:5d3d:32fc with SMTP id 4fb4d7f45d1cf-5a94210307cmr2327913a12.10.1721738781101; Tue, 23 Jul 2024 05:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721738781; cv=none; d=google.com; s=arc-20160816; b=gNOYqqVGt2CdHAPm2Z4eob8h3tFlBl86KWf5XRP8OGcmXglxfg4LyLxLUi1OYLQrpC ZMFnCk7mXEYvsIGdtOfQj8xrUox7DHXSeMy0n1w4y0+OLSGNpWVRaqQ0RU3lTgIALsXO mKbCm1Iy0sCwZA1WmsiUVDVjk9XEDsYZWo1LLUz2BGMZ28Bu2q5AZQx05Q2wvx5dclMA Yr98SiUV74Bc7QfRTil+/ceq1WUJaDSr0zZ0OiM5c4yfxoPQpe5WqhFKCIKZmmAjwgVs VALgBRXB6XF3jS1j++H/UF4KspsPhlUTSaw10OC8EkQBAOMrC8EQ93iV1y/GUVuKvhui vUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=QrKWeyRq6zm9ySJctXSgOXZpvGBQlErrgTyjGpycGyA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=YsbApeZMHj8iLxpNTagq3sOvaJzpq+SwcblDhZepDPYcTdTG3zhGETlHmQyuCiVSw+ ho/UTcMtIn+Eoigl2a8YLgcn+izVZVA/dvceXvx4QHNeNxdBotmRXjlhJkxAEhoALeh2 O3UQyTPqGz6HxSjbREApbe7r07gSbVnIjk2l/WFKwD4jrYo+6jwyBFNbzJZgsD8OhZdk YXkLMRaSzxU0dcToUn8nBCIvnBXSfss8YT3ctrNDVGTH575Slxem1a3wH8n0goq+ker/ qhF7qaRAFSu9LwenNDovNixPUIfBCThI0MqeivceuvKvG0z+Knc3QAxdvIPZrV6bIU+W MEFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=YWgt2DEF; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5a30bf123bcsi5952057a12.240.2024.07.23.05.46.20; Tue, 23 Jul 2024 05:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=YWgt2DEF; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F2AC168D53F; Tue, 23 Jul 2024 15:46:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1FAF68D4AE for ; Tue, 23 Jul 2024 15:46:09 +0300 (EEST) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3686b554cfcso2638094f8f.1 for ; Tue, 23 Jul 2024 05:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721738768; x=1722343568; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/PynPpbWyWgcX4UG9KhBDAuhUvv3yprZ3awz/+3xH3U=; b=YWgt2DEFZCGeYc1tX6eEwVvfLD96nQRaTDkV6MgsZSsOMQIJFRlY2e7oF7bWnJYsca HOPdfncyZcEtcCjYE+geA5towGbDNtHrKHttsfJ4vTKEh7w8ypQMczsun0oFNhPEvqCR /1r1DGIEpo69BZKeG2reR9mYkuzNTmRHRNbPNOT8RjlK9IvpD4Xb85pj7K/NvlUWvUIy 0EstVEaDOAnLiQR9cambpXzSl8hLUQTSPtgtrJXnr6Pw+6rAIl1LlT9+zFdLz1fOt1TW WFDtJejNQRAVSJW/yZyA+8OkYsIaoLR6ZQmrsmDR26O+Ok8AnZLvpJa203K+V/xDm/e6 LwDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721738768; x=1722343568; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/PynPpbWyWgcX4UG9KhBDAuhUvv3yprZ3awz/+3xH3U=; b=p2eMXX4iPW0A39RF/8QMlv9CcHFU62CMyu0QWSUaO0zyK85URYiysHO+htPgV1KVUo wZjjLWjnvW++vUToFHP/v4C1Zw/SYhG1FNKc0pZrWhwFAbCWHUo029hwXrXQNoLmczov WIqKV8LmiIq0VXX/gZbz6jeh412q1xUpOmtNzTqAQ26Bvr2srKj3tz/cZjnH0B35Wqz5 Fb02jmfF4vn2HNiAm+beBvIJ8jh1DiVDJbBHHJ3KiNWR371eDKRWBDm2xdxtC36w2zon M4qRwBuYNMQfOb2E/6cLqJwJLaxnpDbXGJsHkLAZbwAMljR3+pFGA5TVEam+P4FFmYG0 /PpQ== X-Gm-Message-State: AOJu0YxHt1j/z3zDnD7Y1OOIC1b7Ne0rBEwz8j/i5YGMCzDMTxJ8knqN J5acdNWrbc/G/xYF1Il907QS8OCdgbHdnDH8Q+YtqtB6wKP/quWe3D+/xlmE X-Received: by 2002:adf:efd0:0:b0:366:e89c:342b with SMTP id ffacd0b85a97d-369dee63217mr1764706f8f.52.1721738767967; Tue, 23 Jul 2024 05:46:07 -0700 (PDT) Received: from localhost.localdomain (232.39-67-87.adsl-dyn.isp.belgacom.be. [87.67.39.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787cee03sm11493779f8f.76.2024.07.23.05.46.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:46:07 -0700 (PDT) From: Ramiro Polla To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 14:46:03 +0200 Message-Id: <20240723124606.107774-1-ramiro.polla@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] swscale/yuv2rgb: prepare YUV2RGBFUNC macro for multi-planar rgb X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 21+odeuCEvfj This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled colorspace converters. --- libswscale/yuv2rgb.c | 279 ++++++++++++++++++++++--------------------- 1 file changed, 142 insertions(+), 137 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index cfbc54abd0..c283d6d1bd 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -72,59 +72,59 @@ const int *sws_getCoefficients(int colorspace) g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \ b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; -#define PUTRGB(dst, src, asrc, i, abase) \ +#define PUTRGB(l, src, asrc, i, abase) \ Y = src[2 * i]; \ - dst[2 * i] = r[Y] + g[Y] + b[Y]; \ + dst_p[0][l][2 * i] = r[Y] + g[Y] + b[Y]; \ Y = src[2 * i + 1]; \ - dst[2 * i + 1] = r[Y] + g[Y] + b[Y]; + dst_p[0][l][2 * i + 1] = r[Y] + g[Y] + b[Y]; -#define PUTRGB24(dst, src, asrc, i, abase) \ +#define PUTRGB24(l, src, asrc, i, abase) \ Y = src[2 * i]; \ - dst[6 * i + 0] = r[Y]; \ - dst[6 * i + 1] = g[Y]; \ - dst[6 * i + 2] = b[Y]; \ + dst_p[0][l][6 * i + 0] = r[Y]; \ + dst_p[0][l][6 * i + 1] = g[Y]; \ + dst_p[0][l][6 * i + 2] = b[Y]; \ Y = src[2 * i + 1]; \ - dst[6 * i + 3] = r[Y]; \ - dst[6 * i + 4] = g[Y]; \ - dst[6 * i + 5] = b[Y]; + dst_p[0][l][6 * i + 3] = r[Y]; \ + dst_p[0][l][6 * i + 4] = g[Y]; \ + dst_p[0][l][6 * i + 5] = b[Y]; -#define PUTBGR24(dst, src, asrc, i, abase) \ +#define PUTBGR24(l, src, asrc, i, abase) \ Y = src[2 * i]; \ - dst[6 * i + 0] = b[Y]; \ - dst[6 * i + 1] = g[Y]; \ - dst[6 * i + 2] = r[Y]; \ + dst_p[0][l][6 * i + 0] = b[Y]; \ + dst_p[0][l][6 * i + 1] = g[Y]; \ + dst_p[0][l][6 * i + 2] = r[Y]; \ Y = src[2 * i + 1]; \ - dst[6 * i + 3] = b[Y]; \ - dst[6 * i + 4] = g[Y]; \ - dst[6 * i + 5] = r[Y]; + dst_p[0][l][6 * i + 3] = b[Y]; \ + dst_p[0][l][6 * i + 4] = g[Y]; \ + dst_p[0][l][6 * i + 5] = r[Y]; -#define PUTRGBA(dst, ysrc, asrc, i, abase) \ +#define PUTRGBA(l, ysrc, asrc, i, abase) \ Y = ysrc[2 * i]; \ - dst[2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i]) << abase); \ + dst_p[0][l][2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i]) << abase); \ Y = ysrc[2 * i + 1]; \ - dst[2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i + 1]) << abase); + dst_p[0][l][2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i + 1]) << abase); -#define PUTRGB48(dst, src, asrc, i, abase) \ +#define PUTRGB48(l, src, asrc, i, abase) \ Y = src[ 2 * i]; \ - dst[12 * i + 0] = dst[12 * i + 1] = r[Y]; \ - dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \ - dst[12 * i + 4] = dst[12 * i + 5] = b[Y]; \ + dst_p[0][l][12 * i + 0] = dst_p[0][l][12 * i + 1] = r[Y]; \ + dst_p[0][l][12 * i + 2] = dst_p[0][l][12 * i + 3] = g[Y]; \ + dst_p[0][l][12 * i + 4] = dst_p[0][l][12 * i + 5] = b[Y]; \ Y = src[ 2 * i + 1]; \ - dst[12 * i + 6] = dst[12 * i + 7] = r[Y]; \ - dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \ - dst[12 * i + 10] = dst[12 * i + 11] = b[Y]; + dst_p[0][l][12 * i + 6] = dst_p[0][l][12 * i + 7] = r[Y]; \ + dst_p[0][l][12 * i + 8] = dst_p[0][l][12 * i + 9] = g[Y]; \ + dst_p[0][l][12 * i + 10] = dst_p[0][l][12 * i + 11] = b[Y]; -#define PUTBGR48(dst, src, asrc, i, abase) \ +#define PUTBGR48(l, src, asrc, i, abase) \ Y = src[2 * i]; \ - dst[12 * i + 0] = dst[12 * i + 1] = b[Y]; \ - dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \ - dst[12 * i + 4] = dst[12 * i + 5] = r[Y]; \ + dst_p[0][l][12 * i + 0] = dst_p[0][l][12 * i + 1] = b[Y]; \ + dst_p[0][l][12 * i + 2] = dst_p[0][l][12 * i + 3] = g[Y]; \ + dst_p[0][l][12 * i + 4] = dst_p[0][l][12 * i + 5] = r[Y]; \ Y = src[2 * i + 1]; \ - dst[12 * i + 6] = dst[12 * i + 7] = b[Y]; \ - dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \ - dst[12 * i + 10] = dst[12 * i + 11] = r[Y]; + dst_p[0][l][12 * i + 6] = dst_p[0][l][12 * i + 7] = b[Y]; \ + dst_p[0][l][12 * i + 8] = dst_p[0][l][12 * i + 9] = g[Y]; \ + dst_p[0][l][12 * i + 10] = dst_p[0][l][12 * i + 11] = r[Y]; -#define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422) \ +#define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422, nb_dst_planes) \ static int func_name(SwsContext *c, const uint8_t *src[], \ int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *dst[], int dstStride[]) \ @@ -133,10 +133,7 @@ const int *sws_getCoefficients(int colorspace) \ for (y = 0; y < srcSliceH; y += 2) { \ int yd = y + srcSliceY; \ - dst_type *dst_1 = \ - (dst_type *)(dst[0] + (yd) * dstStride[0]); \ - dst_type *dst_2 = \ - (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \ + dst_type *dst_p[nb_dst_planes][2]; \ dst_type av_unused *r, *g, *b; \ const uint8_t *py_1 = src[0] + y * srcStride[0]; \ const uint8_t *py_2 = py_1 + srcStride[0]; \ @@ -145,6 +142,12 @@ const int *sws_getCoefficients(int colorspace) const uint8_t av_unused *pu_2, *pv_2; \ const uint8_t av_unused *pa_1, *pa_2; \ unsigned int h_size = c->dstW >> 3; \ + for (int p = 0; p < nb_dst_planes; p++) { \ + dst_p[p][0] = \ + (dst_type *)(dst[p] + (yd) * dstStride[p]); \ + dst_p[p][1] = \ + (dst_type *)(dst[p] + (yd + 1) * dstStride[p]); \ + } \ if (yuv422) { \ pu_2 = pu_1 + srcStride[1]; \ pv_2 = pv_1 + srcStride[2]; \ @@ -156,7 +159,7 @@ const int *sws_getCoefficients(int colorspace) while (h_size--) { \ int av_unused U, V, Y; \ -#define ENDYUV2RGBLINE(dst_delta, ss, alpha, yuv422) \ +#define ENDYUV2RGBLINE(dst_delta, ss, alpha, yuv422, nb_dst_planes) \ pu_1 += 4 >> ss; \ pv_1 += 4 >> ss; \ if (yuv422) { \ @@ -169,8 +172,10 @@ const int *sws_getCoefficients(int colorspace) pa_1 += 8 >> ss; \ pa_2 += 8 >> ss; \ } \ - dst_1 += dst_delta >> ss; \ - dst_2 += dst_delta >> ss; \ + for (int p = 0; p < nb_dst_planes; p++) { \ + dst_p[p][0] += dst_delta >> ss; \ + dst_p[p][1] += dst_delta >> ss; \ + } \ } \ if (c->dstW & (4 >> ss)) { \ int av_unused Y, U, V; \ @@ -181,168 +186,168 @@ const int *sws_getCoefficients(int colorspace) return srcSliceH; \ } -#define YUV420FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta) \ - YUV2RGBFUNC(func_name, dst_type, alpha, 0) \ +#define YUV420FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta, nb_dst_planes) \ + YUV2RGBFUNC(func_name, dst_type, alpha, 0, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + PUTFUNC(1, py_2, pa_2, 1, abase); \ + PUTFUNC(0, py_1, pa_1, 1, abase); \ \ LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, pa_1, 2, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 2, abase); \ + PUTFUNC(0, py_1, pa_1, 2, abase); \ + PUTFUNC(1, py_2, pa_2, 2, abase); \ \ LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_2, py_2, pa_2, 3, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 3, abase); \ - ENDYUV2RGBLINE(dst_delta, 0, alpha, 0) \ + PUTFUNC(1, py_2, pa_2, 3, abase); \ + PUTFUNC(0, py_1, pa_1, 3, abase); \ + ENDYUV2RGBLINE(dst_delta, 0, alpha, 0, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ - ENDYUV2RGBLINE(dst_delta, 1, alpha, 0) \ + PUTFUNC(1, py_2, pa_2, 1, abase); \ + PUTFUNC(0, py_1, pa_1, 1, abase); \ + ENDYUV2RGBLINE(dst_delta, 1, alpha, 0, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ ENDYUV2RGBFUNC() -#define YUV422FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta) \ - YUV2RGBFUNC(func_name, dst_type, alpha, 1) \ +#define YUV422FUNC(func_name, dst_type, alpha, abase, PUTFUNC, dst_delta, nb_dst_planes) \ + YUV2RGBFUNC(func_name, dst_type, alpha, 1, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ \ LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ + PUTFUNC(1, py_2, pa_2, 1, abase); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ + PUTFUNC(0, py_1, pa_1, 1, abase); \ \ LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, pa_1, 2, abase); \ + PUTFUNC(0, py_1, pa_1, 2, abase); \ \ LOADCHROMA(pu_2, pv_2, 2); \ - PUTFUNC(dst_2, py_2, pa_2, 2, abase); \ + PUTFUNC(1, py_2, pa_2, 2, abase); \ \ LOADCHROMA(pu_2, pv_2, 3); \ - PUTFUNC(dst_2, py_2, pa_2, 3, abase); \ + PUTFUNC(1, py_2, pa_2, 3, abase); \ \ LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_1, py_1, pa_1, 3, abase); \ - ENDYUV2RGBLINE(dst_delta, 0, alpha, 1) \ + PUTFUNC(0, py_1, pa_1, 3, abase); \ + ENDYUV2RGBLINE(dst_delta, 0, alpha, 1, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ \ LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, pa_2, 1, abase); \ + PUTFUNC(1, py_2, pa_2, 1, abase); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, pa_1, 1, abase); \ - ENDYUV2RGBLINE(dst_delta, 1, alpha, 1) \ + PUTFUNC(0, py_1, pa_1, 1, abase); \ + ENDYUV2RGBLINE(dst_delta, 1, alpha, 1, nb_dst_planes) \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, pa_1, 0, abase); \ + PUTFUNC(0, py_1, pa_1, 0, abase); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, pa_2, 0, abase); \ + PUTFUNC(1, py_2, pa_2, 0, abase); \ ENDYUV2RGBFUNC() #define YUV420FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta) \ - YUV2RGBFUNC(func_name, dst_type, 0, 0) \ + YUV2RGBFUNC(func_name, dst_type, 0, 0, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + PUTFUNC(dst_p[0][1], py_2, 1, 2 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 1, 2); \ \ LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, 2, 4); \ - PUTFUNC(dst_2, py_2, 2, 4 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 2, 4); \ + PUTFUNC(dst_p[0][1], py_2, 2, 4 + 8); \ \ LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_2, py_2, 3, 6 + 8); \ - PUTFUNC(dst_1, py_1, 3, 6); \ - ENDYUV2RGBLINE(dst_delta, 0, 0, 0) \ + PUTFUNC(dst_p[0][1], py_2, 3, 6 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 3, 6); \ + ENDYUV2RGBLINE(dst_delta, 0, 0, 0, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ - PUTFUNC(dst_1, py_1, 1, 2); \ - ENDYUV2RGBLINE(dst_delta, 1, 0, 0) \ + PUTFUNC(dst_p[0][1], py_2, 1, 2 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 1, 2); \ + ENDYUV2RGBLINE(dst_delta, 1, 0, 0, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ ENDYUV2RGBFUNC() #define YUV422FUNC_DITHER(func_name, dst_type, LOADDITHER, PUTFUNC, dst_delta) \ - YUV2RGBFUNC(func_name, dst_type, 0, 1) \ + YUV2RGBFUNC(func_name, dst_type, 0, 1, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ \ LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 1, 2 + 8); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, 1, 2); \ + PUTFUNC(dst_p[0][0], py_1, 1, 2); \ \ LOADCHROMA(pu_1, pv_1, 2); \ - PUTFUNC(dst_1, py_1, 2, 4); \ + PUTFUNC(dst_p[0][0], py_1, 2, 4); \ \ LOADCHROMA(pu_2, pv_2, 2); \ - PUTFUNC(dst_2, py_2, 2, 4 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 2, 4 + 8); \ \ LOADCHROMA(pu_2, pv_2, 3); \ - PUTFUNC(dst_2, py_2, 3, 6 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 3, 6 + 8); \ \ LOADCHROMA(pu_1, pv_1, 3); \ - PUTFUNC(dst_1, py_1, 3, 6); \ - ENDYUV2RGBLINE(dst_delta, 0, 0, 1) \ + PUTFUNC(dst_p[0][0], py_1, 3, 6); \ + ENDYUV2RGBLINE(dst_delta, 0, 0, 1, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ \ LOADCHROMA(pu_2, pv_2, 1); \ - PUTFUNC(dst_2, py_2, 1, 2 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 1, 2 + 8); \ \ LOADCHROMA(pu_1, pv_1, 1); \ - PUTFUNC(dst_1, py_1, 1, 2); \ - ENDYUV2RGBLINE(dst_delta, 1, 0, 1) \ + PUTFUNC(dst_p[0][0], py_1, 1, 2); \ + ENDYUV2RGBLINE(dst_delta, 1, 0, 1, 1) \ LOADDITHER \ \ LOADCHROMA(pu_1, pv_1, 0); \ - PUTFUNC(dst_1, py_1, 0, 0); \ + PUTFUNC(dst_p[0][0], py_1, 0, 0); \ \ LOADCHROMA(pu_2, pv_2, 0); \ - PUTFUNC(dst_2, py_2, 0, 0 + 8); \ + PUTFUNC(dst_p[0][1], py_2, 0, 0 + 8); \ ENDYUV2RGBFUNC() #define LOADDITHER16 \ @@ -431,7 +436,7 @@ const int *sws_getCoefficients(int colorspace) g[Y + d64[1 + o]] + \ b[Y + d128[1 + o]]; -YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0) +YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0, 1) const uint8_t *d128 = ff_dither_8x8_220[yd & 7]; char out_1 = 0, out_2 = 0; g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM]; @@ -454,13 +459,13 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0) PUTRGB1(out_2, py_2, 3, 6 + 8); PUTRGB1(out_1, py_1, 3, 6); - dst_1[0] = out_1; - dst_2[0] = out_2; + dst_p[0][0][0] = out_1; + dst_p[0][1][0] = out_2; py_1 += 8; py_2 += 8; - dst_1 += 1; - dst_2 += 1; + dst_p[0][0] += 1; + dst_p[0][1] += 1; } if (c->dstW & 7) { int av_unused Y, U, V; @@ -489,23 +494,23 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0) PUTRGB1_OR00(out_2, py_2, 3, 6 + 8); PUTRGB1_OR00(out_1, py_1, 3, 6); - dst_1[0] = out_1; - dst_2[0] = out_2; + dst_p[0][0][0] = out_1; + dst_p[0][1][0] = out_2; ENDYUV2RGBFUNC() // YUV420 -YUV420FUNC(yuv2rgb_c_48, uint8_t, 0, 0, PUTRGB48, 48) -YUV420FUNC(yuv2rgb_c_bgr48, uint8_t, 0, 0, PUTBGR48, 48) -YUV420FUNC(yuv2rgb_c_32, uint32_t, 0, 0, PUTRGB, 8) +YUV420FUNC(yuv2rgb_c_48, uint8_t, 0, 0, PUTRGB48, 48, 1) +YUV420FUNC(yuv2rgb_c_bgr48, uint8_t, 0, 0, PUTBGR48, 48, 1) +YUV420FUNC(yuv2rgb_c_32, uint32_t, 0, 0, PUTRGB, 8, 1) #if HAVE_BIGENDIAN -YUV420FUNC(yuva2argb_c, uint32_t, 1, 24, PUTRGBA, 8) -YUV420FUNC(yuva2rgba_c, uint32_t, 1, 0, PUTRGBA, 8) +YUV420FUNC(yuva2argb_c, uint32_t, 1, 24, PUTRGBA, 8, 1) +YUV420FUNC(yuva2rgba_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #else -YUV420FUNC(yuva2rgba_c, uint32_t, 1, 24, PUTRGBA, 8) -YUV420FUNC(yuva2argb_c, uint32_t, 1, 0, PUTRGBA, 8) +YUV420FUNC(yuva2rgba_c, uint32_t, 1, 24, PUTRGBA, 8, 1) +YUV420FUNC(yuva2argb_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #endif -YUV420FUNC(yuv2rgb_c_24_rgb, uint8_t, 0, 0, PUTRGB24, 24) -YUV420FUNC(yuv2rgb_c_24_bgr, uint8_t, 0, 0, PUTBGR24, 24) +YUV420FUNC(yuv2rgb_c_24_rgb, uint8_t, 0, 0, PUTRGB24, 24, 1) +YUV420FUNC(yuv2rgb_c_24_bgr, uint8_t, 0, 0, PUTBGR24, 24, 1) YUV420FUNC_DITHER(yuv2rgb_c_16_ordered_dither, uint16_t, LOADDITHER16, PUTRGB16, 8) YUV420FUNC_DITHER(yuv2rgb_c_15_ordered_dither, uint16_t, LOADDITHER15, PUTRGB15, 8) YUV420FUNC_DITHER(yuv2rgb_c_12_ordered_dither, uint16_t, LOADDITHER12, PUTRGB12, 8) @@ -514,18 +519,18 @@ YUV420FUNC_DITHER(yuv2rgb_c_4_ordered_dither, uint8_t, LOADDITHER4D, PUTRGB4D YUV420FUNC_DITHER(yuv2rgb_c_4b_ordered_dither, uint8_t, LOADDITHER4DB, PUTRGB4DB, 8) // YUV422 -YUV422FUNC(yuv422p_rgb48_c, uint8_t, 0, 0, PUTRGB48, 48) -YUV422FUNC(yuv422p_bgr48_c, uint8_t, 0, 0, PUTBGR48, 48) -YUV422FUNC(yuv422p_rgb32_c, uint32_t, 0, 0, PUTRGB, 8) +YUV422FUNC(yuv422p_rgb48_c, uint8_t, 0, 0, PUTRGB48, 48, 1) +YUV422FUNC(yuv422p_bgr48_c, uint8_t, 0, 0, PUTBGR48, 48, 1) +YUV422FUNC(yuv422p_rgb32_c, uint32_t, 0, 0, PUTRGB, 8, 1) #if HAVE_BIGENDIAN -YUV422FUNC(yuva422p_argb_c, uint32_t, 1, 24, PUTRGBA, 8) -YUV422FUNC(yuva422p_rgba_c, uint32_t, 1, 0, PUTRGBA, 8) +YUV422FUNC(yuva422p_argb_c, uint32_t, 1, 24, PUTRGBA, 8, 1) +YUV422FUNC(yuva422p_rgba_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #else -YUV422FUNC(yuva422p_rgba_c, uint32_t, 1, 24, PUTRGBA, 8) -YUV422FUNC(yuva422p_argb_c, uint32_t, 1, 0, PUTRGBA, 8) +YUV422FUNC(yuva422p_rgba_c, uint32_t, 1, 24, PUTRGBA, 8, 1) +YUV422FUNC(yuva422p_argb_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #endif -YUV422FUNC(yuv422p_rgb24_c, uint8_t, 0, 0, PUTRGB24, 24) -YUV422FUNC(yuv422p_bgr24_c, uint8_t, 0, 0, PUTBGR24, 24) +YUV422FUNC(yuv422p_rgb24_c, uint8_t, 0, 0, PUTRGB24, 24, 1) +YUV422FUNC(yuv422p_bgr24_c, uint8_t, 0, 0, PUTBGR24, 24, 1) YUV422FUNC_DITHER(yuv422p_bgr16, uint16_t, LOADDITHER16, PUTRGB16, 8) YUV422FUNC_DITHER(yuv422p_bgr15, uint16_t, LOADDITHER15, PUTRGB15, 8) YUV422FUNC_DITHER(yuv422p_bgr12, uint16_t, LOADDITHER12, PUTRGB12, 8) From patchwork Tue Jul 23 12:46:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramiro Polla X-Patchwork-Id: 50709 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2600746vqm; Tue, 23 Jul 2024 05:46:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVa8ZtJu58fDIUVUqLwqFd42zXX50aJgCYkgel3gJpexM3sc+saRvQ3ZVaNt3zTtCNoJtAwCDBISr2BKXCBweBLkhV7zJjO4aLlBg== X-Google-Smtp-Source: AGHT+IGSS1TI0+kCeIMH7jJhtyEN0Z8ISamwz4irkx0+MvbO3U5azbiptiql7vNOBCItndtsygbn X-Received: by 2002:a17:907:3ea1:b0:a77:dbf0:d22 with SMTP id a640c23a62f3a-a7a4c580e93mr718806866b.65.1721738791159; Tue, 23 Jul 2024 05:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721738791; cv=none; d=google.com; s=arc-20160816; b=MhYICltQ41ZOqXxvZN6S4/+IZA8VqkWcHAVubNWcCSJyyYy/HEtX/pd5WnvPaOT359 qNYAngmF6Nm7Us4TrnJyycNylIEoEVcURuYAm3oegdEz5wGCEAkHUsy5SnwTmxpAKSyl rJSbAkDn6xpA/4SMrB1veLlmuBrcW144kRULPvDzmepeKLn4/sQBsy40O2LThDvAvVce BO0KGbauSLhq24e2TgN4D2AxDUi4ounnVcIYneeHGbkq+5h4Y9oYOry9LV/8mDRj5iUA DingMlncxta8mKnXFTGGOVHtSZEDq1K+09ynCD5pC/c72WExnIeIfni7rETI6uWWqRUy ccEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=34J8bftyIa9ct8ymiwhpfw5/JMllkBJ97RVszPsR8i0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=x2NL1GVgGr2IY5gRr4DKFGVjSikLOUhHK+a+ybCERmiEXsYRR4loE0zruvoSSD7GsI eNFpF9SKkBPe7ReJFBUsMXSD26CFbiUjjT/uVyZy4VeL0i3QdavMVvkbMZgNLm6QsuBW D8aV7L02ZEFUc01jW0bE1ItIqO6C7sHJl6I3IV8WNJ4b6EbSitbK4dVwQ9z9xzw2Ul93 x8AZ9lw4LBq7wfkuaWFNmm76CpgJ/ok332OPnjenUNgXiEEm/Yx+e48ZRWa/KvAj2J+9 Kph1+tTpEQeeas0AsIR8dA+uksHiE27oGT/M4M+hUWNoGyc3MHmR+VPw43s87KkLMYNd T6ow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="P/vKTLhq"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a7aa0472fd4si58128766b.742.2024.07.23.05.46.30; Tue, 23 Jul 2024 05:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="P/vKTLhq"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2A6168D559; Tue, 23 Jul 2024 15:46:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 10C5E68D4AE for ; Tue, 23 Jul 2024 15:46:10 +0300 (EEST) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-367ab76d5e1so2115143f8f.3 for ; Tue, 23 Jul 2024 05:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721738769; x=1722343569; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nqicMMi2T8BVx56JvYLHaakJXMZCAREEenO6cMZojmY=; b=P/vKTLhqbUxXKqkBqSjSIWlEil+awlYjjK2P12aVtKzqjFu5pV+gZKUkMTnI8JAFYz 5uJKOJmgOFca7DqsnEUwQZTpWtzoeG/TETgmtkP3yEa6hZLavrdLiRrdaRTuOJ9CrcBO zF2qwsLv9NjNi0IZcd5IjkZccJRJODK2sLxHZcWxlSi6IqOR9//lwHFbxRbWlBSXtaWO ILzIiPO4EehbpRmza+vXMZ0kS6E85nbm2k5/VSsJpwVnLy3wNqz+0gq3i1EL9gB/jkei BOTbux0h4L8n3uwmVCM2pysN/AsaNvaCzhqi2uxOrpcjqHXTTu26NQB3H7xSxwYav/TY Sr5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721738769; x=1722343569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nqicMMi2T8BVx56JvYLHaakJXMZCAREEenO6cMZojmY=; b=h6J7IFBirgxA7vM5YmKzqJnGwgrWYVXqgtX/BeoTyxgA3FMp45x9Lb4fqVsm/9O10m cajo50Of4zcVmlEKRbvqJKRG+jNlDwr3K7TKfQoVDsSULoGIZCIv3sU/IlVJzcPnOyN9 ErMJNRsWnRhF+Vn1Yk8vjM07Jtbwr3eyFfi/N1cobPGjquKCccmch3NK0Sp8KtraKC/X e/3vZsnv9lsH1AERggOQY3z/uYf89+pwoZ2Ej4yzIUxYNYGGFw7JEzsbQ2Y0QGVfZ89J rbEqRv5cqWCiINLhVEVXLI3haa5Rm5u/3nNL/S6MdOekTlEhDw/IfkB27fdbGS2mib3+ WQVA== X-Gm-Message-State: AOJu0Yx8x4jJk+vaB+E1GmzAqBNMUUwK3eKLFbf99De6sY8yfYcdy4xX Ft5cdEJMegjZNORC3o5ZLuFTuOt7nR0K9tQAkqdb06LscGpA/u6Tlx0/+lHs X-Received: by 2002:a5d:59a4:0:b0:368:785f:b790 with SMTP id ffacd0b85a97d-369bbbb2eddmr7956401f8f.1.1721738768899; Tue, 23 Jul 2024 05:46:08 -0700 (PDT) Received: from localhost.localdomain (232.39-67-87.adsl-dyn.isp.belgacom.be. [87.67.39.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787cee03sm11493779f8f.76.2024.07.23.05.46.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:46:08 -0700 (PDT) From: Ramiro Polla To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 14:46:04 +0200 Message-Id: <20240723124606.107774-2-ramiro.polla@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240723124606.107774-1-ramiro.polla@gmail.com> References: <20240723124606.107774-1-ramiro.polla@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] swscale/yuv2rgb: add yuv42{0, 2}p -> gbrp unscaled colorspace converters X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: uDCCsSmmsd3E --- libswscale/yuv2rgb.c | 16 ++++++++++ tests/checkasm/sw_yuv2rgb.c | 60 +++++++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index c283d6d1bd..3a41c4eba6 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -124,6 +124,16 @@ const int *sws_getCoefficients(int colorspace) dst_p[0][l][12 * i + 8] = dst_p[0][l][12 * i + 9] = g[Y]; \ dst_p[0][l][12 * i + 10] = dst_p[0][l][12 * i + 11] = r[Y]; +#define PUTGBRP(l, src, asrc, i, abase) \ + Y = src[2 * i]; \ + dst_p[0][l][2 * i + 0] = g[Y]; \ + dst_p[1][l][2 * i + 0] = b[Y]; \ + dst_p[2][l][2 * i + 0] = r[Y]; \ + Y = src[2 * i + 1]; \ + dst_p[0][l][2 * i + 1] = g[Y]; \ + dst_p[1][l][2 * i + 1] = b[Y]; \ + dst_p[2][l][2 * i + 1] = r[Y]; + #define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422, nb_dst_planes) \ static int func_name(SwsContext *c, const uint8_t *src[], \ int srcStride[], int srcSliceY, int srcSliceH, \ @@ -511,6 +521,7 @@ YUV420FUNC(yuva2argb_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #endif YUV420FUNC(yuv2rgb_c_24_rgb, uint8_t, 0, 0, PUTRGB24, 24, 1) YUV420FUNC(yuv2rgb_c_24_bgr, uint8_t, 0, 0, PUTBGR24, 24, 1) +YUV420FUNC(yuv420p_gbrp_c, uint8_t, 0, 0, PUTGBRP, 8, 4) YUV420FUNC_DITHER(yuv2rgb_c_16_ordered_dither, uint16_t, LOADDITHER16, PUTRGB16, 8) YUV420FUNC_DITHER(yuv2rgb_c_15_ordered_dither, uint16_t, LOADDITHER15, PUTRGB15, 8) YUV420FUNC_DITHER(yuv2rgb_c_12_ordered_dither, uint16_t, LOADDITHER12, PUTRGB12, 8) @@ -531,6 +542,7 @@ YUV422FUNC(yuva422p_argb_c, uint32_t, 1, 0, PUTRGBA, 8, 1) #endif YUV422FUNC(yuv422p_rgb24_c, uint8_t, 0, 0, PUTRGB24, 24, 1) YUV422FUNC(yuv422p_bgr24_c, uint8_t, 0, 0, PUTBGR24, 24, 1) +YUV422FUNC(yuv422p_gbrp_c, uint8_t, 0, 0, PUTGBRP, 8, 4) YUV422FUNC_DITHER(yuv422p_bgr16, uint16_t, LOADDITHER16, PUTRGB16, 8) YUV422FUNC_DITHER(yuv422p_bgr15, uint16_t, LOADDITHER15, PUTRGB15, 8) YUV422FUNC_DITHER(yuv422p_bgr12, uint16_t, LOADDITHER12, PUTRGB12, 8) @@ -596,6 +608,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) return yuv422p_bgr4_byte; case AV_PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither; + case AV_PIX_FMT_GBRP: + return yuv422p_gbrp_c; } } else { switch (c->dstFormat) { @@ -636,6 +650,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) return yuv2rgb_c_4b_ordered_dither; case AV_PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither; + case AV_PIX_FMT_GBRP: + return yuv420p_gbrp_c; } } return NULL; diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c index 02ed9a74d5..5125f83968 100644 --- a/tests/checkasm/sw_yuv2rgb.c +++ b/tests/checkasm/sw_yuv2rgb.c @@ -58,6 +58,7 @@ static const int dst_fmts[] = { // AV_PIX_FMT_RGB4_BYTE, // AV_PIX_FMT_BGR4_BYTE, // AV_PIX_FMT_MONOBLACK, + AV_PIX_FMT_GBRP, }; static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy) @@ -116,13 +117,25 @@ static void check_yuv2rgb(int src_pix_fmt) LOCAL_ALIGNED_8(uint8_t, src_a, [MAX_LINE_SIZE * 2]); const uint8_t *src[4] = { src_y, src_u, src_v, src_a }; - LOCAL_ALIGNED_8(uint8_t, dst0_, [2 * MAX_LINE_SIZE * 6]); - uint8_t *dst0[4] = { dst0_ }; - uint8_t *lines0[2] = { dst0_, dst0_ + MAX_LINE_SIZE * 6 }; - - LOCAL_ALIGNED_8(uint8_t, dst1_, [2 * MAX_LINE_SIZE * 6]); - uint8_t *dst1[4] = { dst1_ }; - uint8_t *lines1[2] = { dst1_, dst1_ + MAX_LINE_SIZE * 6 }; + LOCAL_ALIGNED_8(uint8_t, dst0_0, [2 * MAX_LINE_SIZE * 6]); + LOCAL_ALIGNED_8(uint8_t, dst0_1, [2 * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst0_2, [2 * MAX_LINE_SIZE]); + uint8_t *dst0[4] = { dst0_0, dst0_1, dst0_2 }; + uint8_t *lines0[4][2] = { + { dst0_0, dst0_0 + MAX_LINE_SIZE * 6 }, + { dst0_1, dst0_1 + MAX_LINE_SIZE }, + { dst0_2, dst0_2 + MAX_LINE_SIZE } + }; + + LOCAL_ALIGNED_8(uint8_t, dst1_0, [2 * MAX_LINE_SIZE * 6]); + LOCAL_ALIGNED_8(uint8_t, dst1_1, [2 * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst1_2, [2 * MAX_LINE_SIZE]); + uint8_t *dst1[4] = { dst1_0, dst1_1, dst1_2 }; + uint8_t *lines1[4][2] = { + { dst1_0, dst1_0 + MAX_LINE_SIZE * 6 }, + { dst1_1, dst1_1 + MAX_LINE_SIZE }, + { dst1_2, dst1_2 + MAX_LINE_SIZE } + }; randomize_buffers(src_y, MAX_LINE_SIZE * 2); randomize_buffers(src_u, MAX_LINE_SIZE); @@ -145,7 +158,11 @@ static void check_yuv2rgb(int src_pix_fmt) width >> src_desc->log2_chroma_w, width, }; - int dstStride[4] = { MAX_LINE_SIZE * 6 }; + int dstStride[4] = { + MAX_LINE_SIZE * 6, + MAX_LINE_SIZE, + MAX_LINE_SIZE, + }; // override log level to prevent spamming of the message // "No accelerated colorspace conversion found from %s to %s" @@ -159,8 +176,14 @@ static void check_yuv2rgb(int src_pix_fmt) fail(); if (check_func(ctx->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { - memset(dst0_, 0xFF, 2 * MAX_LINE_SIZE * 6); - memset(dst1_, 0xFF, 2 * MAX_LINE_SIZE * 6); + memset(dst0_0, 0xFF, 2 * MAX_LINE_SIZE * 6); + memset(dst1_0, 0xFF, 2 * MAX_LINE_SIZE * 6); + if (dst_pix_fmt == AV_PIX_FMT_GBRP) { + memset(dst0_1, 0xFF, MAX_LINE_SIZE); + memset(dst0_2, 0xFF, MAX_LINE_SIZE); + memset(dst1_1, 0xFF, MAX_LINE_SIZE); + memset(dst1_2, 0xFF, MAX_LINE_SIZE); + } call_ref(ctx, src, srcStride, srcSliceY, srcSliceH, dst0, dstStride); @@ -173,19 +196,24 @@ static void check_yuv2rgb(int src_pix_fmt) dst_pix_fmt == AV_PIX_FMT_BGRA || dst_pix_fmt == AV_PIX_FMT_RGB24 || dst_pix_fmt == AV_PIX_FMT_BGR24) { - if (cmp_off_by_n(lines0[0], lines1[0], width * sample_size, 3) || - cmp_off_by_n(lines0[1], lines1[1], width * sample_size, 3)) + if (cmp_off_by_n(lines0[0][0], lines1[0][0], width * sample_size, 3) || + cmp_off_by_n(lines0[0][1], lines1[0][1], width * sample_size, 3)) fail(); } else if (dst_pix_fmt == AV_PIX_FMT_RGB565 || dst_pix_fmt == AV_PIX_FMT_BGR565) { - if (cmp_565_by_n(lines0[0], lines1[0], width, 2) || - cmp_565_by_n(lines0[1], lines1[1], width, 2)) + if (cmp_565_by_n(lines0[0][0], lines1[0][0], width, 2) || + cmp_565_by_n(lines0[0][1], lines1[0][1], width, 2)) fail(); } else if (dst_pix_fmt == AV_PIX_FMT_RGB555 || dst_pix_fmt == AV_PIX_FMT_BGR555) { - if (cmp_555_by_n(lines0[0], lines1[0], width, 2) || - cmp_555_by_n(lines0[1], lines1[1], width, 2)) + if (cmp_555_by_n(lines0[0][0], lines1[0][0], width, 2) || + cmp_555_by_n(lines0[0][1], lines1[0][1], width, 2)) fail(); + } else if (dst_pix_fmt == AV_PIX_FMT_GBRP) { + for (int p = 0; p < 3; p++) + for (int l = 0; l < 2; l++) + if (cmp_off_by_n(lines0[p][l], lines1[p][l], width, 3)) + fail(); } else { fail(); } From patchwork Tue Jul 23 12:46:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramiro Polla X-Patchwork-Id: 50710 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2600812vqm; Tue, 23 Jul 2024 05:46:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWJ5Qx2z6f8CnSjn3azyCxrgQ17nS859IdkaceSULw0mXCQ0Py5C9dbojcKBpEkT7vcjBdfZJG8goLzXTD8Yxgsqo/OjO3v3Kf3MA== X-Google-Smtp-Source: AGHT+IFYNNO4tH983CgvkIftx+K6NNo9/bYw5AINTbAKcMcc3qAWiwWP/jHYXO7uiGLi7no+o2Bz X-Received: by 2002:a50:8d4b:0:b0:5a3:41cb:676a with SMTP id 4fb4d7f45d1cf-5a9438290famr2092279a12.27.1721738800005; Tue, 23 Jul 2024 05:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721738799; cv=none; d=google.com; s=arc-20160816; b=mG86aN/+9WTLrwWhN++0oJM4tgvX+qgZCiV/eGHLTcWsu298CTfXlAQOeLsEIdvouE JUmhB+N+LfLZKprqrsmmz68pCh3BniJY/QDpoYOG0xaNMc7AGuk9dX/JpPnSgyKXGZ7L ae7j+nbdpoly4aPurnNOHJiNegtC5t6Ob12IW/2FMh3domvEaoadmuR5ot2DKWSpjnTX YnB6saJ+WxrZUPe3RHRr+dmxMJcWOCLe/TNb7m6ez2bdEGZX41ppxM9Y9dAKBIbg4Oqi uPWdjrBJEvrJ0F1G+PBVWq6aSguNLGAzUkQbrY33UeyKnk54PBhYK/31vq6ibf6XoIyS ylDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=ZNLUaSp4x9sC7muBgWHFJpubr+CPLr1cWXID1vb3QOg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=vnxoxiuS45j/ziHnBchy4FbOJiM1vewvBXbxinx7PgLGDD3iHQIMl5buP7zz77bu7X Y4Jplp361HJOX+npVdUaFQHaFwbWDItgyuyGurgOXPGJqDeehhbVAIUPQzHo2SA+YIz1 EFCP0sQyrofc55Z380Ob7Rp+h6j550PqXTC7fbycoF9NpQiW2TVpV9unss0WWaY9nR4T /Dvh8nAck+WyMmDektKmUCbp2LhYFq6Lj05/+wdYj2mfZRzdTyg8S6zSuaxg6t7E/c6l QMXG0/niwNlieT7TNWtOwiXfcC0/W6mP1qrvbD/qAwGAmDjjFD59tam48E8VFsECoQd/ 9Cdw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=KgRaUYki; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5a30bf122fasi5852935a12.344.2024.07.23.05.46.39; Tue, 23 Jul 2024 05:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=KgRaUYki; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A2B0368D5EE; Tue, 23 Jul 2024 15:46:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2977268D519 for ; Tue, 23 Jul 2024 15:46:11 +0300 (EEST) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-369cb9f086aso1777345f8f.0 for ; Tue, 23 Jul 2024 05:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721738770; x=1722343570; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pH3ebm75zW/Fl9oJlMSHO1Ma/0MzPOSNnfZccVkyNWY=; b=KgRaUYkiLjZanFzXipX7T5psDkmkfQ5i6y4df351Z0qlNIpmMk2lsnAI8jrcI3jDbk qYw7cKfmU0VQxFPhOcgMiTqFDb5otNBxExfYCwEVZQV7daR+LGaLTWbT5syO4ZtlaBh9 n7yHlo5OizqZS4sgAbpTZutd6a8LuVuxL8UlPCwZMkYJZupD7ADcCcZoyquaGyDjW8+q hALBoWfiPjrlsGJlIs03qj7WHDy26CUhNxXl/FCmjXPpcdMfNfDxyzmzbqJasNzfnJKb PY+OWYtQ3A/kwg0mJJ+g8JTHXMfMu74+bJ7R+hGMlezkL9NPyF/pJZDqCy6t+08opeuI OfNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721738770; x=1722343570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pH3ebm75zW/Fl9oJlMSHO1Ma/0MzPOSNnfZccVkyNWY=; b=jB3wnBUNyFsZ7gla4nj0TVmBBI1NmGyQHdMWqrWUTZMa6RGQNVY5BQeOVPSwYjNe4v oEPKocDs4+DZ5jx7ff3kvQ/6fTuDPUtKVmVX1X2snAlh3HP4dnDWJnXOWmSO2O2fdQfn C84wtpIFv+va+phQ+wnI1rMLYKPnelA/xlRbgZB/yXNjUFk6m16I7fBJpfWjpK38rjDX e+f2C4R7utCD0KwwsjkF3xYHZVDEx/rkvePZgcBtDwgFRbNmsGpn4dAVx7EC616BWQmm PKpLBglQS8psT8S9wgUluEHkGKr4IbCNqeTc3G81zbInXI74OPZPsjj4b3UNL0OSlJEj g0Pw== X-Gm-Message-State: AOJu0YxcQMdkaG5Y/iEuSv8OP/2xZD+cpPE70rLTL0zKnd6S0NEVUOxT mcUPfCK0Ai7zXZYxuBAp28lAnPH45EhKFcydCzVCr4xlU0Ja/7LjY6x7fjEG X-Received: by 2002:a05:6000:507:b0:369:b838:9155 with SMTP id ffacd0b85a97d-369dee579cbmr1968680f8f.40.1721738769649; Tue, 23 Jul 2024 05:46:09 -0700 (PDT) Received: from localhost.localdomain (232.39-67-87.adsl-dyn.isp.belgacom.be. [87.67.39.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787cee03sm11493779f8f.76.2024.07.23.05.46.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:46:09 -0700 (PDT) From: Ramiro Polla To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 14:46:05 +0200 Message-Id: <20240723124606.107774-3-ramiro.polla@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240723124606.107774-1-ramiro.polla@gmail.com> References: <20240723124606.107774-1-ramiro.polla@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] swscale/x86/yuv2rgb: add ssse3 yuv42{0, 2}p -> gbrp unscaled colorspace converters X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cbR/tXuy4Y9I Note: this implementation is limited to x86_64 due to general purpose register pressure. --- libswscale/x86/yuv2rgb.c | 39 ++++++++++++++++++++++++++++++++++++ libswscale/x86/yuv_2_rgb.asm | 24 +++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c index 68e903c6ad..2a4505fa90 100644 --- a/libswscale/x86/yuv2rgb.c +++ b/libswscale/x86/yuv2rgb.c @@ -79,6 +79,12 @@ extern void ff_yuva_420_rgb32_ssse3(x86_reg index, uint8_t *image, const uint8_t extern void ff_yuva_420_bgr32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, const uint8_t *pv_index, const uint64_t *pointer_c_dither, const uint8_t *py_2index, const uint8_t *pa_2index); +#if ARCH_X86_64 +extern void ff_yuv_420_gbrp24_ssse3(x86_reg index, uint8_t *image, uint8_t *dst_b, uint8_t *dst_r, + const uint8_t *pu_index, const uint8_t *pv_index, + const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +#endif static inline int yuv420_rgb15_ssse3(SwsContext *c, const uint8_t *src[], int srcStride[], @@ -201,6 +207,35 @@ static inline int yuv420_bgr24_ssse3(SwsContext *c, const uint8_t *src[], return srcSliceH; } +#if ARCH_X86_64 +static inline int yuv420_gbrp_ssse3(SwsContext *c, const uint8_t *src[], + int srcStride[], + int srcSliceY, int srcSliceH, + uint8_t *dst[], int dstStride[]) +{ + int y, h_size, vshift; + + h_size = (c->dstW + 7) & ~7; + if (h_size * 3 > FFABS(dstStride[0])) + h_size -= 8; + + vshift = c->srcFormat != AV_PIX_FMT_YUV422P; + + for (y = 0; y < srcSliceH; y++) { + uint8_t *dst_g = dst[0] + (y + srcSliceY) * dstStride[0]; + uint8_t *dst_b = dst[1] + (y + srcSliceY) * dstStride[1]; + uint8_t *dst_r = dst[2] + (y + srcSliceY) * dstStride[2]; + const uint8_t *py = src[0] + y * srcStride[0]; + const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; + const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; + x86_reg index = -h_size / 2; + + ff_yuv_420_gbrp24_ssse3(index, dst_g, dst_b, dst_r, pu - index, pv - index, &(c->redDither), py - 2 * index); + } + return srcSliceH; +} +#endif + #endif /* HAVE_X86ASM */ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) @@ -234,6 +269,10 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) return yuv420_rgb16_ssse3; case AV_PIX_FMT_RGB555: return yuv420_rgb15_ssse3; +#if ARCH_X86_64 + case AV_PIX_FMT_GBRP: + return yuv420_gbrp_ssse3; +#endif } } diff --git a/libswscale/x86/yuv_2_rgb.asm b/libswscale/x86/yuv_2_rgb.asm index b67ab162d2..eeb1d25942 100644 --- a/libswscale/x86/yuv_2_rgb.asm +++ b/libswscale/x86/yuv_2_rgb.asm @@ -32,6 +32,7 @@ mask_dw25 : db 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0 rgb24_shuf1: db 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11 rgb24_shuf2: db 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5 rgb24_shuf3: db 4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15 +gbrp_shuf : db 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 pw_00ff: times 8 dw 255 pb_f8: times 16 db 248 pb_e0: times 16 db 224 @@ -60,8 +61,13 @@ SECTION .text %define GPR_num 6 %endif %else + %ifidn %2, gbrp + %define parameters index, image, dst_b, dst_r, pu_index, pv_index, pointer_c_dither, py_2index + %define GPR_num 8 + %else %define parameters index, image, pu_index, pv_index, pointer_c_dither, py_2index %define GPR_num 6 + %endif %endif %define m_green m2 @@ -172,10 +178,22 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters paddsw m2, m6 ; G0 G2 G4 G6 ... %if %3 == 24 ; PACK RGB24 -%define depth 3 packuswb m0, m3 ; B0 B2 B4 B6 ... B1 B3 B5 B7 ... packuswb m1, m5 ; R0 R2 R4 R6 ... R1 R3 R5 R7 ... packuswb m2, m7 ; G0 G2 G4 G6 ... G1 G3 G5 G7 ... +%ifidn %2, gbrp ; PLANAR GBRP +%define depth 1 + mova m4, [gbrp_shuf] + pshufb m0, m4 + pshufb m1, m4 + pshufb m2, m4 + movu [imageq], m2 + movu [dst_bq], m0 + movu [dst_rq], m1 + add dst_bq, 8 * depth * time_num + add dst_rq, 8 * depth * time_num +%else +%define depth 3 mova m3, m_red mova m6, m_blue psrldq m_red, 8 @@ -206,6 +224,7 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters movu [imageq], m0 movu [imageq + 16], m1 movu [imageq + 32], m2 +%endif ; PLANAR GBRP %else ; PACK RGB15/16/32 packuswb m0, m1 packuswb m3, m5 @@ -292,3 +311,6 @@ yuv2rgb_fn yuva, rgb, 32 yuv2rgb_fn yuva, bgr, 32 yuv2rgb_fn yuv, rgb, 15 yuv2rgb_fn yuv, rgb, 16 +%if ARCH_X86_64 +yuv2rgb_fn yuv, gbrp, 24 +%endif From patchwork Tue Jul 23 12:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramiro Polla X-Patchwork-Id: 50711 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2605546vqm; Tue, 23 Jul 2024 05:56:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW9h8OqR7jkKFTr3OP2omDi0JPv3MV/SgmORyJYO1fo9bueD/AXkArrOZbUIVPdUlzLiVrYeJzNWA8nG2B6woL8zyGRkTs75Vew5A== X-Google-Smtp-Source: AGHT+IEBmZ00UECdmcITL+8rna3C6k8KX8J2QvPkKCvTLECJyg4Jj7av6s1/jJnsa2ABO/YXMy42 X-Received: by 2002:a2e:98c6:0:b0:2ee:87b9:91a7 with SMTP id 38308e7fff4ca-2f01ea57aadmr18220701fa.18.1721739412775; Tue, 23 Jul 2024 05:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721739412; cv=none; d=google.com; s=arc-20160816; b=shU7DSM9yY3zePUJPkxhx463kAkVzePfy6d9qcsClOlZNIk5fzA3ZjlcpccrK2xSOv KTqbBW1VdUsq5OeE+DPdZwsxKSdrbMky6z1lFXMc8+JHfra2WAXIEr1qhmC1D5JV1ZbM HZCcF7/4+f/odA93O5rGHqlMWwQgV9nofwwADSnz2gAUVhlV0HvRBVulIDGMDIcWXc/S ADgxICkHuIUbNEEPXJu+Q0TpjXVQt1+1hDVr7ZDTezd56pWFU2I8llSE30J9KAl3D5oD Og/iFWZwSBKGvUmNGXQhKVEg91axb9GFr9yPinfBud1D92FDIas5ZWPaSGU/erhfjH+9 mpdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=n+tv5IGP7maJgEQ0YIjFJsFCl0QHKNEJu/cTyBmkbmE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=i4APK+mM8XNIuoaEoI5Ft/Vs1kH15JZVqGB9YYVYbuu47uH2RTU9NrEWjhjbIPQUY8 33jDeFNDm5mIppCK9khajE33FeYN3CVtSck11QjGowCuWsOhFGSdLxGw9uvK3VEZ0r6D KolfiUBu6lBrWyowsHFr4C3voTIjqEL7n0DJeONUA+ronp6SBDutbheoHpohOk2R8vr6 lDGW2niHpIur+icCfBPfjxGsp/inlPjRA9ac/KvyvrM7rnzO7UoeJSEuCnSV/M5G9BDK oL/m1vsi7AEWn1qn2iB4jzHWfh5pzuvVo3ygIyu7h5r4MPPKZCIhs9QeyabZN999d5UO ak/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=cYp0eYnV; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2ef2fad89d9si10738621fa.421.2024.07.23.05.56.51; Tue, 23 Jul 2024 05:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=cYp0eYnV; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC7D468D67D; Tue, 23 Jul 2024 15:46:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B0EEE68D53F for ; Tue, 23 Jul 2024 15:46:11 +0300 (EEST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4266fd39527so41119925e9.1 for ; Tue, 23 Jul 2024 05:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721738771; x=1722343571; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=K08wK9Hu9DSAY51ffGvqaVZIsUyqxfAxlz9ByyKORCg=; b=cYp0eYnVALzx2KFBmOW1c5xby30H/Pw77iIoIxlKodNA2oFEQZIevLSJIJeHnTrq6J mqYuWpvqNSYMyrxqBCxKBgoT3NvnvxMaxN2Lj/fay2VsGsZH5ahQNou8qPv855ZEzQJU k2MGP2ltpNQiwxq9sn2SZq+3fv/eeQzBhZsXIcIGatwBNTjRFv2W/vbmXqvQv2vIQQKS ck+sA7bqBhjR3ITIwb58ffbUscnjY+3zw7cqfAdF2xY9evxEmEaXYwDBr6Gf70He70wJ JJTwnFxCHpbeVULEoRvs2jPZcOaUd1OGyzIKhI1RwEouHTTteY59wtmcfLdi3vLHb34b koAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721738771; x=1722343571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K08wK9Hu9DSAY51ffGvqaVZIsUyqxfAxlz9ByyKORCg=; b=ZiC2K4ydidiNAOaeU6W/SkeTaMj/TtHgjBD/9qX0vUupG0Yx8od/ny8DZTtU5pnoag uHehy0YQyQsirqOSSro0q+NbvgKdij7FpMg8o4Cryw+uAZ08Gax2rm/AQO/fu23VFrI1 +mdrufrbWx418hCrS79Cuh6EJXNE4v3m0B9p3VlFN+ZiTmVjwb9mdfCU7i2pkCRApfIi wR48KXgKb99x+VvedkyywtMd05dxAF+NyUblXVYypjNP41rUtBdNc3vQsXCIUkzw6mNr 9doq8b9VaHFSbjz6FAwY6OsvOp83573kl+i0lzX6m1zRq91Znknp1C6Tln9zMSqjRRrQ CIxw== X-Gm-Message-State: AOJu0YwgSSV3uy5iPtOrwJTN6Ho/7SzouySpRIlaSpgopOGLRHC8aqUK P4mXQh3xptbUXmrE/ySApF5RAf/tqRpQRh8Ve7Xle1Bhgf4R75Fr2+RLRvBx X-Received: by 2002:a5d:464f:0:b0:367:8a9e:6bed with SMTP id ffacd0b85a97d-369dee631c6mr2041260f8f.61.1721738770468; Tue, 23 Jul 2024 05:46:10 -0700 (PDT) Received: from localhost.localdomain (232.39-67-87.adsl-dyn.isp.belgacom.be. [87.67.39.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787cee03sm11493779f8f.76.2024.07.23.05.46.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:46:10 -0700 (PDT) From: Ramiro Polla To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 14:46:06 +0200 Message-Id: <20240723124606.107774-4-ramiro.polla@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240723124606.107774-1-ramiro.polla@gmail.com> References: <20240723124606.107774-1-ramiro.polla@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] swscale/aarch64/yuv2rgb: add neon yuv42{0, 2}p -> gbrp unscaled colorspace converters X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wu4n35TfFtp3 --- libswscale/aarch64/swscale_unscaled.c | 58 +++++++++++++++++++++ libswscale/aarch64/yuv2rgb_neon.S | 73 ++++++++++++++++++++++----- 2 files changed, 118 insertions(+), 13 deletions(-) diff --git a/libswscale/aarch64/swscale_unscaled.c b/libswscale/aarch64/swscale_unscaled.c index b3093bbc9d..5c4f6fee34 100644 --- a/libswscale/aarch64/swscale_unscaled.c +++ b/libswscale/aarch64/swscale_unscaled.c @@ -52,11 +52,41 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], c->yuv2rgb_y_coeff); \ } \ +#define DECLARE_FF_YUVX_TO_GBRP_FUNCS(ifmt, ofmt) \ +int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcU, int linesizeU, \ + const uint8_t *srcV, int linesizeV, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff, \ + uint8_t *dst1, int linesize1, \ + uint8_t *dst2, int linesize2); \ + \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ + const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ + \ + return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0], srcStride[0], \ + src[1], srcStride[1], \ + src[2], srcStride[2], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff, \ + dst[1] + srcSliceY * dstStride[1], dstStride[1], \ + dst[2] + srcSliceY * dstStride[2], dstStride[2]); \ +} \ + #define DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx) \ DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, argb) \ DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgba) \ DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, abgr) \ DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgra) \ +DECLARE_FF_YUVX_TO_GBRP_FUNCS(yuvx, gbrp) \ DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuv420p) DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuv422p) @@ -83,11 +113,38 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], c->yuv2rgb_y_coeff); \ } \ +#define DECLARE_FF_NVX_TO_GBRP_FUNCS(ifmt, ofmt) \ +int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcC, int linesizeC, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff, \ + uint8_t *dst1, int linesize1, \ + uint8_t *dst2, int linesize2); \ + \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ + const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ + \ + return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0], srcStride[0], src[1], srcStride[1], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff, \ + dst[1] + srcSliceY * dstStride[1], dstStride[1], \ + dst[2] + srcSliceY * dstStride[2], dstStride[2]); \ +} \ + #define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx) \ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb) \ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba) \ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr) \ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra) \ +DECLARE_FF_NVX_TO_GBRP_FUNCS(nvx, gbrp) \ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv12) DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) @@ -110,6 +167,7 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, rgba, RGBA, accurate_rnd); \ SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, abgr, ABGR, accurate_rnd); \ SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgra, BGRA, accurate_rnd); \ + SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, gbrp, GBRP, accurate_rnd); \ } while (0) static void get_unscaled_swscale_neon(SwsContext *c) { diff --git a/libswscale/aarch64/yuv2rgb_neon.S b/libswscale/aarch64/yuv2rgb_neon.S index 89d69e7f6c..b89eb2c781 100644 --- a/libswscale/aarch64/yuv2rgb_neon.S +++ b/libswscale/aarch64/yuv2rgb_neon.S @@ -30,23 +30,43 @@ #endif .endm -.macro load_args_nv12 +.macro load_dst1_dst2 dst1 linesize1 dst2 linesize2 +#if defined(__APPLE__) +#define DST_OFFSET 8 +#else +#define DST_OFFSET 0 +#endif + ldr x10, [sp, #\dst1 - DST_OFFSET] + ldr w12, [sp, #\linesize1 - DST_OFFSET] + ldr x15, [sp, #\dst2 - DST_OFFSET] + ldr w16, [sp, #\linesize2 - DST_OFFSET] +#undef DST_OFFSET + sub w12, w12, w0 // w12 = linesize1 - width (padding1) + sub w16, w16, w0 // w16 = linesize2 - width (padding2) +.endm + +.macro load_args_nv12 ofmt ldr x8, [sp] // table load_yoff_ycoeff 8, 16 // y_offset, y_coeff ld1 {v1.1d}, [x8] dup v0.8h, w10 dup v3.8h, w9 +.ifc \ofmt,gbrp + load_dst1_dst2 24, 32, 40, 48 + sub w3, w3, w0 // w3 = linesize - width (padding) +.else sub w3, w3, w0, lsl #2 // w3 = linesize - width * 4 (padding) +.endif sub w5, w5, w0 // w5 = linesizeY - width (paddingY) sub w7, w7, w0 // w7 = linesizeC - width (paddingC) neg w11, w0 .endm -.macro load_args_nv21 - load_args_nv12 +.macro load_args_nv21 ofmt + load_args_nv12 \ofmt .endm -.macro load_args_yuv420p +.macro load_args_yuv420p ofmt ldr x13, [sp] // srcV ldr w14, [sp, #8] // linesizeV ldr x8, [sp, #16] // table @@ -54,7 +74,12 @@ ld1 {v1.1d}, [x8] dup v0.8h, w10 dup v3.8h, w9 +.ifc \ofmt,gbrp + load_dst1_dst2 40, 48, 56, 64 + sub w3, w3, w0 // w3 = linesize - width (padding) +.else sub w3, w3, w0, lsl #2 // w3 = linesize - width * 4 (padding) +.endif sub w5, w5, w0 // w5 = linesizeY - width (paddingY) sub w7, w7, w0, lsr #1 // w7 = linesizeU - width / 2 (paddingU) sub w14, w14, w0, lsr #1 // w14 = linesizeV - width / 2 (paddingV) @@ -62,7 +87,7 @@ neg w11, w11 .endm -.macro load_args_yuv422p +.macro load_args_yuv422p ofmt ldr x13, [sp] // srcV ldr w14, [sp, #8] // linesizeV ldr x8, [sp, #16] // table @@ -70,7 +95,12 @@ ld1 {v1.1d}, [x8] dup v0.8h, w10 dup v3.8h, w9 +.ifc \ofmt,gbrp + load_dst1_dst2 40, 48, 56, 64 + sub w3, w3, w0 // w3 = linesize - width (padding) +.else sub w3, w3, w0, lsl #2 // w3 = linesize - width * 4 (padding) +.endif sub w5, w5, w0 // w5 = linesizeY - width (paddingY) sub w7, w7, w0, lsr #1 // w7 = linesizeU - width / 2 (paddingU) sub w14, w14, w0, lsr #1 // w14 = linesizeV - width / 2 (paddingV) @@ -100,9 +130,9 @@ .endm .macro increment_nv12 - ands w15, w1, #1 - csel w16, w7, w11, ne // incC = (h & 1) ? paddincC : -width - add x6, x6, w16, sxtw // srcC += incC + ands w17, w1, #1 + csel w17, w7, w11, ne // incC = (h & 1) ? paddincC : -width + add x6, x6, w17, sxtw // srcC += incC .endm .macro increment_nv21 @@ -110,10 +140,10 @@ .endm .macro increment_yuv420p - ands w15, w1, #1 - csel w16, w7, w11, ne // incU = (h & 1) ? paddincU : -width/2 + ands w17, w1, #1 + csel w17, w7, w11, ne // incU = (h & 1) ? paddincU : -width/2 + add x6, x6, w17, sxtw // srcU += incU csel w17, w14, w11, ne // incV = (h & 1) ? paddincV : -width/2 - add x6, x6, w16, sxtw // srcU += incU add x13, x13, w17, sxtw // srcV += incV .endm @@ -122,7 +152,7 @@ add x13, x13, w14, sxtw // srcV += incV .endm -.macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2 +.macro compute_rgb r1 g1 b1 r2 g2 b2 add v20.8h, v26.8h, v20.8h // Y1 + R1 add v21.8h, v27.8h, v21.8h // Y2 + R2 add v22.8h, v26.8h, v22.8h // Y1 + G1 @@ -135,13 +165,18 @@ sqrshrun \g2, v23.8h, #1 // clip_u8((Y2 + G1) >> 1) sqrshrun \b1, v24.8h, #1 // clip_u8((Y1 + B1) >> 1) sqrshrun \b2, v25.8h, #1 // clip_u8((Y2 + B1) >> 1) +.endm + +.macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2 + compute_rgb \r1, \g1, \b1, \r2, \g2, \b2 movi \a1, #255 movi \a2, #255 .endm .macro declare_func ifmt ofmt function ff_\ifmt\()_to_\ofmt\()_neon, export=1 - load_args_\ifmt + load_args_\ifmt \ofmt + mov w9, w1 1: mov w8, w0 // w8 = width @@ -185,11 +220,22 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1 compute_rgba v6.8b,v5.8b,v4.8b,v7.8b, v18.8b,v17.8b,v16.8b,v19.8b .endif +.ifc \ofmt,gbrp + compute_rgb v18.8b,v4.8b,v6.8b, v19.8b,v5.8b,v7.8b + st1 { v4.8b, v5.8b }, [x2], #16 + st1 { v6.8b, v7.8b }, [x10], #16 + st1 { v18.8b, v19.8b }, [x15], #16 +.else st4 { v4.8b, v5.8b, v6.8b, v7.8b}, [x2], #32 st4 {v16.8b,v17.8b,v18.8b,v19.8b}, [x2], #32 +.endif subs w8, w8, #16 // width -= 16 b.gt 2b add x2, x2, w3, sxtw // dst += padding +.ifc \ofmt,gbrp + add x10, x10, w12, sxtw // dst1 += padding1 + add x15, x15, w16, sxtw // dst2 += padding2 +.endif add x4, x4, w5, sxtw // srcY += paddingY increment_\ifmt subs w1, w1, #1 // height -= 1 @@ -204,6 +250,7 @@ endfunc declare_func \ifmt, rgba declare_func \ifmt, abgr declare_func \ifmt, bgra + declare_func \ifmt, gbrp .endm declare_rgb_funcs nv12