Re: What is currentMV and predMV in SearchData struct
Chien Tran <[email protected]> Mon, 21 May 2012 21:05:01 +0700
| Newsgroups | gmane.comp.video.xvid.devel |
|---|---|
| Message-ID | <CAC4iO9OmXvU0CnSZw7YApO1wytPi-n6QxYgKWwu1HoZXeffHdQ@mail.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 <[email protected]> > 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 <[email protected]>: > > > 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 > > [email protected] > > http://list.xvid.org/mailman/listinfo/xvid-devel > > > > > > > > > _______________________________________________ > Xvid-devel mailing list > [email protected] > http://list.xvid.org/mailman/listinfo/xvid-devel > -- Best wishes, Tran Xuan Chien University of Information Technology Phone: (+84) 1692 468 154