mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mlp: initialize all CRC tables in a common function.
This way the decoder does not have to depend on the parser being initialized before. Patch by Laurent Aimar <fenrir at via dot ecp dot fr>. Originally committed as revision 15986 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
751ccc4852
commit
7a2efd2e44
@ -43,26 +43,14 @@ const uint8_t ff_mlp_huffman_tables[3][18][2] = {
|
|||||||
static int crc_init = 0;
|
static int crc_init = 0;
|
||||||
static AVCRC crc_63[1024];
|
static AVCRC crc_63[1024];
|
||||||
static AVCRC crc_1D[1024];
|
static AVCRC crc_1D[1024];
|
||||||
|
|
||||||
|
|
||||||
static int crc_init_2D = 0;
|
|
||||||
static AVCRC crc_2D[1024];
|
static AVCRC crc_2D[1024];
|
||||||
|
|
||||||
int av_cold ff_mlp_init_crc2D(AVCodecParserContext *s)
|
|
||||||
{
|
|
||||||
if (!crc_init_2D) {
|
|
||||||
av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
|
|
||||||
crc_init_2D = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void av_cold ff_mlp_init_crc()
|
void av_cold ff_mlp_init_crc()
|
||||||
{
|
{
|
||||||
if (!crc_init) {
|
if (!crc_init) {
|
||||||
av_crc_init(crc_63, 0, 8, 0x63, sizeof(crc_63));
|
av_crc_init(crc_63, 0, 8, 0x63, sizeof(crc_63));
|
||||||
av_crc_init(crc_1D, 0, 8, 0x1D, sizeof(crc_1D));
|
av_crc_init(crc_1D, 0, 8, 0x1D, sizeof(crc_1D));
|
||||||
|
av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
|
||||||
crc_init = 1;
|
crc_init = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,6 @@ uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size);
|
|||||||
*/
|
*/
|
||||||
uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size);
|
uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size);
|
||||||
|
|
||||||
int ff_mlp_init_crc2D(AVCodecParserContext *s);
|
|
||||||
|
|
||||||
void ff_mlp_init_crc();
|
void ff_mlp_init_crc();
|
||||||
|
|
||||||
/** XOR four bytes into one. */
|
/** XOR four bytes into one. */
|
||||||
|
@ -150,6 +150,12 @@ typedef struct MLPParseContext
|
|||||||
int num_substreams;
|
int num_substreams;
|
||||||
} MLPParseContext;
|
} MLPParseContext;
|
||||||
|
|
||||||
|
static av_cold int mlp_init(AVCodecParserContext *s)
|
||||||
|
{
|
||||||
|
ff_mlp_init_crc();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int mlp_parse(AVCodecParserContext *s,
|
static int mlp_parse(AVCodecParserContext *s,
|
||||||
AVCodecContext *avctx,
|
AVCodecContext *avctx,
|
||||||
const uint8_t **poutbuf, int *poutbuf_size,
|
const uint8_t **poutbuf, int *poutbuf_size,
|
||||||
@ -283,7 +289,7 @@ lost_sync:
|
|||||||
AVCodecParser mlp_parser = {
|
AVCodecParser mlp_parser = {
|
||||||
{ CODEC_ID_MLP },
|
{ CODEC_ID_MLP },
|
||||||
sizeof(MLPParseContext),
|
sizeof(MLPParseContext),
|
||||||
ff_mlp_init_crc2D,
|
mlp_init,
|
||||||
mlp_parse,
|
mlp_parse,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user