aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-09 13:36:01 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-26 11:50:17 -0400
commit7080533cda2cccf980326b0942de8ff046619fd4 (patch)
tree77d12cef269add9b7a5dc791a6dabfd00a1b0057
parentcb50329fc5ea89240ea5e835a3ee72ce16cf052a (diff)
downloadffmpeg-7080533cda2cccf980326b0942de8ff046619fd4.tar.gz
alacdec: remove the numchannels parameter from several functions.
They only operate on stereo content, so the extra param is not necessary and also allows for simplifying the code.
-rw-r--r--libavcodec/alac.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 6563e52f30..3b79645ce1 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -299,8 +299,7 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
}
static void decorrelate_stereo(int32_t *buffer[MAX_CHANNELS],
- int numchannels, int numsamples,
- uint8_t interlacing_shift,
+ int numsamples, uint8_t interlacing_shift,
uint8_t interlacing_leftweight)
{
int i;
@@ -331,37 +330,25 @@ static void append_extra_bits(int32_t *buffer[MAX_CHANNELS],
}
static void interleave_stereo_16(int32_t *buffer[MAX_CHANNELS],
- int16_t *buffer_out, int numchannels,
- int numsamples)
+ int16_t *buffer_out, int numsamples)
{
int i;
for (i = 0; i < numsamples; i++) {
- int16_t left, right;
-
- left = buffer[0][i];
- right = buffer[1][i];
-
- buffer_out[i*numchannels] = left;
- buffer_out[i*numchannels + 1] = right;
+ *buffer_out++ = buffer[0][i];
+ *buffer_out++ = buffer[1][i];
}
}
static void interleave_stereo_24(int32_t *buffer[MAX_CHANNELS],
- int32_t *buffer_out, int numchannels,
- int numsamples)
+ int32_t *buffer_out, int numsamples)
{
int i;
- for (i = 0; i < numsamples; i++) {
- int32_t left, right;
-
- left = buffer[0][i];
- right = buffer[1][i];
-
- buffer_out[i * numchannels] = left << 8;
- buffer_out[i * numchannels + 1] = right << 8;
- }
+ for (i = 0; i < numsamples; i++) {
+ *buffer_out++ = buffer[0][i] << 8;
+ *buffer_out++ = buffer[1][i] << 8;
+ }
}
static int alac_decode_frame(AVCodecContext *avctx,
@@ -521,9 +508,8 @@ static int alac_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n");
if (channels == 2 && interlacing_leftweight) {
- decorrelate_stereo(alac->outputsamples_buffer, alac->numchannels,
- outputsamples, interlacing_shift,
- interlacing_leftweight);
+ decorrelate_stereo(alac->outputsamples_buffer, outputsamples,
+ interlacing_shift, interlacing_leftweight);
}
if (alac->extra_bits) {
@@ -535,7 +521,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
case 16:
if (channels == 2) {
interleave_stereo_16(alac->outputsamples_buffer, outbuffer,
- alac->numchannels, outputsamples);
+ outputsamples);
} else {
int i;
for (i = 0; i < outputsamples; i++) {
@@ -546,7 +532,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
case 24:
if (channels == 2) {
interleave_stereo_24(alac->outputsamples_buffer, outbuffer,
- alac->numchannels, outputsamples);
+ outputsamples);
} else {
int i;
for (i = 0; i < outputsamples; i++)