[FFmpeg-cvslog] r19811 - in trunk/libavcodec: atrac1.c atrac1data.h
Benjamin Larsson
banan
Sun Sep 13 20:05:22 CEST 2009
Diego Biurrun wrote:
> On Thu, Sep 10, 2009 at 08:47:02PM +0200, banan wrote:
>> Log:
>> Initial commit of the atrac1 decoder, not hooked up yet
>>
>> --- /dev/null 00:00:00 1970 (empty, because file is newly added)
>> +++ trunk/libavcodec/atrac1.c Thu Sep 10 20:47:02 2009 (r19811)
>> @@ -0,0 +1,402 @@
>> +
>> +static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits, int rev_spec)
>
> long line
Fixed.
>
>> + mdct_context = &q->mdct_ctx[nbits - 5 - (nbits>6)];
>
> spaces around operators
Nothing in the Coding rules mandates this.
>
>> + for (i=0 ; i<transf_size/2 ; i++)
>
> ditto
Nothing in the Coding rules mandates this.
>
>> + FFSWAP(float, spec[i], spec[transf_size-1-i]);
>
> ditto
Fixed.
>
>> + ff_imdct_half(mdct_context,out,spec);
>
> space after comma
Fixed.
>
>> + for (band_num=0 ; band_num<AT1_QMF_BANDS ; band_num++) {
>
> spaces around operators (SAO)
Nothing in the Coding rules mandates this.
>
>> + if (nbits!=5 && nbits!=7 && nbits!=8)
>
> ditto
Nothing in the Coding rules mandates this.
>
>> + /* overlap and window between short blocks */
>> + q->dsp.vector_fmul_window(&su->spectrum[0][ref_pos+start_pos],
>> + &su->spectrum[0][ref_pos+start_pos],q->short_buf,short_window, 0, 16);
>
>> + /* overlap and window with the previous frame and output the result */
>> + q->dsp.vector_fmul_window(q->bands[band_num], &su->spectrum[1][ref_pos+band_samples/2],
>> + &su->spectrum[0][ref_pos], window_per_band[band_num], 0, band_samples/2);
>
> Alignment is off.
Fixed.
>
>> +static int at1_parse_block_size_mode(GetBitContext* gb, int log2_block_count[AT1_QMF_BANDS])
>
> long line (LL)
Fixed.
>
>> + for(i=0 ; i<2 ; i++) {
>
> SAO
Nothing in the Coding rules mandates this.
>
>> +static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, float spec[AT1_SU_SAMPLES])
>
> LL
Fixed.
>
>> + /* get word length index (idwl) for each BFU */
>> + for (i=0 ; i<su->num_bfus ; i++)
>
>> + /* get scalefactor index (idsf) for each BFU */
>> + for (i=0 ; i<su->num_bfus ; i++)
>
>> + /* read in the spectral data and reconstruct MDCT spectrum of this channel */
>> + for (band_num=0 ; band_num<AT1_QMF_BANDS ; band_num++) {
>> + for (bfu_num=bfu_bands_t[band_num] ; bfu_num<bfu_bands_t[band_num+1] ; bfu_num++) {
>
> SAO
Nothing in the Coding rules mandates this.
>
>> + if (word_len) {
>> + float max_quant = 1.0/(float)((1 << (word_len - 1)) - 1);
>
> SAO
Fixed.
>
>> + for (i=0 ; i<num_specs ; i++) {
>
> SAO
Nothing in the Coding rules mandates this.
>
>> +static int atrac1_decode_frame(AVCodecContext *avctx,
>> + void *data, int *data_size,
>> + AVPacket *avpkt)
>
> Indentation is off.
Fixed.
>
>> + const uint8_t *buf = avpkt->data;
>> + int buf_size = avpkt->size;
>
> align
Fixed.
>
>> + for (ch=0 ; ch<q->channels ; ch++) {
>
> SAO
Nothing in the Coding rules mandates this.
>
>> + /* round, convert to 16bit and interleave */
>> + if (q->channels == 1) {
>> + /* mono */
>> + q->dsp.vector_clipf(samples, q->out_samples[0], -32700./(1<<15), 32700./(1<<15), AT1_SU_SAMPLES);
>
> SAO
Fixed.
>
>> + for (i = 0; i < AT1_SU_SAMPLES; i++) {
>> + samples[i*2] = av_clipf(q->out_samples[0][i], -32700./(1<<15), 32700./(1<<15));
>> + samples[i*2+1] = av_clipf(q->out_samples[1][i], -32700./(1<<15), 32700./(1<<15));
>
> SAO
Fixed.
>
>> + /* Init the mdct transforms */
>> + ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1<<15));
>> + ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1<<15));
>> + ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1<<15));
>
> SAO
Fixed.
>
> Diego
MvH
Benjamin Larsson
More information about the ffmpeg-cvslog
mailing list