Section4 Importing filters from VirtualDub のバックアップの現在との差分(No.4)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
#contents

***Q4.1: VirtualDubのフィルタをインポートするスクリプトの最新版は、どこでダウンロードすることができますか? [#m473f7e5]

A: AviSyntスクリプトは、[[ShareFunctions:http://www.avisynth.org/ShareFunctions]]ページにあります。もしくは、vdub_filtersv15.zipというパッケージを[[[1]:http://forum.doom9.org/showthread.php?s=&threadid=23804]]か[[[2]:http://neuron2.net/hosted.html]]から、ダウンロードすることもできます。 
A: AviSynthスクリプトは、[[ShareFunctions:http://www.avisynth.nl/ShareFunctions]]ページにあります。もしくは、vdub_filtersv15.zipというパッケージを[[[1]:http://forum.doom9.org/showthread.php?s=&threadid=23804]]か[[[2]:http://neuron2.net/hosted.html]]から、ダウンロードすることもできます。 

***Q4.2: どのフィルタがインポートされますか? [#vfe656f8]

A: ほとんどのフィルタが。関連するキュメントを読んでください。

***Q4.3: これらのスクリプトは、RGB空間やYUV空間で動作しますか? [#bc2767d8]

A: RGB空間(RGB32)のみです。

***Q4.4: そのようなスクリプトは、どうやって作るのですか? [#g0a12952]

A: スクリプト例(このVirtualDubフィルタは、[[[Donalds homepage]:http://neuron2.net/]]から、ダウンロードすることが出来ます):

Smart Bob by Donald Graft:

 function VD_SmartBob(clip ''clip'', bool ''show_motion'', int ''threshold'', bool ''motion_map_denoising'')
 LoadVirtualdubPlugin("d:\bob.vdf", "_VD_SmartBob", 1)
 LoadVirtualDubPlugin("d:\bob.vdf", "_VD_SmartBob", 1)
 return clip.SeparateFields._VD_SmartBob(clip.GetParity?1:0,
 \  default(show_motion,false)?1:0, default(threshold,10),
 \  default(motion_map_denoising,true)?1:0)
 }

VirtualDubのプラグインは、"LoadVirtualdubPlugin"というコマンドでインポートされます。1つ目の引数はプラグインのパスを、2つ目の引数はスクリプト内で使われるプラグインの名前を与え、3つ目の引数はプリロール(preroll)と呼ばれます。
VirtualDubのプラグインは、"LoadVirtualDubPlugin"というコマンドでインポートされます。1つ目の引数はプラグインのパスを、2つ目の引数はスクリプト内で使われるプラグインの名前を与え、3つ目の引数はプリロール(preroll)と呼ばれます。

プリロールは、少なくとも、フィルタがバッファをいっぱいにし、そして/または、内部変数を更新するために、前処理(pre-process)するのに必要なフレーム数に設定されるべきです。最後の引数は、SmartBob、SmartDeinterlace、TemporalCleanerなどのフィルタにおいて使われます。その理由は、VirtualDubのフィルタリング・アーキテクチャにより、未来フレームはフィルタによってアクセスされえないからです。Divideeは報告しています:  "VirtualDubの"Add filter"ダイアログにおいて、いくつかのフィルタは、その説明の中に"Lag:"という値を持っています。これはプリロールとして使われなければならない値だと、私は考えます。不幸なことに、この表示が、いつもあるとは限りません。それらのケースでは、あなたは推測しなければなりません。" もちろん、あなたはいつでも、フィルタ作者に問い合わせることができます。

The first step is to find out the sequence of the arguments in the last line where the clip is returned. Configure the script in VirtualDub and select "Save processing Settings" in the File Menu or press Ctrl+S. Open the created .vcf file with a text editor and you should see lines like this:
第1段階は、クリップが返される最後の行の中に、引数の連続を見つけ出すことです。VirtualDubでスクリプトを設定し、Fileメニューで"Save processing Settings"を選択するか、Ctrl+Sを押します。テキストエディタで生成された.vcfファイル((vcf: VirtualDub configuration file))を開いて、このような行を見つけます:

VirtualDub.video.filters.Add("smart bob (1.1 beta 2)");
 VirtualDub.video.filters.Add("smart bob (1.1 beta 2)");
 VirtualDub.video.filters.instance[0].Config(1, 0, 10, 1);

VirtualDub.video.filters.instance[0].Config(1, 0, 10, 1);
引数の順番は、AviSynthで使われなければならない順番です。引数の役割を知るためには、それらの引数をVirtualDubでいじって、結果として生じる行を調べてください。

The order of the arguments is the one that has to be used in AviSynth. To find the role of the arguments, play with them in VirtualDub and examine the resulting lines.
第2段階は、そのフィルタをテストして、VirtualDubでそのフィルタを使用した場合と比較することです。プログラミング自体に関しては、vdub_filters.avsに、すでに含まれているスクリプトを見ることによって、多くを学ぶことができます。

The second step is to test the filter and to compare it with the VirtualDub filter itself. For the programming itself you can learn a lot by looking at the script which are already contained in vdub_filters.avs.
VD_SmartBobを使ったスクリプト例:

Example script which uses the function VD_SmartBob:

 Import("d:\vdub_filters.avs")
 AviSource("d:\filename.avi")
 ConvertToRGB32()  # only when necessary (but doesn't hurt)
 ConvertToRGB32()  # 必要な時のみ(しかし、クリップを傷つけることはない)
 VD_SmartBob(false, 10, true)
 ConvertBackToYUY2()  # only when necessary
 ConvertBackToYUY2()  # 必要な時のみ