[Ffmpeg-devel] [PATCH] ATRAC3 decoder
Michael Niedermayer
michaelni
Wed Apr 18 00:01:08 CEST 2007
Hi
On Tue, Apr 17, 2007 at 11:02:50PM +0200, Benjamin Larsson wrote:
[...]
> > [...]
> >
> >> static int decodeTonalComponents (GetBitContext *gb, int *numComponents, tonal_component *pComponent, int numBands)
> >> {
> >> int i,j,k,cnt;
> >> int component_count, components, coding_mode_selector, coding_mode, coded_values_per_component;
> >> int sfIndx, coded_values, max_coded_values, quant_step_index, coded_components;
> >> int band_flags[4], mantissa[8];
> >> float *pCoef;
> >> float scalefactor;
> >>
> >> component_count = 0;
> >> *numComponents = 0;
> >>
> >> components = get_bits(gb,5);
> >>
> >> /* no tonal components */
> >> if (components == 0)
> >> return 0;
> >>
> >> coding_mode_selector = get_bits(gb,2);
> >> if (coding_mode_selector == 2)
> >> return -1;
> >>
> >> coding_mode = coding_mode_selector & 1;
> >>
> >> for (i = 0; i < components; i++) {
> >> for (cnt = 0; cnt <= numBands; cnt++)
> >> band_flags[cnt] = get_bits1(gb);
> >>
> >> coded_values_per_component = get_bits(gb,3);
> >>
> >> quant_step_index = get_bits(gb,3);
> >> if (quant_step_index <= 1)
> >> return -1;
> >>
> >> if (coding_mode_selector == 3)
> >> coding_mode = get_bits1(gb);
> >>
> >> for (j = 0; j < (numBands + 1) * 4; j++) {
> >> if (band_flags[j >> 2] == 0)
> >> continue;
> >>
> >> coded_components = get_bits(gb,3);
> >>
> >> for (k=0; k<coded_components; k++) {
> >> sfIndx = get_bits(gb,6);
> >> pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
> >> max_coded_values = 1024 - pComponent[component_count].pos;
> >> coded_values = coded_values_per_component + 1;
> >> coded_values = FFMIN(max_coded_values,coded_values);
> >>
> >> scalefactor = SFTable[sfIndx] * iMaxQuant[quant_step_index];
> >>
> >> readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);
> >>
> >> pComponent[component_count].numCoefs = coded_values;
> >>
> >> /* inverse quant */
> >> pCoef = pComponent[k].coef;
> >>
> >
> >
> >> for (cnt = 0; cnt < coded_values; cnt++)
> >> pCoef[cnt] = (float)mantissa[cnt] * scalefactor;
> >>
> >
> > senseless cast?
> >
> >
>
> Fixed.
>
> >
> >> component_count++;
> >> }
> >> }
> >> }
> >>
> >> *numComponents = component_count;
> >>
> >> return 0;
> >> }
> >>
> >
> > hmm why isnt numComponents returned per return numComponents?
> >
>
> The return is used by the error state.
why not
returns <0 if error otherwise the number of components?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070418/40689172/attachment.pgp>
More information about the ffmpeg-devel
mailing list