[FFmpeg-devel] [PATCH] ALS decoder
Thilo Borgmann
thilo.borgmann
Tue Aug 25 18:56:46 CEST 2009
>>>> + // damaged block, write zero for the rest of the frame
>>>> + while (b < ctx->num_blocks) {
>>>> + memset(raw_sample, 0, div_blocks[b]);
>>>> + raw_sample += div_blocks[b];
>>>> + b++;
>>>> + }
>>>> + return -1;
>>> [...]
>>>> + // damaged block, write zero for the rest of the frame
>>>> + while (b < ctx->num_blocks) {
>>>> + memset(raw_samples_L, 0, div_blocks[b]);
>>>> + memset(raw_samples_R, 0, div_blocks[b]);
>>>> + raw_samples_L += div_blocks[b];
>>>> + raw_samples_R += div_blocks[b];
>>>> + b++;
>>>> + }
>>> [...]
>>>> + // damaged block, write zero for the rest of the frame
>>>> + while (b < ctx->num_blocks) {
>>>> + memset(raw_samples_L, 0, div_blocks[b]);
>>>> + raw_samples_L += div_blocks[b];
>>>> + b++;
>>>> + }
>>> cant these be factored/combined?
>> They could be factored into decode_frame() but several parameters would
>> have to be passed somehow to know wich samples of which channel could be
>> decoded correctly already.
>> Alternative 1) loose all samples of the current RA unit.
>> Alternative 2) infunction {while() memset;} but this would add a second
>> loop for the code block in the middle.
>> Which way to go?
>
> Hm, neither?
> get_remain_count():
> while (b < ctx->num_blocks) sum += div_blocks[b];
> return sum;
>
> count = get_remain_count();
> memset(raw_samples_L, 0, count);
> raw_samples_L += count;
> memset(raw_samples_R, 0, count);
> raw_samples_R += count;
>
> Though personally I'd suggest expanding the memset+increment
> into a bytestream_fill_byte() that does both.
I read this too fast for revision 9... will be a count function + memset
in revision 10 - it is zero function incl. count in rev. 9, which counts
twice...
Thanks!
-Thilo
More information about the ffmpeg-devel
mailing list