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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

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

Reply
 
Thread Tools Display Modes
Old 12th February 2026, 13:20   #3621  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,834
Is there any documentation/example for passing functions as parameters to plugins ('n' in AddFunction parameter string)?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 12th February 2026, 15:44   #3622  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
New build.
Avisynth r4507
https://github.com/pinterf/AviSynthP...3.7.6pre-r4507

Full change log:
https://avisynthplus.readthedocs.io/...gelist376.html


Code:
20260213 3.7.5.r4507 (pre 3.7.6)
--------------------------------
Fix Layer "add" 8 bit, regression in r4504

20260212 3.7.5.r4504 (pre 3.7.6)
--------------------------------
* Fix: inaccurate ColorBarsHD 10+ bit values. Now they are derived from the 32-bit float 
  RGB definitions instead of upscaling a 8 bit precalculated YUV value.
  Add Ramp section the lead-in-lead-out.
* Fix: GreyScale + SSE2 + RGB32 + matrix="RGB" overflow. 
  Rare usage; "RGB" matrix (Identity) uses a 1.0 coefficient which exceeds the signed 16-bit 
  SIMD limit of 32767 at 15-bit precision. Added bounds checking to fallback to C-code for any 
  coefficients >= 1.0 or < −1.0.
* Fix: YUV->RGB limited range matrix accuracy for 10-16 bits.
* Use a different rounding in matrix coefficient's integer approximation.
* "ConvertToPlanarRGB": ``bits`` parameter: on-the-fly bit-depth conversions to YUV->RGB conversion. 
  - Full range target: 8-16 bits internal calculation is in 32-bit float.
  - Limited range target: a quicker, bit accuracy optimized integer calculation path.
* Not Fixed: Speed degradation when in-constructor GetFrame(0) (e.g. frame-property getter) 
  is used. Disable internal Cache object creation. Does not work in complex scripts, preparation 
  is 5-10 min instead of <1 sec. Investigation continues (Issue #476: https://github.com/AviSynth/AviSynthPlus/issues/476)
* Avoid MTGuard and CacheGuard creation if filter returns one of its clip parameter unaltered.
* Add some avx2 stuff to Layer and Invert
* Optimization: Overlay "Blend": aarch64 NEON optimization

20260203 3.7.5.r4483 (pre 3.7.6)
--------------------------------
* rst documentation update: RGBAdjust https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/adjust.html
* rst documentation update: ColorYUV https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/coloryuv.html
* optimization: add AVX2 TurnLeft/TurnRight/Turn180 (R/L: 1,5-3x speed).
* optimization: ConvertBits AVX2 integer->float
* optimization: ConvertToPlanarRGB(A): YUV->RGB add AVX2 (2-3x speed)
* optimization: ConvertToPlanarRGB(A): YUV->RGB 16 bit: a quicker way (1,5x)
* Fix: C version of 32-bit ConvertToPlanarRGB YUV->RGB to not clamp output RGB values.
* ConvertToPlanarRGB(A): add bits parameter to alter target bit-depth.
* ConvertToPlanarRGB(A): from YUV->RGB full range output: optimized in-process when bits=32, other cases call ConvertBits internally.
* Fix: Packed RGB conversions altering the bit-depth (e.g. rgb32->ConvertToRGB64() worked always in full range.
* Add more AVX512 resampler code. (WIP)
* Add more AVX512_BASE code paths (Resamplers)
* Build: add _avx512b.cpp/hpp pattern in CMake to detect source to compile with base (F,CD,BW,DQ,VL) flags.
  However AVX512_BASE itself is set only when AVX512_FAST found.
  For pre-Ice Lake (older AVX512) systems you can enable it with SetMaxCPU("avx512base+") and get the optimized AVX512_BASE functions.
* Build: add new architecture z/Architecture

Last edited by pinterf; 14th February 2026 at 00:42. Reason: r4507 with hotfix
pinterf is offline   Reply With Quote
Old 12th February 2026, 15:54   #3623  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Quote:
Originally Posted by wonkey_monkey View Post
Is there any documentation/example for passing functions as parameters to plugins ('n' in AddFunction parameter string)?
Perhaps this one:
https://avisynthplus.readthedocs.io/...n_objects.html

EDIT:
or in function parameter
https://avisynthplus.readthedocs.io/...nalfilter.html

and in Avisynth source (runtime functions accept function objects)
https://github.com/AviSynth/AviSynth...tional.cpp#L61

Last edited by pinterf; 12th February 2026 at 16:03.
pinterf is offline   Reply With Quote
Old 12th February 2026, 18:10   #3624  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 954
https://github.com/pinterf/AviSynthP...dc7e3c00b321c8
I don't know why are minor DEBUG fixes added?
Code:
cache.cpp:745:146: error: macro "_RPT3" passed 6 arguments, but takes just 5
  745 |       _RPT3(0, "CacheGuard::SetCacheHints called. cache=%p hint=%d (%s) frame_range=%d\n", (void*)this, cachehints, hintname.c_str(), frame_range); // P.F.
      |                                                                                                                                                  ^
In file included from cache.h:38,
                 from cache.cpp:35:
avisynth.h:157: note: macro "_RPT3" defined here
  157 |   #define _RPT3(a,b,c,d,e) ((void)0)
      |
cache.cpp: In member function 'virtual int CacheGuard::SetCacheHints(int, int)':
cache.cpp:745:7: error: '_RPT3' was not declared in this scope
  745 |       _RPT3(0, "CacheGuard::SetCacheHints called. cache=%p hint=%d (%s) frame_range=%d\n", (void*)this, cachehints, hintname.c_str(), frame_range); // P.F.
      |       ^~~~~
Jamaika is offline   Reply With Quote
Old 12th February 2026, 18:27   #3625  |  Link
Columbo
Registered Developer
 
Join Date: Sep 2025
Location: Chi-town
Posts: 148
It's a single code base. pinterf and others may want to build with _DEBUG when troubleshooting. Did I miss your point?
Columbo is offline   Reply With Quote
Old 12th February 2026, 18:40   #3626  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Yes, minor, since compared to last week's ~40 hrs work on the project it was just a quick moment to copy-paste _RPT3 and not modifying the _RPT3 to _RPT4. Sorry for the inconvenience.
pinterf is offline   Reply With Quote
Old 12th February 2026, 18:46   #3627  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
(I don't know what private compiler settings are you using again, for me it said '0 warning(s)', vs. your environment which drives it to an error. Anyway, thanks for the report. Fixed.)
pinterf is offline   Reply With Quote
Old 13th February 2026, 00:18   #3628  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,834
Quote:
Originally Posted by pinterf View Post
and in Avisynth source (runtime functions accept function objects)
https://github.com/AviSynth/AviSynth...tional.cpp#L61
When I tried to pass a parameter to the constructor as a PFunction (via args[x].AsFunction()) I get:

Code:
unresolved external symbol "public: class PFunction __cdecl AVSValue::AsFunction(void)const " (?AsFunction@AVSValue@@QEBA?AVPFunction@@XZ)


Is it something to do with this?

Quote:
c++ strict conformance: cannot Convert PFunction to PFunction&
Edit: or this:

Code:
  PFunction AsFunction() const; // internal use only
So external plugins can't make use of it?
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 13th February 2026 at 19:59.
wonkey_monkey is offline   Reply With Quote
Old 14th February 2026, 00:40   #3629  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Quote:
Originally Posted by wonkey_monkey View Post
When I tried to pass a parameter to the constructor as a PFunction (via args[x].AsFunction()) I get:

Code:
unresolved external symbol "public: class PFunction __cdecl AVSValue::AsFunction(void)const " (?AsFunction@AVSValue@@QEBA?AVPFunction@@XZ)


Is it something to do with this?



Edit: or this:

Code:
  PFunction AsFunction() const; // internal use only
So external plugins can't make use of it?
In expression.cpp I encountered with the problem, but can't remember the details:

Code:
  if (real_name == nullptr) {
    // if name is not given, evaluate expression to get the function
    eval_result = func->Evaluate(env);
    if (!eval_result.IsFunction()) {
        env->ThrowError(
          "Script error: '%s' cannot be called. Give me a function!",
        GetAVSTypeName(eval_result));
    }
    //auto& func = eval_result.AsFunction(); // c++ strict conformance: cannot Convert PFunction to PFunction&
    const PFunction& func = eval_result.AsFunction();
    real_name = func->GetLegacyName();
    real_func = func->GetDefinition();
  }
pinterf is offline   Reply With Quote
Old 14th February 2026, 00:45   #3630  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Meanwhile a hotfix, 8 bit Layer "add" mask problems
New build, sorry for that.
Avisynth r4507
https://github.com/pinterf/AviSynthP...3.7.6pre-r4507
pinterf is offline   Reply With Quote
Old 15th February 2026, 11:53   #3631  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,389
Quote:
Originally Posted by pinterf View Post
Meanwhile a hotfix, 8 bit Layer "add" mask problems
New build, sorry for that.
Avisynth r4507
https://github.com/pinterf/AviSynthP...3.7.6pre-r4507


x86-xp build
Tested and working on Windows XP Professional x86



x64-win7-19.44.35221-17.14 build

Tested and working on Windows Server 2008 R2 but there seems to be a problem with assembly optimizations somewhere in x64.

Code:
SetMaxCPU("none")
video=LWLibavVideoSource("M2991374.mxf")
ch1=LWLibavAudioSource("M2991374.mxf", stream_index=1, fill_agaps=1)
ch2=LWLibavAudioSource("M2991374.mxf", stream_index=2, fill_agaps=1)
audio=MergeChannels(ch1, ch2)
AudioDub(video, audio)

propClearAll()

ConvertBits(16)

Limiter(min_luma=4096, max_luma=60160, min_chroma=4096, max_chroma=60160)

SinPowerResize(1024, 576)
Info()
produces the right output


however if I remove the

Code:
SetMaxCPU("none")
I get the following


which is clearly wrong.

Even a simple SetMaxCPU("SSE2") produces the same result which means that only the C++ code is "fine" and there's a problem somewhere in the manually written intrinsics in assembly.


Digging a bit further, this seems to be related to 4:2:2 10bit planar and can be reproduced with a simple:

Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(10)
Info()

In other words:

8bit planar 4:2:2 with assembly optimizations is fine

Code:
ColorBars(848, 480, pixel_type="YV16")
Info()


32bit float 4:2:2 with assembly optimizations is fine

Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(32)
Info()



10bit, 12bit, 14bit, 16bit planar 4:2:2 with assembly optimization from SSE2 onwards are not

Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(10)
Info()


Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(12)
Info()


Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(14)
Info()


Code:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(16)
Info()

Last edited by FranceBB; 15th February 2026 at 12:10.
FranceBB is offline   Reply With Quote
Old 15th February 2026, 14:15   #3632  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,645
You've found the Dolby Vision LUT...
I mean, green/purple, it's the way Dolby Vision is displayed when not supported...
__________________
My github.
jpsdr is offline   Reply With Quote
Old 15th February 2026, 21:45   #3633  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,389
Quote:
Originally Posted by jpsdr View Post
You've found the Dolby Vision LUT...
I mean, green/purple, it's the way Dolby Vision is displayed when not supported...
All this time trying to invert IPTc2 dvhe0509 and the answer was there in front of out eyes... LMAO


Jokes aside I triple checked and I can confirm that it only happens on x64 in the Windows 7 build.

x86-xp isn't affected.

Quote:
ColorBars(848, 480, pixel_type="YV16")
ConvertBits(10)
Info()





Tomorrow morning I'll try the x64-xp build.


EDIT: I did, final results:

Avisynth_3.7.6_20260213_tst_r4507

- x64-xp
- x64-win7-19.44.35221-17.14

8bit planar and 32bit float 4:2:2 ok.
problem with 10bit, 12bit, 14bit, 16bit planar 4:2:2 when assembly optimization are used (SSE2 onwards).
SetMaxCPU("none") forces C++ which is error free.

- x86-xp

all ok (8bit, 10bit, 12bit, 14bit, 16bit planar and 32bit float) 4:2:2. Everything is fine both with assembly optimization (tested up to SSE4.2 which is the maximum XP supports).

Last edited by FranceBB; 16th February 2026 at 09:41.
FranceBB is offline   Reply With Quote
Old 16th February 2026, 13:58   #3634  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Thanks FranceBB, I thought, it would be super-easy, but I was not able to reproduce it.
EDIT: It's the display, which is using ConvertToRGB32() after that.
EDIT: fixed, exchanged G and B in bit-depth changing YUV->RGB full scale code.

Last edited by pinterf; 16th February 2026 at 15:28.
pinterf is offline   Reply With Quote
Old 16th February 2026, 20:47   #3635  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
New build.
Avisynth r4523
https://github.com/pinterf/AviSynthP...3.7.6pre-r4523

For online documentation check https://avisynthplus.readthedocs.io/en/latest/

Actual:
https://avisynthplus.readthedocs.io/...gelist376.html

Code:
20260216 3.7.5.r4523 (pre 3.7.6)
--------------------------------
- Fix r4504 regression YUV->RGBP bit-depth changing full-scale SSE2/AVX2 bug (exchanged G,B storage)
- "Layer" YUV mul/add/subtract/lighten/darken: refactor chroma placement calculation, allowing SIMD optimization in the main frame processing
- "Layer" YUV/RGBP mul/add/subtract/lighten/darken: refactor function dispatchers, add AVX2 path (LLVM/clangcl recommended)
- Fix C-only vertical resampling code which added more rounding than needed (regression since pre-3.7.5 20250427)
- Invert: per-plane processing for planar formats, use C even in AVX2, proper chroma inversion
- New: AddAlphaPlane opacity parameter
- New: ResetMask opacity parameter
- rstdoc: document "opacity" in AddAlphaPlane and ResetMask
- rstdoc: detail Layer "use_chroma" and opacity
- Overlay "Blend": more speed, but keep accuracy, use float only where really needed
- Layer: use YV16 internally for YUY2 (lessen source bloat)

20260213 3.7.5.r4507 (pre 3.7.6)
--------------------------------
Fix Layer "add" 8 bit, regression in r4504

20260212 3.7.5.r4504 (pre 3.7.6)
--------------------------------
* Fix: inaccurate ColorBarsHD 10+ bit values. Now they are derived from the 32-bit float 
  RGB definitions instead of upscaling a 8 bit precalculated YUV value.
  Add Ramp section the lead-in-lead-out.
* Fix: GreyScale + SSE2 + RGB32 + matrix="RGB" overflow. 
  Rare usage; "RGB" matrix (Identity) uses a 1.0 coefficient which exceeds the signed 16-bit 
  SIMD limit of 32767 at 15-bit precision. Added bounds checking to fallback to C-code for any 
  coefficients >= 1.0 or < −1.0.
* Fix: YUV->RGB limited range matrix accuracy for 10-16 bits.
* Use a different rounding in matrix coefficient's integer approximation.
* "ConvertToPlanarRGB": ``bits`` parameter: on-the-fly bit-depth conversions to YUV->RGB conversion. 
  - Full range target: 8-16 bits internal calculation is in 32-bit float.
  - Limited range target: a quicker, bit accuracy optimized integer calculation path.
* Not Fixed: Speed degradation when in-constructor GetFrame(0) (e.g. frame-property getter) 
  is used. Disable internal Cache object creation. Does not work in complex scripts, preparation 
  is 5-10 min instead of <1 sec. Investigation continues (Issue #476: https://github.com/AviSynth/AviSynthPlus/issues/476)
* Avoid MTGuard and CacheGuard creation if filter returns one of its clip parameter unaltered.
* Add some avx2 stuff to Layer and Invert
* Optimization: Overlay "Blend": aarch64 NEON optimization

20260203 3.7.5.r4483 (pre 3.7.6)
--------------------------------
* rst documentation update: RGBAdjust https://avisynthplus.readthedocs.io/...rs/adjust.html
* rst documentation update: ColorYUV https://avisynthplus.readthedocs.io/.../coloryuv.html
* optimization: add AVX2 TurnLeft/TurnRight/Turn180 (R/L: 1,5-3x speed).
* optimization: ConvertBits AVX2 integer->float
* optimization: ConvertToPlanarRGB(A): YUV->RGB add AVX2 (2-3x speed)
* optimization: ConvertToPlanarRGB(A): YUV->RGB 16 bit: a quicker way (1,5x)
* Fix: C version of 32-bit ConvertToPlanarRGB YUV->RGB to not clamp output RGB values.
* ConvertToPlanarRGB(A): add bits parameter to alter target bit-depth.
* ConvertToPlanarRGB(A): from YUV->RGB full range output: optimized in-process when bits=32, other cases call ConvertBits internally.
* Fix: Packed RGB conversions altering the bit-depth (e.g. rgb32->ConvertToRGB64() worked always in full range.
* Add more AVX512 resampler code. (WIP)
* Add more AVX512_BASE code paths (Resamplers)
* Build: add _avx512b.cpp/hpp pattern in CMake to detect source to compile with base (F,CD,BW,DQ,VL) flags.
  However AVX512_BASE itself is set only when AVX512_FAST found.
  For pre-Ice Lake (older AVX512) systems you can enable it with SetMaxCPU("avx512base+") and get the optimized AVX512_BASE functions.
* Build: add new architecture z/Architecture
pinterf is offline   Reply With Quote
Old 18th February 2026, 00:54   #3636  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,389
Thanks for the new build and for fixing the issue, Master Ferenc.

Avisynth_3.7.6_20260216_tst_r4523

x64-win7-19.44.35221-17.14
Windows Server 2008 R2 x64

Now 4:2:2 10bit/12bit/14bit/16bit work correctly with assembly optimizations up to SSE4.2 as well.


x86-xp
Windows XP Professional x86

works normally as usual

FranceBB is offline   Reply With Quote
Old 18th February 2026, 13:24   #3637  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,486
Oh - Windows XP of decades old can use F16C pack/unpack instructions. And big set of AVX512_FP16 instructions for direct computing in FP16 format is not ready to use in most of current CPUs even in 2026.
DTL is offline   Reply With Quote
Old 20th February 2026, 22:42   #3638  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,542
Here's a new pre-release build.
Latest test build
Avisynth+ v3.7.6pre-r4529 test build (20260220)

For online documentation check https://avisynthplus.readthedocs.io/en/latest/

Actual full change log:
https://avisynthplus.readthedocs.io/...gelist376.html


As a result of a chain reaction. After ColorBarsHD 10+ bit was fixed, I did the same update to ColorBars, with almost a full rewrite. Additionally I fixed the reported color matrix as well. I wanted then to visualize the changes, and it turned out that the existing vectorscope (color, color2) is quite basic. So I added a lot of options to them (for details, see
https://avisynthplus.readthedocs.io/...histogram.html), made them matrix and color range aware. Made them accurate (rounding, proper scaling to visible vectorscope area from full or limited range colors). That was another 3/4 rewrite, refactor.

So enjoy this new build, I'm sure FranceBB will be happy to test the new color/color2 overlay flags and you all would give me additional ideas.


Code:
20260220 3.7.5.r4529 (pre 3.7.6)
--------------------------------
- Fix Colorbars inaccurate 10+ bit, by using ground truth linear RGB, similarly to ColorBarsHD.
  - Fix reporting 709 matrix instead of the 601 (170m)
  - Full refactoring.
  - update doc: https://avisynthplus.readthedocs.io/...colorbars.html
- Histogram "color" and "color2" (Vectorscope modes) 
  - almost full refactoring.
  - Drawing is now matrix and color range aware. target positions (75%) +-I and +Q.
  - add individual overlay options:
    added ``matrix``, ``graticule``, ``targets``, ``axes``, ``iq``, ``iq_lines``, ``circle``
    parameters
  - Fix: copy alpha from clip, initialize alpha to zero in the histogram area. 
  - Accurate pixel positioning and scaling to the active histogram area, 
    limited/full range aware.
  - update doc: https://avisynthplus.readthedocs.io/...histogram.html


20260216 3.7.5.r4523 (pre 3.7.6)
--------------------------------
- Fix r4504 regression YUV->RGBP bit-depth changing full-scale SSE2/AVX2 bug (exchanged G,B storage)
- "Layer" YUV mul/add/subtract/lighten/darken: refactor chroma placement calculation, allowing SIMD optimization in the main frame processing
- "Layer" YUV/RGBP mul/add/subtract/lighten/darken: refactor function dispatchers, add AVX2 path (LLVM/clangcl recommended)
- Fix C-only vertical resampling code which added more rounding than needed (regression since pre-3.7.5 20250427)
- Invert: per-plane processing for planar formats, use C even in AVX2, proper chroma inversion
- New: AddAlphaPlane opacity parameter
- New: ResetMask opacity parameter
- rstdoc: document "opacity" in AddAlphaPlane and ResetMask
- rstdoc: detail Layer "use_chroma" and opacity
- Overlay "Blend": more speed, but keep accuracy, use float only where really needed
- Layer: use YV16 internally for YUY2 (lessen source code bloat)
pinterf is offline   Reply With Quote
Old 21st February 2026, 20:52   #3639  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,486
Great. We again can use the good skin tone mark at the vectorscope.

About program text comments of linear RGB: The colour bars are not in linear RGB (scene linear light). They are in system transfer domain encoding. The RGB sources for colour bars in the documents are defined simply to check the matrix/dematrix in distribution but not check transfer conversion too.

With 2-levels current colour bars sources it is not an issue because they do not contain transfer-dependent transients.

Though some old documents indirectly point to the 'conditioning domain' or colour bars and it is a system transfer domain (not linear-light RGB). It may be designed to make DAC and levels checking at waveform monitors more easy. As I understand, close to zero waveform monitors can do transfer conversion to linear before DAC or other way of interpolated (upscaled) waveform draw (render).

So it may be put to the notes section of ColorBars filter: The output is not conditioned to any transfer domain (and it is partially good) and has direct switch transients between levels. The levels are set as defined in the colour bars standard but it is not 75% linear RGB. It is 75% RGB still in system transfer domain encoding (to mark it sometime and in the ITU/EBU documents used R'G'B').

To condition in any required domain for frequency-limited (Nyquist) channel can be used sequence of:
Code:
#to condition transients in transfer domain R'G'B' with 75% in transfer domain
ColorBars(target_width*10, target_height*10, pixel_type="RGB")
UserDefined2Resize(width/10, height/10) #not perfectly match the recommended ITU filter response

#to condition transients in linear domain RGB with 75% in transfer domain
ColorBars(target_width*10, target_height*10, pixel_type="RGB")
#convert transfer to linear RGB (no AVS+ filter currently exist - use avsresize ?)
UserDefined2Resize(width/10, height/10) #not perfectly match the recommended ITU filter response
#convert transfer to target domain R'G'B' (no AVS+ filter currently exist - use avsresize ?)
Also it is nice to have some day to add Transfer() filter to AVS+ core to support transfer domain conversions too. For example to support resize in linear domain with all internal filters only.
Also additional frame/clip properties to mark:
1. Current transfer domain
2. Target conditioning transfer domain for resizing

About real ITU transients shaping filter: https://www.itu.int/dms_pubrec/itu-r...0-W!!PDF-E.pdf
1 Formulae : the filter impulse response is a Blackman window. We have BlackmanResize with the same (or close) window function https://github.com/AviSynth/AviSynth...tions.cpp#L133 . To make required frequency shaping filter we need to use this window as filter kernel and scale for timing as defined in the recommendation:

for –3T < t < 3T, R(t) = 0.42 + 0.50 cos(π t/ 3T) + 0.08 cos(2π t/ 3T) – otherwise R(t) = 0 (filter_support is 3T ?) .

The value of T is 74 ns for digital waveforms A1, A2, A3 and A4 and 148 ns for A5 and A6. To make filtering more simple - all colour bars may be filtered with a single filter of T=74ns (very close to 1 step between target samples, 1/74ns is 13.513 MHz and 1 sample step in PAL/rec.601 is duration of 1/13.5 MHz).A separate 'resize' named filter can be added to Resize filters like BlackmanITUResize(). Users can use it for getting better conditioned ColorBars or for some other conditioning workflows if the exact Blackman-type response is required.

Last edited by DTL; 22nd February 2026 at 10:03.
DTL is offline   Reply With Quote
Old 1st March 2026, 22:53   #3640  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,389
Quote:
Originally Posted by pinterf View Post
So enjoy this new build, I'm sure FranceBB will be happy
I'm so happy right now. This is a very unexpected present, so thank you!
About the colorbars, we've got ColorBars() for BT.601, ColorBarsHD() for BT.709, are we gonna get ColorBarsUHD() for BT.2020?


Something appears to be off in Histogram, though, as this:

Quote:
FFMpegSource2(V:\F1_Movie_FULL_HD_16x9_4tracks_2ch_DolbyE_DolbyE_Stereo_Stereo.mxf", atrack=4)


test1=Histogram(mode="color2", matrix="709", graticule="on", keepsource=false, circle=true, axes=true, iq=true, iq_lines=true)
test2=Histogram(mode="color2", matrix="709", graticule="on", keepsource=false, circle=true, axes=false, iq=false, iq_lines=false)
test3=Histogram(mode="color", matrix="709", graticule="on", keepsource=false, circle=true, axes=true, iq=true, iq_lines=true)
test4=Histogram(mode="color", matrix="709", graticule="on", keepsource=false, circle=true, axes=false, iq=false, iq_lines=false)

v1=StackHorizontal(test1, test2)
v2=StackHorizontal(test3, test4)

StackVertical(v1, v2)
produces identical results despite one combination having

Quote:
axes=false, iq=false, iq_lines=false
and the other having

Quote:
axes=true, iq=true, iq_lines=true


This was tested using the x86-xp build on Windows XP Professional x86 and using the x64-win7-19.44.35221-17.14 build on Windows Server 2008 R2 Standard x64.


Other than that, I can happily confirm that

Quote:
ColorBars(848, 480, pixel_type="YUV444P16")
can produce a proper 16bit output and that both _Matrix and _Range are signaled via the frame properties correctly as Limited and BT.601 while before it said BT.709.



Left: x86-xp build on Windows XP Professional x86 --- Right: x64-win7-19.44.35221-17.14 build on Windows Server 2008 R2 Standard x64

Last edited by FranceBB; 2nd March 2026 at 10:15.
FranceBB is offline   Reply With Quote
Reply

Thread Tools
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 04:40.


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