From patchwork Mon Dec 18 18:33:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 45231 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp7533014pzf; Mon, 18 Dec 2023 10:33:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/ceOk9pBlpLc1cfaakmSraCpxuA7KeQERHdQDTahnTkVNmjVuUIGcMuaLh/aJ/E4i9qZp X-Received: by 2002:a50:a694:0:b0:553:2037:92e2 with SMTP id e20-20020a50a694000000b00553203792e2mr3210383edc.0.1702924432259; Mon, 18 Dec 2023 10:33:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702924432; cv=none; d=google.com; s=arc-20160816; b=0HE30fiMnvO/BX7jawtGY3VTzBp3FiR1ONNM+9AExQcTyqW9tTznM66FWVELiZ6Iy2 w0qEa9xf/+iNpudSeGWQeyznSqAdoIjArrBVNYDwdexCziPkxCDxmSpfK6T/amB7mQJC +cf92s3KwsiD2EZiubbYN5namJg0jSAdetuOx0ivZhojn7kvLaMrxFaB4RASbiS9vE4p wLFnf9UFg79mwZSNpnvOxemX2cSEm3Yb+XUD/MTSTXGG72QtralGl6Q/LH1UDotKQD0B TN6XwsQI8AH/z+iLSeqjVe2Hj4BW9Xefgs32zX20N/jCL3kdzAiYK84bqqnJB31lFZmB JFRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=7CUnL0jhUpIeyi3a5cM2kxsAk5dvOSWiR9/fLpwhuKY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=oIztp0oBCbd7IjFWNbOXbxmPEBKuIS1J2OvyteeaGiGtXdPWsJ0mKHTcg7QJTujcD/ oe1I7IRjcD7grQJtNvE9vXl3LcPYR6t9jtfYyF7LDLa0ZLqWEViozDEhemn2VcIXzLQv P1Iv0wMaqCPzTcoofzMhe5cdVzCZhiVCbX4LF8A2oiyBd9XLgEnSmYddOapinX+Hx9ot jGTIlrUka+MKl3kwE8YKuO5W3i5v4YhJjF/18449D4m/jGNPLvxA0/gdo4MJk6tyR9Rc XcKf0MP8L7DUbqmjZwwc5rvXPTveCNybpm6Gq6CKi/2h3XPuHb0HqnA2neFlg1A3/EPV 5sgw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z14-20020a056402274e00b00552346b02easi4834202edd.330.2023.12.18.10.33.51; Mon, 18 Dec 2023 10:33:52 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C89AE68D125; Mon, 18 Dec 2023 20:33:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4E48168CEF4 for ; Mon, 18 Dec 2023 20:33:41 +0200 (EET) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id B62D6C0186 for ; Mon, 18 Dec 2023 20:33:40 +0200 (EET) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Dec 2023 20:33:40 +0200 Message-ID: <20231218183340.10377-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] mlp: move pack_output pointer to decoder context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yIYfmFVwQ+ON The current pack_output function pointer is a property of the decoder, rather than a constant method provided by the DSP code. Indeed, except for an unused initialisation, the field is never used in DSP code. --- libavcodec/mlpdec.c | 48 ++++++++++++++++++++++++++------------------- libavcodec/mlpdsp.c | 1 - libavcodec/mlpdsp.h | 8 -------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 18e0f47864..ead5ecee76 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -173,6 +173,14 @@ typedef struct MLPDecodeContext { DECLARE_ALIGNED(32, int32_t, sample_buffer)[MAX_BLOCKSIZE][MAX_CHANNELS]; MLPDSPContext dsp; + int32_t (*pack_output)(int32_t lossless_check_data, + uint16_t blockpos, + int32_t (*sample_buffer)[MAX_CHANNELS], + void *data, + uint8_t *ch_assign, + int8_t *output_shift, + uint8_t max_matrix_channel, + int is32); } MLPDecodeContext; static const enum AVChannel thd_channel_order[] = { @@ -422,10 +430,10 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) m->avctx->sample_fmt = AV_SAMPLE_FMT_S32; else m->avctx->sample_fmt = AV_SAMPLE_FMT_S16; - m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(m->substream[m->max_decoded_substream].ch_assign, - m->substream[m->max_decoded_substream].output_shift, - m->substream[m->max_decoded_substream].max_matrix_channel, - m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); + m->pack_output = m->dsp.mlp_select_pack_output(m->substream[m->max_decoded_substream].ch_assign, + m->substream[m->max_decoded_substream].output_shift, + m->substream[m->max_decoded_substream].max_matrix_channel, + m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); m->params_valid = 1; for (substr = 0; substr < MAX_SUBSTREAMS; substr++) @@ -663,10 +671,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, if (substr == m->max_decoded_substream) { av_channel_layout_uninit(&m->avctx->ch_layout); av_channel_layout_from_mask(&m->avctx->ch_layout, s->mask); - m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, - s->output_shift, - s->max_matrix_channel, - m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); + m->pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, + s->output_shift, + s->max_matrix_channel, + m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); if (m->avctx->codec_id == AV_CODEC_ID_MLP && m->needs_reordering) { if (s->mask == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || @@ -925,10 +933,10 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, } } if (substr == m->max_decoded_substream) - m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, - s->output_shift, - s->max_matrix_channel, - m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); + m->pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, + s->output_shift, + s->max_matrix_channel, + m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); } if (s->param_presence_flags & PARAM_QUANTSTEP) @@ -1155,14 +1163,14 @@ static int output_data(MLPDecodeContext *m, unsigned int substr, frame->nb_samples = s->blockpos; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - s->lossless_check_data = m->dsp.mlp_pack_output(s->lossless_check_data, - s->blockpos, - m->sample_buffer, - frame->data[0], - s->ch_assign, - s->output_shift, - s->max_matrix_channel, - is32); + s->lossless_check_data = m->pack_output(s->lossless_check_data, + s->blockpos, + m->sample_buffer, + frame->data[0], + s->ch_assign, + s->output_shift, + s->max_matrix_channel, + is32); /* Update matrix encoding side data */ if (s->matrix_encoding != s->prev_matrix_encoding) { diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c index eaf5de8e1a..cb40160f67 100644 --- a/libavcodec/mlpdsp.c +++ b/libavcodec/mlpdsp.c @@ -130,7 +130,6 @@ av_cold void ff_mlpdsp_init(MLPDSPContext *c) c->mlp_filter_channel = mlp_filter_channel; c->mlp_rematrix_channel = ff_mlp_rematrix_channel; c->mlp_select_pack_output = mlp_select_pack_output; - c->mlp_pack_output = ff_mlp_pack_output; #if ARCH_ARM ff_mlpdsp_init_arm(c); #elif ARCH_X86 diff --git a/libavcodec/mlpdsp.h b/libavcodec/mlpdsp.h index a0edeb7762..7a9ac228d3 100644 --- a/libavcodec/mlpdsp.h +++ b/libavcodec/mlpdsp.h @@ -66,14 +66,6 @@ typedef struct MLPDSPContext { int8_t *output_shift, uint8_t max_matrix_channel, int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int); - int32_t (*mlp_pack_output)(int32_t lossless_check_data, - uint16_t blockpos, - int32_t (*sample_buffer)[MAX_CHANNELS], - void *data, - uint8_t *ch_assign, - int8_t *output_shift, - uint8_t max_matrix_channel, - int is32); } MLPDSPContext; void ff_mlpdsp_init(MLPDSPContext *c);