[FFmpeg-cvslog] r19811 - in trunk/libavcodec: atrac1.c atrac1data.h
Diego Biurrun
diego
Thu Sep 10 21:11:30 CEST 2009
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
> + mdct_context = &q->mdct_ctx[nbits - 5 - (nbits>6)];
spaces around operators
> + for (i=0 ; i<transf_size/2 ; i++)
ditto
> + FFSWAP(float, spec[i], spec[transf_size-1-i]);
ditto
> + ff_imdct_half(mdct_context,out,spec);
space after comma
> + for (band_num=0 ; band_num<AT1_QMF_BANDS ; band_num++) {
spaces around operators (SAO)
> + if (nbits!=5 && nbits!=7 && nbits!=8)
ditto
> + /* 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.
> +static int at1_parse_block_size_mode(GetBitContext* gb, int log2_block_count[AT1_QMF_BANDS])
long line (LL)
> + for(i=0 ; i<2 ; i++) {
SAO
> +static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, float spec[AT1_SU_SAMPLES])
LL
> + /* 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
> + if (word_len) {
> + float max_quant = 1.0/(float)((1 << (word_len - 1)) - 1);
SAO
> + for (i=0 ; i<num_specs ; i++) {
SAO
> +static int atrac1_decode_frame(AVCodecContext *avctx,
> + void *data, int *data_size,
> + AVPacket *avpkt)
Indentation is off.
> + const uint8_t *buf = avpkt->data;
> + int buf_size = avpkt->size;
align
> + for (ch=0 ; ch<q->channels ; ch++) {
SAO
> + /* 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
> + 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
> + /* 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
Diego
More information about the ffmpeg-cvslog
mailing list