From patchwork Tue Dec 13 02:42:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 39688 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp791651pzb; Mon, 12 Dec 2022 18:42:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf79NrrEB2AJvmcwZZ05WveVRaazyRCmghjgBxt9qLh98aHAjiKtkSExYr/063F61EMqYwPR X-Received: by 2002:a17:906:8d08:b0:7c1:3a0:c0a9 with SMTP id rv8-20020a1709068d0800b007c103a0c0a9mr9987231ejc.12.1670899363797; Mon, 12 Dec 2022 18:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670899363; cv=none; d=google.com; s=arc-20160816; b=lHILev+peBlhFqK8cLUtcxGkyqKoHa8mVrILnJqCZbOOT6nzjNWHacYmuYvzuTBWpT c4WoZCnK5ebxgrOv85QvhC/PWxjq7ikj2vtZk5/F9fl81DRGwVa5lenC5PRJnUj0LhXm L4jqmYQM5BZKcVD1suz8VZoU4cFL7f8hvm6eBZ4cFxKtKwaM5vrBRtMSadbd8LX6DKoU oiNFBPvoC+o34uPYnG7bjRlFu6d4Q/OfNfvhvbjXDGu4uE2YJxshx0k5s3aOB/y2GSz2 AxtIgY5m+50EMCo2fy1efnJPZp3jY532QxYYnf3WMRQA3ZV7oC6cZ0fQuYZ3qOvzrgvB XW+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=NHO67kMIzKrrvnmY+0js9349Y8OUSLlpI3dVoQO/VDQ=; b=E7i+XuDoEpdna1Lne7WW9c8Vwzc5ImYYFCVFiBr5Dzri5Z/kt/YBJQS+DoVKxHKqkd ZVPeTI/i4hiRW2ML+8KNU58pnEzfX/jVVlmu+Gjkk4x86i9mJOoPW1Py3i/hRLm3Tnnk uxX9H7Q3YGcyJWXmc7nj4Sm5NrhVGVo896C+vBvqF+6i4vWbk1RZHIkIIrP9Ny+dIAFE iRSzgGBCAC7c1hGozPYZBy40s0p+LwPj8JBbUdeFutManjIOJ05zZOutsYF2SqGeoxcq D417mYmGOtvXk8TfD0xBiBZ/l6vyTN6qfxrOs+2kyN3z6FcV5QvZbhrS0QAB0qtWpK6S xSxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="l9XMl/wu"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p10-20020a170906b20a00b00787ad97302asi5898088ejz.863.2022.12.12.18.42.43; Mon, 12 Dec 2022 18:42:43 -0800 (PST) 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=20210112 header.b="l9XMl/wu"; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6A2B968BDBF; Tue, 13 Dec 2022 04:42:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 93E8B68BD2D for ; Tue, 13 Dec 2022 04:42:32 +0200 (EET) Received: by mail-pj1-f47.google.com with SMTP id js9so1909369pjb.2 for ; Mon, 12 Dec 2022 18:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ob+6xhdW7z1+5/6V7r9zjkwkLKkb+B3/htRMwu6h/aE=; b=l9XMl/wuckb0XGJmrvIeZXeLpKPhoJcuHnPu3ByItPhBLTy8jHpqOR3hZPM/TNTf5p JgZh6F+8yZOTzh3IHwcm6wvYYDnmZgrQLcaLb/FTOTIQipiteSoeiD3s7vwn7etsQacG RTzDfis+hNBYqWf32mpXyP3NLBdz4rvc+fKgyRtG03ADJaB0R0mc9aTqLzrk2LvgprNf X1GqVoeYxewegXoVGmPReeBHIyIamV3FCO90oCMvmyNEue5P4s71Vf1YH+OvYq2qg5PE a/gW9hQYGgtV4qvdXHA4YY+DaZoGXMJWqL5HUNmxG8mR91ATyvz0gz2CUxTwQxpzVQo8 4vGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ob+6xhdW7z1+5/6V7r9zjkwkLKkb+B3/htRMwu6h/aE=; b=47hkoCyRnnZlyD+DqFckgy1UAE13L/drT6TaWlvxro1B673pwenEydWGILHjFj2gih oGUzuMZj1VK7Y4EOOaJlLfkJYiR7zj3I9Ox+RND+iU03lY1iN34rzi6vh5VkLiNL0hcv 2waN/ZO4Edhs5jEXa0F+JrbyL5xWCRQwMXVSmAIFbHmTZXiO2fx0cXuoAeiOvIycM4Km zTMPklS2LAPcXFDbqvY+jRUgWxi/pXfgxP471h0zvsxCfmKWvQ/iDZYVweCQ6XwIrSSN B9KMCu5lIiGhZg+ggH3qPNOGywMFULuh2ACoCj6bmJbZ1EnzH85KA0vta+vJG6bQm+oH 3BnA== X-Gm-Message-State: ANoB5pk1kBZXUQ8au5rJ1tVKw0+3SrCI/AgdWqiP1Xfqtkl6WRdsSIly Moj96PxYat8FhiX16GXkfThCV3YgArM= X-Received: by 2002:a17:902:9691:b0:18f:a27c:fe with SMTP id n17-20020a170902969100b0018fa27c00femr5320178plp.55.1670899349743; Mon, 12 Dec 2022 18:42:29 -0800 (PST) Received: from localhost.localdomain (S0106bc4dfba470f3.vc.shawcable.net. [174.7.244.175]) by smtp.gmail.com with ESMTPSA id ju2-20020a170903428200b00186ae20e8dcsm7060105plb.271.2022.12.12.18.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 18:42:29 -0800 (PST) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Dec 2022 18:42:13 -0800 Message-Id: <20221213024216.259-1-mindmark@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 1/4] avcodec/bswapdsp: remove unused cextern 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: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NBA9u4O8RVWS From: Mark Reid --- libavcodec/x86/bswapdsp.asm | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/x86/bswapdsp.asm b/libavcodec/x86/bswapdsp.asm index 31c6c48a21..2aa235e13c 100644 --- a/libavcodec/x86/bswapdsp.asm +++ b/libavcodec/x86/bswapdsp.asm @@ -26,8 +26,6 @@ SECTION_RODATA pb_bswap32: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 -cextern pb_80 - SECTION .text ; %1 = aligned/unaligned From patchwork Tue Dec 13 02:42:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 39689 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp791712pzb; Mon, 12 Dec 2022 18:42:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5V5dWsJbN7uzZfAfbXB+/jEYOrngZPDlGbOoAmSqRjkDwfZhdqBm5omaZl8Qn9Tb+AtCg6 X-Received: by 2002:aa7:cd8d:0:b0:45c:835b:ac6a with SMTP id x13-20020aa7cd8d000000b0045c835bac6amr16282993edv.37.1670899373260; Mon, 12 Dec 2022 18:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670899373; cv=none; d=google.com; s=arc-20160816; b=iqxvIMfV8wistiuRHpaOv/Yo9xQ3SvoCJS9PSHNRiH26cdBmGVHNGz6TqjEaPoDToh obrN9xTDn0frCVcdn718q2jcMWbRadGxrQYB/NvQYv0ubsWC65o02QvQhRnbQnwZRIXr 51WalqYbFLHbsxuMQJ0BdTSUQaFQyL7CCLRF+/Dl1fQvMcG1PGYZLJfYJFLskQvKGwbR tb9lPgCIJ0IeXyxDom5Qrx2ggL2NuBS8KoXWua17ovWfJ/D++RSfNeKWv7GgMO0vCUAs JpPNr0Rxn5D9V4ieYpgWge8VhnodRDN5/SFBIl5apyeok8gIygU1qK+JcvS3YE6JO2Yt HlBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=ulmo2Rg1bFZtCjHotdVduuHVPV3CcAaG6pMKdCvQ5z0=; b=X7kMRuqkZc1zejg+TcnJA17pXTwC+PhgTS1mzg0dvroaCPwwYplQPgPInOrHagu+rc r6eKz2xQwXClGeS2hE6ch5oS2khIlk3wUPSXUz2Zr+5JGRPC8A5hcIndMtFpmTlcpHfB fbw+TeNSFGWcHrBBkJACQ3Xn1gmCHuUuOYBLtKbeGyWGUwRnPIAy596p2vtt0wFSKHNs B+Qc3XnjAStEWCmbVXV0A4hpuVzOVzFf/vC8Zzjlnb0XRttEeYJq7wby+f5j+wa1bLxc ++pPt0RLmLvU4TjywrdfB+9hjwPEKXGyiJQWgXFqIdLzMCZr/cmUO3V14evKBIH/PztE 54ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="hzf+h/OX"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u9-20020a50d509000000b0045c26f0050esi7936803edi.238.2022.12.12.18.42.52; Mon, 12 Dec 2022 18:42:53 -0800 (PST) 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=20210112 header.b="hzf+h/OX"; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C1BFE68BDF2; Tue, 13 Dec 2022 04:42:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BF05968BD2D for ; Tue, 13 Dec 2022 04:42:32 +0200 (EET) Received: by mail-pj1-f41.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so2050059pjj.4 for ; Mon, 12 Dec 2022 18:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wB8k2a8Qk1bKvfsaTFD9kWi1o8g2Yee7DOaVH0Bph9w=; b=hzf+h/OXbiQ8VnSLDZLYKbGjdWRCbnX1lHHoGD/sGxjRp+6Na3e/QuPqm+TxpWydna yep+BhFdFSYRBgCqBWCtzXDDGdk4g8isyhgp76TX8NqE+wSGo8II7Q3gbeqqB6LipHkv RwuEGQamxBt6NpNAlP6QX+PjSukk38QLUqy1uG7qqt3we2STvsiZw30BSQugwbdKQLwB WfsKaAn7spuJF1KoxL0Xp3+yNwRaYMnDsbTuUA+3kw9mizvBOg9zJUY5sONkJtGN3Y6O DlAsG5PVUXnmWv9nES5RzYVBvq/GS6DklfykrOkueZlz3W3zymSQbInZNLZSsOs9yZmU jn7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wB8k2a8Qk1bKvfsaTFD9kWi1o8g2Yee7DOaVH0Bph9w=; b=7h+zGtBVCyIcPlqav+2GeVh8WKhGuKniR6WXNPWbgQrGxggbSsHuVe0ev3bJsi3Apm 4IPNrLDP/d6jO2TEHQL+AQfBAh4LKmS/Vsqi6LBLjEyAHsSMAhBDpWEWcRaBjPOUCAxl Ylp7+wLGHyl3LXseZ4z6OHpwbyuEqCSK/fhPAhkZke/I76OGzCpI25Y2J1OsS5B2bqEM IGoheGdwCegbLoh8Y1zZuO9PDYBECIJUt4HPMYG2hE9R6szlX8boeqaptjhPKSePFCX7 tfzL7Zsg61NKvAy6uyLJLBX6Ro6NQqpVegvwU4gwZC8T2LP67VAcGNY5GEGR5M5oLwTg 3fRw== X-Gm-Message-State: ANoB5plAHZRbs2BNMLcT4Z850zFF6zF4w10q2aoJ9z+j8iSgMlKAX/sz bEi6A5xuvgjVR1eYyTiZ0BySANtl+IA= X-Received: by 2002:a17:902:ce0e:b0:186:8bb2:de4b with SMTP id k14-20020a170902ce0e00b001868bb2de4bmr19647991plg.43.1670899350690; Mon, 12 Dec 2022 18:42:30 -0800 (PST) Received: from localhost.localdomain (S0106bc4dfba470f3.vc.shawcable.net. [174.7.244.175]) by smtp.gmail.com with ESMTPSA id ju2-20020a170903428200b00186ae20e8dcsm7060105plb.271.2022.12.12.18.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 18:42:30 -0800 (PST) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Dec 2022 18:42:14 -0800 Message-Id: <20221213024216.259-2-mindmark@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20221213024216.259-1-mindmark@gmail.com> References: <20221213024216.259-1-mindmark@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/4] avcodec/bswapdsp: rename bswap_buf to bswap_buf32 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: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WML07Uma2LvQ From: Mark Reid --- libavcodec/4xm.c | 8 ++++---- libavcodec/alsdec.c | 6 +++--- libavcodec/apedec.c | 4 ++-- libavcodec/asvdec.c | 4 ++-- libavcodec/asvenc.c | 4 ++-- libavcodec/bswapdsp.c | 8 ++++---- libavcodec/bswapdsp.h | 2 +- libavcodec/eatqi.c | 4 ++-- libavcodec/fraps.c | 4 ++-- libavcodec/huffyuvdec.c | 8 ++++---- libavcodec/huffyuvenc.c | 2 +- libavcodec/imm4.c | 6 +++--- libavcodec/mimic.c | 6 +++--- libavcodec/motionpixels.c | 4 ++-- libavcodec/mpc7.c | 4 ++-- libavcodec/rawdec.c | 2 +- libavcodec/riscv/bswapdsp_init.c | 4 ++-- libavcodec/truemotion2.c | 4 ++-- libavcodec/truespeech.c | 2 +- libavcodec/utvideodec.c | 12 ++++++------ libavcodec/utvideoenc.c | 6 +++--- libavcodec/x86/bswapdsp.asm | 2 +- libavcodec/x86/bswapdsp_init.c | 6 +++--- libavcodec/ylc.c | 12 ++++++------ tests/checkasm/bswapdsp.c | 2 +- 25 files changed, 63 insertions(+), 63 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 5636fdef2d..a26b2f9004 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -469,8 +469,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) bitstream_size); if (!f->bitstream_buffer) return AVERROR(ENOMEM); - f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra), - bitstream_size / 4); + f->bbdsp.bswap32_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra), + bitstream_size / 4); init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size); wordstream_offset = extra + bitstream_size; @@ -813,8 +813,8 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length) prestream_size); if (!f->bitstream_buffer) return AVERROR(ENOMEM); - f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) prestream, - prestream_size / 4); + f->bbdsp.bswap32_buf(f->bitstream_buffer, (const uint32_t *) prestream, + prestream_size / 4); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size); f->last_dc = 0 * 128 * 8 * 8; diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 4605b2248f..6f401cf890 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1899,9 +1899,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, sample++) *dest++ = av_bswap16(src[sample]); } else { - ctx->bdsp.bswap_buf((uint32_t *) ctx->crc_buffer, - (uint32_t *) frame->data[0], - ctx->cur_frame_length * channels); + ctx->bdsp.bswap32_buf((uint32_t *) ctx->crc_buffer, + (uint32_t *) frame->data[0], + ctx->cur_frame_length * channels); } crc_source = ctx->crc_buffer; } else { diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index c08d13d6c2..b7856c82e5 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1499,8 +1499,8 @@ static int ape_decode_frame(AVCodecContext *avctx, AVFrame *frame, av_fast_padded_malloc(&s->data, &s->data_size, buf_size); if (!s->data) return AVERROR(ENOMEM); - s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf, - buf_size >> 2); + s->bdsp.bswap32_buf((uint32_t *) s->data, (const uint32_t *) buf, + buf_size >> 2); memset(s->data + (buf_size & ~3), 0, buf_size & 3); s->ptr = s->data; s->data_end = s->data + buf_size; diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 699aab9f8f..25dab7473f 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -253,8 +253,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (!a->bitstream_buffer) return AVERROR(ENOMEM); - c->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer, - (const uint32_t *) buf, buf_size / 4); + c->bbdsp.bswap32_buf((uint32_t *) a->bitstream_buffer, + (const uint32_t *) buf, buf_size / 4); ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size); } else { ret = init_get_bits8_le(&a->gb, buf, buf_size); diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 9da7cbb986..2bf67d686c 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -309,8 +309,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, size = (put_bytes_output(&a->pb) + 3) / 4; if (avctx->codec_id == AV_CODEC_ID_ASV1) { - c->bbdsp.bswap_buf((uint32_t *) pkt->data, - (uint32_t *) pkt->data, size); + c->bbdsp.bswap32_buf((uint32_t *) pkt->data, + (uint32_t *) pkt->data, size); } pkt->size = size * 4; diff --git a/libavcodec/bswapdsp.c b/libavcodec/bswapdsp.c index f0ea2b55c5..432f53efbf 100644 --- a/libavcodec/bswapdsp.c +++ b/libavcodec/bswapdsp.c @@ -22,11 +22,11 @@ #include "libavutil/bswap.h" #include "bswapdsp.h" -static void bswap_buf(uint32_t *dst, const uint32_t *src, int w) +static void bswap32_buf(uint32_t *dst, const uint32_t *src, int len) { int i; - for (i = 0; i + 8 <= w; i += 8) { + for (i = 0; i + 8 <= len; i += 8) { dst[i + 0] = av_bswap32(src[i + 0]); dst[i + 1] = av_bswap32(src[i + 1]); dst[i + 2] = av_bswap32(src[i + 2]); @@ -36,7 +36,7 @@ static void bswap_buf(uint32_t *dst, const uint32_t *src, int w) dst[i + 6] = av_bswap32(src[i + 6]); dst[i + 7] = av_bswap32(src[i + 7]); } - for (; i < w; i++) + for (; i < len; i++) dst[i + 0] = av_bswap32(src[i + 0]); } @@ -48,7 +48,7 @@ static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len) av_cold void ff_bswapdsp_init(BswapDSPContext *c) { - c->bswap_buf = bswap_buf; + c->bswap32_buf = bswap32_buf; c->bswap16_buf = bswap16_buf; #if ARCH_RISCV diff --git a/libavcodec/bswapdsp.h b/libavcodec/bswapdsp.h index 6f4db66115..10519cfd2e 100644 --- a/libavcodec/bswapdsp.h +++ b/libavcodec/bswapdsp.h @@ -22,7 +22,7 @@ #include typedef struct BswapDSPContext { - void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w); + void (*bswap32_buf)(uint32_t *dst, const uint32_t *src, int len); void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); } BswapDSPContext; diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index e4f12b3db2..ec4bf02720 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -148,8 +148,8 @@ static int tqi_decode_frame(AVCodecContext *avctx, AVFrame *frame, buf_end - buf); if (!t->bitstream_buf) return AVERROR(ENOMEM); - t->bsdsp.bswap_buf(t->bitstream_buf, (const uint32_t *) buf, - (buf_end - buf) / 4); + t->bsdsp.bswap32_buf(t->bitstream_buf, (const uint32_t *) buf, + (buf_end - buf) / 4); init_get_bits(&t->gb, t->bitstream_buf, 8 * (buf_end - buf)); t->last_dc[0] = diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 4c4c46b602..1a0f52ebe6 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -106,8 +106,8 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, /* we have built Huffman table and are ready to decode plane */ /* convert bits so they may be used by standard bitreader */ - s->bdsp.bswap_buf((uint32_t *) s->tmpbuf, - (const uint32_t *) src, size >> 2); + s->bdsp.bswap32_buf((uint32_t *) s->tmpbuf, + (const uint32_t *) src, size >> 2); if ((ret = init_get_bits8(&gb, s->tmpbuf, size)) < 0) return ret; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 7d3515cc88..f5793d2eec 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -1239,8 +1239,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (!s->bitstream_buffer) return AVERROR(ENOMEM); - s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer, - (const uint32_t *) buf, buf_size / 4); + s->bdsp.bswap32_buf((uint32_t *) s->bitstream_buffer, + (const uint32_t *) buf, buf_size / 4); if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) return ret; @@ -1282,8 +1282,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, return AVERROR_INVALIDDATA; y_offset = height - (slice + 1) * slice_height; - s->bdsp.bswap_buf((uint32_t *)s->bitstream_buffer, - (const uint32_t *)(buf + slice_offset), slice_size / 4); + s->bdsp.bswap32_buf((uint32_t *)s->bitstream_buffer, + (const uint32_t *)(buf + slice_offset), slice_size / 4); } else { y_offset = 0; slice_offset = 0; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index db274e37ad..b26f2a8fd6 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -1018,7 +1018,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, avctx->stats_out[0] = '\0'; if (!(s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)) { flush_put_bits(&s->pb); - s->bdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size); + s->bdsp.bswap32_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size); } s->picture_number++; diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c index ccec5dff43..1372afacfd 100644 --- a/libavcodec/imm4.c +++ b/libavcodec/imm4.c @@ -368,9 +368,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, if (!s->bitstream) return AVERROR(ENOMEM); - s->bdsp.bswap_buf((uint32_t *)s->bitstream, - (uint32_t *)avpkt->data, - (avpkt->size + 3) >> 2); + s->bdsp.bswap32_buf((uint32_t *)s->bitstream, + (uint32_t *)avpkt->data, + (avpkt->size + 3) >> 2); if ((ret = init_get_bits8(gb, s->bitstream, FFALIGN(avpkt->size, 4))) < 0) return ret; diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 891471b30e..6cc46b6c38 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -411,9 +411,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, AVFrame *rframe, if (!ctx->swap_buf) return AVERROR(ENOMEM); - ctx->bbdsp.bswap_buf(ctx->swap_buf, - (const uint32_t *) (buf + MIMIC_HEADER_SIZE), - swap_buf_size >> 2); + ctx->bbdsp.bswap32_buf(ctx->swap_buf, + (const uint32_t *) (buf + MIMIC_HEADER_SIZE), + swap_buf_size >> 2); init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3); res = decode(ctx, quality, num_coeffs, !is_pframe); diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 4141c5a495..9199c0eaa4 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -294,8 +294,8 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe, av_fast_padded_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size); if (!mp->bswapbuf) return AVERROR(ENOMEM); - mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf, - buf_size / 4); + mp->bdsp.bswap32_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf, + buf_size / 4); if (buf_size & 3) memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); init_get_bits(&gb, mp->bswapbuf, buf_size * 8); diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index d2745366c2..cb15de88e1 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -93,7 +93,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) av_lfg_init(&c->rnd, 0xDEADBEEF); ff_bswapdsp_init(&c->bdsp); ff_mpadsp_init(&c->mpadsp); - c->bdsp.bswap_buf((uint32_t *) buf, (const uint32_t *) avctx->extradata, 4); + c->bdsp.bswap32_buf((uint32_t *) buf, (const uint32_t *) avctx->extradata, 4); init_get_bits(&gb, buf, 128); c->IS = get_bits1(&gb); @@ -211,7 +211,7 @@ static int mpc7_decode_frame(AVCodecContext *avctx, AVFrame *frame, av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size); if (!c->bits) return AVERROR(ENOMEM); - c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf, + c->bdsp.bswap32_buf((uint32_t *) c->bits, (const uint32_t *) buf, buf_size >> 2); if ((ret = init_get_bits8(&gb, c->bits, buf_size)) < 0) return ret; diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index c20c317fed..e15e72eb14 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -321,7 +321,7 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame, if (swap == 16) context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); else if (swap == 32) - context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); + context->bbdsp.bswap32_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); else return AVERROR_INVALIDDATA; buf = context->bitstream_buf; diff --git a/libavcodec/riscv/bswapdsp_init.c b/libavcodec/riscv/bswapdsp_init.c index abe84ec1f7..4d229c53e3 100644 --- a/libavcodec/riscv/bswapdsp_init.c +++ b/libavcodec/riscv/bswapdsp_init.c @@ -35,11 +35,11 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) #if (__riscv_xlen >= 64) if (cpu_flags & AV_CPU_FLAG_RVB_BASIC) - c->bswap_buf = ff_bswap32_buf_rvb; + c->bswap32_buf = ff_bswap32_buf_rvb; #endif #if HAVE_RVV if (cpu_flags & AV_CPU_FLAG_RVV_I32) { - c->bswap_buf = ff_bswap32_buf_rvv; + c->bswap32_buf = ff_bswap32_buf_rvv; c->bswap16_buf = ff_bswap16_buf_rvv; } #endif diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b168b9cda1..772504d65b 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -907,8 +907,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, if ((ret = ff_reget_buffer(avctx, p, 0)) < 0) return ret; - l->bdsp.bswap_buf((uint32_t *) l->buffer, (const uint32_t *) buf, - buf_size >> 2); + l->bdsp.bswap32_buf((uint32_t *) l->buffer, (const uint32_t *) buf, + buf_size >> 2); if ((ret = tm2_read_header(l, l->buffer)) < 0) { return ret; diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 454121cc75..5689db675c 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -82,7 +82,7 @@ static void truespeech_read_frame(TSContext *dec, const uint8_t *input) { GetBitContext gb; - dec->bdsp.bswap_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8); + dec->bdsp.bswap32_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8); init_get_bits(&gb, dec->buffer, 32 * 8); dec->vector[7] = ts_codebook[7][get_bits(&gb, 3)]; diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 83120d1b22..7b943faed8 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -150,9 +150,9 @@ static int decode_plane10(UtvideoContext *c, int plane_no, } memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - c->bdsp.bswap_buf((uint32_t *) c->slice_bits, - (uint32_t *)(src + slice_data_start + c->slices * 4), - (slice_data_end - slice_data_start + 3) >> 2); + c->bdsp.bswap32_buf((uint32_t *) c->slice_bits, + (uint32_t *)(src + slice_data_start + c->slices * 4), + (slice_data_end - slice_data_start + 3) >> 2); init_get_bits(&gb, c->slice_bits, slice_size * 8); prev = 0x200; @@ -311,9 +311,9 @@ static int decode_plane(UtvideoContext *c, int plane_no, } memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - c->bdsp.bswap_buf((uint32_t *) c->slice_bits, - (uint32_t *)(src + slice_data_start + c->slices * 4), - (slice_data_end - slice_data_start + 3) >> 2); + c->bdsp.bswap32_buf((uint32_t *) c->slice_bits, + (uint32_t *)(src + slice_data_start + c->slices * 4), + (slice_data_end - slice_data_start + 3) >> 2); init_get_bits(&gb, c->slice_bits, slice_size * 8); prev = 0x80; diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index d4388da8ba..0cfec16ec3 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -490,9 +490,9 @@ static int encode_plane(AVCodecContext *avctx, const uint8_t *src, slice_len = offset - slice_len; /* Byteswap the written huffman codes */ - c->bdsp.bswap_buf((uint32_t *) c->slice_bits, - (uint32_t *) c->slice_bits, - slice_len >> 2); + c->bdsp.bswap32_buf((uint32_t *) c->slice_bits, + (uint32_t *) c->slice_bits, + slice_len >> 2); /* Write the offset to the stream */ bytestream2_put_le32(pb, offset); diff --git a/libavcodec/x86/bswapdsp.asm b/libavcodec/x86/bswapdsp.asm index 2aa235e13c..4e6918ea5a 100644 --- a/libavcodec/x86/bswapdsp.asm +++ b/libavcodec/x86/bswapdsp.asm @@ -97,7 +97,7 @@ SECTION .text add r0, 16 %endmacro -; void ff_bswap_buf(uint32_t *dst, const uint32_t *src, int w); +; void ff_.bswap32_buf(uint32_t *dst, const uint32_t *src, int w); %macro BSWAP32_BUF 0 %if cpuflag(ssse3)||cpuflag(avx2) cglobal bswap32_buf, 3,4,3 diff --git a/libavcodec/x86/bswapdsp_init.c b/libavcodec/x86/bswapdsp_init.c index 877bab1a2c..b00a3efd2f 100644 --- a/libavcodec/x86/bswapdsp_init.c +++ b/libavcodec/x86/bswapdsp_init.c @@ -32,9 +32,9 @@ av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c) int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE2(cpu_flags)) - c->bswap_buf = ff_bswap32_buf_sse2; + c->bswap32_buf = ff_bswap32_buf_sse2; if (EXTERNAL_SSSE3(cpu_flags)) - c->bswap_buf = ff_bswap32_buf_ssse3; + c->bswap32_buf = ff_bswap32_buf_ssse3; if (EXTERNAL_AVX2_FAST(cpu_flags)) - c->bswap_buf = ff_bswap32_buf_avx2; + c->bswap32_buf = ff_bswap32_buf_avx2; } diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index 29c10f05da..8eace8c2e2 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -311,9 +311,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, memcpy(s->buffer, avpkt->data + toffset, boffset - toffset); memset(s->buffer + boffset - toffset, 0, AV_INPUT_BUFFER_PADDING_SIZE); - s->bdsp.bswap_buf((uint32_t *) s->buffer, - (uint32_t *) s->buffer, - (boffset - toffset + 3) >> 2); + s->bdsp.bswap32_buf((uint32_t *) s->buffer, + (uint32_t *) s->buffer, + (boffset - toffset + 3) >> 2); if ((ret = init_get_bits8(&gb, s->buffer, boffset - toffset)) < 0) return ret; @@ -332,9 +332,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, memcpy(s->buffer, avpkt->data + boffset, avpkt->size - boffset); memset(s->buffer + avpkt->size - boffset, 0, AV_INPUT_BUFFER_PADDING_SIZE); - s->bdsp.bswap_buf((uint32_t *) s->buffer, - (uint32_t *) s->buffer, - (avpkt->size - boffset) >> 2); + s->bdsp.bswap32_buf((uint32_t *) s->buffer, + (uint32_t *) s->buffer, + (avpkt->size - boffset) >> 2); if ((ret = init_get_bits8(&gb, s->buffer, avpkt->size - boffset)) < 0) return ret; diff --git a/tests/checkasm/bswapdsp.c b/tests/checkasm/bswapdsp.c index d789e90de3..8ac6b54ae2 100644 --- a/tests/checkasm/bswapdsp.c +++ b/tests/checkasm/bswapdsp.c @@ -67,7 +67,7 @@ void checkasm_check_bswapdsp(void) ff_bswapdsp_init(&h); - if (check_func(h.bswap_buf, "bswap_buf")) + if (check_func(h.bswap32_buf, "bswap32_buf")) check_bswap(uint32_t); if (check_func(h.bswap16_buf, "bswap16_buf")) From patchwork Tue Dec 13 02:42:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 39690 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp791775pzb; Mon, 12 Dec 2022 18:43:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4dzkuA42kJ6GHEzSNgU9xDv+fgXC5ESsKsL8Re7CsVl3P0L7/k7APTvL7tVfN1phsweJip X-Received: by 2002:a17:907:d082:b0:78d:f455:c397 with SMTP id vc2-20020a170907d08200b0078df455c397mr16235522ejc.61.1670899382040; Mon, 12 Dec 2022 18:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670899382; cv=none; d=google.com; s=arc-20160816; b=x6fx6nWjehusrtW72wN0nWcVHOvOkV0T7COZUkym2gCOkEJmyWRZcxhBGD/XUSmMpv /pri5ZoFhOv7yrvHq8yFiOMWl/KUf7RTeSXKiwhjN7fQ3l7/PjVXqGRTanEI4e/+PtXs SCtgGhYv3JkdaOvsdwjZ/d+rIx7GVlvGEL1uFZXMZh7v8KuYaCNm1Fx13p7lL6ZUlf8Q SAyG1XRk1NsgRGj0mh/7SKP2GXL+gds4Kuv4tSMJry1Ww4gCs8XVoCwlGHXcXTTmEVWm 7CWxwNBIT9/EDeG9dgQ0wTblBb489page9ya/EhZcOdAU+q5yGRMWV0fYN18I71owH6k ifHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=sore+bGC+t4t519RbE+M0IF+QUUuvlCct24p+eT55E8=; b=jxX52A8XraFaH+oHkzDKE7/qcR+Apx2I/U5Ocwh+Jyb/pITZscy8a8AxscRYBhTLQh OMldd9/UYqV/bMIJJyJkDyQ0/4OM70D48IAHJW46n4ufJTkDag57Kp93ku+vw/iufX8T i0UQt+nE6Pon3SM4VTETFdmovDIsEeTXvkHRGrz4TnpTlfhtdSPC3XZL+YZqdYIHPsKE F/pQlWl1m/xS+bEmNBXkrk1VNHILdVvkMjVrWJuQ66XlHWjXxEkD51AZIwC4500xu6ZK 2tGjeHs2VCxlCeYeEAF+PzCR2IiI5DoFzXBbUIa+bgDx7odIJTbm/8Pk/2zfhTHiCC91 hXeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=hK2OmeQZ; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dt11-20020a170907728b00b007c098bddb61si7444228ejc.448.2022.12.12.18.43.01; Mon, 12 Dec 2022 18:43:02 -0800 (PST) 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=20210112 header.b=hK2OmeQZ; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D349568BE0C; Tue, 13 Dec 2022 04:42:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DCFB968B14E for ; Tue, 13 Dec 2022 04:42:33 +0200 (EET) Received: by mail-pl1-f181.google.com with SMTP id 4so8172864plj.3 for ; Mon, 12 Dec 2022 18:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ah5jnSQd0uwlQM476wKU9MSV1W213y5QXsaQdVLTuX0=; b=hK2OmeQZQx38gJ3DIw0B+WK9AuQdpSL8Tdz6PMqwQQQ1EiPX9W6dduIR9mnocVoO4P JP7t1tF0Eg1Fw9VL9pApGT5VUSvqyR39Iy3jYorhRHKSDkScWPppiVeQkjxBZ2pDCWA/ bfPkOzLTI1a1qnFP1LqXAqjlfZG3BatTfkK62urOiMaPq1NZUMBeoPIQukTqjy4FLfO7 CBXJW5VeqgQdTTpX5aAjUrgEXTWDQ2gxEQ7c2hXrliEaQn11oY7PNtB2WOPsByIMla8x KESVC4gN/ZVfA6MbSgRSlLkvBWqalKREZJ+yZxOeic/QsMKL852rOs8n9cBBpZ6sL1w2 bfoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ah5jnSQd0uwlQM476wKU9MSV1W213y5QXsaQdVLTuX0=; b=fmg/4MQRAkuiKhHPF092IJMjxZOA7l6+kW952tWAjCsC1y976MW1pZCo7m/VJkqzzl Zx85zPS0wS7iJMHX78BtQDhRVLVC+4QKKyJwTz5GNyzR9qn5gPxBZegigGqB/pYbKRNR 38Y1wvAbJ7M6zAjUOBEfLVM5ucCZD9uvEReEdWG3pH+1HaONr+94uXGdXdMGAroCVPAG mE4lKxew3q6UKQgaP6IueIJma+lN7GDS0nq9PRrpF+zc96KBev+abSbSq14QJPXj/Ons 3V0d6c0fNcMESFeRbzF5xc/ALJJ4/DPfq92kcbhzJ1NVix+9mf0aQNXR0rTxj5n6VOC2 dn1Q== X-Gm-Message-State: ANoB5pmrEVr8l26CkBBFGRJJEBVuBulP+O0XEhcMQHX2iLXk5pPR5sSe PDrhFTxT7OiUcThOREADQTNe0m7Baos= X-Received: by 2002:a17:902:9b93:b0:189:8c38:cb96 with SMTP id y19-20020a1709029b9300b001898c38cb96mr17725048plp.20.1670899351713; Mon, 12 Dec 2022 18:42:31 -0800 (PST) Received: from localhost.localdomain (S0106bc4dfba470f3.vc.shawcable.net. [174.7.244.175]) by smtp.gmail.com with ESMTPSA id ju2-20020a170903428200b00186ae20e8dcsm7060105plb.271.2022.12.12.18.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 18:42:31 -0800 (PST) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Dec 2022 18:42:15 -0800 Message-Id: <20221213024216.259-3-mindmark@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20221213024216.259-1-mindmark@gmail.com> References: <20221213024216.259-1-mindmark@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/4] avcodec/bswapdsp: add documentation 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: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JcO4vFEeJx/8 From: Mark Reid --- libavcodec/bswapdsp.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/libavcodec/bswapdsp.h b/libavcodec/bswapdsp.h index 10519cfd2e..ecc37d2c56 100644 --- a/libavcodec/bswapdsp.h +++ b/libavcodec/bswapdsp.h @@ -21,11 +21,44 @@ #include +/** + * @file + * Optimized buffer byte swapping routines. + */ + typedef struct BswapDSPContext { + /** + * Byte swap 32 bit elements in a buffer. + + * @param dst Destination buffer. + * @param src Source buffer, may be the same as dst. + * @param len The number of elements in the buffer. + * + */ + /** @{ */ void (*bswap32_buf)(uint32_t *dst, const uint32_t *src, int len); + /** @} */ + + /** + * Byte swap 16 bit elements in a buffer. + * + * @param dst Destination buffer. + * @param src Source buffer, may be the same as dst. + * @param len The number of elements in the buffer. + * + */ + /** @{ */ void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); + /** @} */ } BswapDSPContext; + +/** + * Initialize BswapDSPContext function pointers. + * + * @param c pointer to BswapDSPContext + * + */ void ff_bswapdsp_init(BswapDSPContext *c); void ff_bswapdsp_init_riscv(BswapDSPContext *c); void ff_bswapdsp_init_x86(BswapDSPContext *c); From patchwork Tue Dec 13 02:42:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 39691 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp791849pzb; Mon, 12 Dec 2022 18:43:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf6W0vjnp36wNXEqfd4FhymxMXat8HKIG5B38+fFq7SIFa/YkyIDLZQj/pAvSsCXC1a9rxBd X-Received: by 2002:aa7:d28d:0:b0:46c:aa7a:bd3f with SMTP id w13-20020aa7d28d000000b0046caa7abd3fmr15844305edq.23.1670899391085; Mon, 12 Dec 2022 18:43:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670899391; cv=none; d=google.com; s=arc-20160816; b=GJI64iIVm9qOh+Z6GwcKu5lTQaerGZxiB9UGBLqMAcqUCNBIKvnqGlmX8eWUS9BOLR yo3hyXt9bNIhI+1RnRuGw9OCAHHytCUdR9P6qx4olfLG+Z766xfXD/FwO+jI6txa9zQC XwH9QZ2pOZIksxu2auijydbsnqAWhWLyihg7l9sMbJrPWvJdj//sOC5u/KAWcgbDfat4 23+EMoiPtQU9itQ+4H/H5wP8BlGGOJTSOpNMWR1i9P8B10yZ2rMoHVPzJzRmxYyhx9Vj rWNN+4tcFgsD2JuHWggOAXuTfqyIevziGXEv4Es9vNX2R5Pjn/gUXRBPf8bqzjcYxONj C4pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=+i6wmOUxXwNz5VQLOycBY7SKeNlRywhCWFkp42C7Z+s=; b=dpBJxLnvfvGIwKZcjZy5MlnJB/dhIA4hXDYTP276LPm1kNH2S42oA7zT7eK4eGqNly DH3/kuXn8g/nvQaeC01mT4dHY375MNm3fsd14urHg1NCECV+zmGcTkna249F6VgEN0mg igH4tIFkc4Y/vs4Cn9m/Kabn0hi2nd8q5atIMSgz+OHyzu3PTkm5zmd06pNkeo3PqT3t Qv4SLia+VSpKZ4hjMqJJ7lLeRyuudzXZo3RKOBd4hzfVTZtxUX4vFMDHHFfR2FfHWdS4 FZlmuvVOvHaQLeuL3Cfa5fspnNYxKvmF61YEoxMCVDDem/sfZyuEW5jIXc96hqslCGIj zvjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=KrnZfqZy; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d24-20020a50f698000000b0046ae3282cefsi8796978edn.59.2022.12.12.18.43.10; Mon, 12 Dec 2022 18:43:11 -0800 (PST) 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=20210112 header.b=KrnZfqZy; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D362D68BDC0; Tue, 13 Dec 2022 04:42:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5185668BDC5 for ; Tue, 13 Dec 2022 04:42:35 +0200 (EET) Received: by mail-pl1-f176.google.com with SMTP id d3so14120652plr.10 for ; Mon, 12 Dec 2022 18:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SKMsS+Tv3UhamGfH6i7QB+vP1MJv+GSCSlrXaVl3rO0=; b=KrnZfqZyj32iynf56gylfR9hhKCcfFZz3LbCamu//h7bVYPaQELyQ/wGQR4Q6/ogx2 gWHPO8OMV0T2w8dyIOFkfnaDsbNs617i9uNZjcCedAt7e5qhCWHNQsVZE9z5+nKabO1V Z9gpmCBuMHCZGnynKs/prjzYGsJdgyBxNQMdoPDB767lfWeBAfxC2T8lz8jO316+eUDO jx+e280lAb6tNf7f97gCqj0/fXY5Si6R85rIIkQEKHr4UGEbiurCyCekpiPcCKkwcCrW VYmOUEgQZ6H68n/7/FGaQq3sqd/IoqepRVKuY2GOc1ZuqFrhb5Y7ivNq3itNCXEYPfvG HMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SKMsS+Tv3UhamGfH6i7QB+vP1MJv+GSCSlrXaVl3rO0=; b=3UV0H2EM5I2lAZ75kKB7uesK+NCVIGH/aQss3QicWrRHcV0/iz7c0u6h8MXx7oXYbU G/xhvuN/cOOqV1YZvbsFIYPNxzVl5tNT7idydlHt83CfBrDmgble9rRf+yj67mZRacUs 67LHTVK7fGbC+ksP7fjeE5RYzM+6CfKFJsOXywPxQ0s9XC81wNCkPCj6sAVI5ZOQPjdl MibS0BSCMkQafuvGslwO9yROqCFa1J8eyrEkCCd1cdDFHN/kRDLXS0KljrWfzRGPxdDA x6M5kTW2h7ai3nkLqZzdVCHguaxsqqNxqD8IIkB6VtmqL34k8Rl2N9cZWw8LBbAedkMK EEsg== X-Gm-Message-State: ANoB5pmXs2ghAeZcUBPPOVcPmLVzb2bDp4cqkmnQrJVUEOxjhaXBkRqA P0dokgPvvISH301mhFJA8lt4j+Rm9nw= X-Received: by 2002:a05:6a20:12cc:b0:9d:efbf:8151 with SMTP id v12-20020a056a2012cc00b0009defbf8151mr27826951pzg.26.1670899352969; Mon, 12 Dec 2022 18:42:32 -0800 (PST) Received: from localhost.localdomain (S0106bc4dfba470f3.vc.shawcable.net. [174.7.244.175]) by smtp.gmail.com with ESMTPSA id ju2-20020a170903428200b00186ae20e8dcsm7060105plb.271.2022.12.12.18.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 18:42:32 -0800 (PST) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Dec 2022 18:42:16 -0800 Message-Id: <20221213024216.259-4-mindmark@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20221213024216.259-1-mindmark@gmail.com> References: <20221213024216.259-1-mindmark@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 4/4] swscale/bswapdsp: copy over bswapdsp from avcodec 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: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fdeU5qXxQCYr From: Mark Reid There are some places in input.c that could use it too but they aren't currently being pass the SwsContext --- libswscale/Makefile | 1 + libswscale/bswapdsp.c | 59 ++++++++++++ libswscale/bswapdsp.h | 66 +++++++++++++ libswscale/output.c | 36 +++---- libswscale/riscv/Makefile | 7 +- libswscale/riscv/bswapdsp_init.c | 46 +++++++++ libswscale/riscv/bswapdsp_rvb.S | 68 +++++++++++++ libswscale/riscv/bswapdsp_rvv.S | 62 ++++++++++++ libswscale/swscale_internal.h | 3 + libswscale/swscale_unscaled.c | 26 ++--- libswscale/utils.c | 2 + libswscale/x86/Makefile | 6 +- libswscale/x86/bswapdsp.asm | 157 +++++++++++++++++++++++++++++++ libswscale/x86/bswapdsp_init.c | 40 ++++++++ 14 files changed, 537 insertions(+), 42 deletions(-) create mode 100644 libswscale/bswapdsp.c create mode 100644 libswscale/bswapdsp.h create mode 100644 libswscale/riscv/bswapdsp_init.c create mode 100644 libswscale/riscv/bswapdsp_rvb.S create mode 100644 libswscale/riscv/bswapdsp_rvv.S create mode 100644 libswscale/x86/bswapdsp.asm create mode 100644 libswscale/x86/bswapdsp_init.c diff --git a/libswscale/Makefile b/libswscale/Makefile index 757997b401..4a916739c3 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -6,6 +6,7 @@ HEADERS = swscale.h \ version_major.h \ OBJS = alphablend.o \ + bswapdsp.o \ hscale.o \ hscale_fast_bilinear.o \ gamma.o \ diff --git a/libswscale/bswapdsp.c b/libswscale/bswapdsp.c new file mode 100644 index 0000000000..a164d89a76 --- /dev/null +++ b/libswscale/bswapdsp.c @@ -0,0 +1,59 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "libavutil/attributes.h" +#include "libavutil/bswap.h" +#include "bswapdsp.h" + +static void bswap32_buf(uint32_t *dst, const uint32_t *src, int len) +{ + int i; + + for (i = 0; i + 8 <= len; i += 8) { + dst[i + 0] = av_bswap32(src[i + 0]); + dst[i + 1] = av_bswap32(src[i + 1]); + dst[i + 2] = av_bswap32(src[i + 2]); + dst[i + 3] = av_bswap32(src[i + 3]); + dst[i + 4] = av_bswap32(src[i + 4]); + dst[i + 5] = av_bswap32(src[i + 5]); + dst[i + 6] = av_bswap32(src[i + 6]); + dst[i + 7] = av_bswap32(src[i + 7]); + } + for (; i < len; i++) + dst[i + 0] = av_bswap32(src[i + 0]); +} + +static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len) +{ + while (len--) + *dst++ = av_bswap16(*src++); +} + +av_cold void ff_sws_bswapdsp_init(BswapDSPContext *c) +{ + c->bswap32_buf = bswap32_buf; + c->bswap16_buf = bswap16_buf; + +#if ARCH_RISCV + ff_sws_bswapdsp_init_riscv(c); +#elif ARCH_X86 + ff_sws_bswapdsp_init_x86(c); +#endif +} diff --git a/libswscale/bswapdsp.h b/libswscale/bswapdsp.h new file mode 100644 index 0000000000..f2e12d1b8f --- /dev/null +++ b/libswscale/bswapdsp.h @@ -0,0 +1,66 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_BSWAPDSP_H +#define SWSCALE_BSWAPDSP_H + +#include + +/** + * @file + * Optimized buffer byte swapping routines. + */ + +typedef struct BswapDSPContext { + /** + * Byte swap 32 bit elements in a buffer. + + * @param dst Destination buffer. + * @param src Source buffer, may be the same as dst. + * @param len The number of elements in the buffer. + * + */ + /** @{ */ + void (*bswap32_buf)(uint32_t *dst, const uint32_t *src, int len); + /** @} */ + + /** + * Byte swap 16 bit elements in a buffer. + * + * @param dst Destination buffer. + * @param src Source buffer, may be the same as dst. + * @param len The number of elements in the buffer. + * + */ + /** @{ */ + void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); + /** @} */ +} BswapDSPContext; + + +/** + * Initialize BswapDSPContext function pointers. + * + * @param c pointer to BswapDSPContext + * + */ +void ff_sws_bswapdsp_init(BswapDSPContext *c); +void ff_sws_bswapdsp_init_riscv(BswapDSPContext *c); +void ff_sws_bswapdsp_init_x86(BswapDSPContext *c); + +#endif /* SWSCALE_BSWAPDSP_H */ diff --git a/libswscale/output.c b/libswscale/output.c index 5c85bff971..cd44081e3d 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2313,13 +2313,11 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, } } if (SH != 22 && (!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) { - for (i = 0; i < dstW; i++) { - dest16[0][i] = av_bswap16(dest16[0][i]); - dest16[1][i] = av_bswap16(dest16[1][i]); - dest16[2][i] = av_bswap16(dest16[2][i]); - if (hasAlpha) - dest16[3][i] = av_bswap16(dest16[3][i]); - } + c->bsdsp.bswap16_buf(dest16[0], dest16[0], dstW); + c->bsdsp.bswap16_buf(dest16[1], dest16[1], dstW); + c->bsdsp.bswap16_buf(dest16[2], dest16[2], dstW); + if (hasAlpha) + c->bsdsp.bswap16_buf(dest16[3], dest16[3], dstW); } } @@ -2385,13 +2383,11 @@ yuv2gbrp16_full_X_c(SwsContext *c, const int16_t *lumFilter, dest16[3][i] = av_clip_uintp2(A, 30) >> 14; } if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) { - for (i = 0; i < dstW; i++) { - dest16[0][i] = av_bswap16(dest16[0][i]); - dest16[1][i] = av_bswap16(dest16[1][i]); - dest16[2][i] = av_bswap16(dest16[2][i]); - if (hasAlpha) - dest16[3][i] = av_bswap16(dest16[3][i]); - } + c->bsdsp.bswap16_buf(dest16[0], dest16[0], dstW); + c->bsdsp.bswap16_buf(dest16[1], dest16[1], dstW); + c->bsdsp.bswap16_buf(dest16[2], dest16[2], dstW); + if (hasAlpha) + c->bsdsp.bswap16_buf(dest16[3], dest16[3], dstW); } } @@ -2461,13 +2457,11 @@ yuv2gbrpf32_full_X_c(SwsContext *c, const int16_t *lumFilter, dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14)); } if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) { - for (i = 0; i < dstW; i++) { - dest32[0][i] = av_bswap32(dest32[0][i]); - dest32[1][i] = av_bswap32(dest32[1][i]); - dest32[2][i] = av_bswap32(dest32[2][i]); - if (hasAlpha) - dest32[3][i] = av_bswap32(dest32[3][i]); - } + c->bsdsp.bswap32_buf(dest32[0], dest32[0], dstW); + c->bsdsp.bswap32_buf(dest32[1], dest32[1], dstW); + c->bsdsp.bswap32_buf(dest32[2], dest32[2], dstW); + if (hasAlpha) + c->bsdsp.bswap32_buf(dest32[3], dest32[3], dstW); } } diff --git a/libswscale/riscv/Makefile b/libswscale/riscv/Makefile index 214d877b62..bb33f2b707 100644 --- a/libswscale/riscv/Makefile +++ b/libswscale/riscv/Makefile @@ -1,2 +1,5 @@ -OBJS += riscv/rgb2rgb.o -RVV-OBJS += riscv/rgb2rgb_rvv.o +OBJS += riscv/bswapdsp_init.o \ + riscv/bswapdsp_rvb.o \ + riscv/rgb2rgb.o +RVV-OBJS += riscv/bswapdsp_rvv.o \ + riscv/rgb2rgb_rvv.o diff --git a/libswscale/riscv/bswapdsp_init.c b/libswscale/riscv/bswapdsp_init.c new file mode 100644 index 0000000000..9fedcde3fa --- /dev/null +++ b/libswscale/riscv/bswapdsp_init.c @@ -0,0 +1,46 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libswscale/bswapdsp.h" + +void ff_sws_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len); +void ff_sws_bswap32_buf_rvv(uint32_t *dst, const uint32_t *src, int len); +void ff_sws_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len); + +av_cold void ff_sws_bswapdsp_init_riscv(BswapDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + +#if (__riscv_xlen >= 64) + if (cpu_flags & AV_CPU_FLAG_RVB_BASIC) + c->bswap32_buf = ff_sws_bswap32_buf_rvb; +#endif +#if HAVE_RVV + if (cpu_flags & AV_CPU_FLAG_RVV_I32) { + c->bswap32_buf = ff_sws_bswap32_buf_rvv; + c->bswap16_buf = ff_sws_bswap16_buf_rvv; + } +#endif +} diff --git a/libswscale/riscv/bswapdsp_rvb.S b/libswscale/riscv/bswapdsp_rvb.S new file mode 100644 index 0000000000..92edbce7cd --- /dev/null +++ b/libswscale/riscv/bswapdsp_rvb.S @@ -0,0 +1,68 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/riscv/asm.S" + +#if (__riscv_xlen >= 64) +func ff_sws_bswap32_buf_rvb, zbb + andi t0, a1, 4 + beqz t0, 1f + /* Align a1 (input) to 64-bit */ + lwu t0, (a1) + addi a0, a0, 4 + rev8 t0, t0 + addi a2, a2, -1 + srli t0, t0, __riscv_xlen - 32 + addi a1, a1, 4 + sw t0, -4(a0) +1: + andi a3, a2, -2 + sh2add a2, a2, a0 + beqz a3, 3f + sh2add a3, a3, a0 +2: /* 2 elements (64 bits) at a time on a 64-bit boundary */ + ld t0, (a1) + addi a0, a0, 8 + rev8 t0, t0 +#if (__riscv_xlen == 64) + srli t2, t0, 32 + sw t0, -4(a0) +#else + srli t1, t0, __riscv_xlen - 64 + srli t2, t0, __riscv_xlen - 32 + sw t1, -4(a0) +#endif + addi a1, a1, 8 + sw t2, -8(a0) + bne a0, a3, 2b +3: + beq a0, a2, 5f +4: /* Process last element */ + lwu t0, (a1) + addi a0, a0, 4 + rev8 t0, t0 + addi a1, a1, 4 + srli t0, t0, __riscv_xlen - 32 + sw t0, -4(a0) +5: + ret +endfunc +#endif diff --git a/libswscale/riscv/bswapdsp_rvv.S b/libswscale/riscv/bswapdsp_rvv.S new file mode 100644 index 0000000000..923cb9bc9d --- /dev/null +++ b/libswscale/riscv/bswapdsp_rvv.S @@ -0,0 +1,62 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/riscv/asm.S" + +func ff_sws_bswap32_buf_rvv, zve32x + li t4, 4 + addi t1, a0, 1 + addi t2, a0, 2 + addi t3, a0, 3 +1: + vsetvli t0, a2, e8, m1, ta, ma + vlseg4e8.v v8, (a1) + sub a2, a2, t0 + sh2add a1, t0, a1 + vsse8.v v8, (t3), t4 + sh2add t3, t0, t3 + vsse8.v v9, (t2), t4 + sh2add t2, t0, t2 + vsse8.v v10, (t1), t4 + sh2add t1, t0, t1 + vsse8.v v11, (a0), t4 + sh2add a0, t0, a0 + bnez a2, 1b + + ret +endfunc + +func ff_sws_bswap16_buf_rvv, zve32x + li t2, 2 + addi t1, a0, 1 +1: + vsetvli t0, a2, e8, m1, ta, ma + vlseg2e8.v v8, (a1) + sub a2, a2, t0 + sh1add a1, t0, a1 + vsse8.v v8, (t1), t2 + sh1add t1, t0, t1 + vsse8.v v9, (a0), t2 + sh1add a0, t0, a0 + bnez a2, 1b + + ret +endfunc diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index abeebbb002..30ce4907cc 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -36,6 +36,7 @@ #include "libavutil/slicethread.h" #include "libavutil/ppc/util_altivec.h" #include "libavutil/half2float.h" +#include "bswapdsp.h" #define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long @@ -682,6 +683,8 @@ typedef struct SwsContext { atomic_int data_unaligned_warned; Half2FloatTables *h2f_tables; + + BswapDSPContext bsdsp; } SwsContext; //FIXME check init (where 0) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 9af2e7ecc3..0010ab24d1 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -468,7 +468,7 @@ static int bswap_16bpc(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { - int i, j, p; + int i, p; for (p = 0; p < 4; p++) { int srcstr = srcStride[p] / 2; @@ -480,9 +480,7 @@ static int bswap_16bpc(SwsContext *c, const uint8_t *src[], continue; dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { - for (j = 0; j < min_stride; j++) { - dstPtr[j] = av_bswap16(srcPtr[j]); - } + c->bsdsp.bswap16_buf(dstPtr, srcPtr, min_stride); srcPtr += srcstr; dstPtr += dststr; } @@ -495,7 +493,7 @@ static int bswap_32bpc(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { - int i, j, p; + int i, p; for (p = 0; p < 4; p++) { int srcstr = srcStride[p] / 4; @@ -507,9 +505,7 @@ static int bswap_32bpc(SwsContext *c, const uint8_t *src[], continue; dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { - for (j = 0; j < min_stride; j++) { - dstPtr[j] = av_bswap32(srcPtr[j]); - } + c->bsdsp.bswap32_buf(dstPtr, srcPtr, min_stride); srcPtr += srcstr; dstPtr += dststr; } @@ -1616,19 +1612,17 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], conv(srcPtr, dstPtr + dstStride[0] * srcSliceY, (srcSliceH - 1) * srcStride[0] + c->srcW * srcBpp); else { - int i, j; + int i; dstPtr += dstStride[0] * srcSliceY; for (i = 0; i < srcSliceH; i++) { if(src_bswap) { - for(j=0; jsrcW; j++) - ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]); + c->bsdsp.bswap16_buf((uint16_t*)c->formatConvBuffer, (uint16_t*)srcPtr, c->srcW); conv(c->formatConvBuffer, dstPtr, c->srcW * srcBpp); }else conv(srcPtr, dstPtr, c->srcW * srcBpp); if(dst_bswap) - for(j=0; jsrcW; j++) - ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]); + c->bsdsp.bswap16_buf((uint16_t*)dstPtr, (uint16_t*)dstPtr, c->srcW); srcPtr += srcStride[0]; dstPtr += dstStride[0]; } @@ -1932,16 +1926,14 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], isBE(c->srcFormat) != isBE(c->dstFormat)) { for (i = 0; i < height; i++) { - for (j = 0; j < length; j++) - ((uint16_t *) dstPtr)[j] = av_bswap16(((const uint16_t *) srcPtr)[j]); + c->bsdsp.bswap16_buf((uint16_t *)dstPtr, (const uint16_t *)srcPtr, length); srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } } else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) && isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */ for (i = 0; i < height; i++) { - for (j = 0; j < length; j++) - ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]); + c->bsdsp.bswap32_buf((uint32_t *)dstPtr, (const uint32_t *)srcPtr, length); srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } diff --git a/libswscale/utils.c b/libswscale/utils.c index 90734f66ef..3ff8c2f84f 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1921,6 +1921,8 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, return 0; } + ff_sws_bswapdsp_init(&c->bsdsp); + /* unscaled special cases */ if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat) || diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile index 68391494be..f7cdda5a25 100644 --- a/libswscale/x86/Makefile +++ b/libswscale/x86/Makefile @@ -1,6 +1,7 @@ $(SUBDIR)x86/swscale_mmx.o: CFLAGS += $(NOREDZONE_FLAGS) -OBJS += x86/rgb2rgb.o \ +OBJS += x86/bswapdsp_init.o \ + x86/rgb2rgb.o \ x86/swscale.o \ x86/yuv2rgb.o \ @@ -8,7 +9,8 @@ MMX-OBJS += x86/hscale_fast_bilinear_simd.o \ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o -X86ASM-OBJS += x86/input.o \ +X86ASM-OBJS += x86/bswapdsp.o \ + x86/input.o \ x86/output.o \ x86/scale.o \ x86/scale_avx2.o \ diff --git a/libswscale/x86/bswapdsp.asm b/libswscale/x86/bswapdsp.asm new file mode 100644 index 0000000000..84fc6fb000 --- /dev/null +++ b/libswscale/x86/bswapdsp.asm @@ -0,0 +1,157 @@ +;****************************************************************************** +;* optimized bswap buffer functions +;* Copyright (c) 2008 Loren Merritt +;* Copyright (c) 2003-2013 Michael Niedermayer +;* Copyright (c) 2013 Daniel Kang +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "libavutil/x86/x86util.asm" + +SECTION_RODATA +pb_bswap32: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 + +SECTION .text + +; %1 = aligned/unaligned +%macro BSWAP_LOOPS 1 + mov r3d, r2d + sar r2d, 3 + jz .left4_%1 +%if cpuflag(avx2) + sar r2d, 1 + jz .left8_%1 +%endif +.loop8_%1: + mov%1 m0, [r1 + 0] + mov%1 m1, [r1 + mmsize] +%if cpuflag(ssse3)||cpuflag(avx2) + pshufb m0, m2 + pshufb m1, m2 + mov%1 [r0 + 0], m0 + mov%1 [r0 + mmsize], m1 +%else + pshuflw m0, m0, 10110001b + pshuflw m1, m1, 10110001b + pshufhw m0, m0, 10110001b + pshufhw m1, m1, 10110001b + mova m2, m0 + mova m3, m1 + psllw m0, 8 + psllw m1, 8 + psrlw m2, 8 + psrlw m3, 8 + por m2, m0 + por m3, m1 + mov%1 [r0 + 0], m2 + mov%1 [r0 + 16], m3 +%endif + add r0, mmsize*2 + add r1, mmsize*2 + dec r2d + jnz .loop8_%1 +%if cpuflag(avx2) +.left8_%1: + mov r2d, r3d + test r3d, 8 + jz .left4_%1 + mov%1 m0, [r1] + pshufb m0, m2 + mov%1 [r0 + 0], m0 + add r1, mmsize + add r0, mmsize +%endif +.left4_%1: + mov r2d, r3d + test r3d, 4 + jz .left + mov%1 xm0, [r1] +%if cpuflag(ssse3) + pshufb xm0, xm2 + mov%1 [r0], xm0 +%else + pshuflw m0, m0, 10110001b + pshufhw m0, m0, 10110001b + mova m2, m0 + psllw m0, 8 + psrlw m2, 8 + por m2, m0 + mov%1 [r0], m2 +%endif + add r1, 16 + add r0, 16 +%endmacro + +; void bswap32_buf(uint32_t *dst, const uint32_t *src, int w); +%macro BSWAP32_BUF 0 +%if cpuflag(ssse3)||cpuflag(avx2) +cglobal sws_bswap32_buf, 3,4,3 + mov r3, r1 + VBROADCASTI128 m2, [pb_bswap32] +%else +cglobal sws_bswap32_buf, 3,4,5 + mov r3, r1 +%endif + or r3, r0 + test r3, mmsize - 1 + jz .start_align + BSWAP_LOOPS u + jmp .left +.start_align: + BSWAP_LOOPS a +.left: +%if cpuflag(ssse3) + test r2d, 2 + jz .left1 + movq xm0, [r1] + pshufb xm0, xm2 + movq [r0], xm0 + add r1, 8 + add r0, 8 +.left1: + test r2d, 1 + jz .end + mov r2d, [r1] + bswap r2d + mov [r0], r2d +%else + and r2d, 3 + jz .end +.loop2: + mov r3d, [r1] + bswap r3d + mov [r0], r3d + add r1, 4 + add r0, 4 + dec r2d + jnz .loop2 +%endif +.end: + RET +%endmacro + +INIT_XMM sse2 +BSWAP32_BUF + +INIT_XMM ssse3 +BSWAP32_BUF + +%if HAVE_AVX2_EXTERNAL +INIT_YMM avx2 +BSWAP32_BUF +%endif diff --git a/libswscale/x86/bswapdsp_init.c b/libswscale/x86/bswapdsp_init.c new file mode 100644 index 0000000000..57f2944db7 --- /dev/null +++ b/libswscale/x86/bswapdsp_init.c @@ -0,0 +1,40 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/x86/cpu.h" +#include "libswscale/bswapdsp.h" + +void ff_sws_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w); +void ff_sws_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w); +void ff_sws_bswap32_buf_avx2(uint32_t *dst, const uint32_t *src, int w); + +av_cold void ff_sws_bswapdsp_init_x86(BswapDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (EXTERNAL_SSE2(cpu_flags)) + c->bswap32_buf = ff_sws_bswap32_buf_sse2; + if (EXTERNAL_SSSE3(cpu_flags)) + c->bswap32_buf = ff_sws_bswap32_buf_ssse3; + if (EXTERNAL_AVX2_FAST(cpu_flags)) + c->bswap32_buf = ff_sws_bswap32_buf_avx2; +}