From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] mlp: move pack_output pointer to decoder context Date: Mon, 18 Dec 2023 20:33:40 +0200 Message-ID: <20231218183340.10377-1-remi@remlab.net> (raw) 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); -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2023-12-18 18:33 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231218183340.10377-1-remi@remlab.net \ --to=remi@remlab.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git