Thread: MVTools
View Single Post
Old 1st November 2004, 15:18   #1  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
MVTools

Hi everybody

Since there was no dedicated thread for the MVTools on the usage forum, I create one. It's bundled with (yet another) new version of the MVTools.

You can fetch it here : http://manao4.free.fr/MVTools-v0.9.8.zip

A lot of things have changed since the latest version, but most of the changes are internal. However, some filters'parameters were changed ( MVAnalyse, MVCompensate, MVDenoise ). Two filters were added ( Deblock and MVChangeCompensate ), some were temporarily ( MVInterpolate, MVBlur, MVConvertFPS ) or definitively removed ( EncDenoise ).

The main change for this release is that a vector stream now contains a lot of information : for each blocks, it stores the motion vector, the SAD, but also the mean luminance of the source block and of the reference block, and an approximation of the standard deviation of the source block, and the reference block itself.

That means that, by default, a mv stream already contains the result of the motion compensation ( for luminance and chrominance ). Hence, MVCompensate becomes ( in one of its mode ) a mean of extracting the compensation from the stream. And, of course, you may want to filter it and put it back into the stream, and that's the role of MVChangeCompensate. For example, to deblock the compensation, just do the following :
Code:
vectors = source.MVAnalyse(isb = false, lambda = 1000)
compensation = source.MVCompensate(vectors, mode = 0)
compensation = compensation.Deblock()
vectors = vectors.MVChangeCompensate(compensation)
Now, that change has a great influence on MVDenoise. At the beginning, that filter was only compensating the previous and next frames in order to denoise. That wasn't enough, and I added a hack in order to compensate twice the frames n-2 and n+2, in order to work on 5 frames ( which allows a better denoising ). But it was slow, and the hack was creating a lot of blocking.

Now, since the compensation are stored inside the mv stream, and since you can make a mv search between frame n and n-delta easily ( I added a parameter 'delta' to MVAnalyse ), MVDenoise can take an unlimited number of mv streams as input, and will use all of them to denoise the source.

And, to avoid blocking, you can now deblock the compensations before feeding them to MVDenoise.

Finally, the 'pel' parameter is now limited to 1 or 2 only, but works for all filters.

Now, what's left to do ? The temporal interpolations will come back, but they need a lot of work to be more than left-artifacts-all-around filters. There is still room for optimisations ( when 'pel' = 2, I interpolate the source and the reference 2 times ( one when the frame is the source, the second when the frame becomes the reference ), and when MVAnalyse is used several times on the same clip, the interpolations are recomputed each times ).

Also, MVDenoise need a better algorithm in order to denoise ( Didee, I'm still waiting for your ideas ). Right now, it's only merging together collocated pixels which respects the thresholds. Something better can be done, and it can be changed very easily, so any ideas are welcomed ( BTW, i take into account the mean luma of the source and reference block when doing the merging, it avoids some artifacts when luminance was changing from a frame to another, but it still leaves a slight blocking ).

I'm sure I forgot a lot of things, and that there are still slight bugs left into the code, so I'm waiting for your impressions.

Last edited by Manao; 20th January 2005 at 22:06.
Manao is offline   Reply With Quote