summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2010-12-23 18:01:23 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2010-12-23 18:01:23 +0000
commita897423baa09dd651d7c339fdf386c954577d6d6 (patch)
treed5938d8c699892a564fed5942799beec55a86de7 /libavcodec
parent0e9b064305fec5939631fd905b0d4aa23b983443 (diff)
Store CRC context locally to reduce number of calls to av_crc_get_table().
Originally committed as revision 26082 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3enc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index edd9167ef7..ed86e61955 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -1571,6 +1571,7 @@ static unsigned int pow_poly(unsigned int a, unsigned int n, unsigned int poly)
*/
static void output_frame_end(AC3EncodeContext *s)
{
+ const AVCRC *crc_ctx = av_crc_get_table(AV_CRC_16_ANSI);
int frame_size_58, pad_bytes, crc1, crc2, crc_inv;
uint8_t *frame;
@@ -1586,14 +1587,14 @@ static void output_frame_end(AC3EncodeContext *s)
/* compute crc1 */
/* this is not so easy because it is at the beginning of the data... */
- crc1 = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0,
+ crc1 = av_bswap16(av_crc(crc_ctx, 0,
frame + 4, frame_size_58 - 4));
crc_inv = s->crc_inv[s->frame_size > s->frame_size_min];
crc1 = mul_poly(crc_inv, crc1, CRC16_POLY);
AV_WB16(frame + 2, crc1);
/* compute crc2 */
- crc2 = av_bswap16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0,
+ crc2 = av_bswap16(av_crc(crc_ctx, 0,
frame + frame_size_58,
s->frame_size - frame_size_58 - 2));
AV_WB16(frame + s->frame_size - 2, crc2);