From patchwork Thu Sep 8 03:31:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37753 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp42314pzh; Wed, 7 Sep 2022 20:32:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5R8J8TaZtI/LwT7q51RFq6CEeqlzrlG0DasqZsRMqNKBYGhzi0XwgDhWEHIyFVbE85SuLK X-Received: by 2002:a17:907:762b:b0:771:5755:82b7 with SMTP id jy11-20020a170907762b00b00771575582b7mr2495853ejc.684.1662607932774; Wed, 07 Sep 2022 20:32:12 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cb4-20020a170906a44400b00741559ff58dsi998500ejb.787.2022.09.07.20.32.12; Wed, 07 Sep 2022 20:32:12 -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=@outlook.com header.s=selector1 header.b=Q+bf3DB4; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7DBFA68B991; Thu, 8 Sep 2022 06:32:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2066.outbound.protection.outlook.com [40.92.89.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C12B68B74D for ; Thu, 8 Sep 2022 06:32:01 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c+Emh/NkqvgQspPDzP2d/6CuvcDWv54OknDYmulJoIZ78oNxKWVs7gQ31jnW+ElcNXfLnKTXxwbl8Hte8+ccPS3VIBYOTx1Ew5h9Rmsm5Q1+csyALjI9hjPziBCtoK8vqo1XamyYo922BjFnddcUlXaYp5Usa8AwVgQx+dXCZg1kP0LjYrZdeeKio3h1SMioswTk9f+O9NgS+C2yTX9ZmRzc0YTVjmPE//oWJiZDcg47M9d6HviFc/IFD8dQBUNs7up8uezOvNtnLkwI1CCWbuVijPzND3epztbKxxnT5iva5CuhVV/MA06OezpuCZcQdQun9XdhHglK+gKa0M3Kcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8dhgewNX8pUlRjjxEW/1xedDY/qiUj409npBRIvMT/4=; b=G/KNxHbnf9cFtQYuQpdr1O2hJhI/hsy5Q5Kaf22a9D5/pas83edOED7FfO1bgVBqHIUJLnBA2Um+Vuve+H9e9Q0jPUHPBEvNTC8WkDVIf747RzktHdsjUMyiAdy4+fNNk2KskoP2l8PgGl19J91gUfaDmo044Lr562WY+KEbqmYf/C94R90DzI61mlzOANiTw2qsi7HPHphYn69EIkauz3YJRWK4XARqimBqs6EIPW6qx/zuQJTHI8p8GSZkOLWcbGnXeNFg+HKbz7B4uoJlB1W1BgGiz89Wm3osaBCNYlqD2GOm6MaXKXbLiUbXgmWYng9JmCE3+wQiVcd6SZ6ZFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8dhgewNX8pUlRjjxEW/1xedDY/qiUj409npBRIvMT/4=; b=Q+bf3DB4BxoRxxQv//Opm/HZOxowqHmKFfk7UMhEBTJQaGbJ06X9f7SyjBuuDf+50UOAkz6uDt7iIUCZZdUbmuaPlcCDkRrBPlcMJURY404DmsqT2MFCfvUM/PLEVaL4VoFxD2hfO2vjlHaCK2E7sMaKQ92nc32JGDy57VX2lO7AHkaGASVCNmuyRl+RbILIhZAiEUt8T2ab6ON2m0tRT3L4v+Bwdr4wnT9ImrrkJOxWNq8kM6hWJTue+IOjNVacYrHhdy0MsH5+OVSW2qCswEKVGwipp/rUijx4H0r5YojBF6Cc0T4DAlfqNnX3yDjV0HHsjzc1QZCZWN6R/eZyRA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0755.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.15; Thu, 8 Sep 2022 03:31:59 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab%8]) with mapi id 15.20.5588.018; Thu, 8 Sep 2022 03:31:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 8 Sep 2022 05:31:49 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [Wf1BILBZuKvORqp6T5/oyLLyUrfWwIqREzNU/QXrAyc=] X-ClientProxiedBy: ZR0P278CA0026.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1c::13) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220908033149.2505176-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5fe91e62-8763-4db3-f06e-08da914aafe1 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmp16suNY6DpRD31ZauPJnPpaqxef3ywspjSx3XylKcvs6LR9LBJ4JOiqhzv9w20lsWg3l3BhqWfQhUzPk9PRYTPc+QgJQ4zaX55dLLilXEs0k0p7RBFwviihRJ80muECtronnDhM2XqcyAtQrxlSf03balSTOQsRira3EcLBSqplnIeWnUlbpdhvBrE5/XtQVRXW2UF10OaNJD+8jDelUkXJEb2sPEnTGUruBrNsIYR9KTICmgmYsPRP0EGFt4K+2uwnCE+XkabcF37gkD9vJbas8iAacaJY5lalC55I86nZvNDlFcOT7RUzFsSrk+tNyIinKh135xST08uaNkj6DbM2wy5zyEig8ouPRkZ1dNYOKxCD+LT4cwrLbsLCY8ogZZ7WSSLshsh2Zmi+hXcxwGq5FDkjIyZoNJc5xq4SMXcyW5PhfIBKOc6UZQGPH9D6/mpkymo5UuoX4pZ2jaK9DyUyVczXLH9+BLFh5VmyRxlwKfLNkwnlXpi/H0xTJUc5LywWD0/uoj0OUJHo+u0XusvknXe9F/GBni0u9gSoKfS+/9gx4mdo8S7w84GuPUz3VosHmITpLgBtqzX2Lj7kreWIRB0DV6RIP9tJPNda6Mxy+L+ZqXVaWwWMUorn2VyhoERL97TgcD+PNhdMkF22fV8QhxLPqblbNs/D5yIRYO1ZRRpLJhzXMLIgBGrVfVTFKqjRNZpHTmWjWjn7c0dZQXWhTZxf8b35TgirVAJjkrr72bvoIpyV8c4QFaGsBCgMyI= X-MS-TrafficTypeDiagnostic: GV2P250MB0755:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /FpOFIKm4aV2YhtGeAaHx0VP15QLI0kT339irQsXGEewObkiHWSJIOSzG+YOnGd3Rvn9vYEnnFKYT/Rzz3HdKW3VX/iJYrAoy0MS968f/DoOegSymbhTbOJc+pmkOvtQeD03RNe7emXMviuVFvpm+k9zzm1GcTTGYBDoxuRVTQ1Q/OTPhgH5MqYwKc37tk0QByOy1fkaZKtE/mLKgvh7JC5+UGWX4skPnSoJTG3c+WZ3x/nCOdVM1ldtq0fZ4f5E6Q+s6te+rLK17u/osYm0goXZHq3rsAmv4O7bpM6tyEp869qbmkxYuk0/NDE4nczXgtne3K0lTThFNPZ3XQL9erNrgH6ALdIRcDFOvbcb2ScY1yVNpx1bDmM7PjAZyd023EiwX6i5JjnfSlwpcZ4oSWW9OArostmDR9hlb7G8sDkbsvwXZDjxhurFj6hN0TL3krZWeQLj0CeCzQAxDOyR8eCDqaYuz+yqdTePKJjJ5HE44kE5Kgv/0o+z1GGpZ65x4phJCY4SnDzglEFkFQJ9ZlYzj8qs30V3zB7XOwhWsQKt2dbYclPSFy4EHm4412QxhLdj6z5l7MbNqiwM+EDMcV/5RbFoUBfzlGUDz0K8gQa5tHhxYNhc9FKZIjesaUuqI18DlMJjlY9kXBo82/Nnag== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ElDXU0P444B5tD6HwvBDpmWtvUpLfxRzpoCSV8QdY6vOmxepLwFcQWunoSLvu8gP1v9Jo6E4LX2wdffYZVwN0qf63MIhOd/5C2iAAc10OnrnFpQPbuKS8boGQ52DVY3wOCl8EZEnvT7YXSctBvjojCx4Dyt3IizP8E5oQBQcZ4KzpZoX66t/do5ILzUG9tr7PfRbTEVd3X6iVftNMs8n760BIAj6lckQ+jETdJYgjQTs4DjK0hVH/ZxNJUToBieYv25I/qGRNsXQK/fmvxmT280wOqdmKzV/myXwOeBc8wrVM04gEMgP5SVawvXKQWIr5WdSe5lMTuHTjo6K/yWbf5k58Lmz30CT2cUVVZNpvJVZUcpmu4iAcdSVM7sJiKNjYbiigLqegnRQU3eyryrudY3lEa4vJstIBhyp02i+35Qcxw7OjO5OHkJQBg2LrJOITf0vv0OU/mLA8c6KICyy+NRYnu+AcO1yMY9b/3oskyMGD8pJa/8vQEAA55W8M7nOIET6jfP9DX3q94gTSuSg+Y+EAAJK2cxKD+kp34Aj72au8yQ7FlUPFDCW8zNsx6tFBzVu0FWKv9mDQeVKmqsCqXJMeMK90jNh2uSbO9F+xlePTEj6WTuK1SfE1937ibIsknqhSKWt55rMUwj+FzJFcENCY2JtcAG/4GlgAN2CqfL/ZKUtb72IZ0/HeLLAblkpkyi7zslDNhY/su1XXy1NErqci3q1NAmsXR2jPyXjP87cT8hPKSNqPkzp5SVIK77tIhMOTlku5LUbEuYsporpuQ5MeJtgbQx+4qPFULqvo1g9+NLQnivyH4sC4tj05g1v92KRErgNKskFHwMcaL8jrS0vxkXyIYFqZwPDspqRF9QesRFMO6/5nL7I/zvKYAP6nD4JjVqaddRVnas3wwq+5E4W3VJaFTt7Bn0NndL6q4E2mIUO//igO8f/19PFb9E0+tnPPnmKWWVLDiHOwGF+eYevnPS/lMb/w8+Io4qSnY8sgosShTncOyCpjgi3LD55AK3le2vlJUTlM0ryHuyGIMW8tbF+035dkuvv6TA6LgyPfi8oTfhLYt9nsGVLke+dG5bFub14rXYkkmwqstPyPEPRUqVdk1RWLxXrYQj+Xad8ZyglhZCayGQPc+LEp2DXEiAw/+4kWkW436+TDHBhvtINKEwF6fBcLl7vZfxYTjIKrQtciemVLGWTJHcGhvDvaQRKAkOGJ0XiCKkSEeaCOfMpOTP+U6xYfEcr4MNTGA32W3qc07jjbw/BJALG1HUzsbz0IyDSXQNGH70Lezl9hYBx2TqVrZ5911fJx2NVquiTFKFjbBYfmigEDvt5tEDD X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fe91e62-8763-4db3-f06e-08da914aafe1 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 03:31:59.3273 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2P250MB0755 Subject: [FFmpeg-devel] [PATCH 3/3] swscale/output: Don't call av_pix_fmt_desc_get() in a loop 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: C8WFR6yDpy/I Up until now, libswscale/output.c used a macro to write an output pixel which involved a call to av_pix_fmt_desc_get() to find out whether the input pixel format is BE or LE despite this being known at compile-time (there are templates per pixfmt). Even worse, these calls are made in a loop, so that e.g. there are eight calls to av_pix_fmt_desc_get() for every pixel processed in yuv2rgba64_X_c_template() for 64bit RGB formats. This commit modifies these macros to ensure that isBE() is evaluated at compile-time. This saved 41184B of .text for me (GCC 11.2, -O3). Signed-off-by: Andreas Rheinhardt --- This must be the lowest-hanging fruit in the whole codebase. Two other question: Why do all these functions in swscale_internal.h take an enum AVPixelFormat instead of accepting an AVPixFmtDescriptor? And would making av_pix_fmt_desc_get() av_const be beneficial? libswscale/output.c | 101 +++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index 40a4476c6d..590334eb57 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -919,7 +919,7 @@ YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) #define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B) #define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R) #define output_pixel(pos, val) \ - if (isBE(target)) { \ + if (is_be) { \ AV_WB16(pos, val); \ } else { \ AV_WL16(pos, val); \ @@ -931,7 +931,8 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, const int16_t *chrFilter, const int32_t **unused_chrUSrc, const int32_t **unused_chrVSrc, int unused_chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, - int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) + int y, enum AVPixelFormat target, + int unused_hasAlpha, int unused_eightbytes, int is_be) { int hasAlpha = !!alpSrc; int i; @@ -968,7 +969,8 @@ yuv2ya16_2_c_template(SwsContext *c, const int32_t *buf[2], const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int unused_uvalpha, int y, - enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) + enum AVPixelFormat target, int unused_hasAlpha, + int unused_eightbytes, int is_be) { int hasAlpha = abuf && abuf[0] && abuf[1]; const int32_t *buf0 = buf[0], *buf1 = buf[1], @@ -999,7 +1001,8 @@ static av_always_inline void yuv2ya16_1_c_template(SwsContext *c, const int32_t *buf0, const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, - int unused_uvalpha, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) + int unused_uvalpha, int y, enum AVPixelFormat target, + int unused_hasAlpha, int unused_eightbytes, int is_be) { int hasAlpha = !!abuf0; int i; @@ -1027,7 +1030,8 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, - int y, enum AVPixelFormat target, int hasAlpha, int eightbytes) + int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, + int is_be) { int i; int A1 = 0xffff<<14, A2 = 0xffff<<14; @@ -1108,7 +1112,8 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, - enum AVPixelFormat target, int hasAlpha, int eightbytes) + enum AVPixelFormat target, int hasAlpha, int eightbytes, + int is_be) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], @@ -1172,7 +1177,8 @@ static av_always_inline void yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, - int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes) + int uvalpha, int y, enum AVPixelFormat target, + int hasAlpha, int eightbytes, int is_be) { const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; @@ -1277,7 +1283,8 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, - int y, enum AVPixelFormat target, int hasAlpha, int eightbytes) + int y, enum AVPixelFormat target, int hasAlpha, + int eightbytes, int is_be) { int i; int A = 0xffff<<14; @@ -1340,7 +1347,8 @@ yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, - enum AVPixelFormat target, int hasAlpha, int eightbytes) + enum AVPixelFormat target, int hasAlpha, int eightbytes, + int is_be) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], @@ -1391,7 +1399,8 @@ static av_always_inline void yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, - int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes) + int uvalpha, int y, enum AVPixelFormat target, + int hasAlpha, int eightbytes, int is_be) { const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; @@ -1468,7 +1477,11 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0, #undef r_b #undef b_r -#define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \ +#define IS_BE_LE 0 +#define IS_BE_BE 1 +#define IS_BE(BE_LE) IS_BE_ ## BE_LE + +#define YUV2PACKED16WRAPPER_0(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \ static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ const int16_t **_lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **_chrUSrc, \ @@ -1483,7 +1496,7 @@ static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ uint16_t *dest = (uint16_t *) _dest; \ name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ - alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \ + alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \ } \ \ static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ @@ -1497,7 +1510,7 @@ static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ **abuf = (const int32_t **) _abuf; \ uint16_t *dest = (uint16_t *) _dest; \ name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ - dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \ + dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ } \ \ static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ @@ -1511,36 +1524,38 @@ static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ *abuf0 = (const int32_t *) _abuf0; \ uint16_t *dest = (uint16_t *) _dest; \ name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ - dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \ -} - -YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48be, AV_PIX_FMT_RGB48BE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48le, AV_PIX_FMT_RGB48LE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48be, AV_PIX_FMT_BGR48BE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48le, AV_PIX_FMT_BGR48LE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64BE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64LE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64BE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64LE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64BE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64LE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64BE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64LE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16BE, 1, 0) -YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16LE, 1, 0) - -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48BE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48LE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48be_full, AV_PIX_FMT_BGR48BE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48le_full, AV_PIX_FMT_BGR48LE, 0, 0) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64be_full, AV_PIX_FMT_RGBA64BE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64le_full, AV_PIX_FMT_RGBA64LE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64be_full, AV_PIX_FMT_RGBA64BE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64le_full, AV_PIX_FMT_RGBA64LE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, AV_PIX_FMT_BGRA64BE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64LE, 1, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64BE, 0, 1) -YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64LE, 0, 1) + dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ +} +#define YUV2PACKED16WRAPPER(name, base, ext, fmt, endianness, hasAlpha, eightbytes) \ + YUV2PACKED16WRAPPER_0(name, base, ext, fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes) + +YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48be, AV_PIX_FMT_RGB48, BE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48le, AV_PIX_FMT_RGB48, LE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48be, AV_PIX_FMT_BGR48, BE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48le, AV_PIX_FMT_BGR48, LE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64, BE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64, LE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64, BE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64, LE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64, BE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64, LE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64, BE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0) +YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0) + +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48, BE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48, LE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48be_full, AV_PIX_FMT_BGR48, BE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48le_full, AV_PIX_FMT_BGR48, LE, 0, 0) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64be_full, AV_PIX_FMT_RGBA64, BE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64le_full, AV_PIX_FMT_RGBA64, LE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64be_full, AV_PIX_FMT_RGBA64, BE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64le_full, AV_PIX_FMT_RGBA64, LE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, AV_PIX_FMT_BGRA64, BE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64, LE, 1, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64, BE, 0, 1) +YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 0, 1) /* * Write out 2 RGB pixels in the target pixel format. This function takes a