Mercurial > libavcodec.hg
comparison h263dec.c @ 344:9f6071a87e17 libavcodec
fixed msmpeg4 infinite loop if buggy stream
rewrote quantizer
fixed bias (+10% compression/quality for h263 like codecs)
qscale=1 support
mpeg1 intra frames looks far less blocky
added codec_id field
author | michaelni |
---|---|
date | Sat, 27 Apr 2002 12:30:26 +0000 |
parents | bf26081c373c |
children | e05b357a398a |
comparison
equal
deleted
inserted
replaced
343:9211a0c9466a | 344:9f6071a87e17 |
---|---|
71 s->h263_intel = 1; | 71 s->h263_intel = 1; |
72 break; | 72 break; |
73 default: | 73 default: |
74 return -1; | 74 return -1; |
75 } | 75 } |
76 | 76 s->codec_id= avctx->codec->id; |
77 | |
77 /* for h263, we allocate the images after having read the header */ | 78 /* for h263, we allocate the images after having read the header */ |
78 if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) | 79 if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) |
79 if (MPV_common_init(s) < 0) | 80 if (MPV_common_init(s) < 0) |
80 return -1; | 81 return -1; |
81 | |
82 /* XXX: suppress this matrix init, only needed because using mpeg1 | |
83 dequantize in mmx case */ | |
84 for(i=0;i<64;i++) | |
85 s->non_intra_matrix[i] = default_non_intra_matrix[i]; | |
86 | 82 |
87 if (s->h263_msmpeg4) | 83 if (s->h263_msmpeg4) |
88 msmpeg4_decode_init_vlc(s); | 84 msmpeg4_decode_init_vlc(s); |
89 else | 85 else |
90 h263_decode_init_vlc(s); | 86 h263_decode_init_vlc(s); |
249 | 245 |
250 if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE) | 246 if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE) |
251 if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1; | 247 if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1; |
252 | 248 |
253 /* divx 5.01+ bistream reorder stuff */ | 249 /* divx 5.01+ bistream reorder stuff */ |
254 if(s->h263_pred && s->bitstream_buffer_size==0){ | 250 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0){ |
255 int current_pos= get_bits_count(&s->gb)/8; | 251 int current_pos= get_bits_count(&s->gb)/8; |
256 if( buf_size - current_pos > 5 | 252 if( buf_size - current_pos > 5 |
257 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ | 253 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ |
258 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); | 254 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); |
259 s->bitstream_buffer_size= buf_size - current_pos; | 255 s->bitstream_buffer_size= buf_size - current_pos; |