[Xvid-devel] What is currentMV and predMV in SearchData struct

Chien Tran chien.study at gmail.com
Mon May 21 18:07:01 CEST 2012


Oh, I understand it now. Thank you very much for your help

2012/5/21 Michael Militzer <michael at xvid.org>

> There is no "matching Macroblock in previous Frame". The vector found by
> ME can point to arbitrary pixel (and sub-pixel) positions in the reference
> frame and not just to macroblock borders.
>
> Therefore, there isn't a single matching macroblock. The reference samples
> used for motion compensation may span over several macroblocks. You could
> just determine the macroblock which most closely matches a given pixel
> position by rounding to nearest macroblock border (and also clipping into
> the [0, mb_width] and [0, mb_height] area). But I don't see for what you
> would need to do this?
>
> Regards,
> Michael
>
>
> Quoting Chien Tran <chien.study at gmail.com>:
>
> > Thanks for your answer.
> > So let's say I found the match_x and match_y of referenced Macroblock.
> How
> > could I get the exact Macroblock from the macroblock pointers (pMBs)?
> > Currently I see some places in the code do like this:
> > pMB = pMBs[x + y * mb_width]; //get Macroblock based on x, y location
> >
> > But I am afraid I can not do like that if (x + y * mb_width) < 0, right?
> >
> > 2012/5/21 Michael Militzer <michael at xvid.org>
> >
> >> Hi,
> >>
> >> your understanding is correct: currentMV stores the best candidate
> vector
> >> found so far during ME for a respective mode/partition (e.g. 16x16) and
> >> predMV holds the corresponding predictor vector that will be substracted
> >> before actual coding of the vector.
> >>
> >> Note that only the difference between best found vector and predictor
> >> vector is written to the bitstream (refer to e.g. get_pmv2() in
> >> mbprediction.c on how the predictor vector gets determined). Considering
> >> the predMV already during ME is important to estimate the motion vector
> >> cost (so the amount of bits needed to write the found vector into the
> >> bitstream). The more currentMV deviates from predMV, the higher the cost
> >> for coding the vector into the bitstream.
> >>
> >> Also note that motion vectors can indeed point outside the visible
> >> rectangle of a ref frame. So your understanding on how to determine the
> >> reference blocks for motion compensation is correct but you need to
> >> consider that there is a padded, "edge" area around reference frames.
> >> Therefore, "match_x < 0" is legal. You can take a closer look at how
> >> the edge padding is performed in image_setedges() (image/image.c).
> >>
> >> Best regards,
> >> Michael
> >>
> >>
> >> Quoting Chien Tran <chien.study at gmail.com>:
> >>
> >> > Hi everyone,
> >> > I am new to Xvid and I am doing a research about video compression.
> When
> >> I
> >> > look at the SearchData struct, I saw two important fields: currentMV
> and
> >> > predMV. I guessed it stored the information about the motion vector of
> >> > Macroblock, but I don't know what it really means to have 2 fields
> like
> >> > that. Its comment said currentMV is "best vectors found so far"
> >> > (currentMV[0] would be the MV for the 16x16 MB, I think) and the
> predMV
> >> is
> >> > "vector which predicts current vector". Could you guys please tell me
> >> what
> >> > currentMV and predMV are really used for?
> >> > Let's say I have the x, y of the current Macroblock. How can I know
> the
> >> > location of the matching Macroblock in previous Frame that were found
> in
> >> > Motion Estimation? Is it: match_x = x + currentMV[0].x; match_y = y +
> >> > currentMV[0].y? I did some tests and found that it sometimes has the
> >> value
> >> > that is out of the Macroblock array (more specifically, match_x < 0).
> >> >
> >> > --
> >> > Best wishes,
> >> >
> >> > Tran Xuan Chien
> >> > University of Information Technology
> >> > Phone: (+84) 1692 468 154
> >> > _______________________________________________
> >> > Xvid-devel mailing list
> >> > Xvid-devel at xvid.org
> >> > http://list.xvid.org/mailman/listinfo/xvid-devel
> >> >
> >> >
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Xvid-devel mailing list
> >> Xvid-devel at xvid.org
> >> http://list.xvid.org/mailman/listinfo/xvid-devel
> >>
> >
> >
> >
> > --
> > Best wishes,
> >
> > Tran Xuan Chien
> > University of Information Technology
> > Phone: (+84) 1692 468 154
> > _______________________________________________
> > Xvid-devel mailing list
> > Xvid-devel at xvid.org
> > http://list.xvid.org/mailman/listinfo/xvid-devel
> >
> >
>
>
>
>
>
>
> _______________________________________________
> Xvid-devel mailing list
> Xvid-devel at xvid.org
> http://list.xvid.org/mailman/listinfo/xvid-devel
>



-- 
Best wishes,

Tran Xuan Chien
University of Information Technology
Phone: (+84) 1692 468 154


More information about the Xvid-devel mailing list