mpeg4video_parser: init mpeg4 static tables.
They are used when decoding the frame header. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
		@@ -110,6 +110,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
 | 
					extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ff_mpeg4_init_tables(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0 //3IV1 is quite rare and it slows things down a tiny bit
 | 
					#if 0 //3IV1 is quite rare and it slows things down a tiny bit
 | 
				
			||||||
#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
 | 
					#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,6 +100,8 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    struct Mp4vParseContext *pc = s->priv_data;
 | 
					    struct Mp4vParseContext *pc = s->priv_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ff_mpeg4_init_tables();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pc->first_picture = 1;
 | 
					    pc->first_picture = 1;
 | 
				
			||||||
    pc->enc.slice_context_count = 1;
 | 
					    pc->enc.slice_context_count = 1;
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ static const int mb_type_b_map[4]= {
 | 
				
			|||||||
    MB_TYPE_L0 | MB_TYPE_16x16,
 | 
					    MB_TYPE_L0 | MB_TYPE_16x16,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void init_tables(void)
 | 
					void ff_mpeg4_init_tables(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static int done = 0;
 | 
					    static int done = 0;
 | 
				
			||||||
    if (!done) {
 | 
					    if (!done) {
 | 
				
			||||||
@@ -2230,7 +2230,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 | 
				
			|||||||
    MpegEncContext *s = avctx->priv_data;
 | 
					    MpegEncContext *s = avctx->priv_data;
 | 
				
			||||||
    int ret;
 | 
					    int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    init_tables();
 | 
					    ff_mpeg4_init_tables();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s->divx_version=
 | 
					    s->divx_version=
 | 
				
			||||||
    s->divx_build=
 | 
					    s->divx_build=
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user