Commit 178ab5c3 authored by michaelni's avatar michaelni

xvid edge bug (if i understand the mpeg4 spec correctly) autodetection

improved edge & padding bug detection for old files
tested with *.avi *.mp4 on my HD


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2163 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c4ac7f2a
...@@ -301,9 +301,9 @@ static int decode_slice(MpegEncContext *s){ ...@@ -301,9 +301,9 @@ static int decode_slice(MpegEncContext *s){
return 0; return 0;
} }
fprintf(stderr, "slice end not reached but screenspace end (%d left %06X)\n", fprintf(stderr, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
s->gb.size_in_bits - get_bits_count(&s->gb), s->gb.size_in_bits - get_bits_count(&s->gb),
show_bits(&s->gb, 24)); show_bits(&s->gb, 24), s->padding_bug_score);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
...@@ -481,27 +481,29 @@ retry: ...@@ -481,27 +481,29 @@ retry:
avctx->has_b_frames= !s->low_delay; avctx->has_b_frames= !s->low_delay;
if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){
if(s->avctx->codec_tag == ff_get_fourcc("XVID") || s->avctx->codec_tag == ff_get_fourcc("XVIX"))
s->xvid_build= -1;
if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0)
s->divx_version= 400; //divx 4
}
if(s->workaround_bugs&FF_BUG_AUTODETECT){ if(s->workaround_bugs&FF_BUG_AUTODETECT){
if(s->padding_bug_score > -2 && !s->data_partitioning && !s->resync_marker)
s->workaround_bugs |= FF_BUG_NO_PADDING;
else
s->workaround_bugs &= ~FF_BUG_NO_PADDING; s->workaround_bugs &= ~FF_BUG_NO_PADDING;
if(s->padding_bug_score > -2 && !s->data_partitioning && (s->divx_version || !s->resync_marker))
s->workaround_bugs |= FF_BUG_NO_PADDING;
if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) if(s->avctx->codec_tag == ff_get_fourcc("XVIX"))
s->workaround_bugs|= FF_BUG_XVID_ILACE; s->workaround_bugs|= FF_BUG_XVID_ILACE;
#if 0
if(s->avctx->codec_tag == ff_get_fourcc("MP4S"))
s->workaround_bugs|= FF_BUG_AC_VLC;
if(s->avctx->codec_tag == ff_get_fourcc("M4S2"))
s->workaround_bugs|= FF_BUG_AC_VLC;
#endif
if(s->avctx->codec_tag == ff_get_fourcc("UMP4")){ if(s->avctx->codec_tag == ff_get_fourcc("UMP4")){
s->workaround_bugs|= FF_BUG_UMP4; s->workaround_bugs|= FF_BUG_UMP4;
s->workaround_bugs|= FF_BUG_AC_VLC; s->workaround_bugs|= FF_BUG_AC_VLC;
} }
if(s->divx_version){ if(s->divx_version>=500){
s->workaround_bugs|= FF_BUG_QPEL_CHROMA; s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
} }
...@@ -509,18 +511,15 @@ retry: ...@@ -509,18 +511,15 @@ retry:
s->workaround_bugs|= FF_BUG_QPEL_CHROMA2; s->workaround_bugs|= FF_BUG_QPEL_CHROMA2;
} }
if(s->avctx->codec_tag == ff_get_fourcc("XVID") && s->xvid_build==0)
s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
if(s->avctx->codec_tag == ff_get_fourcc("XVID") && s->xvid_build==0)
s->padding_bug_score= 256*256*256*64;
if(s->xvid_build && s->xvid_build<=3) if(s->xvid_build && s->xvid_build<=3)
s->padding_bug_score= 256*256*256*64; s->padding_bug_score= 256*256*256*64;
if(s->xvid_build && s->xvid_build<=1) if(s->xvid_build && s->xvid_build<=1)
s->workaround_bugs|= FF_BUG_QPEL_CHROMA; s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
if(s->xvid_build && s->xvid_build<=12)
s->workaround_bugs|= FF_BUG_EDGE;
#define SET_QPEL_FUNC(postfix1, postfix2) \ #define SET_QPEL_FUNC(postfix1, postfix2) \
s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\ s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\ s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
...@@ -546,9 +545,6 @@ retry: ...@@ -546,9 +545,6 @@ retry:
s->workaround_bugs|= FF_BUG_EDGE; s->workaround_bugs|= FF_BUG_EDGE;
} }
if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->divx_version==0 && s->lavc_build==0 && s->xvid_build==0 && s->vo_type==0 && s->vol_control_parameters==0 && s->low_delay)
s->workaround_bugs|= FF_BUG_EDGE;
#if 0 #if 0
if(s->divx_version==500) if(s->divx_version==500)
s->padding_bug_score= 256*256*256*64; s->padding_bug_score= 256*256*256*64;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment