MPEG2DecPlus

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Description)
m (Update the version)
 
(9 intermediate revisions by one user not shown)
Line 2: Line 2:
 
{{Filter3
 
{{Filter3
 
|{{Author/Chikuzen}}, [https://github.com/Asd-g/MPEG2DecPlus asd-g]
 
|{{Author/Chikuzen}}, [https://github.com/Asd-g/MPEG2DecPlus asd-g]
|0.1.2
+
|1.3.0
|[https://github.com/Asd-g/MPEG2DecPlus/releases MPEG2DecPlus-0.1.2.7z]
+
|[https://github.com/Asd-g/MPEG2DecPlus/releases D2VSource-1.3.0.7z]
 
|Source filters
 
|Source filters
 
|[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
Line 10: Line 10:
  
 
== Description ==
 
== Description ==
MPEG2DecPlus is a MPEG-1/2 decoder plug-in. MPEG2DecPlus is a project to modernize "[[DGDecode]].dll" for AviSynth+.
+
DV2Source (previously named as MPEG2DecPlus) is a MPEG-1/2 decoder plug-in. DV2Source is a project to modernize "[[DGDecode]].dll" for AviSynth+.
 
<br>
 
<br>
 
<br>
 
<br>
 
Changes include:
 
Changes include:
* Code clean up
+
* Function renamed to DV2Source
 +
* Code clean up and refactoring
 
* Elimination of code that is not currently required, such as VFAPI code and YUY2 code.
 
* 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.
 
* Support 64bit by removing assembly code, and optimization by intrinsic in SSE2 / AVX2. etc.
* LumaYUV: additional colorspace support, function name change (was LumaYV12)
+
* LumaYUV: function removed
* DeBlock: function disabled, see standalone [[DeBlock]] plugin for up-to-date version.
+
* BlindPP: function removed
* BlindPP: function disabled
+
* DeBlock: function removed, see standalone [[DeBlock]] plugin for up-to-date version.
* MPEG2Source: <code>iPP, moderate_h, moderate_v, fastMC, cpu2</code> parameters are disabled, nothing happens when set.
+
* DV2Source: <code>iPP, moderate_h, moderate_v, fastMC, and cpu2</code> parameters are removed.
 +
* Support for [[MPEG2DecPlus#Frame_properties | frame properties]] and [[MPEG2DecPlus#Exported variables|variables]].
 
<br>
 
<br>
  
Line 28: Line 30:
 
* Supported color formats: [[YV12]], [[YV16]]
 
* Supported color formats: [[YV12]], [[YV16]]
 
<br>
 
<br>
 +
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2022 Redistributable Package (x86 / x64)]
 +
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>DV2Source-x86</tt>
 +
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>DV2Source-x64</tt>
 
<br>
 
<br>
== [[Script variables|Syntax and Parameters]] ==
 
  
=== MPEG2Source ===
+
== [[Script variables|Syntax and Parameters]] ==
:{{Template:FuncDef|MPEG2Source (''string d2v'', ''int'' "cpu", ''int'' "idct", ''bool'' "iPP", ''int'' "moderate_h", ''int'' "moderate_v", ''string'' "cpu2", ''int'' "upConv", ''bool'' "iCC", ''bool'' "i420", ''int'' "info", ''bool'' "showQ", ''bool'' "fastMC")}}
+
:{{Template:FuncDef|D2VSource (string "d2v", int "idct", bool "showQ", int "info", int "upConv", bool "i420", bool "iCC", bool "nocrop", int "rff")}}
 
<br>
 
<br>
::{{Par2|d2v|string| " "}}
+
::{{Par2|d2v|string|""}}
 
:::d2v file path [required]. Note: you can you DGIndex to create the d2v file.
 
:::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.
 
:::'''Note:''' PATH can be ignored if the d2v file is in the same directory as your AviSynth (*.avs) script.
<br>
 
::{{Par2|cpu|int|0}}
 
:::Disabled parameter.
 
 
<br>
 
<br>
 
::{{Par2|idct|int|0}}
 
::{{Par2|idct|int|0}}
 
:::iDCT algorithm to use:
 
:::iDCT algorithm to use:
::::*0 : as specified by the d2v file
+
:::*0 : as specified by the d2v file
::::*1,2,3,6,7 : AP922 integer (same as SSE2MMX).
+
:::*1,2,3,6,7 : AP922 integer (same as SSE2MMX).
::::*4 : SSE2 / AVX2 LLM (single precision floating point, SSE2 / AVX2 judgment is automatic).
+
:::*4 : SSE2 / AVX2 LLM (single precision floating point, SSE2 / AVX2 judgment is automatic).
::::*5 : IEEE 1180 reference (double precision floating point).
+
:::*5 : IEEE 1180 reference (double precision floating point).
 
<br>
 
<br>
::{{Par2|iPP|bool|auto}}
+
::{{Par2|showQ|bool|false}}
:::Disabled parameter.
+
:::Show Macroblock Quantizers.
 +
:::*true : Show quantizers
 +
:::*false : Do not show quantizers
 
<br>
 
<br>
::{{Par2|moderate_h|int|20}}
+
::{{Par2|info|int|0}}
::{{Par2|moderate_v|int|40}}
+
:::Debug Information
:::Disabled parameter.
+
:::*0 : Do not generate debug information
<br>
+
:::*1 : Overlay debug information on the video
::{{Par2|cpu2|string|""}}
+
:::*2 : Output debug information via OutputDebugString() (check the contents with DebugView.exe)
:::Disabled parameter.
+
:::*3 : Output hints in the video (embed hints in 64 bytes in the upper left corner of the frame)
 
<br>
 
<br>
 
::{{Par2|upConv|int|0}}
 
::{{Par2|upConv|int|0}}
Line 63: Line 66:
 
:::*1 : up convert to YV16.
 
:::*1 : up convert to YV16.
 
:::*2 : up convert to YV24.
 
:::*2 : up convert to YV24.
 +
<br>
 +
::{{Par2|i420|bool|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]]
 
<br>
 
<br>
 
::{{Par2|iCC|bool|auto}}
 
::{{Par2|iCC|bool|auto}}
Line 68: Line 77:
 
:::MPEG2Source automatically uses the PROGRESSIVE_FRAME flag to switch between field/frame based upsampling on a per-frame-basis.
 
:::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.
 
:::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
+
:::*[unspecified] : follow the PROGRESSIVE_FRAME flag
::::*true : force field-based (interlaced) upsampling
+
:::*true : force field-based (interlaced) upsampling
::::*false : force frame-based (progressive) upsampling
+
:::*false : force frame-based (progressive) upsampling
 
<br>
 
<br>
::{{Par2|i420|bool|false}}
+
::{{Par2|nocrop|bool|false}}
:::Output I420 Colorspace. Possibly required by some legacy applications.
+
:::Use direct-rendered buffer, which may need cropping.
:::Ignored if the input is not YV12 (4:2:0), or if upsampling with '''upConv'''=1 or 2.
+
:::It could provide a speedup when you know you need to crop your image anyway, by avoiding extra memcpy calls.
::::*true : output [[I420]]
+
:::Default: False.
::::*false : output [[YV12]]
+
 
<br>
 
<br>
::{{Par2|info|int|0}}
+
::{{Par2|rff|int|-1}}
:::Debug Information
+
:::Changes Field_Operation without the need of editing d2v or rescanning with different Field Operation.
::::*0 : Do not generate debug information
+
:::*0: Honor Pulldowns Flags.
::::*1 : Overlay debug information on the video
+
:::*1: Forced Film.
::::*2 : Output debug information via OutputDebugString() (check the contents with DebugView.exe)
+
:::*2: Ignored Pulldowns Flags.
::::*3 : Output hints in the video (embed hints in 64 bytes in the upper left corner of the frame)
+
:::Default: -1 - read the value from d2v.
 
<br>
 
<br>
::{{Par2|showQ|bool|false}}
+
===Exported variables===
:::Show Macroblock Quantizers.
+
 
::::*true : Show quantizers
+
<code>FFSAR_NUM, FFSAR_DEN, FFSAR (these indicate Generic PAR)</code>
::::*false : Do not show quantizers
+
<br>
+
::{{Par2|fastMC|bool|false}}
+
:::Disabled parameter.
+
 
<br>
 
<br>
---------------------
+
===Frame properties===
=== LumaYUV ===
+
LumaYUV() outputs a 0->255 YUV range, and not a CCIR-601 16->235 range. Use the AviSynth built-in filter ColorYUV() instead if you need to enforce a 16->235 range. The functionality of LumaYUV() can be achieved using ColorYUV(), which has more features, but LumaYUV() is optimized for speed in performing basic luma adjustment.
+
  
 +
<code>_AbsoluteTime [float]</code>
 +
:The frame’s absolute timestamp in seconds.
  
:{{Template:FuncDef|LumaYV12 (clip, int "lumoff", float "lumgain")}}
+
<code>_AspectRatio [int]</code>
 +
:An array giving the display aspect ratio.
 +
 
 +
<code>_ChromaLocation [int]</code>
 +
:Chroma sample position in YUV formats: 0=left, 1=center, 2=topleft, 3=top, 4=bottomleft, 5=bottom.
 +
 
 +
<code>_DurationNum [int], _DurationDen [int]</code>
 +
:The frame’s duration in seconds as a rational number.
 +
 
 +
<code>_EncodedFrameTop [int], _EncodedFrameBottom [int]</code>
 +
:Frame number (before pulldown) used to generate this frame's top/bottom field.
 +
 
 +
<code>_FieldBased [int]</code>
 +
: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.
 +
 
 +
<code>v_FieldOperation [int]</code>
 +
:Describes the field operation option in effect:
 +
:*0=honor pulldown, 1=force film, 2=ignore pulldown.
 +
 
 +
<code>_FieldOrder [int]</code>
 +
:Display field order of the frame:
 +
:*0=bottom field first, 1=top field first.
 +
 
 +
<code>_Film [int]</code>
 +
: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.
 +
 
 +
<code>_GOPClosed [int]</code>
 +
:Set if the current GOP is closed.
 +
 
 +
<code>_GOPNumber [int]</code>
 +
: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.
 +
 
 +
<code>_GOPPosition [int]</code>
 +
:The GOP position field from the D2V file for the GOP containing the frame.
 +
 
 +
<code>_Matrix [int]</code>
 +
:The matrix number field from the D2V file for the GOP containing the frame.
 +
 
 +
<code>_PictType [data]</code>
 +
: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.
 +
 
 +
<code>_ProgressiveFrame [int]</code>
 +
:Set if the progress_frame flag is set for this frame.
 +
 
 +
<code>_QuantsAverage [int]</code>
 +
:The average quantizer value for the frame.
 +
 
 +
<code>_QuantsMax [int]</code>
 +
:The maximum quantizer value for the frame.
 +
 
 +
<code>_QuantsMin [int]</code>
 +
:The minimum quantizer value for the frame.
 +
 
 +
<code>_RFF [int]</code>
 +
: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.
 +
 
 +
<code>_SARDen [int]</code>
 +
:The denominator of the "pixel size" (MPEG-4 PAR), also called the Sample Aspect Ratio (SAR).
 +
 
 +
<code>_SARNum [int]</code>
 +
:The numerator of the "pixel size" (MPEG-4 PAR), also called the the Sample Aspect Ratio (SAR).
 +
 
 +
<code>_TFF [int]</code>
 +
: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.
 
<br>
 
<br>
::{{Par2| |clip| }}
+
==Examples==
:::Input clip; supports Y8, YV12, YV16, YV411, and YV24.
+
DV2Source() should be used only with MPEG-1 and MPEG-2 video sources. To do plain YV12 decoding:
<br>
+
 
::{{Par2|lumoff|int|0}}
+
DV2Source("[PATH\]project.d2v")
:::Luminosity Offset; adjust the luma of all pixels by a fixed amount.
+
Note: PATH can be ignored if "project.d2v" is in the same directory as your AviSynth (*.avs) script.
:::Range: -255 to 255 (default: 0)
+
 
<br>
 
<br>
::{{Par2|lumgain|float|1.0}}
 
:::Luminosity Gain; adjust the luma of all pixels by a proportional amount.
 
:::Range: 0.0 to 2.0 (default: 1.0)
 
 
<br>
 
<br>
 +
== Changelog ==
 +
See the [https://github.com/Asd-g/MPEG2DecPlus/releases GitHub releases] page for full changelog history.
 +
Version      Date            Changes<br>
 +
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
 +
                              - [http://kuroko.fushizen.eu/bin/mpeg2decplus-0.1.1.zip mpeg2decplus-0.1.1.zip] /// [https://web.archive.org/web/20161102003551/https://kuroko.fushizen.eu/bin/mpeg2decplus-0.1.1.zip mirror]
 
<br>
 
<br>
 
==External Links==
 
==External Links==

Latest revision as of 02:26, 16 May 2022

Abstract
Author Chikuzen, asd-g
Version 1.3.0
Download D2VSource-1.3.0.7z
Category Source filters
License GPLv2
Discussion

Contents

[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:

DV2Source("[PATH\]project.d2v")

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 - mpeg2decplus-0.1.1.zip /// mirror


[edit] External Links

  • GitHub - Source code repository.




Back to External Filters

Personal tools