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 Search this Thread Display Modes
Old 23rd May 2025, 17:12   #3361  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,378
Can I ask which version of SoundTouch was linked to TimeStretch when it was compiled?
SoundTouch version 2.4.0 was released on April 6th 2025 while Avisynth 3.7.5 was released on Apr 21st 2025, so I expected it to be using that one, however I'm getting some weird results, so I'm worried that version 2.3.3 from March 29th 2024 might have been used instead. It would make sense, given that Avisynth 3.7.5 is just a "tiny" update from Avisynth 3.7.4 which was released on Mar 24th 2025, so before the SoundTouch 2.4.0 official release.
If that's the case, if someone has a bit of time and everything setup already, can you recompile TimeStretch against SoundTouch 2.4.0? Otherwise I'll try to do it when I'm back later next week.
FranceBB is offline   Reply With Quote
Old 23rd May 2025, 21:25   #3362  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,501
git-9ef8458d85, HEAD as of 2025-02-27 15:25:09

The only commit after that which makes a difference to current HEAD is the one that was merged literally one week ago, on the 16th.
qyot27 is offline   Reply With Quote
Old 27th May 2025, 13:02   #3363  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,531
Quote:
Originally Posted by FranceBB View Post
Happy 25th birthday, Avisynth!
(May 19th 2000 - May 19th 2025)
In case we're still around to read the next round of birthday greetings (50th), we should definitely plan a BBQ somewhere halfway between our homes. Good wine will surely help the celebration—while my grandchildren will probably have to help me get to the party spot.
pinterf is offline   Reply With Quote
Old 27th May 2025, 15:11   #3364  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 5,062
Is it by design that when you specify a chroma placement for a resizer and it differs from the chroma location in frame properties, the frame property isn't updated to reflect the chroma placement used for resizing? It's the same for ResampleMT when using the placement argument. For example:

# Frame property chroma = "left"
Spline36Resize(960,540, placement="center")
# Frame property chroma = "left"

Also, I just want to confirm...
As it's not possible to change the chroma location with the Avisynth resizers, is this a legit way to do it (for a YV12 source)?

ConvertToYV12(ChromaInPlacement="top_left", ChromaOutPlacement="center")
hello_hello is offline   Reply With Quote
Old 28th May 2025, 08:36   #3365  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,531
Quote:
Originally Posted by hello_hello View Post
Is it by design that when you specify a chroma placement for a resizer and it differs from the chroma location in frame properties, the frame property isn't updated to reflect the chroma placement used for resizing? It's the same for ResampleMT when using the placement argument.
Yes, by design.

https://avisynthplus.readthedocs.io/...rs/resize.html

Section:
placement
pinterf is offline   Reply With Quote
Old 14th June 2025, 13:50   #3366  |  Link
v0lt
Registered User
 
Join Date: Dec 2008
Posts: 2,400
I did some tests of Unicode string support.
I use Avisynth+ 3.7.5 and save scripts in UTF-8.

Code:
FFVideoSource("Утка_Πάπια_오리.mkv")
It works!
Code:
FFVideoSource("Утка_Πάπια_오리.mkv")
Subtitle("Утка_Πάπια_오리")
The text is not displayed correctly.
Code:
FFVideoSource("Утка_Πάπια_오리.mkv")
Subtitle("Утка_Πάπια_오리", utf8=true)
Strange, but the Subtitle function, unlike FFVideoSource, requires additional specification of UTF-8 encoding.
Code:
MessageClip("Утка_Πάπια_오리")
The text is not displayed correctly. And it seems there is no way to use MessageClip with Unicode strings.

1. Is it possible to make any string parameters interpreted as UTF-8 strings? So that users don't have to write "utf8=true" for UTF-8 scripts.

2. Will the MessageClip function support UTF-8 in the future?
v0lt is offline   Reply With Quote
Old 14th June 2025, 20:33   #3367  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,501
AviSynth+ (and classic AviSynth, for that matter) are dependent on the system codepage/locale. Some plugins (and with utf8=true, internal functions) allow for converting between UTF8 and other string formats, but it's not automatic. Largely, it's handled outside of AviSynth+:

A) Set the Windows codepage to UTF-8. By far the easiest way to accomplish it, but some users get scared away from the 'Beta' language that the option uses in the config dialog. I can't remember if Win11 changed this to more neutral wording or even enables it by default now.

B) Set the client application to UTF-8 using that app manifest thing, whereby AviSynth(+) should probably inherit the changed locale. AFAIK, libraries can't have those manifests attached to them, only application binaries can. This is not something I've really tested, since I just went with A) about 6 or 7 years ago on Windows 10 and never looked back.


Just relying on the system setting is also why it can happily ingest/display UTF8 characters on all the non-Windows OSes, which all do default to UTF-8 and have for like, the last 20 years or so. Something to point out, though, is that you need to use a font that contains the Unicode characters as well.

On Windows, MessageClip uses Arial, which should then select Arial Unicode and display them (when talking about the system/application being set on UTF8, I mean). Everywhere else, MessageClip defaults to Terminus, which unfortunately does not contain all of the Unicode characters (from the example, it contains just Cyrillic and Greek, but not Hangul - and probably not the other CJK sets either); Subtitle/Text can load external fonts, so you could see it work if you give it GNU Unifont, for example. That one has all the glyphs, and it displays correctly for Text(), just with much wider spacing. MessageClip should probably have the font_filename option added to it as well.

This is one reason why there needs to be a Freetype2 backend, as that would allow for using Fontconfig to select TrueType and OpenType fonts that have the full range of glyphs and not be limited to bitmapped fonts with specific sizes.


Local tests below

MessageClip() per example:


Text() and Version(), with Text being provided an external BDF font file to provide the correct glyphs:


Ditto, but in VirtualDub2:
qyot27 is offline   Reply With Quote
Old 15th June 2025, 06:15   #3368  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 594
Quote:
Originally Posted by qyot27 View Post
Some plugins (and with utf8=true, internal functions) allow for converting between UTF8 and other string formats, but it's not automatic. Largely, it's handled outside of AviSynth+:
But some of the plugins are doing it automatically (e.g., the unofficial ffms2).
StvG is offline   Reply With Quote
Old 16th June 2025, 09:26   #3369  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,531
@qyot27

1.) "if you give it GNU Unifont, for example. That one has all the glyphs, and it displays correctly for Text(), just with much wider spacing. MessageClip should probably have the font_filename option added to it as well."
Regarding the wider spacing: I suppose that BDF rendering rule implemention is missing something. I did not implement all features.

EDIT: (reason for visual gap found)
Regarding the wider spacing in Unifont, this is due to how FONTBOUNDINGBOX is interpreted during rendering. In Unifont's BDF header, FONTBOUNDINGBOX is set to 16 pixels wide. This causes all glyphs, regardless of their actual width, to be rendered with 16 pixel spacing in Avisynth's Text() function, resulting in visible gaps for narrower characters. While Unifont is conceptually monospaced, it technically includes variable-width glyphs. Many Latin characters have DWIDTH 8, but others (like U+007F or CJK characters) use DWIDTH 16. Thus the global FONTBOUNDINGBOX must be 16 pixels wide.

In a fully BDF-compliant renderer, the per-character DWIDTH and BBX values can override the global bounding box for spacing and alignment. However, Avisynth's BDF renderer does not implement this override behavior. It uses the global FONTBOUNDINGBOX width as a constant for the whole rendered text line.

So far I’ve only encountered BDF fonts where FONTBOUNDINGBOX, DWIDTH, and BBX were consistent across all glyphs. Unifont breaks this assumption, which in turn revealed a limitation in my implementation.

2.) The (C) (Copyright) character is missing on your system, why?

Last edited by pinterf; 16th June 2025 at 11:02. Reason: gap reason found
pinterf is offline   Reply With Quote
Old 16th June 2025, 11:02   #3370  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,501
Quote:
Originally Posted by pinterf View Post
2.) The (C) (Copyright) character is missing on your system, why?
That's the one side-effect I've encountered in the AviSynth+ core of switching the system codepage to UTF-8. On Ubuntu it displays the Copyright symbol just fine, but because Windows has to take a far more convoluted path to get there, that's probably where the issue lies.
qyot27 is offline   Reply With Quote
Old 16th June 2025, 12:15   #3371  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,531
Quote:
Originally Posted by qyot27 View Post
That's the one side-effect I've encountered in the AviSynth+ core of switching the system codepage to UTF-8. On Ubuntu it displays the Copyright symbol just fine, but because Windows has to take a far more convoluted path to get there, that's probably where the issue lies.
It's because on non-Posix builds this string is used:
Code:
#define AVS_COPYRIGHT "\n\xA9 2000-2015 Ben Rudiak-Gould, et al.\nhttp://avisynth.nl\n\xA9 2013-2025 AviSynth+ Project"
Which contains (C) symbol as xA9 but it's an invalid code sequence in UTF8 and is has problems on Hebrew or Arabic code pages as well. I'm gonna figure it out.

EDIT: and we returned to the problematic non-utf8 aware MessageClip

Code:
  return Create_MessageClip(
#ifdef AVS_POSIX
    AVS_FULLVERSION AVS_DEVELOPMENT_BUILD AVS_DEVELOPMENT_BUILD_GIT AVS_COPYRIGHT_UTF8
#else
    AVS_FULLVERSION AVS_DEVELOPMENT_BUILD AVS_DEVELOPMENT_BUILD_GIT AVS_COPYRIGHT
#endif
    , w, h, i_pixel_type, shrink, textcolor, halocolor, bgcolor, fps_numerator, fps_denominator, num_frames, env);
EDIT2:
Which in turn is using the non-changeable env->ApplyMessage, which has no utf8 parameter, and cannot even have one, without breaking the IScriptInterface.

EDIT3:
Version (C) symbol now works when Windows codepage is utf8, MessageClip utf8 bool parameter added; env->ApplyMessageEx added as a new v12 interface function. Now it needs a code cleanup, but before it I'd like to implement the Unifont 8-16 pixel fixed-variable width feature.

Last edited by pinterf; 16th June 2025 at 14:34. Reason: Features implemented.
pinterf is offline   Reply With Quote
Old 16th June 2025, 12:49   #3372  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
All of that there weird UTF8, Unicode, code pages etc, terrifies and fills me with despair.
I blame foreigners, hangin's too good for them.
Everybody should use English, if its good enough for God, it should be good enough for them
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 16th June 2025, 14:45   #3373  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,531
Quote:
Originally Posted by StainlessS View Post
All of that there weird UTF8, Unicode, code pages etc, terrifies and fills me with despair.
I blame foreigners, hangin's too good for them.
Everybody should use English, if its good enough for God, it should be good enough for them
You are right, but that's still way too modern. Let's ditch traditional English, and go full retro, I propose cuneiform on clay tablets, no more encoding issues, more fun. No exotic keyboard layouts, just have a good stylus. proper C++ support is questionable though, we'd have to step back a bit.
pinterf is offline   Reply With Quote
Old 19th June 2025, 14:47   #3374  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,637
@pinterf
Is the AVX2 resample code in the current branch ok, or are you still working on it ?
Just to avoid to implement the new code in my ResampleMT and re-doing things later if it's for changing later.
No big deal, i am absolutely not in hurry.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 27th June 2025, 13:32   #3375  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,637
@pinterf
I have a different result with my pure "C" 8bits and yours for the vertical part, and i don't see what's wrong...
Is it possible that there is something wrong in your pure "C" vertical ?
__________________
My github.
jpsdr is offline   Reply With Quote
Old 3rd July 2025, 18:32   #3376  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
In June 2025 there were another big update on resampling engines (SIMD) and possible new resample function (H+V for each plane with single temp buf) for planar formats. But to the end of June there were no news from pinterf and what of the suggested updates will be transfered to main AVS+ branch is unknown. You can see latest news and commits about resamplers at this pull request - https://github.com/AviSynth/AviSynthPlus/pull/440 . Though some may be treated as performance tech demos and may be not safe for end of line and even end of buffer memory access.
For AVX512 many resizers somehow done too (at least all verticals ?) and only left 8 and 16bit H-resizers. Also you can see some performance optimization updates for AVX2 (mostly float32 resizers).

Also main new design idea on H-resizers (transposition of H-resize task to V and process with SIMD-friendly V-fma) cause possibility to design several more faster processing functions but limited to the filter support size (kernel size). This may make performance benefit for small-kernel resizers like Bilinear/Bicubic(?)/some small support Gauss and may be some others (like sinc-based with taps=2) but solution is not one for all H-resize function as exist in 3.7.5 AVS+ and before.
Also different SIMD architectures supports different size load and transposition with better performance (AVX512 is best as expected). This makes resampling engine more complex (and more complex to maintain) and may be not accepted by current very limited amount of developers resources. Though some more simple optimizations may be included.
DTL is offline   Reply With Quote
Old 19th July 2025, 17:43   #3377  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,818
The examples for env->invoke with multiple parameters are all of this form:

Code:
AVSValue up_args[3] = { child, 384, 288 };
        PClip resized = env->Invoke(upsizerString, AVSValue(up_args,3)).AsClip(); // up_args is AVSValue[1], but is effectively also AVSValue*(?)
But what if I don't have a fixed number of parameters? I'm trying to do an equivalent of this:

Code:
std::vector<AVSValue> up_args;
up_args.push_back(clip);
up_args.push_back(384);
up_args.push_back(288);
PClip resized = env->Invoke(upsizerString, AVSValue(up_args.data(), up_args.size())).AsClip(); // up_args.data() is AVSValue*
But it throws an exception about invalid arguments.

Is there any way to do what I'm trying to do? Or do I have to use a fixed size array allocated on the stack?

------------------

Also, I'm trying to catch any exceptions from call to invoke. But I can't work out what type is thrown. I can catch generally with (...) but AvisynthError and std::exception don't work.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 19th July 2025 at 20:13.
wonkey_monkey is offline   Reply With Quote
Old 20th July 2025, 11:08   #3378  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,637
@pinterf
Hi.

Now that i have updated to the new SSE code, i have a crash i didnt' have before.
I happens in resize_v_sse2_planar on the following line:
Code:
      if (notMod2)
	  { // do last odd row
        // Load a single coefficients as a single packed value and broadcast
        __m128i coeff = _mm_set1_epi16(*reinterpret_cast<const short*>(current_coeff[sizeMod2])); // 0|co|0|co|0|co|0|co
__________________
My github.

Last edited by jpsdr; 20th July 2025 at 11:14.
jpsdr is offline   Reply With Quote
Old 20th July 2025, 16:06   #3379  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
Current AVS+ repository lists for void resize_v_sse2_planar() https://github.com/AviSynth/AviSynth...L231C1-L231C27

https://github.com/AviSynth/AviSynth...e_sse.cpp#L296
// Process the last odd row if needed
if (notMod2) {
// Load a single coefficients as a single packed value and broadcast
__m128i coeff = _mm_set1_epi16(*reinterpret_cast<const short*>(current_coeff + i)); // 0|co|0|co|0|co|0|co

May you got wrong text somewhere ?

Also you change function somehow - i counter used in loop and as pointer to the last index:
int i = 0;
for (; i < kernel_size_mod2; i += 2) {}
- after loop exit i+=2 always and
if (notMod2) {
// Load a single coefficients as a single packed value and broadcast
__m128i coeff = _mm_set1_epi16(*reinterpret_cast<const short*>(current_coeff + i)); // 0|co|0|co|0|co|0|co - reads last coef indexed by i from current_coef array (vector)

In your text you use
if (notMod2)
{ // do last odd row
// Load a single coefficients as a single packed value and broadcast
__m128i coeff = _mm_set1_epi16(*reinterpret_cast<const short*>(current_coeff[sizeMod2])); // 0|co|0|co|0|co|0|co

sizeMod2 may be not equal in all cases to i+=2 in the AVS+ current core version ?

Last edited by DTL; 20th July 2025 at 16:39.
DTL is offline   Reply With Quote
Old 20th July 2025, 16:15   #3380  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,637
Code:
SetMaxCPU("SSE2")
ColorBars(720,480).KillAudio()
Spline36ResizeMT(1280,720,src_left=17.2,src_width=680,src_top=-8.7,src_height=440)
DeSpline36ResizeMT(720,480,src_left=17.2,src_width=680,src_top=-8.7,src_height=440,accuracy=0,order=0)
The error message is the typical @00000000 cryptic one a unaligned acces can generate.

Edit:
Script edited...
__________________
My github.

Last edited by jpsdr; 20th July 2025 at 17:04.
jpsdr is offline   Reply With Quote
Reply

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 22:55.


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