From Avisynth wiki
Jump to: navigation, search
Author Chikuzen, asd-g
Version 1.3.0
Download D2VSource-
Category Source filters
License GPLv2


[edit] Description

DV2Source (previously named as MPEG2DecPlus) is a MPEG-1/2 decoder plug-in. DV2Source is a project to modernize "DGDecode.dll" for AviSynth+.

Changes include:

  • Function renamed to DV2Source
  • Code clean up and refactoring
  • Elimination of code that is not currently required, such as VFAPI code and YUY2 code.
  • Support 64bit by removing assembly code, and optimization by intrinsic in SSE2 / AVX2. etc.
  • LumaYUV: function removed
  • BlindPP: function removed
  • DeBlock: function removed, see standalone DeBlock plugin for up-to-date version.
  • DV2Source: iPP, moderate_h, moderate_v, fastMC, and cpu2 parameters are removed.
  • Support for frame properties and variables.

[edit] Requirements

*** vcredist_x86.exe is required for DV2Source-x86
*** vcredist_x64.exe is required for DV2Source-x64

[edit] Syntax and Parameters

D2VSource (string "d2v", int "idct", bool "showQ", int "info", int "upConv", bool "i420", bool "iCC", bool "nocrop", int "rff")

string  d2v = ""
d2v file path [required]. Note: you can you DGIndex to create the d2v file.
Note: PATH can be ignored if the d2v file is in the same directory as your AviSynth (*.avs) script.

int  idct = 0
iDCT algorithm to use:
  • 0 : as specified by the d2v file
  • 1,2,3,6,7 : AP922 integer (same as SSE2MMX).
  • 4 : SSE2 / AVX2 LLM (single precision floating point, SSE2 / AVX2 judgment is automatic).
  • 5 : IEEE 1180 reference (double precision floating point).

bool  showQ = false
Show Macroblock Quantizers.
  • true : Show quantizers
  • false : Do not show quantizers

int  info = 0
Debug Information
  • 0 : Do not generate debug information
  • 1 : Overlay debug information on the video
  • 2 : Output debug information via OutputDebugString() (check the contents with DebugView.exe)
  • 3 : Output hints in the video (embed hints in 64 bytes in the upper left corner of the frame)

int  upConv = 0
Output colorspace:
  • 0 : No conversion, YUV420 source is YV12 output, YUV422 source is YV16 output.
  • 1 : up convert to YV16.
  • 2 : up convert to YV24.

bool  i420 = false
Output I420 Colorspace. Possibly required by some legacy applications.
Ignored if the input is not YV12 (4:2:0), or if upsampling with upConv=1 or 2.
  • true : output I420
  • false : output YV12

bool  iCC = auto
Settings for handling YUV420 in upConv.
MPEG2Source automatically uses the PROGRESSIVE_FRAME flag to switch between field/frame based upsampling on a per-frame-basis.
You should only specify the iCC parameter if you want to force DGDecode to use a particular upsampling mode.
  • [unspecified] : follow the PROGRESSIVE_FRAME flag
  • true : force field-based (interlaced) upsampling
  • false : force frame-based (progressive) upsampling

bool  nocrop = false
Use direct-rendered buffer, which may need cropping.
It could provide a speedup when you know you need to crop your image anyway, by avoiding extra memcpy calls.
Default: False.

int  rff = -1
Changes Field_Operation without the need of editing d2v or rescanning with different Field Operation.
  • 0: Honor Pulldowns Flags.
  • 1: Forced Film.
  • 2: Ignored Pulldowns Flags.
Default: -1 - read the value from d2v.

[edit] Exported variables

FFSAR_NUM, FFSAR_DEN, FFSAR (these indicate Generic PAR)

[edit] Frame properties

_AbsoluteTime [float]

The frame’s absolute timestamp in seconds.

_AspectRatio [int]

An array giving the display aspect ratio.

_ChromaLocation [int]

Chroma sample position in YUV formats: 0=left, 1=center, 2=topleft, 3=top, 4=bottomleft, 5=bottom.

_DurationNum [int], _DurationDen [int]

The frame’s duration in seconds as a rational number.

_EncodedFrameTop [int], _EncodedFrameBottom [int]

Frame number (before pulldown) used to generate this frame's top/bottom field.

_FieldBased [int]

Describes the composition of the frame:
  • 0=frame based (progressive), 1=bottom field first, 2=top field first.
Note that the GOP progressive flag is used to determine whether the frame is progressive.

v_FieldOperation [int]

Describes the field operation option in effect:
  • 0=honor pulldown, 1=force film, 2=ignore pulldown.

_FieldOrder [int]

Display field order of the frame:
  • 0=bottom field first, 1=top field first.

_Film [int]

Set if the frame is part of a 3:2 soft pulldown section.
Note that this uses the RFF history of several preceding frames, and so is valid only when doing linear access.

_GOPClosed [int]

Set if the current GOP is closed.

_GOPNumber [int]

The 0-based GOP number that contains the frame.
Note that if this is set as the value x, then propShow displays it as [x, y] where y is the 0-based frame number of the first frame in the GOP.

_GOPPosition [int]

The GOP position field from the D2V file for the GOP containing the frame.

_Matrix [int]

The matrix number field from the D2V file for the GOP containing the frame.

_PictType [data]

A single character describing the frame type.
It uses the common IPB characters but others may also be used for formats with additional frame types.

_ProgressiveFrame [int]

Set if the progress_frame flag is set for this frame.

_QuantsAverage [int]

The average quantizer value for the frame.

_QuantsMax [int]

The maximum quantizer value for the frame.

_QuantsMin [int]

The minimum quantizer value for the frame.

_RFF [int]

If _FieldOperation is 2 (ignore pulldown) then _RFF describes whether the stream specifies that a repeat field operation is to be performed on this frame.
If _FieldOperation is 0 (honor pulldown) or 1 (force film) then _RFF describes whether the frame was composed with field repetition.

_SARDen [int]

The denominator of the "pixel size" (MPEG-4 PAR), also called the Sample Aspect Ratio (SAR).

_SARNum [int]

The numerator of the "pixel size" (MPEG-4 PAR), also called the the Sample Aspect Ratio (SAR).

_TFF [int]

If _FieldOperation is 2 (ignore pulldown) and _RFF is set, then _TFF describes whether the stream specifies that the top field is to be repeated, otherwise the bottom field is to be repeated.
If _FieldOperation is 0 (honor pulldown) or 1 (force film) then _TFF is inapplicable and is set to -1.

[edit] Examples

DV2Source() should be used only with MPEG-1 and MPEG-2 video sources. To do plain YV12 decoding:


Note: PATH can be ignored if "project.d2v" is in the same directory as your AviSynth (*.avs) script.

[edit] Changelog

See the GitHub releases page for full changelog history.

Version      Date            Changes
v0.1.2 2020/05/13 - Changes by asd-g - Update to AviSynth+'s v8 interface v0.1.1 2016/08/31 - Last release by Chikuzen - /// mirror

[edit] External Links

  • GitHub - Source code repository.

Back to External Filters

Personal tools