aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/g729dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-09 21:11:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-01 17:17:04 +0100
commit576746b4e30069a922564e0019ef0758811e771d (patch)
tree071ff0e7e66e9b5a5ea4a779c13277f745659398 /libavcodec/g729dec.c
parentf64be9da4c8b16071ec84056a61d1fc0d5d6728c (diff)
downloadffmpeg-576746b4e30069a922564e0019ef0758811e771d.tar.gz
avcodec/g729dec: Factor block_size out
This will be used in the next commit Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/g729dec.c')
-rw-r--r--libavcodec/g729dec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 282668d472..70cf3391bd 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -97,6 +97,7 @@ typedef struct {
uint8_t gc_2nd_index_bits; ///< gain codebook (second stage) index (size in bits)
uint8_t fc_signs_bits; ///< number of pulses in fixed-codebook vector
uint8_t fc_indexes_bits; ///< size (in bits) of fixed-codebook index entry
+ uint8_t block_size;
} G729FormatDescription;
typedef struct {
@@ -165,6 +166,7 @@ static const G729FormatDescription format_g729_8k = {
.gc_2nd_index_bits = GC_2ND_IDX_BITS_8K,
.fc_signs_bits = 4,
.fc_indexes_bits = 13,
+ .block_size = G729_8K_BLOCK_SIZE,
};
static const G729FormatDescription format_g729d_6k4 = {
@@ -174,6 +176,7 @@ static const G729FormatDescription format_g729d_6k4 = {
.gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4,
.fc_signs_bits = 2,
.fc_indexes_bits = 9,
+ .block_size = G729D_6K4_BLOCK_SIZE,
};
/**
@@ -731,12 +734,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
/* Save signal for use in next frame. */
memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, (PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t));
- buf += packet_type == FORMAT_G729_8K ? G729_8K_BLOCK_SIZE : G729D_6K4_BLOCK_SIZE;
+ buf += format->block_size;
ctx++;
}
*got_frame_ptr = 1;
- return packet_type == FORMAT_G729_8K ? (G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels;
+ return (format->block_size + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels;
}
static av_cold int decode_close(AVCodecContext *avctx)