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)