Re: What is currentMV and predMV in SearchData struct
Michael Militzer <[email protected]> Mon, 21 May 2012 15:47:16 +0200
| Newsgroups | gmane.comp.video.xvid.devel |
|---|---|
| Message-ID | <[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 > >