[SCM] libav/experimental: Proper handling of motion vectors for adv. profile

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:57:57 UTC 2013


The following commit has been merged in the experimental branch:
commit ab47579565c33c857d11b0a41671495c0e53f709
Author: Kostya Shishkov <kostya.shishkov at gmail.com>
Date:   Sun Mar 18 07:51:40 2007 +0000

    Proper handling of motion vectors for adv. profile
    
    Originally committed as revision 8436 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index deea0fd..0629bd1 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -821,10 +821,17 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
     uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
     uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
 
+if(v->profile != PROFILE_ADVANCED){
     src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
     src_y   = av_clip(  src_y, -16, s->mb_height * 16);
     uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
     uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
+}else{
+    src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
+    src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
+    uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
+    uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
+}
 
     srcY += src_y * s->linesize + src_x;
     srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
@@ -944,8 +951,13 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n)
     src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2);
     src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2);
 
+if(v->profile != PROFILE_ADVANCED){
     src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
     src_y   = av_clip(  src_y, -16, s->mb_height * 16);
+}else{
+    src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
+    src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
+}
 
     srcY += src_y * s->linesize + src_x;
 
@@ -1071,8 +1083,14 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
     uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
     uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
 
+if(v->profile != PROFILE_ADVANCED){
     uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
     uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
+}else{
+    uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
+    uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
+}
+
     srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x;
     srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
     if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
@@ -1285,6 +1303,9 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
     v->finterpflag = get_bits1(gb);
     get_bits1(gb); // reserved
 
+    v->s.h_edge_pos = v->s.avctx->coded_width;
+    v->s.v_edge_pos = v->s.avctx->coded_height;
+
     av_log(v->s.avctx, AV_LOG_DEBUG,
                "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
                "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
@@ -2118,10 +2139,17 @@ static void vc1_interp_mc(VC1Context *v)
     uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
     uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
 
+if(v->profile != PROFILE_ADVANCED){
     src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
     src_y   = av_clip(  src_y, -16, s->mb_height * 16);
     uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
     uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
+}else{
+    src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
+    src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
+    uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
+    uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
+}
 
     srcY += src_y * s->linesize + src_x;
     srcU += uvsrc_y * s->uvlinesize + uvsrc_x;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list