mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
tak: use crc table from lavu
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
410192e369
commit
8491f40500
@ -72,22 +72,6 @@ static int tak_get_nb_samples(int sample_rate, enum TAKFrameSizeType type)
|
||||
return nb_samples;
|
||||
}
|
||||
|
||||
static int crc_init = 0;
|
||||
#if CONFIG_SMALL
|
||||
#define CRC_TABLE_SIZE 257
|
||||
#else
|
||||
#define CRC_TABLE_SIZE 1024
|
||||
#endif
|
||||
static AVCRC crc_24[CRC_TABLE_SIZE];
|
||||
|
||||
av_cold void ff_tak_init_crc(void)
|
||||
{
|
||||
if (!crc_init) {
|
||||
av_crc_init(crc_24, 0, 24, 0x864CFBU, sizeof(crc_24));
|
||||
crc_init = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size)
|
||||
{
|
||||
uint32_t crc, CRC;
|
||||
@ -97,7 +81,7 @@ int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size)
|
||||
buf_size -= 3;
|
||||
|
||||
CRC = AV_RB24(buf + buf_size);
|
||||
crc = av_crc(crc_24, 0xCE04B7U, buf, buf_size);
|
||||
crc = av_crc(av_crc_get_table(AV_CRC_24_IEEE), 0xCE04B7U, buf, buf_size);
|
||||
if (CRC != crc)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
@ -140,8 +140,6 @@ typedef struct TAKStreamInfo {
|
||||
int64_t samples;
|
||||
} TAKStreamInfo;
|
||||
|
||||
void ff_tak_init_crc(void);
|
||||
|
||||
int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size);
|
||||
|
||||
/**
|
||||
|
@ -33,12 +33,6 @@ typedef struct TAKParseContext {
|
||||
int index;
|
||||
} TAKParseContext;
|
||||
|
||||
static av_cold int tak_init(AVCodecParserContext *s)
|
||||
{
|
||||
ff_tak_init_crc();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
const uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
@ -123,7 +117,6 @@ found:
|
||||
AVCodecParser ff_tak_parser = {
|
||||
.codec_ids = { AV_CODEC_ID_TAK },
|
||||
.priv_data_size = sizeof(TAKParseContext),
|
||||
.parser_init = tak_init,
|
||||
.parser_parse = tak_parse,
|
||||
.parser_close = ff_parse_close,
|
||||
};
|
||||
|
@ -171,7 +171,6 @@ static av_cold int tak_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
TAKDecContext *s = avctx->priv_data;
|
||||
|
||||
ff_tak_init_crc();
|
||||
ff_dsputil_init(&s->dsp, avctx);
|
||||
|
||||
s->avctx = avctx;
|
||||
|
Loading…
Reference in New Issue
Block a user