From patchwork Mon Dec 5 22:16:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 39620 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp3609483pzb; Mon, 5 Dec 2022 14:17:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf7kWL2KiYek3dKA9VaWn9oNIyD9UU8EOHNU9QM0Jcbe6DYdSypukPTr9Q2xah82Iqxv68W7 X-Received: by 2002:a17:906:d8a6:b0:7c0:b741:8b61 with SMTP id qc6-20020a170906d8a600b007c0b7418b61mr16404538ejb.625.1670278638766; Mon, 05 Dec 2022 14:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670278638; cv=none; d=google.com; s=arc-20160816; b=Iuhji9pQ9tFyjurvKHdrrldP7GfBbmejqx4Cvy/o9vmIz7lBMQBNeKIXZenCk7taA5 oeQ87fdacNQo0JcdDXW8nkltc5TGEupZsE4u3niKh3RJUjYp50wczyWZvfUatUoFCfts aiWzRsJhufjJFarf57zOITyYuyWXGONyYpuESY3I/CxABBzaoRxqYBC1E1HmdArneyJJ j6ID1mzS39O6IoZclDk3UshMNiTP0vzqocb3mT+kWG06PqkjHk3xsUqu17DTkk8y359A P6K2DE3kFpqejLnLeBN1HzqoAjam1YPDYik4dXp1yJAwmKKZ3ZZW+/eU/y3cwNAJfPAB HkzQ== 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=wy6c2sJHXR2cKu0lzA4E9/AvpkzO3bb+0tyT0xddxG4=; b=Zjq3cN214LywLE90Oj9Lr++F4C5Um80cMT7tGeVjk6rrkyxrSqg2jA+DfkCy/dYnhc qlH7nVECQ0D0jubepxZnVOKvSN2RfWUG2+vvvIMwODnyYO6XuEOe56MvepyYgtL6QtHa JMByOBjBQYmXeNM3tH+e1AWuswm2lpKoEVnDEDa0s1yfAmxsZs9gIgs5HnosW7K6xWT4 Koagf21pJ4+a7e4XkIO8aCEEmRcjvujGh5I028etCJgWxvE5uqZ2iJL1hi1qwLDlICHk wbqy8ESwU2HApSsGcZ3wcQfU68I6OSfq20oOrKitEcDr/ojJehcpRF4cqocRLczq4Ntm URIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=mzszN+YJ; 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 l12-20020aa7c3cc000000b0046107f951f9si484897edr.237.2022.12.05.14.17.17; Mon, 05 Dec 2022 14:17:18 -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=mzszN+YJ; 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 DCA8A68BC41; Tue, 6 Dec 2022 00:17:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 13B6068BB37 for ; Tue, 6 Dec 2022 00:16:59 +0200 (EET) Received: by mail-pj1-f53.google.com with SMTP id t11-20020a17090a024b00b0021932afece4so16222461pje.5 for ; Mon, 05 Dec 2022 14:16:58 -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=32CLu2WdBN/k35iS8E0g1kVI0zUT6GnqeR1ecOFCXnY=; b=mzszN+YJLqUhYbiRfPRtOLSwM9sEpqqin9HpWR/AmwXmW1bRwxx3eIMUprPTGjfOKd NKizR9RjurWF5MxKv+tkeaepqmF0Iiu+LKMKET/Qsc/RnCV1yYfndsT/fmyvgl46Auz2 JziWUbHgJZ1fZoWVtDVrn4U0U+Gr1ie9KUwzYgBBmvYa68mixzRjD+KGDhfQRzseHgff P3QHp7cPlnhKgGJpmmwgS5Ogrisc84rkhlFF2/kJ8aKD7qN9tFbV501+Vq2QiUQuSeKP I3ZkoQyMY9o+e5i47WmG7OnsCiFBUZwsbMiv8Vk4Z0uvq1oGItA/xtrieD57U5yNeHac lY3A== 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=32CLu2WdBN/k35iS8E0g1kVI0zUT6GnqeR1ecOFCXnY=; b=e6lx3Z+UlQfzXGcXk9HO2Br9F44a2f2P4HRT3yuittEAIuDeqC7Qyoc8NsRfcDy2mf o6wRqqI/CWqu/1OvL0dzcFalz+6R5P77/nTpOOvwkJv8ZzXWH3dUEpXFkV6kDerE5+kQ Hz/Z9qvH7M7KH1Z4npHM3hgSQXlJ3z1zmvusHrPRDWoU8GEU4bLAVy3Cz3Lz7ZO4vhZS ng7/qZGnwPlMqRdR98OWEqSJ1NUwi3x1oSE4I7HzrDcSGsTnUzhPyFoivZtySAdOWbB4 zjJc3ABVKbTkUjS52b6OPhOEdAoPKn/WMaSwzwGBa/YZsNOGJqRKVkbK8d8jPCfUSvYZ K1Ew== X-Gm-Message-State: ANoB5pmqRdLdudUN5evCWMxQQdwi1wtMDzGXwdxqKK7E5A+P5icaT1+t 8SCur075GqXV+MGGhM+5ux2RKvRJU08= X-Received: by 2002:a17:90b:238b:b0:219:7904:6de with SMTP id mr11-20020a17090b238b00b00219790406demr23585579pjb.136.1670278615749; Mon, 05 Dec 2022 14:16:55 -0800 (PST) Received: from localhost.localdomain (S0106bc4dfba470f3.vc.shawcable.net. [174.7.244.175]) by smtp.gmail.com with ESMTPSA id b4-20020a170902650400b00176dc67df44sm11097913plk.132.2022.12.05.14.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 14:16:54 -0800 (PST) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Dec 2022 14:16:40 -0800 Message-Id: <20221205221641.1215-1-mindmark@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] avutil: move bswapdsp from avcodec to avutil 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: WAjb0pHazz3j From: Mark Reid Also renamed bswap_buf to bswap32_buf --- configure | 56 ++++++++----------- libavcodec/4xm.c | 14 ++--- libavcodec/Makefile | 1 - libavcodec/ac3dec.c | 4 +- libavcodec/ac3dec.h | 4 +- libavcodec/alsdec.c | 12 ++-- libavcodec/apedec.c | 10 ++-- libavcodec/asv.c | 4 +- libavcodec/asv.h | 4 +- libavcodec/asvdec.c | 4 +- libavcodec/asvenc.c | 4 +- libavcodec/cllc.c | 6 +- libavcodec/eamad.c | 6 +- libavcodec/eatqi.c | 10 ++-- libavcodec/exr.c | 6 +- libavcodec/flacenc.c | 6 +- libavcodec/fraps.c | 10 ++-- libavcodec/hevcdec.c | 4 +- libavcodec/hevcdec.h | 4 +- libavcodec/huffyuvdec.c | 14 ++--- libavcodec/huffyuvenc.c | 8 +-- libavcodec/imc.c | 6 +- libavcodec/imm4.c | 12 ++-- libavcodec/mdec.c | 6 +- libavcodec/mimic.c | 12 ++-- libavcodec/mobiclip.c | 6 +- libavcodec/motionpixels.c | 10 ++-- libavcodec/mpc.h | 4 +- libavcodec/mpc7.c | 8 +-- libavcodec/rawdec.c | 8 +-- libavcodec/riscv/Makefile | 3 - libavcodec/shorten.c | 7 ++- libavcodec/truemotion2.c | 11 ++-- libavcodec/truespeech.c | 8 +-- libavcodec/utvideo.h | 4 +- libavcodec/utvideodec.c | 16 +++--- libavcodec/utvideoenc.c | 10 ++-- libavcodec/x86/Makefile | 2 - libavcodec/ylc.c | 18 +++--- libavutil/Makefile | 2 + {libavcodec => libavutil}/bswapdsp.c | 17 +++--- {libavcodec => libavutil}/bswapdsp.h | 16 +++--- libavutil/riscv/Makefile | 7 ++- .../riscv/bswapdsp_init.c | 9 +-- .../riscv/bswapdsp_rvb.S | 0 .../riscv/bswapdsp_rvv.S | 0 libavutil/version.h | 2 +- libavutil/x86/Makefile | 8 ++- {libavcodec => libavutil}/x86/bswapdsp.asm | 4 +- {libavcodec => libavutil}/x86/bswapdsp_init.c | 17 +++--- tests/checkasm/Makefile | 2 +- tests/checkasm/bswapdsp.c | 8 +-- tests/checkasm/checkasm.c | 4 +- 53 files changed, 216 insertions(+), 222 deletions(-) rename {libavcodec => libavutil}/bswapdsp.c (80%) rename {libavcodec => libavutil}/bswapdsp.h (71%) rename {libavcodec => libavutil}/riscv/bswapdsp_init.c (85%) rename {libavcodec => libavutil}/riscv/bswapdsp_rvb.S (100%) rename {libavcodec => libavutil}/riscv/bswapdsp_rvv.S (100%) rename {libavcodec => libavutil}/x86/bswapdsp.asm (97%) rename {libavcodec => libavutil}/x86/bswapdsp_init.c (80%) diff --git a/configure b/configure index f4eedfc207..03b502ea37 100755 --- a/configure +++ b/configure @@ -2421,7 +2421,6 @@ CONFIG_EXTRA=" audio_frame_queue audiodsp blockdsp - bswapdsp cabac cbs cbs_av1 @@ -2749,8 +2748,8 @@ aac_decoder_select="adts_header mpeg4audio sinewin" aac_fixed_decoder_select="adts_header mpeg4audio" aac_encoder_select="audio_frame_queue iirfilter lpc sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" -ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert" -ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp" +ac3_decoder_select="ac3_parser ac3dsp fmtconvert" +ac3_fixed_decoder_select="ac3_parser ac3dsp" ac3_encoder_select="ac3dsp audiodsp me_cmp" ac3_fixed_encoder_select="ac3dsp audiodsp me_cmp" acelp_kelvin_decoder_select="audiodsp" @@ -2759,20 +2758,20 @@ adpcm_g722_encoder_select="g722dsp" agm_decoder_select="idctdsp" aic_decoder_select="golomb idctdsp" alac_encoder_select="lpc" -als_decoder_select="bswapdsp mpeg4audio" +als_decoder_select="mpeg4audio" amrnb_decoder_select="lsp" amrwb_decoder_select="lsp" amv_decoder_select="sp5x_decoder exif" amv_encoder_select="jpegtables mpegvideoenc" -ape_decoder_select="bswapdsp llauddsp" +ape_decoder_select="llauddsp" apng_decoder_select="inflate_wrapper" apng_encoder_select="deflate_wrapper llvidencdsp" aptx_encoder_select="audio_frame_queue" aptx_hd_encoder_select="audio_frame_queue" -asv1_decoder_select="blockdsp bswapdsp idctdsp" -asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" -asv2_decoder_select="blockdsp bswapdsp idctdsp" -asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" +asv1_decoder_select="idctdsp" +asv1_encoder_select="aandcttables fdctdsp pixblockdsp" +asv2_decoder_select="idctdsp" +asv2_encoder_select="aandcttables fdctdsp pixblockdsp" atrac1_decoder_select="sinewin" av1_decoder_select="av1_frame_split_bsf cbs_av1" bink_decoder_select="blockdsp hpeldsp" @@ -2780,7 +2779,6 @@ binkaudio_dct_decoder_select="wma_freqs" binkaudio_rdft_decoder_select="wma_freqs" cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp" clearvideo_decoder_select="idctdsp" -cllc_decoder_select="bswapdsp" comfortnoise_encoder_select="lpc" cook_decoder_select="audiodsp sinewin" cri_decoder_select="mjpeg_decoder" @@ -2795,9 +2793,9 @@ dxa_decoder_deps="zlib" dxv_decoder_select="lzf texturedsp" eac3_decoder_select="ac3_decoder" eac3_encoder_select="ac3_encoder" -eamad_decoder_select="aandcttables blockdsp bswapdsp" +eamad_decoder_select="aandcttables blockdsp" eatgq_decoder_select="aandcttables" -eatqi_decoder_select="aandcttables blockdsp bswapdsp" +eatqi_decoder_select="aandcttables blockdsp" exr_decoder_deps="zlib" exr_encoder_deps="zlib" ffv1_decoder_select="rangecoder" @@ -2805,15 +2803,15 @@ ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" ffvhuff_encoder_select="huffyuv_encoder" fic_decoder_select="golomb" -flac_encoder_select="bswapdsp lpc" +flac_encoder_select="lpc" flashsv2_decoder_select="inflate_wrapper" flashsv2_encoder_select="deflate_wrapper" flashsv_decoder_select="inflate_wrapper" flashsv_encoder_deps="zlib" flv_decoder_select="h263_decoder" flv_encoder_select="h263_encoder" -fourxm_decoder_select="blockdsp bswapdsp" -fraps_decoder_select="bswapdsp huffman" +fourxm_decoder_select="blockdsp" +fraps_decoder_select="huffman" g2m_decoder_deps="zlib" g2m_decoder_select="blockdsp idctdsp jpegtables" g729_decoder_select="audiodsp" @@ -2829,13 +2827,13 @@ h264_decoder_suggest="error_resilience" hap_decoder_select="snappy texturedsp" hap_encoder_deps="libsnappy" hap_encoder_select="texturedspenc" -hevc_decoder_select="bswapdsp cabac dovi_rpu golomb hevcparse hevc_sei videodsp" -huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" -huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" +hevc_decoder_select="cabac dovi_rpu golomb hevcparse hevc_sei videodsp" +huffyuv_decoder_select="huffyuvdsp llviddsp" +huffyuv_encoder_select="huffman huffyuvencdsp llvidencdsp" hymt_decoder_select="huffyuv_decoder" iac_decoder_select="imc_decoder" -imc_decoder_select="bswapdsp sinewin" -imm4_decoder_select="bswapdsp idctdsp" +imc_decoder_select="sinewin" +imm4_decoder_select="idctdsp" imm5_decoder_select="h264_decoder hevc_decoder" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" @@ -2849,16 +2847,15 @@ ljpeg_encoder_select="jpegtables" lscr_decoder_select="inflate_wrapper" magicyuv_decoder_select="llviddsp" magicyuv_encoder_select="llvidencdsp" -mdec_decoder_select="blockdsp bswapdsp idctdsp" +mdec_decoder_select="blockdsp idctdsp" metasound_decoder_select="lsp sinewin" -mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp" +mimic_decoder_select="blockdsp hpeldsp idctdsp" mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables" mjpeg_encoder_select="jpegtables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" mlp_decoder_select="mlp_parser" mlp_encoder_select="lpc audio_frame_queue" -mobiclip_decoder_select="bswapdsp golomb" -motionpixels_decoder_select="bswapdsp" +mobiclip_decoder_select="golomb" mp1_decoder_select="mpegaudio" mp1float_decoder_select="mpegaudio" mp2_decoder_select="mpegaudio" @@ -2869,7 +2866,7 @@ mp3adufloat_decoder_select="mpegaudio" mp3float_decoder_select="mpegaudio" mp3on4_decoder_select="mpegaudio mpeg4audio" mp3on4float_decoder_select="mpegaudio mpeg4audio" -mpc7_decoder_select="bswapdsp mpegaudiodsp" +mpc7_decoder_select="mpegaudiodsp" mpc8_decoder_select="mpegaudiodsp" mpegvideo_decoder_select="mpegvideodec" mpeg1video_decoder_select="mpegvideodec" @@ -2909,7 +2906,6 @@ ra_144_decoder_select="audiodsp" ra_144_encoder_select="audio_frame_queue lpc audiodsp" ralf_decoder_select="golomb" rasc_decoder_select="inflate_wrapper" -rawvideo_decoder_select="bswapdsp" rscc_decoder_deps="zlib" rv10_decoder_select="h263_decoder" rv10_encoder_select="h263_encoder" @@ -2918,7 +2914,6 @@ rv20_encoder_select="h263_encoder" rv30_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp" rv40_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp" screenpresso_decoder_deps="zlib" -shorten_decoder_select="bswapdsp" sipr_decoder_select="lsp" smvjpeg_decoder_select="mjpeg_decoder" snow_decoder_select="dwt h264qpel hpeldsp rangecoder videodsp" @@ -2944,13 +2939,11 @@ tiff_decoder_suggest="zlib lzma" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_parser" truehd_encoder_select="lpc audio_frame_queue" -truemotion2_decoder_select="bswapdsp" -truespeech_decoder_select="bswapdsp" tscc_decoder_select="inflate_wrapper" twinvq_decoder_select="lsp sinewin" txd_decoder_select="texturedsp" -utvideo_decoder_select="bswapdsp llviddsp" -utvideo_encoder_select="bswapdsp huffman llvidencdsp" +utvideo_decoder_select="llviddsp" +utvideo_encoder_select="huffman llvidencdsp" vble_decoder_select="llviddsp" vbn_decoder_select="texturedsp" vbn_encoder_select="texturedspenc" @@ -2983,7 +2976,6 @@ wmv3_decoder_select="vc1_decoder" wmv3image_decoder_select="wmv3_decoder" xma1_decoder_select="wmapro_decoder" xma2_decoder_select="wmapro_decoder" -ylc_decoder_select="bswapdsp" zerocodec_decoder_select="inflate_wrapper" zlib_decoder_select="inflate_wrapper" zlib_encoder_select="deflate_wrapper" diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 5636fdef2d..b99f8be172 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -27,6 +27,7 @@ #include #include "libavutil/avassert.h" +#include "libavutil/bswapdsp.h" #include "libavutil/frame.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" @@ -34,7 +35,6 @@ #include "libavutil/thread.h" #include "avcodec.h" #include "blockdsp.h" -#include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" #include "decode.h" @@ -138,7 +138,7 @@ typedef struct CFrameBuffer { typedef struct FourXContext { AVCodecContext *avctx; BlockDSPContext bdsp; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; uint16_t *frame_buffer; uint16_t *last_frame_buffer; GetBitContext pre_gb; ///< ac/dc prefix @@ -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; @@ -1013,7 +1013,7 @@ static av_cold int decode_init(AVCodecContext *avctx) f->version = AV_RL32(avctx->extradata) >> 16; ff_blockdsp_init(&f->bdsp); - ff_bswapdsp_init(&f->bbdsp); + av_bswapdsp_init(&f->bbdsp); f->avctx = avctx; if (f->version > 2) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 98841ed07c..6b9b7a48dd 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -70,7 +70,6 @@ OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o OBJS-$(CONFIG_ATSC_A53) += atsc_a53.o OBJS-$(CONFIG_AUDIODSP) += audiodsp.o OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o -OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o OBJS-$(CONFIG_CABAC) += cabac.o OBJS-$(CONFIG_CBS) += cbs.o cbs_bsf.o OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 1f2949dcfd..218f4e96d2 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -31,13 +31,13 @@ #include #include +#include "libavutil/bswapdsp.h" #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/downmix_info.h" #include "libavutil/intmath.h" #include "libavutil/opt.h" #include "libavutil/thread.h" -#include "bswapdsp.h" #include "aac_ac3_parser.h" #include "ac3_parser_internal.h" #include "ac3dec.h" @@ -229,7 +229,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) return ret; AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256); - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); #if (USE_FIXED) s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & AV_CODEC_FLAG_BITEXACT); diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 138b462abb..8cd6d83e9a 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -51,6 +51,7 @@ #define AVCODEC_AC3DEC_H #include "libavutil/tx.h" +#include "libavutil/bswapdsp.h" #include "libavutil/float_dsp.h" #include "libavutil/fixed_dsp.h" #include "libavutil/lfg.h" @@ -59,7 +60,6 @@ #include "ac3.h" #include "ac3dsp.h" #include "avcodec.h" -#include "bswapdsp.h" #include "get_bits.h" #include "fmtconvert.h" @@ -228,7 +228,7 @@ typedef struct AC3DecodeContext { ///@} ///@name Optimization - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; #if USE_FIXED AVFixedDSPContext *fdsp; #else diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 4605b2248f..af41eda49f 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -32,12 +32,12 @@ #include "unary.h" #include "mpeg4audio.h" #include "bgmc.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "internal.h" #include "mlz.h" #include "libavutil/samplefmt.h" +#include "libavutil/bswapdsp.h" #include "libavutil/crc.h" #include "libavutil/softfloat_ieee754.h" #include "libavutil/intfloat.h" @@ -197,7 +197,7 @@ typedef struct ALSDecContext { AVCodecContext *avctx; ALSSpecificConfig sconf; GetBitContext gb; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; const AVCRC *crc_table; uint32_t crc_org; ///< CRC value of the original input data uint32_t crc; ///< CRC value calculated from decoded data @@ -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 { @@ -2164,7 +2164,7 @@ static av_cold int decode_init(AVCodecContext *avctx) } } - ff_bswapdsp_init(&ctx->bdsp); + av_bswapdsp_init(&ctx->bdsp); return 0; } diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index c08d13d6c2..7b9fa74416 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -23,12 +23,12 @@ #include #include "libavutil/avassert.h" +#include "libavutil/bswapdsp.h" #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/opt.h" #include "lossless_audiodsp.h" #include "avcodec.h" -#include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" #include "decode.h" @@ -153,7 +153,7 @@ typedef struct APEPredictor64 { typedef struct APEContext { AVClass *class; ///< class for AVOptions AVCodecContext *avctx; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; LLAudDSPContext adsp; int channels; int samples; ///< samples left to decode in current frame @@ -313,7 +313,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) s->predictor_decode_stereo = predictor_decode_stereo_3950; } - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); ff_llauddsp_init(&s->adsp); av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = (channels == 2) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO @@ -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/asv.c b/libavcodec/asv.c index 3aa08c30c0..bfe669d25e 100644 --- a/libavcodec/asv.c +++ b/libavcodec/asv.c @@ -26,10 +26,10 @@ #include #include "libavutil/attributes.h" +#include "libavutil/bswapdsp.h" #include "asv.h" #include "avcodec.h" -#include "bswapdsp.h" const uint8_t ff_asv_scantab[64] = { 0x00, 0x08, 0x01, 0x09, 0x10, 0x18, 0x11, 0x19, @@ -92,7 +92,7 @@ av_cold void ff_asv_common_init(AVCodecContext *avctx) { ASVCommonContext *const a = avctx->priv_data; - ff_bswapdsp_init(&a->bbdsp); + av_bswapdsp_init(&a->bbdsp); a->mb_width = (avctx->width + 15) / 16; a->mb_height = (avctx->height + 15) / 16; diff --git a/libavcodec/asv.h b/libavcodec/asv.h index 7c0983a497..f7e00d8ef2 100644 --- a/libavcodec/asv.h +++ b/libavcodec/asv.h @@ -29,11 +29,11 @@ #include #include "avcodec.h" -#include "bswapdsp.h" +#include "libavutil/bswapdsp.h" typedef struct ASVCommonContext { AVCodecContext *avctx; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; int mb_width; int mb_height; int mb_width2; 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/cllc.c b/libavcodec/cllc.c index 911717b68d..dede8591c5 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -22,8 +22,8 @@ #include +#include "libavutil/bswapdsp.h" #include "libavutil/intreadwrite.h" -#include "bswapdsp.h" #include "canopus.h" #include "get_bits.h" #include "avcodec.h" @@ -36,7 +36,7 @@ typedef struct CLLCContext { AVCodecContext *avctx; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; uint8_t *swapped_buf; int swapped_buf_size; @@ -486,7 +486,7 @@ static av_cold int cllc_decode_init(AVCodecContext *avctx) ctx->swapped_buf = NULL; ctx->swapped_buf_size = 0; - ff_bswapdsp_init(&ctx->bdsp); + av_bswapdsp_init(&ctx->bdsp); return 0; } diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 45012c62b8..0ffcd14105 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -28,12 +28,12 @@ * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_MAD */ +#include "libavutil/bswapdsp.h" #include "libavutil/mem_internal.h" #include "avcodec.h" #include "blockdsp.h" #include "bytestream.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" @@ -50,7 +50,7 @@ typedef struct MadContext { AVCodecContext *avctx; BlockDSPContext bdsp; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; AVFrame *last_frame; GetBitContext gb; void *bitstream_buf; @@ -67,7 +67,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_YUV420P; ff_blockdsp_init(&s->bdsp); - ff_bswapdsp_init(&s->bbdsp); + av_bswapdsp_init(&s->bbdsp); ff_mpeg12_init_vlcs(); s->last_frame = av_frame_alloc(); diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index e4f12b3db2..b1475b16c4 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -26,11 +26,11 @@ * @see http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TQI */ +#include "libavutil/bswapdsp.h" #include "libavutil/mem_internal.h" #include "avcodec.h" #include "blockdsp.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" @@ -43,7 +43,7 @@ typedef struct TqiContext { AVCodecContext *avctx; GetBitContext gb; BlockDSPContext bdsp; - BswapDSPContext bsdsp; + AVBSwapDSPContext bsdsp; void *bitstream_buf; unsigned int bitstream_buf_size; @@ -60,7 +60,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx) TqiContext *t = avctx->priv_data; ff_blockdsp_init(&t->bdsp); - ff_bswapdsp_init(&t->bsdsp); + av_bswapdsp_init(&t->bsdsp); avctx->framerate = (AVRational){ 15, 1 }; avctx->pix_fmt = AV_PIX_FMT_YUV420P; @@ -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/exr.c b/libavcodec/exr.c index 6a0af96ce4..e22045a1a9 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -47,7 +47,7 @@ #include "bytestream.h" #if HAVE_BIGENDIAN -#include "bswapdsp.h" +#include "libavutil/bswapdsp.h" #endif #include "codec_internal.h" @@ -150,7 +150,7 @@ typedef struct EXRContext { ExrDSPContext dsp; #if HAVE_BIGENDIAN - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; #endif enum ExrCompr compression; @@ -2224,7 +2224,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_exrdsp_init(&s->dsp); #if HAVE_BIGENDIAN - ff_bswapdsp_init(&s->bbdsp); + av_bswapdsp_init(&s->bbdsp); #endif trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type); diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index bca71b3780..1082910974 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -20,6 +20,7 @@ */ #include "libavutil/avassert.h" +#include "libavutil/bswapdsp.h" #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/intmath.h" @@ -27,7 +28,6 @@ #include "libavutil/opt.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "encode.h" #include "put_bits.h" @@ -123,7 +123,7 @@ typedef struct FlacEncodeContext { struct AVMD5 *md5ctx; uint8_t *md5_buffer; unsigned int md5_buffer_size; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; FLACEncDSPContext flac_dsp; int flushed; @@ -454,7 +454,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON); - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); ff_flacencdsp_init(&s->flac_dsp); dprint_compression_options(s); diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 4c4c46b602..33e24a5bfb 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -35,11 +35,11 @@ #define CACHED_BITSTREAM_READER HAVE_FAST_64BIT #define UNCHECKED_BITSTREAM_READER 1 +#include "libavutil/bswapdsp.h" #include "avcodec.h" #include "get_bits.h" #include "huffman.h" #include "bytestream.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "thread.h" @@ -51,7 +51,7 @@ */ typedef struct FrapsContext { AVCodecContext *avctx; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; uint8_t *tmpbuf; int tmpbuf_size; } FrapsContext; @@ -69,7 +69,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->avctx = avctx; s->tmpbuf = NULL; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); return 0; } @@ -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/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..e9cef539b2 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -27,6 +27,7 @@ #include "libavutil/attributes.h" #include "libavutil/avstring.h" +#include "libavutil/bswapdsp.h" #include "libavutil/common.h" #include "libavutil/display.h" #include "libavutil/film_grain_params.h" @@ -37,7 +38,6 @@ #include "libavutil/pixdesc.h" #include "libavutil/timecode.h" -#include "bswapdsp.h" #include "bytestream.h" #include "cabac_functions.h" #include "codec_internal.h" @@ -3527,7 +3527,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) if (!s->md5_ctx) return AVERROR(ENOMEM); - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); s->dovi_ctx.logctx = avctx; s->eos = 0; diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..f73ff352d1 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -25,11 +25,11 @@ #include +#include "libavutil/bswapdsp.h" #include "libavutil/buffer.h" #include "libavutil/mem_internal.h" #include "avcodec.h" -#include "bswapdsp.h" #include "cabac.h" #include "dovi_rpu.h" #include "get_bits.h" @@ -541,7 +541,7 @@ typedef struct HEVCContext { HEVCPredContext hpc; HEVCDSPContext hevcdsp; VideoDSPContext vdsp; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; H274FilmGrainDatabase h274db; int8_t *qp_y_tab; uint8_t *horizontal_bs; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 7d3515cc88..5d3c7a3828 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -35,13 +35,13 @@ #include "config_components.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "get_bits.h" #include "huffyuv.h" #include "huffyuvdsp.h" #include "lossless_videodsp.h" #include "thread.h" +#include "libavutil/bswapdsp.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" @@ -76,7 +76,7 @@ typedef struct HYuvDecContext { VLC vlc[8]; //Y,U,V,A,YY,YU,YV,AA uint8_t *bitstream_buffer; unsigned int bitstream_buffer_size; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; HuffYUVDSPContext hdsp; LLVidDSPContext llviddsp; } HYuvDecContext; @@ -340,7 +340,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->flags = avctx->flags; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); ff_huffyuvdsp_init(&s->hdsp, avctx->pix_fmt); ff_llviddsp_init(&s->llviddsp); memset(s->vlc, 0, 4 * sizeof(VLC)); @@ -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..6230e107a3 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -31,7 +31,6 @@ #include "config_components.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "encode.h" #include "huffyuv.h" @@ -39,6 +38,7 @@ #include "huffyuvencdsp.h" #include "lossless_videoencdsp.h" #include "put_bits.h" +#include "libavutil/bswapdsp.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" @@ -68,7 +68,7 @@ typedef struct HYuvEncContext { uint64_t stats[4][MAX_VLC_N]; uint8_t len[4][MAX_VLC_N]; uint32_t bits[4][MAX_VLC_N]; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; HuffYUVEncDSPContext hencdsp; LLVidEncDSPContext llvidencdsp; int non_determ; // non-deterministic, multi-threaded encoder allowed @@ -247,7 +247,7 @@ static av_cold int encode_init(AVCodecContext *avctx) s->avctx = avctx; s->flags = avctx->flags; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); ff_llvidencdsp_init(&s->llvidencdsp); @@ -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/imc.c b/libavcodec/imc.c index 174332de4d..185da01323 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -34,6 +34,7 @@ #include #include +#include "libavutil/bswapdsp.h" #include "libavutil/channel_layout.h" #include "libavutil/ffmath.h" #include "libavutil/float_dsp.h" @@ -43,7 +44,6 @@ #include "libavutil/tx.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" @@ -92,7 +92,7 @@ typedef struct IMCContext { GetBitContext gb; AVFloatDSPContext *fdsp; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; AVTXContext *mdct; av_tx_fn mdct_fn; float *out_samples; @@ -243,7 +243,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) if (ret < 0) return ret; - ff_bswapdsp_init(&q->bdsp); + av_bswapdsp_init(&q->bdsp); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c index ccec5dff43..ae391b343b 100644 --- a/libavcodec/imm4.c +++ b/libavcodec/imm4.c @@ -23,11 +23,11 @@ #include #include +#include "libavutil/bswapdsp.h" #include "libavutil/mem_internal.h" #include "libavutil/thread.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "copy_block.h" @@ -40,7 +40,7 @@ #define BLOCK_VLC_BITS 12 typedef struct IMM4Context { - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; GetBitContext gb; AVFrame *prev_frame; @@ -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; @@ -495,7 +495,7 @@ static av_cold int decode_init(AVCodecContext *avctx) static AVOnce init_static_once = AV_ONCE_INIT; IMM4Context *s = avctx->priv_data; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); ff_idctdsp_init(&s->idsp, avctx); s->prev_frame = av_frame_alloc(); diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 640b671a0f..269a3afdfe 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -27,11 +27,11 @@ * This is very similar to intra-only MPEG-1. */ +#include "libavutil/bswapdsp.h" #include "libavutil/mem_internal.h" #include "avcodec.h" #include "blockdsp.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "idctdsp.h" #include "mpeg12data.h" @@ -41,7 +41,7 @@ typedef struct MDECContext { AVCodecContext *avctx; BlockDSPContext bdsp; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; IDCTDSPContext idsp; GetBitContext gb; uint8_t permutated_scantable[64]; @@ -219,7 +219,7 @@ static av_cold int decode_init(AVCodecContext *avctx) a->avctx = avctx; ff_blockdsp_init(&a->bdsp); - ff_bswapdsp_init(&a->bbdsp); + av_bswapdsp_init(&a->bbdsp); ff_idctdsp_init(&a->idsp, avctx); ff_mpeg12_init_vlcs(); ff_permute_scantable(a->permutated_scantable, ff_zigzag_direct, diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 891471b30e..333085f8f3 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -21,6 +21,7 @@ #include +#include "libavutil/bswapdsp.h" #include "libavutil/mem_internal.h" #include "libavutil/thread.h" @@ -30,7 +31,6 @@ #include "decode.h" #include "get_bits.h" #include "bytestream.h" -#include "bswapdsp.h" #include "hpeldsp.h" #include "idctdsp.h" #include "thread.h" @@ -58,7 +58,7 @@ typedef struct MimicContext { GetBitContext gb; uint8_t permutated_scantable[64]; BlockDSPContext bdsp; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; HpelDSPContext hdsp; IDCTDSPContext idsp; @@ -134,7 +134,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) ctx->cur_index = 15; ff_blockdsp_init(&ctx->bdsp); - ff_bswapdsp_init(&ctx->bbdsp); + av_bswapdsp_init(&ctx->bbdsp); ff_hpeldsp_init(&ctx->hdsp, avctx->flags); ff_idctdsp_init(&ctx->idsp, avctx); ff_permute_scantable(ctx->permutated_scantable, col_zag, ctx->idsp.idct_permutation); @@ -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/mobiclip.c b/libavcodec/mobiclip.c index c3b2383dbc..79c6953ee4 100644 --- a/libavcodec/mobiclip.c +++ b/libavcodec/mobiclip.c @@ -24,10 +24,10 @@ #include #include "libavutil/avassert.h" +#include "libavutil/bswapdsp.h" #include "libavutil/thread.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" @@ -271,7 +271,7 @@ typedef struct MobiClipContext { MotionXY *motion; int motion_size; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; } MobiClipContext; static VLC rl_vlc[2]; @@ -310,7 +310,7 @@ static av_cold int mobiclip_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); avctx->pix_fmt = AV_PIX_FMT_YUV420P; diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 4141c5a495..04a56a379c 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -19,13 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/bswapdsp.h" #include "libavutil/thread.h" #include "config.h" #include "avcodec.h" #include "get_bits.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" @@ -41,7 +41,7 @@ typedef struct HuffCode { typedef struct MotionPixelsContext { AVCodecContext *avctx; AVFrame *frame; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; uint8_t *changes_map; int offset_bits_len; int codes_count, current_codes_count; @@ -80,7 +80,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) } mp->avctx = avctx; - ff_bswapdsp_init(&mp->bdsp); + av_bswapdsp_init(&mp->bdsp); mp->changes_map = av_calloc(avctx->width, h4); mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1; mp->vpt = av_calloc(avctx->height, sizeof(*mp->vpt)); @@ -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/mpc.h b/libavcodec/mpc.h index cef8db4899..c736a84088 100644 --- a/libavcodec/mpc.h +++ b/libavcodec/mpc.h @@ -31,10 +31,10 @@ #include +#include "libavutil/bswapdsp.h" #include "libavutil/lfg.h" #include "libavutil/mem_internal.h" -#include "bswapdsp.h" #include "mpegaudio.h" #include "mpegaudiodsp.h" @@ -52,7 +52,7 @@ typedef struct Band { }Band; typedef struct MPCContext { - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; MPADSPContext mpadsp; int IS, MSS, gapless; int lastframelen; diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index d2745366c2..9b7af9a01f 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -91,9 +91,9 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_lfg_init(&c->rnd, 0xDEADBEEF); - ff_bswapdsp_init(&c->bdsp); + av_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,8 +211,8 @@ 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, - buf_size >> 2); + 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; skip_bits_long(&gb, skip); diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 72cdd13916..0fc25cac04 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -25,13 +25,13 @@ */ #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" #include "internal.h" #include "raw.h" #include "libavutil/avassert.h" +#include "libavutil/bswapdsp.h" #include "libavutil/buffer.h" #include "libavutil/common.h" #include "libavutil/intreadwrite.h" @@ -52,7 +52,7 @@ typedef struct RawVideoContext { int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16 int tff; - BswapDSPContext bbdsp; + AVBSwapDSPContext bbdsp; void *bitstream_buf; unsigned int bitstream_buf_size; } RawVideoContext; @@ -73,7 +73,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) RawVideoContext *context = avctx->priv_data; const AVPixFmtDescriptor *desc; - ff_bswapdsp_init(&context->bbdsp); + av_bswapdsp_init(&context->bbdsp); if ( avctx->codec_tag == MKTAG('r','a','w',' ') || avctx->codec_tag == MKTAG('N','O','1','6')) @@ -324,7 +324,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/Makefile b/libavcodec/riscv/Makefile index 965942f4df..212ab3dc13 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -5,9 +5,6 @@ RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \ riscv/audiodsp_rvf.o RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o -OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o \ - riscv/bswapdsp_rvb.o -RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 1b2abd76b1..6385821ca1 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -25,9 +25,10 @@ * @author Jeff Muizelaar */ +#include "libavutil/bswapdsp.h" + #include #include "avcodec.h" -#include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" #include "decode.h" @@ -112,7 +113,7 @@ typedef struct ShortenContext { int got_header; int got_quit_command; int swap; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; } ShortenContext; static av_cold int shorten_decode_init(AVCodecContext *avctx) @@ -120,7 +121,7 @@ static av_cold int shorten_decode_init(AVCodecContext *avctx) ShortenContext *s = avctx->priv_data; s->avctx = avctx; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); return 0; } diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b168b9cda1..7b6db4d9d5 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -26,8 +26,9 @@ #include +#include "libavutil/bswapdsp.h" + #include "avcodec.h" -#include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" #include "decode.h" @@ -65,7 +66,7 @@ typedef struct TM2Context { GetBitContext gb; int error; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; uint8_t *buffer; int buffer_size; @@ -907,8 +908,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; @@ -960,7 +961,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if (!l->pic) return AVERROR(ENOMEM); - ff_bswapdsp_init(&l->bdsp); + av_bswapdsp_init(&l->bdsp); l->last = av_malloc_array(w, 2 * sizeof(*l->last)); if (!l->last) diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 454121cc75..06a76fe0db 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/bswapdsp.h" #include "libavutil/channel_layout.h" #include "libavutil/mem_internal.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "decode.h" #include "get_bits.h" @@ -38,7 +38,7 @@ * TrueSpeech decoder context */ typedef struct TSContext { - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; /* input data */ DECLARE_ALIGNED(16, uint8_t, buffer)[32]; int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3 @@ -73,7 +73,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx) avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - ff_bswapdsp_init(&c->bdsp); + av_bswapdsp_init(&c->bdsp); return 0; } @@ -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/utvideo.h b/libavcodec/utvideo.h index 9da9329ff3..2ccd088c47 100644 --- a/libavcodec/utvideo.h +++ b/libavcodec/utvideo.h @@ -27,9 +27,9 @@ * Common Ut Video header */ +#include "libavutil/bswapdsp.h" #include "libavutil/common.h" #include "avcodec.h" -#include "bswapdsp.h" #include "utvideodsp.h" #include "lossless_videodsp.h" #include "lossless_videoencdsp.h" @@ -65,7 +65,7 @@ typedef struct UtvideoContext { const AVClass *class; AVCodecContext *avctx; UTVideoDSPContext utdsp; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; LLVidDSPContext llviddsp; LLVidEncDSPContext llvidencdsp; diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 83120d1b22..dcf09b56c6 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -30,10 +30,10 @@ #define CACHED_BITSTREAM_READER !ARCH_X86_32 #define UNCHECKED_BITSTREAM_READER 1 +#include "libavutil/bswapdsp.h" #include "libavutil/intreadwrite.h" #include "libavutil/pixdesc.h" #include "avcodec.h" -#include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" #include "get_bits.h" @@ -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; @@ -887,7 +887,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; ff_utvideodsp_init(&c->utdsp); - ff_bswapdsp_init(&c->bdsp); + av_bswapdsp_init(&c->bdsp); ff_llviddsp_init(&c->llviddsp); c->slice_bits_size = 0; diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index d4388da8ba..de9ea8c135 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -24,6 +24,7 @@ * Ut Video encoder */ +#include "libavutil/bswapdsp.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" @@ -31,7 +32,6 @@ #include "avcodec.h" #include "codec_internal.h" #include "encode.h" -#include "bswapdsp.h" #include "bytestream.h" #include "put_bits.h" #include "mathops.h" @@ -132,7 +132,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - ff_bswapdsp_init(&c->bdsp); + av_bswapdsp_init(&c->bdsp); ff_llvidencdsp_init(&c->llvidencdsp); if (c->frame_pred == PRED_GRADIENT) { @@ -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/Makefile b/libavcodec/x86/Makefile index 6f62878081..ad0f54be3c 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -4,7 +4,6 @@ OBJS += x86/constants.o \ OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp_init.o -OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp_init.o OBJS-$(CONFIG_DCT) += x86/dct_init.o OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_init.o \ x86/dirac_dwt_init.o @@ -98,7 +97,6 @@ X86ASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o \ x86/ac3dsp_downmix.o X86ASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o X86ASM-OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp.o -X86ASM-OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp.o X86ASM-OBJS-$(CONFIG_DCT) += x86/dct32.o X86ASM-OBJS-$(CONFIG_FFT) += x86/fft.o X86ASM-OBJS-$(CONFIG_FMTCONVERT) += x86/fmtconvert.o diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index 29c10f05da..7a90e2e5f1 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -22,11 +22,11 @@ #define YLC_VLC_BITS 10 +#include "libavutil/bswapdsp.h" #include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/pixfmt.h" #include "avcodec.h" -#include "bswapdsp.h" #include "codec_internal.h" #include "get_bits.h" #include "thread.h" @@ -37,7 +37,7 @@ typedef struct YLCContext { uint32_t table[256]; uint8_t *buffer; int buffer_size; - BswapDSPContext bdsp; + AVBSwapDSPContext bdsp; } YLCContext; static av_cold int decode_init(AVCodecContext *avctx) @@ -45,7 +45,7 @@ static av_cold int decode_init(AVCodecContext *avctx) YLCContext *s = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_YUYV422; - ff_bswapdsp_init(&s->bdsp); + av_bswapdsp_init(&s->bdsp); return 0; } @@ -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/libavutil/Makefile b/libavutil/Makefile index 3d9c07aea8..bff5dbc7d9 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -13,6 +13,7 @@ HEADERS = adler32.h \ blowfish.h \ bprint.h \ bswap.h \ + bswapdsp.h \ buffer.h \ cast5.h \ camellia.h \ @@ -108,6 +109,7 @@ OBJS = adler32.o \ base64.o \ blowfish.o \ bprint.o \ + bswapdsp.o \ buffer.o \ cast5.o \ camellia.o \ diff --git a/libavcodec/bswapdsp.c b/libavutil/bswapdsp.c similarity index 80% rename from libavcodec/bswapdsp.c rename to libavutil/bswapdsp.c index f0ea2b55c5..e85cdfe5d7 100644 --- a/libavcodec/bswapdsp.c +++ b/libavutil/bswapdsp.c @@ -18,15 +18,18 @@ #include -#include "libavutil/attributes.h" -#include "libavutil/bswap.h" +#include "attributes.h" +#include "bswap.h" #include "bswapdsp.h" -static void bswap_buf(uint32_t *dst, const uint32_t *src, int w) +void ff_bswapdsp_init_riscv(AVBSwapDSPContext *c); +void ff_bswapdsp_init_x86(AVBSwapDSPContext *c); + +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 +39,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]); } @@ -46,9 +49,9 @@ static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len) *dst++ = av_bswap16(*src++); } -av_cold void ff_bswapdsp_init(BswapDSPContext *c) +av_cold void av_bswapdsp_init(AVBSwapDSPContext *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/libavutil/bswapdsp.h similarity index 71% rename from libavcodec/bswapdsp.h rename to libavutil/bswapdsp.h index 6f4db66115..b540560d6a 100644 --- a/libavcodec/bswapdsp.h +++ b/libavutil/bswapdsp.h @@ -16,18 +16,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_BSWAPDSP_H -#define AVCODEC_BSWAPDSP_H +#ifndef AVUTIL_BSWAPDSP_H +#define AVUTIL_BSWAPDSP_H #include -typedef struct BswapDSPContext { - void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w); +typedef struct AVBSwapDSPContext { + 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; +} AVBSwapDSPContext; -void ff_bswapdsp_init(BswapDSPContext *c); -void ff_bswapdsp_init_riscv(BswapDSPContext *c); -void ff_bswapdsp_init_x86(BswapDSPContext *c); +void av_bswapdsp_init(AVBSwapDSPContext *c); -#endif /* AVCODEC_BSWAPDSP_H */ +#endif /* AVUTIL_BSWAPDSP_H */ diff --git a/libavutil/riscv/Makefile b/libavutil/riscv/Makefile index 1597154ba5..525538f6b6 100644 --- a/libavutil/riscv/Makefile +++ b/libavutil/riscv/Makefile @@ -1,5 +1,8 @@ -OBJS += riscv/float_dsp_init.o \ +OBJS += riscv/bswapdsp_init.o \ + riscv/bswapdsp_rvb.o \ + riscv/float_dsp_init.o \ riscv/fixed_dsp_init.o \ riscv/cpu.o -RVV-OBJS += riscv/float_dsp_rvv.o \ +RVV-OBJS += riscv/bswapdsp_rvv.o \ + riscv/float_dsp_rvv.o \ riscv/fixed_dsp_rvv.o diff --git a/libavcodec/riscv/bswapdsp_init.c b/libavutil/riscv/bswapdsp_init.c similarity index 85% rename from libavcodec/riscv/bswapdsp_init.c rename to libavutil/riscv/bswapdsp_init.c index abe84ec1f7..362d574a27 100644 --- a/libavcodec/riscv/bswapdsp_init.c +++ b/libavutil/riscv/bswapdsp_init.c @@ -22,24 +22,25 @@ #include "config.h" #include "libavutil/attributes.h" +#include "libavutil/bswapdsp.h" #include "libavutil/cpu.h" -#include "libavcodec/bswapdsp.h" void ff_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len); void ff_bswap32_buf_rvv(uint32_t *dst, const uint32_t *src, int len); void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len); +void ff_bswapdsp_init_riscv(AVBSwapDSPContext *c); -av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) +av_cold void ff_bswapdsp_init_riscv(AVBSwapDSPContext *c) { int cpu_flags = av_get_cpu_flags(); #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/riscv/bswapdsp_rvb.S b/libavutil/riscv/bswapdsp_rvb.S similarity index 100% rename from libavcodec/riscv/bswapdsp_rvb.S rename to libavutil/riscv/bswapdsp_rvb.S diff --git a/libavcodec/riscv/bswapdsp_rvv.S b/libavutil/riscv/bswapdsp_rvv.S similarity index 100% rename from libavcodec/riscv/bswapdsp_rvv.S rename to libavutil/riscv/bswapdsp_rvv.S diff --git a/libavutil/version.h b/libavutil/version.h index 3b616ea489..60f96af5df 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 43 +#define LIBAVUTIL_VERSION_MINOR 44 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile index d66839e35d..40bac784d1 100644 --- a/libavutil/x86/Makefile +++ b/libavutil/x86/Makefile @@ -4,14 +4,16 @@ OBJS += x86/cpu.o \ x86/imgutils_init.o \ x86/lls_init.o \ -OBJS-$(HAVE_X86ASM) += x86/tx_float_init.o \ +OBJS-$(HAVE_X86ASM) += x86/bswapdsp_init.o \ + x86/tx_float_init.o OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils_init.o \ EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o -X86ASM-OBJS += x86/cpuid.o \ - $(EMMS_OBJS__yes_) \ +X86ASM-OBJS += x86/bswapdsp.o \ + x86/cpuid.o \ + $(EMMS_OBJS__yes_) \ x86/fixed_dsp.o \ x86/float_dsp.o \ x86/imgutils.o \ diff --git a/libavcodec/x86/bswapdsp.asm b/libavutil/x86/bswapdsp.asm similarity index 97% rename from libavcodec/x86/bswapdsp.asm rename to libavutil/x86/bswapdsp.asm index 31c6c48a21..c3bb90c2be 100644 --- a/libavcodec/x86/bswapdsp.asm +++ b/libavutil/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 @@ -99,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 len); %macro BSWAP32_BUF 0 %if cpuflag(ssse3)||cpuflag(avx2) cglobal bswap32_buf, 3,4,3 diff --git a/libavcodec/x86/bswapdsp_init.c b/libavutil/x86/bswapdsp_init.c similarity index 80% rename from libavcodec/x86/bswapdsp_init.c rename to libavutil/x86/bswapdsp_init.c index 877bab1a2c..3694e9208c 100644 --- a/libavcodec/x86/bswapdsp_init.c +++ b/libavutil/x86/bswapdsp_init.c @@ -19,22 +19,23 @@ #include #include "libavutil/attributes.h" +#include "libavutil/bswapdsp.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" -#include "libavcodec/bswapdsp.h" -void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w); -void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w); -void ff_bswap32_buf_avx2(uint32_t *dst, const uint32_t *src, int w); +void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int len); +void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int len); +void ff_bswap32_buf_avx2(uint32_t *dst, const uint32_t *src, int len); +void ff_bswapdsp_init_x86(AVBSwapDSPContext *c); -av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c) +av_cold void ff_bswapdsp_init_x86(AVBSwapDSPContext *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/tests/checkasm/Makefile b/tests/checkasm/Makefile index a6f06c7007..1bfaea0e9b 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -2,7 +2,6 @@ # subsystems AVCODECOBJS-$(CONFIG_AUDIODSP) += audiodsp.o AVCODECOBJS-$(CONFIG_BLOCKDSP) += blockdsp.o -AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o AVCODECOBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o AVCODECOBJS-$(CONFIG_G722DSP) += g722dsp.o AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o @@ -59,6 +58,7 @@ CHECKASMOBJS-$(CONFIG_SWSCALE) += $(SWSCALEOBJS) AVUTILOBJS += av_tx.o AVUTILOBJS += fixed_dsp.o AVUTILOBJS += float_dsp.o +AVUTILOBJS += bswapdsp.o CHECKASMOBJS-$(CONFIG_AVUTIL) += $(AVUTILOBJS) diff --git a/tests/checkasm/bswapdsp.c b/tests/checkasm/bswapdsp.c index d789e90de3..f8dc50be33 100644 --- a/tests/checkasm/bswapdsp.c +++ b/tests/checkasm/bswapdsp.c @@ -20,7 +20,7 @@ #include #include "checkasm.h" -#include "libavcodec/bswapdsp.h" +#include "libavutil/bswapdsp.h" #include "libavutil/common.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" @@ -63,11 +63,11 @@ void checkasm_check_bswapdsp(void) LOCAL_ALIGNED_16(uint8_t, src1, [BUF_SIZE]); LOCAL_ALIGNED_16(uint8_t, dst0, [BUF_SIZE]); LOCAL_ALIGNED_16(uint8_t, dst1, [BUF_SIZE]); - BswapDSPContext h; + AVBSwapDSPContext h; - ff_bswapdsp_init(&h); + av_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")) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e96d84a7da..32657b6c2d 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -87,9 +87,6 @@ static const struct { #if CONFIG_BLOCKDSP { "blockdsp", checkasm_check_blockdsp }, #endif - #if CONFIG_BSWAPDSP - { "bswapdsp", checkasm_check_bswapdsp }, - #endif #if CONFIG_DCA_DECODER { "synth_filter", checkasm_check_synth_filter }, #endif @@ -207,6 +204,7 @@ static const struct { { "sw_scale", checkasm_check_sw_scale }, #endif #if CONFIG_AVUTIL + { "bswapdsp", checkasm_check_bswapdsp }, { "fixed_dsp", checkasm_check_fixed_dsp }, { "float_dsp", checkasm_check_float_dsp }, { "av_tx", checkasm_check_av_tx },