Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 31st January 2017, 03:10   #2941  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Thanks. Is there an updated version of SMDegrain script that uses the new MVTools or not yet?
MysteryX is offline  
Old 31st January 2017, 03:14   #2942  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by MysteryX View Post
Thanks. Is there an updated version of SMDegrain script that uses the new MVTools or not yet?
Don't know, ask Dogway on VideoHelp. If you want the hacks-upon-hacks-mod-of-a-mod version check with real.finder .
Reel.Deel is offline  
Old 31st January 2017, 03:43   #2943  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
I have this line of code for which I want to add 16-bit support with Y16, YUV420P16, YUV444P16, RGB48 and RGB64.
Code:
sourceFormat = FormatOut != "" ? FormatOut : IsY8 ? "Y8" : IsYV12 ? "YV12" : IsYV24 ? "YV24" : IsRGB24 ? "RGB24" : IsRGB32 ? "RGB32" : ""
How can I know whether the clip is 8 bit or 16 bit from the script? Is there a way to write it in a way that will still work under AviSynth 2.6?
MysteryX is offline  
Old 31st January 2017, 04:16   #2944  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by MysteryX View Post
Thanks. Is there an updated version of SMDegrain script that uses the new MVTools or not yet?
my mod work and use last mvtools, but all prefilter not yet work with > 8 bit, with tv_range=false and prefilter=-1 or prefilter=external clip it should work now
__________________
See My Avisynth Stuff

Last edited by real.finder; 31st January 2017 at 05:37.
real.finder is offline  
Old 31st January 2017, 04:26   #2945  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by Reel.Deel View Post
Don't know, ask Dogway on VideoHelp. If you want the hacks-upon-hacks-mod-of-a-mod version check with real.finder .
most hack done in YUY2 and that nothing to do with new color format

all filter that needed in SMDegrain work with yv16 now, so there is no need for YUY2 in avs 2.6 (Except for contrasharp > 0.0 cuz it use LSFmod), smart users will covert to yv16 if they have YUY2 source
__________________
See My Avisynth Stuff

Last edited by real.finder; 31st January 2017 at 05:31.
real.finder is offline  
Old 31st January 2017, 05:05   #2946  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Quote:
Originally Posted by MysteryX View Post
that uses the new MVTools or not yet?
Oups what I wanted to ask is "that uses native 16-bit in/out instead of Stack16"
MysteryX is offline  
Old 31st January 2017, 05:29   #2947  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by MysteryX View Post
Oups what I wanted to ask is "that uses native 16-bit in/out instead of Stack16"
in most cases, script functions support depends on plugins supports, lsb is still there in new mvtools, you can use what you want whether old lsb hack or native (but not both), native > 8 support incompatible with lsb things, there are functions in new avs+ that convert native > 8 from/to lsb but I don't want to did this hack in SMDegrain, but anyone can use these functions like this

Code:
10 bit source
prefilter=ConvertBits(16).ConvertToStacked().SMDegrain_prefilters(prefilter=3,lsb_in=true).ConvertFromStacked(16).ConvertBits(10) #or prefilter=4
SMDegrain(tv_range=false, prefilter=prefilter) #don't use contrasharp cuz there is no native > 8 support
__________________
See My Avisynth Stuff

Last edited by real.finder; 31st January 2017 at 05:35.
real.finder is offline  
Old 31st January 2017, 06:09   #2948  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
I'm not interested in 10-bit sources... just looking at whether I can drop LSB stuff and use native 16-bit instead. Question is: the filters used by SMDegrain that were using LSB, do they now support native 16-bit? MVTools does.
MysteryX is offline  
Old 31st January 2017, 06:19   #2949  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by MysteryX View Post
I'm not interested in 10-bit sources... just looking at whether I can drop LSB stuff and use native 16-bit instead.
then

Code:
prefilter=ConvertToStacked().SMDegrain_prefilters(prefilter=3,lsb_in=true).ConvertFromStacked(16) #or prefilter=4
Quote:
Question is: the filters used by SMDegrain that were using LSB, do they now support native 16-bit? MVTools does.
in this case, as I already said, you can't use prefilter or tv_range=true or contrasharp cuz there is no native 16 bit for all plugins that used in SMDegrain
__________________
See My Avisynth Stuff
real.finder is offline  
Old 31st January 2017, 07:00   #2950  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Quote:
Originally Posted by real.finder View Post
in this case, as I already said, you can't use prefilter or tv_range=true or contrasharp cuz there is no native 16 bit for all plugins that used in SMDegrain
Native 16-bit will provide great performance improvement over LSB, especially for a heavy script like SMDegrain. However, it's kind of pointless until enough plugins support 16-bit to actually use it.

How about producing a list of filters supporting LSB that don't support the new native formats? Since they already work with high-bit-depth, I'm supposing it wouldn't be too hard to update those.
MysteryX is offline  
Old 31st January 2017, 09:07   #2951  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by ajp_anton View Post
Using "averageluma", 128 is converted to 0.501961 (128/255).
Using "yplanemax"/"-min", 128 is converted to 32896 (is this a bug? should be a float number, not a 16bit int)
.
Yes, it was fixed recently, perhaps after v2397. MinMax-like conditional functions (Min, Max, MinMaxDifference and Median) were done at the very beginning and could not decide that the return value should be the old integer or can be float (always the compatibility in mind). Then recently it was changed to float.

Conditional runtime functions have 10-16 bit/float support for YUV, PlanarRGB and 16 bit packed RGB formats.

Since RGB is also available as a planar colorspace, the plane statistics functions logically were expanded.

New functions
• AverageR, AverageG AverageB like AverageLuma
• RDifference, GDifference, BDifference like LumaDifference(clip1, clip2)
• RDifferenceFromPrevious, GDifferenceFromPrevious, BDifferenceFromPrevious
• RDifferenceToNext, GDifferenceToNext, BDifferenceToNext
• RPlaneMin, GPlaneMin BPlaneMin like YPlaneMin(clip [, float threshold = 0, int offset = 0])
• RPlaneMax, GPlaneMax BPlaneMax like YPlaneMax(clip [, float threshold = 0, int offset = 0])
• RPlaneMinMaxDifference, GPlaneMinMaxDifference BPlaneMinMaxDifference like YPlaneMinMaxDifference(clip [, float threshold = 0, int offset = 0])
• RPlaneMedian, GPlaneMedian, BPlaneMedian like YPlaneMedian(clip [, int offset = 0])

For float colorspaces the Min, Max, MinMaxDifference and Median functions populate pixel counts for the internal statistics at a 16 bit resolution internally.
pinterf is offline  
Old 31st January 2017, 16:23   #2952  |  Link
Khanattila
Registered User
 
Khanattila's Avatar
 
Join Date: Nov 2014
Posts: 440
Code:
Packed RGB
8 bits: RGB24, RGB32 (BGR and BGRA internally)
16 bits: RGB48, RGB64

Check: IsRGB ; note: IsRGB now true for planar RGB(A) color spaces.
Check2: IsRGB24, IsRGB32, IsRGB48, IsRGB64
I'm working on adding new formats to my program and I need a clarification.
Packed RGB64 is BGRA internally?
__________________
github.com
Khanattila is offline  
Old 31st January 2017, 16:41   #2953  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by Khanattila View Post
Code:
Packed RGB
8 bits: RGB24, RGB32 (BGR and BGRA internally)
16 bits: RGB48, RGB64

Check: IsRGB ; note: IsRGB now true for planar RGB(A) color spaces.
Check2: IsRGB24, IsRGB32, IsRGB48, IsRGB64
I'm working on adding new formats to my program and I need a clarification.
Packed RGB64 is BGRA internally?
Yes, same as RGB32 and the same upside down order.
pinterf is offline  
Old 31st January 2017, 16:47   #2954  |  Link
Khanattila
Registered User
 
Khanattila's Avatar
 
Join Date: Nov 2014
Posts: 440
Quote:
Originally Posted by pinterf View Post
Yes, same as RGB32 and the same upside down order.
Perfect, I will not have problems.
__________________
github.com
Khanattila is offline  
Old 31st January 2017, 17:12   #2955  |  Link
poodle
Registered User
 
Join Date: Mar 2014
Posts: 1
Quote:
Originally Posted by pinterf View Post
The original blending formula is something like that, where an ideal mask is 0..1.0:
new_value = orig*(1-mask) + overlay*mask

This is equivalent to (only one multiplication, faster):
new_value = orig+(overlay-orig)*mask

As mask is coming from a clip, its value is 0..255

The approximation in overlay core:
new_value = ((orig * 256 + 128)+(overlay-orig)*mask) / 256

When orig=255, overlay=0, mask=255 (overlay is fully visible), we would expect 0 (=overlay)

Unfortunately the approximation above results in:

new_value = ((orig * 256 + 128)+(overlay-orig)*mask) / 256:
(255*256+128) + (0-255)*255) / 256 = 383/256 =
(65408 - 65025) / 256 =
383/256 = 1
which is obviously incorrect

For orig=0, overlay=255, mask=255 the result is 254 instead of 255.
Hi.
I encountered similar problem.
Chroma is offset signed value, then these asymmetric conversion brings to color shift.

In order to cope with this problem, I wrote the following codes.

u = _mm_sub_epi16(u, offsetUV);
sign = _mm_cmpgt_epi16(zero, u);
u = _mm_sub_epi16(_mm_xor_si128(u, sign), sign); // abs(u)

process U

u = _mm_sub_epi16(_mm_xor_si128(u, sign), sign); // if (sign) neg(u)
u = _mm_add_epi16(u, offsetUV);

It is complex than madd.
poodle is offline  
Old 2nd February 2017, 16:50   #2956  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
I decided to make a release, I hope this version is much better than the previous one, it is quite a few months since v2294 was released. Sure, it has a wider feature set than the ROM routines of a ZX81, which I started programming on.

Avisynth Plus v2420

Report bugs, regressions, wish-list as always.

!!! There is a long readme.txt in the packet which contains detailed informations on the new and changed functions, fixes and hints. Formatting is not that nice, but at least there is some doc (sort of).

Changelog since last dev release (v2397):
Code:
- CombinePlanes:
    When there is only one input clip, zero-cost BitBlt-less subframes are used, which is much faster.

    e.g.: casting YUV to RGB, shuffle RGBA to ABGR, U to Y, etc..
    Target planes that are not specified, preserve their content.

    Examples:
    CombinePlanes(clipRGBP, planes="RGB",source_planes="BGR") # swap R and B
    CombinePlanes(clipYUV, planes="GBRA",source_planes="YUVA",pixel_type="RGBAP8") # cast YUVA to planar RGBA
    CombinePlanes(clipYUV, planes="Y",source_planes="U",pixel_type="Y8") # extract U

- fix: SubframePlanarA (available in IScriptEnvironment2)
- faster: Difference-type conditional functions: Simd for 10-16 bits
- Fix: MinMax-type conditional functions (min, max, median): return float value for float clips
- ConvertToPlanarRGB(A): 
    PlanarRGB <-> PlanarRGBA is now allowed
- ConvertToPlanarRGB(A):
    YUY2 source is now allowed (through automatic ConvertToRGB proxy)
- faster: RemoveAlphaPlane (subframe instead of BitBlt copy)
- Overlay: "Blend" native greyscale mode: process y plane only w/o conversion
- Overlay: automatic use444=false for "blend"/"luma"/"chroma" 
    for inputs: 420/422/444 and any RGB, lossless Planar RGB intermediate for PackedRGB
    Overlay/mask auto-follows input clip format.
    For compatibility: when greymask=true (default) and mask is RGB then mask source is the B channel
- faster: RGB48->RGB64 SSSE3 (1,6x), RGB64->RGB48 SSSE3 (1.5x speed)
- faster: RGB24,RGB48->PlanarRGB: uses RGB32/64 intermediate clip
- Histogram "levels": allow RGB24/32/48/64 input.
    Display R, G and B channels instead of Y, U and V
    Reminder 1: "levels" for Planar RGB was working already
    Reminder 2: Histogram "levels" and "Classic" allows bits=xx parameter, xx=8..12
                If "bits" is specified then Histogram is drawn with 9..12 bits precision. Get a wide monitor though :)
pinterf is offline  
Old 2nd February 2017, 23:22   #2957  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
Small feature request: In histogram, add some parameter to show the histogram itself in a higher bitdepth. Even a histogram of an 8-bit video can benefit from being able to display the data more accurately. Probably has to convert the whole clip into a higher bitdepth in the process, unless you add another bool parameter (default false) to only return the histogram part and make it faster. Only returning the histogram would also help with those ultra-wide histograms that you can crop and stretch more easily, without having to crop away the video part first.

Last edited by ajp_anton; 2nd February 2017 at 23:26.
ajp_anton is offline  
Old 3rd February 2017, 02:41   #2958  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by MysteryX View Post
Native 16-bit will provide great performance improvement over LSB, especially for a heavy script like SMDegrain. However, it's kind of pointless until enough plugins support 16-bit to actually use it.

How about producing a list of filters supporting LSB that don't support the new native formats? Since they already work with high-bit-depth, I'm supposing it wouldn't be too hard to update those.
lsb in SMDegrain is not full 16 bit, it's done in MDegrain and some prefilters only, even MDegrain is not full cuz there are no lsb_in in MDegrain, dogway use some dither tools functions to do the lsb_in support in crooked ways

but anyway, since pinterf promise to work on masktools2 you can try port Dfttest, it's work in float internally too so I think it's not hard to you
__________________
See My Avisynth Stuff
real.finder is offline  
Old 3rd February 2017, 09:54   #2959  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
Regarding histogram levels, I don't know if there are already plugins that do that, but it could be helpful to have the min and max value of each channel written down. Sometimes there are videos with some levels off that needs to be "shifted" (especially the old ones) and having the min/max value can be useful to shift with more precision.
mp3dom is offline  
Old 3rd February 2017, 10:26   #2960  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
One may use WriteFile to log a CSV with strings concatenated from Color plane median, min, max, range function results.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.