[FFmpeg-soc] [soc]: r1043 - rv40/rv40.c

Kostya kostya.shishkov at gmail.com
Mon Aug 20 16:20:46 CEST 2007


On Mon, Aug 20, 2007 at 02:46:54PM +0200, Michael Niedermayer wrote:
> Hi
> 
> On Mon, Aug 20, 2007 at 11:50:08AM +0200, kostya wrote:
> > Author: kostya
> > Date: Mon Aug 20 11:50:07 2007
> > New Revision: 1043
> > 
> > Log:
> > B-frames motion prediction and compensation
> > 
> > Modified:
> >    rv40/rv40.c
> > 
> > Modified: rv40/rv40.c
> > ==============================================================================
> > --- rv40/rv40.c	(original)
> > +++ rv40/rv40.c	Mon Aug 20 11:50:07 2007
> > @@ -879,6 +879,160 @@ static void rv40_pred_mv(RV40DecContext 
> >  }
> >  
> >  /**
> > + * Predict motion vector for B-frame macroblock.
> > + */
> > +static inline void rv40_pred_b_vector(int A[2], int B[2], int C[2], int no_A, int no_B, int no_C, int *mx, int *my)
> 
> i assume A/B/C are 0 if no_A/B/C are 1

right

> if so you could do
> 
> if(no_A + no_B + no_C){
>     *mx = *my = 0;
>     if(!no_A){
>         *mx += A[0];
>         *my += A[1];
>     }
>     if(!no_B){
>         *mx += B[0];
>         *my += B[1];
>     }
>     if(!no_C){
>         *mx += C[0];
>         *my += C[1];
>     }
>     if(no_A + no_B + no_C == 1){
>         *mx /=2;
>         *my /=2;
>     }
> }else{
>     *mx = mid_pred(A[0], B[0], C[0]);
>     *my = mid_pred(A[1], B[1], C[1]);
> }

will do so 
 
> [...]
[MV prediction]
> 
> your code looks odd
> that what you call RV40_MB_B_INTERP looks like DIRECT, that what you call
> direct looks like bidirectional
> 
> direct uses the motion vectors from another frame (not the surrounding blocks)
> (that is in early h264 and mpeg4 later h264 can use the surrounding blocks
> too IIRC)

Well, here's what I know:
Both interpolated and direct(or bidirectional) are known to me since VC-1,
interpolated block just have zero motion vectors and acts as skip type block.

Motion vectors on B-frames are predicted only from other vectors on that frame
(and interpolated counts as no vectors). I've verified this on real data and
this scheme is correct.

During motion compensation interpolated blocks (not sure about bidirectional)
reuse vectors from previous/next frame and even may perform 8x8 compensation
if previous frame has such partitioning. But they add vectors only for
compensation, actual value is not modified. I will try to implement this soon. 

> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB



More information about the FFmpeg-soc mailing list