[FFmpeg-devel] [PATCH] Multi-Channel Correlation in ALS
Thilo Borgmann
thilo.borgmann
Mon Jan 4 14:57:16 CET 2010
Am 04.01.10 12:48, schrieb Michael Niedermayer:
> On Mon, Dec 21, 2009 at 01:24:07PM +0100, Thilo Borgmann wrote:
> [...]
>> +/** Recursively reverts the inter-channel correlation for a block.
>> + */
>> +static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
>> + ALSChannelData **cd, int *reverted,
>> + unsigned int offset, int c)
>> +{
>> + ALSChannelData *ch = cd[c];
>> + unsigned int dep = 0;
>> + unsigned int channels = ctx->avctx->channels;
>> +
>
>> + if (reverted[c])
>> + return 0;
>> + else
>
> {}
>
>
>> + reverted[c] = 1;
>> +
>> + while (dep < channels && !ch[dep].stop_flag) {
>> + if (!reverted[ch[dep].master_channel])
>> + revert_channel_correlation(ctx, bd, cd, reverted, offset,
>> + ch[dep].master_channel);
>> +
>> + dep++;
>> + }
>> +
>> + if (dep == channels) {
>> + av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation!\n");
>> + return -1;
>> + }
>> +
>> + bd->use_ltp = ctx->use_ltp + c;
>> + bd->ltp_lag = ctx->ltp_lag + c;
>> + bd->ltp_gain = ctx->ltp_gain[c];
>> + bd->lpc_cof = ctx->lpc_cof[c];
>> + bd->quant_cof = ctx->quant_cof[c];
>> + bd->raw_samples = ctx->raw_samples[c] + offset;
>> +
>> + dep = 0;
>> + while (!ch[dep].stop_flag) {
>> + unsigned int smp;
>> + unsigned int begin = 1;
>> + unsigned int end = bd->block_length - 1;
>> + int64_t y;
>> + int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
>> +
>> + if (ch[dep].time_diff_flag) {
>> + int t = ch[dep].time_diff_index;
>> +
>> + if (ch[dep].time_diff_sign)
>> + begin -= t;
>> + else
>
> {}
I just removed the else.
>
>
> [...]
>> @@ -%ld,%ld +%ld,%ld @@
>> sizeof(*ctx->raw_samples[c]) * sconf->max_order);
>> }
>> } else { // multi-channel coding
>> + ALSBlockData bd;
>> + int b;
>
>> + int reverted_channels[avctx->channels];
>
> i think malloc() would be safer or check that channel is within a
> reasonabe range. Or make double sure the common code checks it
>
> iam ok with the rest of the patch i think
Oh yes, and channels can become quite large, so moved into the context
and malloc'ed.
Revision 3 attached.
-Thilo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: als_mcc.rev3.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/25e9c9d6/attachment.txt>
More information about the ffmpeg-devel
mailing list