From patchwork Sat Oct 1 15:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38494 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp350922pzh; Sat, 1 Oct 2022 08:44:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yyTLIb0o+FkQdULpBit95MldSkVvzftxrbYdDSJnvl4mmDfrCBEdTAirlVt4anKk0NkS/ X-Received: by 2002:a17:906:5a54:b0:78a:6e87:5587 with SMTP id my20-20020a1709065a5400b0078a6e875587mr341359ejc.545.1664639054935; Sat, 01 Oct 2022 08:44:14 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f16-20020a056402355000b00456f89d82b0si4396597edd.252.2022.10.01.08.44.14; Sat, 01 Oct 2022 08:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=Rb2A18vU; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3C3B68BAEF; Sat, 1 Oct 2022 18:44:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064068.outbound.protection.outlook.com [40.92.64.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E65C68BA9B for ; Sat, 1 Oct 2022 18:44:04 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D+pGgjqzGjVv+VPgdwm+qoCG4GTSeizL/ps1TXi4O2hlKBHOWnKBupSSJ5S3bZ6aJWlczaR3EFELV5jJ4H/jzjzcZ4ZLC6E37grKv8xv6y8LHNB1nH4VBJutDOTOGhtbVF1ym4HI472QKa8OT5S8LqDCWsxZRmHxye8GAcSlQJDP6sNB8y6CHvg9jR+eTSZ0DeaPW7oGQPa1ANRy2zM5ntM3w40OfNspBozUsIa2Uyv6lFUXgxSQPy7fAC+iNCOdfeMwLFQfXAe8SYdajPNV72KgSkzcybjBCmC4tAWGVi0sLheHFlsAFrCbP/lHbuaJrRj8Jgg2v6Nccgo5LJvzuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MgXqIsKvyzlK/oIr6hAplrSBwy32hVb3Gtv31f1OZJ8=; b=B6cTsqILnhSFXvvx3Q9Ip0EdUWXsOnq94ahkg6NMEW59cJLG2IFcQMvA86UNO873Orx9yvf1quytI48eZQ/nY43BFEUrunds2Z7eN9JmEIoDSrQTPfch1kaacq0H+Gr/Gm5iLtNX8Kd7inhTL6hIPXa0S9bcdjTudAVFFGvx8j0nFIlOopqFe6EM8zRhE4+r4SE4wcz5KgFERZnKTqQiWkS5dOI4VzlUZM7PfGA3JD9vE+MsMdu4EMMt+BhozKUQPqXfDzziEN3fbn2pt+bLf0j7nfDayX/Q6s+ER7tlhNnCi+dzgbYhg6VNbxkr0kgFcQn8t5ftTti2czbffaJL6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MgXqIsKvyzlK/oIr6hAplrSBwy32hVb3Gtv31f1OZJ8=; b=Rb2A18vUC8/lkH+f990f4slRhAjRYoBUj6c8Kb7FA9s65OpC4LuvWb9vyTHkyrhm+jjeticVBq25f7YMpOOBVwN/qEU1GzZ3sEivBdQprsljg35M2/SORf4sdY0K2mpEBtIFY0B73JtLGU+7OuIua+VhlGm3/6hK7x/bO3TK0FTkV/IuHG+Iyisw4w1/oC/gM2fCEMlT41r6NVMW3QTvR12Paj1/egvSZQUssM/VKr6ATiGv4ruBZD6cxDqNMTEl6l+TR5qEcrJKwD/glrK71BgBaqyBq6YZKF4nbg222HxgYAAhx3QALCu9CO4Pz/BBS7ivuOHHfBnNt2GjlRzUJw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0037.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Sat, 1 Oct 2022 15:44:02 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5676.023; Sat, 1 Oct 2022 15:44:02 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 1 Oct 2022 17:44:02 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [bkvE3RBSU3c6Em/iYAZT+tSNkKxkD4pQNsk8W1PtbEY=] X-ClientProxiedBy: ZR2P278CA0002.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::7) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221001154402.4133103-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0037:EE_ X-MS-Office365-Filtering-Correlation-Id: c70cd694-b5d6-471a-dd42-08daa3c3c3cb X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nPH8ePuXi+6RRET7ofC7u6H6FGSjJhJ3FzLKuHRh4TIJ9pBA/11ZGF5DU4GkkztANzZxD3/eajBlTcJzUc8JcX3HJDhhDmLB7hryB3A4F20jXOsJ+3rTlrDKpcT/3igjCtwSVykJiPEYyA3VtP4Dwa6dXuE4TYhC/9G4XsT2cVnN28Rk/lDkW7OCjL7gsJUxaWopdegdE3tlliLMYSYBUs2KxMkfathRmoBgGtvbq5Pps+NGhi87Luh+WGizMhqfcvE+IHylc3yG47SIoKeCDbCPmRrfdccjCYHLGQJjOZ+g/zzIu0BbFuLPMQSOm7wtTPFIp+W5GXSe3vJa5y2Buk0EO2nK7KM1MnKNNDTt3zOYaRiLLiyc9rsQ8gNAYZ9bT22ntQP1wt1LAHq5XNXChYeNNJ0RWNov040CTznmdxuo/c7OjQf2ejtJ1w0evjLYRgG9gfoGpSE1+Lj4Ic6oUfX7ZDfWIGfUY8edFe1RYx0iB5CTldBSaB/U3JmZNkNr3P+0eUoz7+i7kII6XOQaOp0d9i6KpllTDKs6Sx21dEu21OGXbiI7OEdxSTiQsHqfRPzvQAOVsF7qVNhj74kJi0FTH+Ts7m8irw53QiHeD7tZSiaGwjCvERCc7kQTkd4Z8E9K+F1ZWBxkwa4kVPYbu35GS2rUaxR17TM43y2IJN5EAQ9rzoM+ih0M25Qfjw7Wedzgmn+pVlsq+DJy0VmPTdqJCGpFUu46MC+Bobb4IdOmZ7Jl6JHoVo7itcZvBe+ZLHJNGzcB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CMaUVAcFAxXlXqKdDoV1 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c70cd694-b5d6-471a-dd42-08daa3c3c3cb X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2022 15:44:02.7556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P250MB0037 Subject: [FFmpeg-devel] [PATCH] avcodec/asv: Split ASV1Context into decoder and encoder contexts X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GGcrSrz5XT7g A lot of the stuff in ASV1Context is actually only used by decoders or encoders, but not both: Of the seven contexts in ASV1Context, only the BswapDSPContext is used by both. So splitting makes sense. Signed-off-by: Andreas Rheinhardt --- libavcodec/asv.c | 4 ++- libavcodec/asv.h | 25 ++-------------- libavcodec/asvdec.c | 72 ++++++++++++++++++++++++++++----------------- libavcodec/asvenc.c | 69 ++++++++++++++++++++++++++----------------- 4 files changed, 92 insertions(+), 78 deletions(-) diff --git a/libavcodec/asv.c b/libavcodec/asv.c index dcae90982a..3aa08c30c0 100644 --- a/libavcodec/asv.c +++ b/libavcodec/asv.c @@ -25,6 +25,8 @@ #include +#include "libavutil/attributes.h" + #include "asv.h" #include "avcodec.h" #include "bswapdsp.h" @@ -88,7 +90,7 @@ const uint16_t ff_asv2_level_tab[63][2] = { av_cold void ff_asv_common_init(AVCodecContext *avctx) { - ASV1Context *const a = avctx->priv_data; + ASVCommonContext *const a = avctx->priv_data; ff_bswapdsp_init(&a->bbdsp); diff --git a/libavcodec/asv.h b/libavcodec/asv.h index 269bbe7c18..7c0983a497 100644 --- a/libavcodec/asv.h +++ b/libavcodec/asv.h @@ -28,38 +28,17 @@ #include -#include "libavutil/mem_internal.h" - #include "avcodec.h" -#include "blockdsp.h" #include "bswapdsp.h" -#include "fdctdsp.h" -#include "idctdsp.h" -#include "get_bits.h" -#include "pixblockdsp.h" -#include "put_bits.h" -typedef struct ASV1Context { +typedef struct ASVCommonContext { AVCodecContext *avctx; - BlockDSPContext bdsp; BswapDSPContext bbdsp; - FDCTDSPContext fdsp; - IDCTDSPContext idsp; - PixblockDSPContext pdsp; - PutBitContext pb; - GetBitContext gb; - ScanTable scantable; - int inv_qscale; int mb_width; int mb_height; int mb_width2; int mb_height2; - DECLARE_ALIGNED(32, int16_t, block)[6][64]; - uint16_t intra_matrix[64]; - int q_intra_matrix[64]; - uint8_t *bitstream_buffer; - unsigned int bitstream_buffer_size; -} ASV1Context; +} ASVCommonContext; extern const uint8_t ff_asv_scantab[64]; extern const uint8_t ff_asv_ccp_tab[17][2]; diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 4ca370d1ec..81260058fc 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -25,6 +25,7 @@ #include "libavutil/attributes.h" #include "libavutil/mem.h" +#include "libavutil/mem_internal.h" #include "libavutil/thread.h" #include "asv.h" @@ -33,6 +34,7 @@ #include "codec_internal.h" #include "config_components.h" #include "decode.h" +#include "get_bits.h" #include "idctdsp.h" #include "mpeg12data.h" @@ -48,6 +50,20 @@ static VLC dc_ccp_vlc; static VLC ac_ccp_vlc; static VLC asv2_level_vlc; +typedef struct ASVDecContext { + ASVCommonContext c; + + GetBitContext gb; + + BlockDSPContext bdsp; + IDCTDSPContext idsp; + ScanTable scantable; + DECLARE_ALIGNED(32, int16_t, block)[6][64]; + uint16_t intra_matrix[64]; + uint8_t *bitstream_buffer; + unsigned int bitstream_buffer_size; +} ASVDecContext; + static av_cold void init_vlcs(void) { INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, @@ -106,7 +122,7 @@ static inline int asv2_get_level(GetBitContext *gb) return code - 31; } -static inline int asv1_decode_block(ASV1Context *a, int16_t block[64]) +static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64]) { int i; @@ -119,7 +135,7 @@ static inline int asv1_decode_block(ASV1Context *a, int16_t block[64]) if (ccp == 16) break; if (ccp < 0 || i >= 10) { - av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n"); + av_log(a->c.avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n"); return AVERROR_INVALIDDATA; } @@ -137,7 +153,7 @@ static inline int asv1_decode_block(ASV1Context *a, int16_t block[64]) return 0; } -static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) +static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64]) { int i, count, ccp; @@ -173,13 +189,13 @@ static inline int asv2_decode_block(ASV1Context *a, int16_t block[64]) return 0; } -static inline int decode_mb(ASV1Context *a, int16_t block[6][64]) +static inline int decode_mb(ASVDecContext *a, int16_t block[6][64]) { int i, ret; a->bdsp.clear_blocks(block[0]); - if (a->avctx->codec_id == AV_CODEC_ID_ASV1) { + if (a->c.avctx->codec_id == AV_CODEC_ID_ASV1) { for (i = 0; i < 6; i++) { if ((ret = asv1_decode_block(a, block[i])) < 0) return ret; @@ -193,7 +209,7 @@ static inline int decode_mb(ASV1Context *a, int16_t block[6][64]) return 0; } -static inline void idct_put(ASV1Context *a, AVFrame *frame, int mb_x, int mb_y) +static inline void idct_put(ASVDecContext *a, AVFrame *frame, int mb_x, int mb_y) { int16_t(*block)[64] = a->block; int linesize = frame->linesize[0]; @@ -207,7 +223,7 @@ static inline void idct_put(ASV1Context *a, AVFrame *frame, int mb_x, int mb_y) a->idsp.idct_put(dest_y + 8 * linesize, linesize, block[2]); a->idsp.idct_put(dest_y + 8 * linesize + 8, linesize, block[3]); - if (!(a->avctx->flags & AV_CODEC_FLAG_GRAY)) { + if (!(a->c.avctx->flags & AV_CODEC_FLAG_GRAY)) { a->idsp.idct_put(dest_cb, frame->linesize[1], block[4]); a->idsp.idct_put(dest_cr, frame->linesize[2], block[5]); } @@ -216,12 +232,13 @@ static inline void idct_put(ASV1Context *a, AVFrame *frame, int mb_x, int mb_y) static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt) { - ASV1Context *const a = avctx->priv_data; + ASVDecContext *const a = avctx->priv_data; + const ASVCommonContext *const c = &a->c; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - int mb_x, mb_y, ret; + int ret; - if (buf_size * 8LL < a->mb_height * a->mb_width * 13LL) + if (buf_size * 8LL < c->mb_height * c->mb_width * 13LL) return AVERROR_INVALIDDATA; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) @@ -235,7 +252,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (!a->bitstream_buffer) return AVERROR(ENOMEM); - a->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer, + c->bbdsp.bswap_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 { @@ -244,8 +261,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (ret < 0) return ret; - for (mb_y = 0; mb_y < a->mb_height2; mb_y++) { - for (mb_x = 0; mb_x < a->mb_width2; mb_x++) { + for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) { + for (int mb_x = 0; mb_x < c->mb_width2; mb_x++) { if ((ret = decode_mb(a, a->block)) < 0) return ret; @@ -253,9 +270,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, } } - if (a->mb_width2 != a->mb_width) { - mb_x = a->mb_width2; - for (mb_y = 0; mb_y < a->mb_height2; mb_y++) { + if (c->mb_width2 != c->mb_width) { + int mb_x = c->mb_width2; + for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) { if ((ret = decode_mb(a, a->block)) < 0) return ret; @@ -263,9 +280,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, } } - if (a->mb_height2 != a->mb_height) { - mb_y = a->mb_height2; - for (mb_x = 0; mb_x < a->mb_width; mb_x++) { + if (c->mb_height2 != c->mb_height) { + int mb_y = c->mb_height2; + for (int mb_x = 0; mb_x < c->mb_width; mb_x++) { if ((ret = decode_mb(a, a->block)) < 0) return ret; @@ -283,8 +300,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, static av_cold int decode_init(AVCodecContext *avctx) { static AVOnce init_static_once = AV_ONCE_INIT; - ASV1Context *const a = avctx->priv_data; + ASVDecContext *const a = avctx->priv_data; const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; + int inv_qscale; int i; if (avctx->extradata_size < 1) { @@ -297,19 +315,19 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab); avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if (avctx->extradata_size < 1 || (a->inv_qscale = avctx->extradata[0]) == 0) { + if (avctx->extradata_size < 1 || (inv_qscale = avctx->extradata[0]) == 0) { av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n"); if (avctx->codec_id == AV_CODEC_ID_ASV1) - a->inv_qscale = 6; + inv_qscale = 6; else - a->inv_qscale = 10; + inv_qscale = 10; } for (i = 0; i < 64; i++) { int index = ff_asv_scantab[i]; a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] / - a->inv_qscale; + inv_qscale; } ff_thread_once(&init_static_once, init_vlcs); @@ -319,7 +337,7 @@ static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx) { - ASV1Context *const a = avctx->priv_data; + ASVDecContext *const a = avctx->priv_data; av_freep(&a->bitstream_buffer); a->bitstream_buffer_size = 0; @@ -333,7 +351,7 @@ const FFCodec ff_asv1_decoder = { CODEC_LONG_NAME("ASUS V1"), .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_ASV1, - .priv_data_size = sizeof(ASV1Context), + .priv_data_size = sizeof(ASVDecContext), .init = decode_init, .close = decode_end, FF_CODEC_DECODE_CB(decode_frame), @@ -347,7 +365,7 @@ const FFCodec ff_asv2_decoder = { CODEC_LONG_NAME("ASUS V2"), .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_ASV2, - .priv_data_size = sizeof(ASV1Context), + .priv_data_size = sizeof(ASVDecContext), .init = decode_init, FF_CODEC_DECODE_CB(decode_frame), .p.capabilities = AV_CODEC_CAP_DR1, diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 25ea96e64e..e185d501b3 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -27,6 +27,7 @@ #include "libavutil/attributes.h" #include "libavutil/mem.h" +#include "libavutil/mem_internal.h" #include "aandcttab.h" #include "asv.h" @@ -36,6 +37,19 @@ #include "encode.h" #include "fdctdsp.h" #include "mpeg12data.h" +#include "pixblockdsp.h" +#include "put_bits.h" + +typedef struct ASVEncContext { + ASVCommonContext c; + + PutBitContext pb; + + PixblockDSPContext pdsp; + FDCTDSPContext fdsp; + DECLARE_ALIGNED(32, int16_t, block)[6][64]; + int q_intra_matrix[64]; +} ASVEncContext; static inline void asv1_put_level(PutBitContext *pb, int level) { @@ -49,7 +63,7 @@ static inline void asv1_put_level(PutBitContext *pb, int level) } } -static inline void asv2_put_level(ASV1Context *a, PutBitContext *pb, int level) +static inline void asv2_put_level(ASVEncContext *a, PutBitContext *pb, int level) { unsigned int index = level + 31; @@ -58,14 +72,14 @@ static inline void asv2_put_level(ASV1Context *a, PutBitContext *pb, int level) } else { put_bits_le(pb, 5, 0); /* Escape code */ if (level < -128 || level > 127) { - av_log(a->avctx, AV_LOG_WARNING, "Clipping level %d, increase qscale\n", level); + av_log(a->c.avctx, AV_LOG_WARNING, "Clipping level %d, increase qscale\n", level); level = av_clip_int8(level); } put_bits_le(pb, 8, level & 0xFF); } } -static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]) +static inline void asv1_encode_block(ASVEncContext *a, int16_t block[64]) { int i; int nc_count = 0; @@ -111,7 +125,7 @@ static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]) put_bits(&a->pb, 5, 0xF); /* End of block */ } -static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) +static inline void asv2_encode_block(ASVEncContext *a, int16_t block[64]) { int i; int count = 0; @@ -166,13 +180,13 @@ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) #define MAX_MB_SIZE (30 * 16 * 16 * 3 / 2 / 8) -static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) +static inline int encode_mb(ASVEncContext *a, int16_t block[6][64]) { int i; av_assert0(put_bytes_left(&a->pb, 0) >= MAX_MB_SIZE); - if (a->avctx->codec_id == AV_CODEC_ID_ASV1) { + if (a->c.avctx->codec_id == AV_CODEC_ID_ASV1) { for (i = 0; i < 6; i++) asv1_encode_block(a, block[i]); } else { @@ -183,7 +197,7 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) return 0; } -static inline void dct_get(ASV1Context *a, const AVFrame *frame, +static inline void dct_get(ASVEncContext *a, const AVFrame *frame, int mb_x, int mb_y) { int16_t (*block)[64] = a->block; @@ -201,7 +215,7 @@ static inline void dct_get(ASV1Context *a, const AVFrame *frame, for (i = 0; i < 4; i++) a->fdsp.fdct(block[i]); - if (!(a->avctx->flags & AV_CODEC_FLAG_GRAY)) { + if (!(a->c.avctx->flags & AV_CODEC_FLAG_GRAY)) { a->pdsp.get_pixels(block[4], ptr_cb, frame->linesize[1]); a->pdsp.get_pixels(block[5], ptr_cr, frame->linesize[2]); for (i = 4; i < 6; i++) @@ -212,9 +226,9 @@ static inline void dct_get(ASV1Context *a, const AVFrame *frame, static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { - ASV1Context *const a = avctx->priv_data; + ASVEncContext *const a = avctx->priv_data; + const ASVCommonContext *const c = &a->c; int size, ret; - int mb_x, mb_y; if (pict->width % 16 || pict->height % 16) { AVFrame *clone = av_frame_alloc(); @@ -258,30 +272,30 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, return ret; } - if ((ret = ff_alloc_packet(avctx, pkt, a->mb_height * a->mb_width * MAX_MB_SIZE + + if ((ret = ff_alloc_packet(avctx, pkt, c->mb_height * c->mb_width * MAX_MB_SIZE + AV_INPUT_BUFFER_MIN_SIZE)) < 0) return ret; init_put_bits(&a->pb, pkt->data, pkt->size); - for (mb_y = 0; mb_y < a->mb_height2; mb_y++) { - for (mb_x = 0; mb_x < a->mb_width2; mb_x++) { + for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) { + for (int mb_x = 0; mb_x < c->mb_width2; mb_x++) { dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } } - if (a->mb_width2 != a->mb_width) { - mb_x = a->mb_width2; - for (mb_y = 0; mb_y < a->mb_height2; mb_y++) { + if (c->mb_width2 != c->mb_width) { + int mb_x = c->mb_width2; + for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) { dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } } - if (a->mb_height2 != a->mb_height) { - mb_y = a->mb_height2; - for (mb_x = 0; mb_x < a->mb_width; mb_x++) { + if (c->mb_height2 != c->mb_height) { + int mb_y = c->mb_height2; + for (int mb_x = 0; mb_x < c->mb_width; mb_x++) { dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } @@ -296,7 +310,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, size = (put_bytes_output(&a->pb) + 3) / 4; if (avctx->codec_id == AV_CODEC_ID_ASV1) { - a->bbdsp.bswap_buf((uint32_t *) pkt->data, + c->bbdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size); } @@ -308,9 +322,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, static av_cold int encode_init(AVCodecContext *avctx) { - ASV1Context *const a = avctx->priv_data; + ASVEncContext *const a = avctx->priv_data; int i; const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; + int inv_qscale; ff_asv_common_init(avctx); ff_fdctdsp_init(&a->fdsp, avctx); @@ -319,23 +334,23 @@ static av_cold int encode_init(AVCodecContext *avctx) if (avctx->global_quality <= 0) avctx->global_quality = 4 * FF_QUALITY_SCALE; - a->inv_qscale = (32 * scale * FF_QUALITY_SCALE + + inv_qscale = (32 * scale * FF_QUALITY_SCALE + avctx->global_quality / 2) / avctx->global_quality; avctx->extradata = av_mallocz(8); if (!avctx->extradata) return AVERROR(ENOMEM); avctx->extradata_size = 8; - ((uint32_t *) avctx->extradata)[0] = av_le2ne32(a->inv_qscale); + AV_WLA(32, avctx->extradata, inv_qscale); ((uint32_t *) avctx->extradata)[1] = av_le2ne32(AV_RL32("ASUS")); for (i = 0; i < 64; i++) { if (a->fdsp.fdct == ff_fdct_ifast) { int q = 32LL * scale * ff_mpeg1_default_intra_matrix[i] * ff_aanscales[i]; - a->q_intra_matrix[i] = (((int64_t)a->inv_qscale << 30) + q / 2) / q; + a->q_intra_matrix[i] = (((int64_t)inv_qscale << 30) + q / 2) / q; } else { int q = 32 * scale * ff_mpeg1_default_intra_matrix[i]; - a->q_intra_matrix[i] = ((a->inv_qscale << 16) + q / 2) / q; + a->q_intra_matrix[i] = ((inv_qscale << 16) + q / 2) / q; } } @@ -349,7 +364,7 @@ const FFCodec ff_asv1_encoder = { .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_ASV1, .p.capabilities = AV_CODEC_CAP_DR1, - .priv_data_size = sizeof(ASV1Context), + .priv_data_size = sizeof(ASVEncContext), .init = encode_init, FF_CODEC_ENCODE_CB(encode_frame), .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, @@ -364,7 +379,7 @@ const FFCodec ff_asv2_encoder = { .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_ASV2, .p.capabilities = AV_CODEC_CAP_DR1, - .priv_data_size = sizeof(ASV1Context), + .priv_data_size = sizeof(ASVEncContext), .init = encode_init, FF_CODEC_ENCODE_CB(encode_frame), .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, From patchwork Wed Oct 5 01:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38560 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4d9:b0:9c:f4b:4e41 with SMTP id 25csp404483pzd; Tue, 4 Oct 2022 18:37:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KV0DSdHRX+vX/Wag5tC269//7zXKB5gZLVXO4nDednNLxK6wp+7KoEM1hW0m6E7swlN3I X-Received: by 2002:a05:6402:270f:b0:451:b5bd:95dd with SMTP id y15-20020a056402270f00b00451b5bd95ddmr26174733edd.215.1664933876281; Tue, 04 Oct 2022 18:37:56 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id lg9-20020a170906f88900b0078d231cedb0si1621770ejb.194.2022.10.04.18.37.55; Tue, 04 Oct 2022 18:37:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=Cd1RXmay; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 024D468B28D; Wed, 5 Oct 2022 04:37:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075070.outbound.protection.outlook.com [40.92.75.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E68968B28D for ; Wed, 5 Oct 2022 04:37:45 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ow9Ii1blECA9H1FLNx9jBv20zTrTnTFk5y4tiWZcvjIasP2Cnd/+33NE96/TfWShHiqq/kC0aiSc6wY5BjTIIyO46TvbG8Hdi16CTkymNCMQRheSOmIURVFSrTy0W/SgCWilRkMwxDQTvVFSs7V7RD3Fjp6ZmVjvQh6iLBX5bkUyfdrNcfL6F7wh3ALt4BVOUzWsODQi3gYHU4okasQtZwN5L79o9apOAsGjgZcJdmyb3WDe6DsK373etTGPPn+YkGtLgGTl2pbdLxD46f3bDswbv9Wmq2b47Iwcxz1UTB30xa1If4qqFQfNTqBGDFDaEgRpyWwkFXn9fX5a+hKm4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R1hMOyRevt5VQBWOihcCt/hq4y+K3x5wQNCck39PTzM=; b=fLhplLGM693O0TJkZP2qmmTQsvzGuOTeFx1DPvmoC004jTR+IbiEzYXjAVXOgZ0rhbGb7uwETOd8n+4LLlQinxjvRDxXGMxt431CoEqRqhYNBWzyr/UZSAdON6RV+K+awnTjGftuXzyIh0bgNvkzOC15v3LDpf1C1SOGGj65jJZ2RCc+Bx3uCwSpuZd1+e9de7n071Fr2I9XJY+qOmB8iSn12IzHzAnSyYI8bjzhgP0E0DHiyMI3bEcA+RaxM7K9TupsLxtSTLT7v8WjzYtYUcijjGNh3CnUBsdX9xN0E4gzPvx04OyVF17iRbKf0O9UGUtiuWXLTl/CtK9iMFcUkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R1hMOyRevt5VQBWOihcCt/hq4y+K3x5wQNCck39PTzM=; b=Cd1RXmayUHAZHeVRbgifrpa7NnP43uGMZFHwet5ys0B9tWcBtNG4hcnWyXW96FwS1Xdp8s0MWsJb0PcpRO7IwnnQEI7d+Hyr7d6kbexgR8kkPFgbvqoNgyjADbYqa7qQIZed0dVF8VfLuEERefMC5lvARVEVJj5YTOqjGqDTaRLEaB7e7NCgONprYQgrp47g5IqAoia2pBB5HRh84aQxPuORi7NB4DaiO7aF5yI6X08SqXR17HvdSRU/HoDpd6uEtvconBURrCEdRX6/Th82u5wv9u0i13tVTbObE/UxqT1Nn103adfvx5cL8X3FY41JrjNDY9jt2W2XRkxG8YjuJw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0095.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:270::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Wed, 5 Oct 2022 01:37:42 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5676.028; Wed, 5 Oct 2022 01:37:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Oct 2022 03:37:41 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [d8E2yzycY/XPAAlX/8Ba/duZQe4aMh0J9eD+eFBtvug=] X-ClientProxiedBy: ZR0P278CA0027.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1c::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221005013741.2522917-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0095:EE_ X-MS-Office365-Filtering-Correlation-Id: 3513130e-3a64-486d-d57e-08daa6723206 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqVT5WuMVYob3VZq/ES5LHiuNQFfEYBXswizfhVHF/SF3+DEmBhg7wWClkfletjZaqtoAV0ftUoXyUSB7lnFdjI/+Hqp6aFThY8WwbuZe2oNeQxQ+O+aKrU4lp0irL39eipZsI24EdZV9g8cG74nuGbuM3m86kgmYUgr32AHLyipcxy0ma03HxcOdfs3AGggc2Wc4KVzSEsDHuG3hBIfm6E1ozT0tLsExPa1hgUtgewOn7sDF0fj+nm59JBSIxkL+mEuCZn3iHKTD0F9cfnuanmTGF97viZ5ZuN6tN7mZ3m1F4o56kmu9QKd/aRpKOr6bQxgyq5EAoRoexZRg6Z77U+WopwrmW67tbBSYRdBw4qRpW4STMeTtXDSgb9J7Y7uznbx3cXWWWDDuxWzSyuubZ2SWXmF2+nJfXleL4WJ65UTr31ukZ7mAUuuTgeR1muhkZNTq+27HAUSScZ5oCETsAdAP5DBRN5KdsLHvZ6vlpVHDWsWNH3bLVnUOeAUunpUpssowaQHw9DG9a8Cb7oLParwoh/ASaKis9oab0iyZXvJhSAjbaXS3M5t5EHJbJ1DArJaVImZc1cb+DuxPp9fLFzm7cy9iGGDyit34eMF0SFHt4FXBNiYXNGJEuyDgm3Fdci7G0fsIX6hsBmgB9Pblf79p34VYsXxKqgEfeAf7nR7BPESEjcdyFdsB3L1x6eGeu9zT58USBbNcM4iPBBrmtpsRIUYFcgwkEGHfAbfBhWw6ReuCof9wDiyFIN3somUus= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ost9C9Xd/EG2iSJ2CIAOkmXrr3yOJL+Dn5mHO3DUW1g5831ZVrpXpSeANesRtaesV0iwdI/RlKSihTNRKnKEZsQL7DgSdSChdhgdrF2UPLsmCL7FiTip9iYF8eLl81lNWvGx1ScJ7mEN3A3jUy8NRHRwTu3RGqS1Irah5zq/9C1Zo26IoaK2Pl1w95ui6wtv7HvpqCJu9zp1kDA28tDD5ZFARhX4QGqkNDUx7ZOsJutdGITej8+WKBTkpqNSAe5M+Ea6bRcmNErRh15r2yf+hH/gStJdCRjAQ8uWp1bmHyCyw7Bhz7Vd3/v5CdeDK+HbGkFzBKP8cyBgHMa8p/AMw1OI+wL+qCsL6h+/fL0xN+aSkBe1/wsgYxt1gIcDnrm35MNleHLCwdgWuwqsqqfBK1ElKVFGvfxOGHvbZVlGT2T5F0ZKAe+HOAR4QcTBGoqbj0rWlSbM2+mtlv9pulqPPlPUJldb/OD6vwq4mytT3/+tAtWyutq8ZsGVEKIh57xmseYKHazdwlNNQpSMvOu3bHkoxGvJnb5er3H27+Bw/o06M5GB7UIITWrFi1QmsChLc3iwURSFo539w6OtSkH5P/zy8QG2XmcCCjaH8BTRpkrk/zUXB+jT62VPT2cSbcjUejUv5K3gWORSoe4gj44AZckONWMhHdPQb2v+RBn4orACvBrp25+9r0VSu83qvORT X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hnN3wo6hSqJvjeerHtdEM4lYro7qsm0Ga8SPE4++woXelc0XEbzZMK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8LeGZtSwY5fF7qqQEcrd6ho2AXOsvVivLqLs+UslzX8fB3Jc0lzbdh04nboRKYe4rmENx4kTXKCnyGLkxIgjTHMXWWaG5hhaDo4Zb2Sr6jVV7bRGccnjDRnfUkfpWdmshf79FFVA+4v90bft8NaH/NzNzsIwmMgEVlB/KgmG4Gq+gjNnDpRf7QDl5pqj1Xsmhm0mD+qgZ1840Gbbz X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3513130e-3a64-486d-d57e-08daa6723206 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2022 01:37:42.5275 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0095 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/asvenc: Remove unnecessary emms_c() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1pXJqTR3ffuf PixblockDSP does not use MMX functions any more since 92b58002776edd3a3df03c90e8a3ab24b8f987de and FDCTDSP since d402ec6be99dc82e263bad883e7c1c3d957343db. BswapDSP never used MMX, so that the emms_c() here is unnecessary. Signed-off-by: Andreas Rheinhardt --- libavcodec/asvenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index e185d501b3..9da7cbb986 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -300,7 +300,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, encode_mb(a, a->block); } } - emms_c(); if (avctx->codec_id == AV_CODEC_ID_ASV1) flush_put_bits(&a->pb);