Cosmetics. Renames, indentation and spacing.
Originally committed as revision 19832 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
72cdcc0b9b
commit
04a6d1b0db
@ -94,7 +94,8 @@ static const uint16_t samples_per_band[3] = {128, 128, 256};
|
||||
static const uint8_t mdct_long_nbits[3] = {7, 7, 8};
|
||||
|
||||
|
||||
static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits, int rev_spec)
|
||||
static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
|
||||
int rev_spec)
|
||||
{
|
||||
MDCTContext* mdct_context;
|
||||
int transf_size = 1 << nbits;
|
||||
@ -104,9 +105,9 @@ static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits, int rev_spe
|
||||
if (rev_spec) {
|
||||
int i;
|
||||
for (i=0 ; i<transf_size/2 ; i++)
|
||||
FFSWAP(float, spec[i], spec[transf_size-1-i]);
|
||||
FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
|
||||
}
|
||||
ff_imdct_half(mdct_context,out,spec);
|
||||
ff_imdct_half(mdct_context, out, spec);
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +148,8 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
|
||||
|
||||
/* 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);
|
||||
&su->spectrum[0][ref_pos+start_pos],
|
||||
q->short_buf,short_window, 0, 16);
|
||||
start_pos += 32; // use hardcoded block_size
|
||||
pos += 32;
|
||||
}
|
||||
@ -166,8 +168,11 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the block size mode byte
|
||||
*/
|
||||
|
||||
static int at1_parse_block_size_mode(GetBitContext* gb, int log2_block_count[AT1_QMF_BANDS])
|
||||
static int at1_parse_bsm(GetBitContext* gb, int log2_block_cnt[AT1_QMF_BANDS])
|
||||
{
|
||||
int log2_block_count_tmp, i;
|
||||
|
||||
@ -176,21 +181,22 @@ static int at1_parse_block_size_mode(GetBitContext* gb, int log2_block_count[AT1
|
||||
log2_block_count_tmp = get_bits(gb, 2);
|
||||
if (log2_block_count_tmp & 1)
|
||||
return -1;
|
||||
log2_block_count[i] = 2 - log2_block_count_tmp;
|
||||
log2_block_cnt[i] = 2 - log2_block_count_tmp;
|
||||
}
|
||||
|
||||
/* high band */
|
||||
log2_block_count_tmp = get_bits(gb, 2);
|
||||
if (log2_block_count_tmp != 0 && log2_block_count_tmp != 3)
|
||||
return -1;
|
||||
log2_block_count[IDX_HIGH_BAND] = 3 - log2_block_count_tmp;
|
||||
log2_block_cnt[IDX_HIGH_BAND] = 3 - log2_block_count_tmp;
|
||||
|
||||
skip_bits(gb, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, float spec[AT1_SU_SAMPLES])
|
||||
static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su,
|
||||
float spec[AT1_SU_SAMPLES])
|
||||
{
|
||||
int bits_used, band_num, bfu_num, i;
|
||||
|
||||
@ -234,7 +240,7 @@ static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, float spec[AT1_SU
|
||||
pos = su->log2_block_count[band_num] ? bfu_start_short[bfu_num] : bfu_start_long[bfu_num];
|
||||
|
||||
if (word_len) {
|
||||
float max_quant = 1.0/(float)((1 << (word_len - 1)) - 1);
|
||||
float max_quant = 1.0 / (float)((1 << (word_len - 1)) - 1);
|
||||
|
||||
for (i=0 ; i<num_specs ; i++) {
|
||||
/* read in a quantized spec and convert it to
|
||||
@ -269,9 +275,8 @@ void at1_subband_synthesis(AT1Ctx *q, AT1SUCtx* su, float *pOut)
|
||||
}
|
||||
|
||||
|
||||
static int atrac1_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
AVPacket *avpkt)
|
||||
static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int *data_size, AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
@ -292,7 +297,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx,
|
||||
init_get_bits(&gb, &buf[212*ch], 212*8);
|
||||
|
||||
/* parse block_size_mode, 1st byte */
|
||||
ret = at1_parse_block_size_mode(&gb, su->log2_block_count);
|
||||
ret = at1_parse_bsm(&gb, su->log2_block_count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -309,12 +314,15 @@ static int atrac1_decode_frame(AVCodecContext *avctx,
|
||||
/* 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);
|
||||
q->dsp.vector_clipf(samples, q->out_samples[0], -32700.0 / (1<<15),
|
||||
32700.0 / (1<<15), AT1_SU_SAMPLES);
|
||||
} else {
|
||||
/* stereo */
|
||||
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));
|
||||
samples[i*2] = av_clipf(q->out_samples[0][i], -32700.0 / (1<<15),
|
||||
32700.0 / (1<<15));
|
||||
samples[i*2+1] = av_clipf(q->out_samples[1][i], -32700.0 / (1<<15),
|
||||
32700.0 / (1<<15));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user