Mercurial > libavcodec.hg
comparison h263dec.c @ 411:5c8b3a717929 libavcodec
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
author | michaelni |
---|---|
date | Tue, 21 May 2002 23:13:57 +0000 |
parents | fce0a2520551 |
children | 718a22dc121f |
comparison
equal
deleted
inserted
replaced
410:8aba98b353f0 | 411:5c8b3a717929 |
---|---|
41 s->avctx = avctx; | 41 s->avctx = avctx; |
42 s->out_format = FMT_H263; | 42 s->out_format = FMT_H263; |
43 | 43 |
44 s->width = avctx->width; | 44 s->width = avctx->width; |
45 s->height = avctx->height; | 45 s->height = avctx->height; |
46 s->workaround_bugs= avctx->workaround_bugs; | |
46 | 47 |
47 /* select sub codec */ | 48 /* select sub codec */ |
48 switch(avctx->codec->id) { | 49 switch(avctx->codec->id) { |
49 case CODEC_ID_H263: | 50 case CODEC_ID_H263: |
50 s->gob_number = 0; | 51 s->gob_number = 0; |
209 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | 210 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); |
210 #endif | 211 #endif |
211 //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x); | 212 //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x); |
212 /* DCT & quantize */ | 213 /* DCT & quantize */ |
213 if (s->h263_pred && s->msmpeg4_version!=2) { | 214 if (s->h263_pred && s->msmpeg4_version!=2) { |
214 h263_dc_scale(s); | 215 /* old ffmpeg encoded msmpeg4v3 workaround */ |
216 if(s->workaround_bugs==1 && s->msmpeg4_version==3) | |
217 ff_old_msmpeg4_dc_scale(s); | |
218 else | |
219 h263_dc_scale(s); | |
215 } else { | 220 } else { |
216 /* default quantization values */ | 221 /* default quantization values */ |
217 s->y_dc_scale = 8; | 222 s->y_dc_scale = 8; |
218 s->c_dc_scale = 8; | 223 s->c_dc_scale = 8; |
219 } | 224 } |
275 { | 280 { |
276 int mb_y; | 281 int mb_y; |
277 s->has_b_frames=1; | 282 s->has_b_frames=1; |
278 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 283 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
279 int mb_x; | 284 int mb_x; |
280 int y= mb_y*16; | 285 int y= mb_y*16 + 8; |
281 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 286 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
282 int x= mb_x*16; | 287 int x= mb_x*16 + 8; |
283 uint8_t *ptr= s->last_picture[0]; | 288 uint8_t *ptr= s->last_picture[0]; |
284 int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2); | 289 int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2); |
285 int mx= (s->motion_val[xy][0]>>1) + x; | 290 int mx= (s->motion_val[xy][0]>>1) + x; |
286 int my= (s->motion_val[xy][1]>>1) + y; | 291 int my= (s->motion_val[xy][1]>>1) + y; |
287 int i; | 292 int i; |
297 for(i=0; i<max; i++){ | 302 for(i=0; i<max; i++){ |
298 int x1= x + (mx-x)*i/max; | 303 int x1= x + (mx-x)*i/max; |
299 int y1= y + (my-y)*i/max; | 304 int y1= y + (my-y)*i/max; |
300 ptr[y1*s->linesize + x1]+=100; | 305 ptr[y1*s->linesize + x1]+=100; |
301 } | 306 } |
307 ptr[y*s->linesize + x]+=100; | |
302 s->mbskip_table[mb_x + mb_y*s->mb_width]=0; | 308 s->mbskip_table[mb_x + mb_y*s->mb_width]=0; |
303 } | 309 } |
304 } | 310 } |
305 | 311 |
306 } | 312 } |