aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sipr.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-11-03 22:10:15 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-09 14:59:52 -0500
commit979c8de549b7a627e6ce26026e39a01672dbd0b1 (patch)
treea048655f6153386d37364a90da0d5fe84974c2bf /libavcodec/sipr.c
parent3468ff106008da160b8cbb2d69d396a751fe8a08 (diff)
downloadffmpeg-979c8de549b7a627e6ce26026e39a01672dbd0b1.tar.gz
sipr: use a function pointer to select the decode_frame function
Diffstat (limited to 'libavcodec/sipr.c')
-rw-r--r--libavcodec/sipr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index 4257496e0e..10a12c52a5 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -492,8 +492,12 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name);
- if (ctx->mode == MODE_16k)
+ if (ctx->mode == MODE_16k) {
ff_sipr_init_16k(ctx);
+ ctx->decode_frame = ff_sipr_decode_frame_16k;
+ } else {
+ ctx->decode_frame = decode_frame;
+ }
for (i = 0; i < LP_FILTER_ORDER; i++)
ctx->lsp_history[i] = cos((i+1) * M_PI / (LP_FILTER_ORDER + 1));
@@ -541,10 +545,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
for (i = 0; i < mode_par->frames_per_packet; i++) {
decode_parameters(&parm, &gb, mode_par);
- if (ctx->mode == MODE_16k)
- ff_sipr_decode_frame_16k(ctx, &parm, data);
- else
- decode_frame(ctx, &parm, data);
+ ctx->decode_frame(ctx, &parm, data);
data += subframe_size * mode_par->subframe_count;
}