DGDecode/MPEG2Source

From Avisynth wiki
Jump to: navigation, search


Back to DGDecode



Contents

Description

Frame accurate MPEG1/2 decoder. Official documentation: http://rationalqm.us/dgmpgdec/DGDecodeManual.html

Syntax and Parameters

MPEG2Source (string d2v, int "idct", int "cpu", bool "iPP", int "moderate_h", int "moderate_v", string "cpu2", int "upConv", bool "iCC", bool "i420", int "info", bool "showQ", bool "fastMC")


string  d2v = " "
DGIndex Project File [Required]
Note: PATH can be ignored if "project.d2v" is in the same directory as your AviSynth (*.avs) script.


int  idct = 0
iDCT Algorithm.
For more infomation on iDCTs please see iDCT Algorithm Notes. Please see SIMD Instructions for supported CPUs.
  • 0 : Use value specified by DGIndex
  • 1 : 32-bit MMX
  • 2 : 32-bit SSEMMX
  • 3 : 32-bit SSE2MMX
  • 4 : 64-bit Floating Point
  • 5 : 64-bit IEEE-1180 Reference
  • 6 : 32-bit SSEMMX (Skal)
  • 7 : 32-bit Simple MMX (XviD)


int  cpu = 0
Post-Processing Quickset Options.
(Y=luma, C=chroma, H=horizontal, V=vertical)
  • 0 : DISABLE POST-PROCESSING
  • 1 : DEBLOCK_Y_H
  • 2 : DEBLOCK_Y_H, DEBLOCK_Y_V
  • 3 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H
  • 4 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V
  • 5 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V, DERING_Y
  • 6 : DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V, DERING_Y, DERING_C


bool  iPP = auto
Post-Processing Mode.
DGDecode automatically uses the PROGRESSIVE_FRAME flag to switch between field/frame based post-processing on a per-frame-basis.
You should only specify the iPP parameter if you want to force DGDecode to use a particular post-processing mode.
  • [unspecified] : follow the PROGRESSIVE_FRAME flag
  • true : force field-based (interlaced) post-processing
  • false : force frame-based (progressive) post-processing


int  moderate_h = 20
int  moderate_v = 40
Horizontal and Vertical Block Detection Sensitivity. Smaller values are stronger, use with care.
Range: 0 to 255


string  cpu2 = " "
Post-Processing Custom Options.
Specify a six character string of x's and o's according to list below. (case-insensitive)
Each "x" enables the corresponding post-processing feature.
Each "o" disables the corresponding post-processing feature.
  • character 1 : luma horizontal deblocking
  • character 2 : luma vertical deblocking
  • character 3 : chroma horizontal deblocking
  • character 4 : chroma vertical deblocking
  • character 5 : luma deringing
  • character 6 : chroma deringing
For example, to enable chroma-only post-processing use:
MPEG2Source("project.d2v", cpu2="ooxxox")


int  upConv = 0
Upsample from 4:2:0 to YUY2 (4:2:2) or RGB24.
  • 0 : Do not upsample
  • 1 : Upsample to YUY2 (ignored if input is already 4:2:2)
  • 2 : Upsample to RGB24


bool  iCC = auto
Upsampling Mode.
DGDecode 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  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


int  info = 0
Debug Information
  • 0 : Do not generate debug information
  • 1 : Overlay debug information on the video
  • 2 : Output debug information via OutputDebugString()
  • 3 : Output hints in the video (as defined in utilities.cpp/utilities.h)


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


bool  fastMC = false
Vlad's Fast Motion Compensation. Very small speedup, but with degraded accuracy.
For testing purposes, and may be removed in a future version. Requires SSE or 3DNow!, please see iDCT Algorithm Notes for supported CPUs.


Examples

MPEG2Source() should be used only with MPEG-1 and MPEG-2 video sources.

  • To do plain YV12 decoding:
MPEG2Source("project.d2v", cpu=0)
Note: PATH can be ignored if "project.d2v" is in the same directory as your AviSynth (*.avs) script.


  • To do deblocking only:
MPEG2Source("project.d2v", cpu=4, iPP=true, moderate_v=20)


  • To do deblocking on an interlaced source with increased vertical sensitivity:
MPEG2Source("project.d2v", cpu=4, iPP=true, moderate_v=20)


  • To do deringing only:
MPEG2Source("project.d2v", cpu2="ooooxx")


  • To select the optimized 32-bit SSE2 iDCT and also output I420 colorspace:
MPEG2Source("project.d2v", idct=5, i420=true)


  • To convert to YUY2 based on the PROGRESSIVE_FRAME flag:
MPEG2Source("project.d2v", upConv=1)


  • To do display onscreen information about the video:
MPEG2Source("project.d2v", info=1)


iDCT Algorithm Notes

The FlasKMPEG readme file contains an excellent technical description of iDCTs. It states:

"The video information inside MPEG files is stored in the frequency domain rather than in the spatial domain (the images we see). That way, the information gets compacted and that compaction can be used to compress (reduce) the amount of information you have to send over the transmission channel. MPEG uses the DCT (Discrete Cosine Transform) to translate spatial information into frequency information. To bring back the spatial information from the MPEG stream you have to apply the iDCT, that is, the Inverse Discrete Cosine Transform, that undoes the DCT that was used during encoding."
"Although MPEG is almost deterministic (given a MPEG stream the output should be identical in all decoders), the standard has a degree of freedom when choosing the iDCT to use. That way, the decoder can be more easily implemented depending on the hardware below it. What the standard requires from the decoder is that the iDCT meets IEEE-1180 specs, or in plain words, that the error from the iDCT doesn't go beyond that the ones pointed out in the IEEE-1180."

Which iDCT you should use depends primarily on what CPU you have and to a lesser degree, on how accurate an iDCT you desire. Most people will not be able to tell the difference in quality between these algorithms but they can be easily observed by combining the AviSynth filters Subtract() and Levels(). All of the available options are IEEE-1180 compliant, except for SSE/MMX (Skal).

  • Qualitywise: IEEE-1180 Reference > 64-bit Floating Point > Simple MMX (XviD) > Remaining iDCTs.
  • Speedwise: SSE2/MMX and SSE/MMX (Skal) are usually the fastest. The IEEE-1180 Reference is easily the slowest.




Back to DGDecode


Personal tools