if (extrabits > 1) {
x += extrabits - 1;
- get_bits(&alac->gb, k);
+ skip_bits(&alac->gb, k);
} else
- get_bits(&alac->gb, k - 1);
+ skip_bits(&alac->gb, k - 1);
}
}
if (extrabits < 2) {
x = 1 - extrabits;
block_size += x;
- get_bits(&alac->gb, k - 1);
+ skip_bits(&alac->gb, k - 1);
} else {
- get_bits(&alac->gb, k);
+ skip_bits(&alac->gb, k);
}
}
}
}
-static void deinterlace_16(int32_t *buffer[MAX_CHANNELS],
- int16_t *buffer_out,
- int numchannels, int numsamples,
- uint8_t interlacing_shift,
- uint8_t interlacing_leftweight)
+static void reconstruct_stereo_16(int32_t *buffer[MAX_CHANNELS],
+ int16_t *buffer_out,
+ int numchannels, int numsamples,
+ uint8_t interlacing_shift,
+ uint8_t interlacing_leftweight)
{
int i;
if (numsamples <= 0)
/* weighted interlacing */
if (interlacing_leftweight) {
for (i = 0; i < numsamples; i++) {
- int32_t difference, midright;
- int16_t left;
- int16_t right;
+ int32_t a, b;
- midright = buffer[0][i];
- difference = buffer[1][i];
+ a = buffer[0][i];
+ b = buffer[1][i];
+ a -= (b * interlacing_leftweight) >> interlacing_shift;
+ b += a;
- right = midright - ((difference * interlacing_leftweight) >> interlacing_shift);
- left = right + difference;
-
- buffer_out[i*numchannels] = left;
- buffer_out[i*numchannels + 1] = right;
+ buffer_out[i*numchannels] = b;
+ buffer_out[i*numchannels + 1] = a;
}
return;
/* 2^result = something to do with output waiting.
* perhaps matters if we read > 1 frame in a pass?
*/
- get_bits(&alac->gb, 4);
+ skip_bits(&alac->gb, 4);
- get_bits(&alac->gb, 12); /* unknown, skip 12 bits */
+ skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */
/* the output sample size is stored soon */
- hassize = get_bits(&alac->gb, 1);
+ hassize = get_bits1(&alac->gb);
wasted_bytes = get_bits(&alac->gb, 2); /* unknown ? */
/* whether the frame is compressed */
- isnotcompressed = get_bits(&alac->gb, 1);
+ isnotcompressed = get_bits1(&alac->gb);
if (hassize) {
/* now read the number of samples as a 32bit integer */
predictor_coef_table[chan][i] = (int16_t)get_bits(&alac->gb, 16);
}
- if (wasted_bytes) {
+ if (wasted_bytes)
av_log(avctx, AV_LOG_ERROR, "FIXME: unimplemented, unhandling of wasted_bytes\n");
- }
for (chan = 0; chan < channels; chan++) {
bastardized_rice_decompress(alac,
}
switch(alac->setinfo_sample_size) {
- case 16: {
+ case 16:
if (channels == 2) {
- deinterlace_16(alac->outputsamples_buffer,
- (int16_t*)outbuffer,
- alac->numchannels,
- outputsamples,
- interlacing_shift,
- interlacing_leftweight);
+ reconstruct_stereo_16(alac->outputsamples_buffer,
+ (int16_t*)outbuffer,
+ alac->numchannels,
+ outputsamples,
+ interlacing_shift,
+ interlacing_leftweight);
} else {
int i;
for (i = 0; i < outputsamples; i++) {
}
}
break;
- }
case 20:
case 24:
case 32: