ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Tue Sep 30 15:12:10 2014 -0300| [ddb813b0ef8f135679020240fdca41c29976c23a] | committer: James Almer
mlpdec: move rematrix_channels code to output_data() Reviewed-by: Michael Niedermayer <michae...@gmx.at> Signed-off-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddb813b0ef8f135679020240fdca41c29976c23a --- libavcodec/mlpdec.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index e443f81..2c5426c 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -1038,15 +1038,27 @@ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr) s->noisegen_seed = seed; } +/** Write the audio data into the output buffer. */ -/** Apply the channel matrices in turn to reconstruct the original audio - * samples. */ - -static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) +static int output_data(MLPDecodeContext *m, unsigned int substr, + AVFrame *frame, int *got_frame_ptr) { + AVCodecContext *avctx = m->avctx; SubStream *s = &m->substream[substr]; unsigned int mat; unsigned int maxchan; + int ret; + int is32 = (m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); + + if (m->avctx->channels != s->max_matrix_channel + 1) { + av_log(m->avctx, AV_LOG_ERROR, "channel count mismatch\n"); + return AVERROR_INVALIDDATA; + } + + if (!s->blockpos) { + av_log(avctx, AV_LOG_ERROR, "No samples to output.\n"); + return AVERROR_INVALIDDATA; + } maxchan = s->max_matrix_channel; if (!s->noise_type) { @@ -1056,6 +1068,8 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) fill_noise_buffer(m, substr); } + /* Apply the channel matrices in turn to reconstruct the original audio + * samples. */ for (mat = 0; mat < s->num_primitive_matrices; mat++) { unsigned int dest_ch = s->matrix_out_ch[mat]; m->dsp.mlp_rematrix_channel(&m->sample_buffer[0][0], @@ -1070,27 +1084,6 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) m->access_unit_size_pow2, MSB_MASK(s->quant_step_size[dest_ch])); } -} - -/** Write the audio data into the output buffer. */ - -static int output_data(MLPDecodeContext *m, unsigned int substr, - AVFrame *frame, int *got_frame_ptr) -{ - AVCodecContext *avctx = m->avctx; - SubStream *s = &m->substream[substr]; - int ret; - int is32 = (m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); - - if (m->avctx->channels != s->max_matrix_channel + 1) { - av_log(m->avctx, AV_LOG_ERROR, "channel count mismatch\n"); - return AVERROR_INVALIDDATA; - } - - if (!s->blockpos) { - av_log(avctx, AV_LOG_ERROR, "No samples to output.\n"); - return AVERROR_INVALIDDATA; - } /* get output buffer */ frame->nb_samples = s->blockpos; @@ -1298,8 +1291,6 @@ next_substr: buf += substream_data_len[substr]; } - rematrix_channels(m, m->max_decoded_substream); - if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0) return ret; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog