FRebuild

From Avisynth wiki
Revision as of 21:29, 3 September 2012 by Wilbert (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Abstract
Author martin53
Version 1.0e
Download frebuild.avsi
Category Temporal_Sharpeners
Requirements
License
Discussion

FRebuild(clip source, int mode, float thresholdCF, float thresholdI)


Contents

Abstract

FRebuild is mainly intended for amateur video clips. These clips may show short loss of detail during 'shaky' camera movement. FRebuild restores these frames by neighbor frames. Three motion compensation methods are implemented and are automatically chosen. Runtime environment is used heavily. The filter is also useful against compression artifacts during high motion for overly compressed clips. However, since no 3D modeling is used, the replacement may be visible in pan scenes with different fore- and background. Also, partial movements, e.g. a waving person, are not or not perfectly restored.

You may cascade calls of the internal functions and add new modes. See the end of the function source.


Important notes: Expect not more than a few FPS. FRebuild defines two runtime functions as global string variables. Avoid reuse of these global names.

Requires Filters

Parameters

mode int = optional
Chooses the restoration mode.

1 - 1 pass FreezeFrame.
2 - 2 pass 1st pass FreezeFrame, 2nd pass MCompensate with a maximum distance of 2 and FreezeFrame for frames MCompensate could not fix (default, compromise between quality and speed)
3 - 3 pass 1st pass FreezeFrame, 2nd pass MCompensate/FreezeFrame with distance 2, 3rd pass MCompensate/FreezeFrame with distance 3. (Useful for very bad sources)
4 - 1 pass MFlowInter motion compensation from two frames, one before and the other after the bad frame.

A FreezeFrame call can restore to a maximum distance of +/- 1 frame. Otherwise, the monotonic sequence of frames would not be guaranteed. So, if a shaky sequence is 6 frames long, one FreezeFrame call will not show a complete repair.

A MCompensate call can restore to a maximum distance of +/- 4 frames. However, this limit is not used to full extent in mode 2. Usually, frames with that distance are already so diferent, that only a small part of the bad frame can be recovered. In that case, it is better to cascade several passes and thus restore detail toward the center of the sequence.

A MFlowInter call can restore to a maximum distance of +4/-3 frames. I found that, in contrast to the expectations, MFlowInter dos not frequently recover frames. So it is here for completeness.

thresholdCF float = optional, default 1.05

This is the minimum detail gain to replace an original frame with MCompensate/FreezeFrame. If the replacement frame is not better, then the original frame is not replaced.

thresholdI float = optional

This is the minimum detail gain to replace an original frame with MFlowInter. If the replacement frame is not better, then the original frame is not replaced.

Examples

source with short shakes/blurs

FRebuild()

External Links

Personal tools