[FFmpeg-cvslog] tak: use crc table from lavu

Paul B Mahol git at videolan.org
Wed Jul 10 14:09:06 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jun  4 16:41:05 2013 +0000| [8491f40500535bf1ab0aa1997391fb23d7b695bc] | committer: Paul B Mahol

tak: use crc table from lavu

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8491f40500535bf1ab0aa1997391fb23d7b695bc
---

 libavcodec/tak.c        |   18 +-----------------
 libavcodec/tak.h        |    2 --
 libavcodec/tak_parser.c |    7 -------
 libavcodec/takdec.c     |    1 -
 4 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/libavcodec/tak.c b/libavcodec/tak.c
index ccf3abf..ed41ca8 100644
--- a/libavcodec/tak.c
+++ b/libavcodec/tak.c
@@ -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;
 
diff --git a/libavcodec/tak.h b/libavcodec/tak.h
index 876468d..e8e2dac 100644
--- a/libavcodec/tak.h
+++ b/libavcodec/tak.h
@@ -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);
 
 /**
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 9136192..5d8460c 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -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,
 };
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 9e01ee0..0edfddd 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -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;



More information about the ffmpeg-cvslog mailing list