diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-02-08 18:23:39 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-02-08 18:23:39 +0000 |
commit | c40c34828a1dc775225bdd7b0d6f04cc24deaa7a (patch) | |
tree | cd5fa454a820883ea4aaa80049e307248130c4c3 /libavcodec | |
parent | 16e83cbbc4023ab89c0ac7c193ab02e22ce72790 (diff) | |
download | ffmpeg-c40c34828a1dc775225bdd7b0d6f04cc24deaa7a.tar.gz |
direct blocksize in bframes fix (might fix qpel+bframe bug)
Originally committed as revision 1557 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 5 | ||||
-rw-r--r-- | libavcodec/h263.c | 15 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 19 | ||||
-rw-r--r-- | libavcodec/motion_est.c | 10 |
4 files changed, 39 insertions, 10 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 6e7b0d4837..c5fd425e3c 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -16,8 +16,8 @@ extern "C" { #define LIBAVCODEC_VERSION_INT 0x000406 #define LIBAVCODEC_VERSION "0.4.6" -#define LIBAVCODEC_BUILD 4654 -#define LIBAVCODEC_BUILD_STR "4654" +#define LIBAVCODEC_BUILD 4655 +#define LIBAVCODEC_BUILD_STR "4655" enum CodecID { CODEC_ID_NONE, @@ -531,6 +531,7 @@ typedef struct AVCodecContext { #define FF_BUG_QPEL_CHROMA 64 #define FF_BUG_STD_QPEL 128 #define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100% /** diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 63bf190597..a9c1fc7421 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -403,17 +403,20 @@ void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){ uint16_t time_pp= s->pp_time; uint16_t time_pb= s->pb_time; int i; - + //FIXME avoid divides switch(s->co_located_type_table[mb_index]){ case 0: - s->mv_type= MV_TYPE_16X16; - s->mv[0][0][0] = s->motion_val[xy][0]*time_pb/time_pp + mx; - s->mv[0][0][1] = s->motion_val[xy][1]*time_pb/time_pp + my; - s->mv[1][0][0] = mx ? s->mv[0][0][0] - s->motion_val[xy][0] + s->mv[0][0][0] = s->mv[0][1][0] = s->mv[0][2][0] = s->mv[0][3][0] = s->motion_val[xy][0]*time_pb/time_pp + mx; + s->mv[0][0][1] = s->mv[0][1][1] = s->mv[0][2][1] = s->mv[0][3][1] = s->motion_val[xy][1]*time_pb/time_pp + my; + s->mv[1][0][0] = s->mv[1][1][0] = s->mv[1][2][0] = s->mv[1][3][0] = mx ? s->mv[0][0][0] - s->motion_val[xy][0] : s->motion_val[xy][0]*(time_pb - time_pp)/time_pp; - s->mv[1][0][1] = my ? s->mv[0][0][1] - s->motion_val[xy][1] + s->mv[1][0][1] = s->mv[1][1][1] = s->mv[1][2][1] = s->mv[1][3][1] = my ? s->mv[0][0][1] - s->motion_val[xy][1] : s->motion_val[xy][1]*(time_pb - time_pp)/time_pp; + if((s->avctx->workaround_bugs & FF_BUG_DIRECT_BLOCKSIZE) || !s->quarter_sample) + s->mv_type= MV_TYPE_16X16; + else + s->mv_type= MV_TYPE_8X8; break; case CO_LOCATED_TYPE_4MV: s->mv_type = MV_TYPE_8X8; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 89f606b216..3a445ec944 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -332,6 +332,13 @@ static int mpeg4_find_frame_end(MpegEncContext *s, UINT8 *buf, int buf_size){ return -1; } +/** + * draws an line from (ex, ey) -> (sx, sy). + * @param w width of the image + * @param h height of the image + * @param stride stride/linesize of the image + * @param color color of the arrow + */ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int t, x, y, f; @@ -368,6 +375,13 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h } } +/** + * draws an arrow from (ex, ey) -> (sx, sy). + * @param w width of the image + * @param h height of the image + * @param stride stride/linesize of the image + * @param color color of the arrow + */ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int dx= ex - sx; int dy= ey - sy; @@ -510,6 +524,11 @@ retry: if(s->lavc_build && s->lavc_build<4653) s->workaround_bugs|= FF_BUG_STD_QPEL; + if(s->lavc_build && s->lavc_build<4655) + s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; + + if(s->divx_version) + s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; //printf("padding_bug_score: %d\n", s->padding_bug_score); #if 0 if(s->divx_version==500) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 5814cb33cf..a8517fb7cd 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -241,8 +241,14 @@ if((x) >= xmin && 4*(x) + (dx) <= 4*xmax && (y) >= ymin && 4*(y) + (dy) <= 4*yma int fxy= (fx&3) + 4*(fy&3);\ int bxy= (bx&3) + 4*(by&3);\ \ - qpel_put[0][fxy](s->me.scratchpad, (ref_y ) + (fx>>2) + (fy>>2)*(stride), stride);\ - qpel_avg[0][bxy](s->me.scratchpad, (ref2_y) + (bx>>2) + (by>>2)*(stride), stride);\ + qpel_put[1][fxy](s->me.scratchpad , (ref_y ) + (fx>>2) + (fy>>2)*(stride) , stride);\ + qpel_put[1][fxy](s->me.scratchpad + 8 , (ref_y ) + (fx>>2) + (fy>>2)*(stride) + 8 , stride);\ + qpel_put[1][fxy](s->me.scratchpad + 8*stride, (ref_y ) + (fx>>2) + (fy>>2)*(stride) + 8*stride, stride);\ + qpel_put[1][fxy](s->me.scratchpad + 8 + 8*stride, (ref_y ) + (fx>>2) + (fy>>2)*(stride) + 8 + 8*stride, stride);\ + qpel_avg[1][bxy](s->me.scratchpad , (ref2_y) + (bx>>2) + (by>>2)*(stride) , stride);\ + qpel_avg[1][bxy](s->me.scratchpad + 8 , (ref2_y) + (bx>>2) + (by>>2)*(stride) + 8 , stride);\ + qpel_avg[1][bxy](s->me.scratchpad + 8*stride, (ref2_y) + (bx>>2) + (by>>2)*(stride) + 8*stride, stride);\ + qpel_avg[1][bxy](s->me.scratchpad + 8 + 8*stride, (ref2_y) + (bx>>2) + (by>>2)*(stride) + 8 + 8*stride, stride);\ }\ d = cmp_func(s, s->me.scratchpad, src_y, stride);\ }else\ |