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

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th February 2025, 13:08   #3061  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by StainlessS View Post
Jamaika, is that YOUR code, or Avs+ code ?

If yours (where post is Off Topic in this thread), then how about

Code:
if (!(vi.IsPlanar() || vi.IsPlanarRGB() || vi.IsPlanarRGBA()))
            throw_error("clip must be planar");
This is of e.g. avsresize but IsPlanar() is present in many add-ons to AVS+.
Jamaika is offline   Reply With Quote
Old 13th February 2025, 13:20   #3062  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,108
Quote:
... but IsPlanar() is present in many add-ons to AVS+.
Yep, but you have to use it correctly.
Code:
if (!vi.IsPlanar() || !vi.IsPlanarRGB() || !vi.IsPlanarRGBA())
            throw_error("clip must be planar");
Your code says, if any one of (IsPlanar, IsPlanarRGB, IsPlanarRGBA) is false then throw error,
so, as at least one of them (actually at least 2 of them) is always false, so will always throw an error.

Mine
Code:
if (!(vi.IsPlanar() || vi.IsPlanarRGB() || vi.IsPlanarRGBA()))
            throw_error("clip must be planar");
says, if all of (IsPlanar, IsPlanarRGB, IsPlanarRGBA) are false then throw error.

EDIT: This would also work (if all isPlanarXXX false)
Code:
if (!vi.IsPlanar() && !vi.IsPlanarRGB() && !vi.IsPlanarRGBA())
            throw_error("clip must be planar");
__________________
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 ???

Last edited by StainlessS; 13th February 2025 at 13:35.
StainlessS is offline   Reply With Quote
Old 13th February 2025, 13:29   #3063  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
So I open the planar documentation. I assume that YUV420P8 is planar so the codec should work but it doesn't for gcc 14.2.0. I'm testing 11.5.0 now. I'll know soon.
http://avisynth.nl/index.php/Planar
Jamaika is offline   Reply With Quote
Old 13th February 2025, 13:38   #3064  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,108
Just use either of the code snippets I gave in post #3062, it will work, It is your logic that is wrong.

either,

Code:
if (!(vi.IsPlanar() || vi.IsPlanarRGB() || vi.IsPlanarRGBA()))
            throw_error("clip must be planar");
OR
Code:
if (!vi.IsPlanar() && !vi.IsPlanarRGB() && !vi.IsPlanarRGBA())
            throw_error("clip must be planar");
__________________
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 ???

Last edited by StainlessS; 13th February 2025 at 13:41.
StainlessS is offline   Reply With Quote
Old 13th February 2025, 13:51   #3065  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by StainlessS View Post
Code:
if (!vi.IsPlanar() && !vi.IsPlanarRGB() && !vi.IsPlanarRGBA())
            throw_error("clip must be planar");
I simply deleted it and it worked, but I wonder what IsPlanar() does.

For me, this entry is incorrect.
What is the meaning of writing for the value if (1 and 0 and 0) it will be zero.
Jamaika is offline   Reply With Quote
Old 13th February 2025, 13:58   #3066  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,465
Quote:
Originally Posted by Jamaika View Post
I simply deleted it and it worked, but I wonder what IsPlanar() does.

For me, this entry is incorrect.
What is the meaning of writing for the value if (1 and 0 and 0) it will be zero.
If you read your problematic expression aloud in your native language, you'll likely start to sense what's wrong with it.
pinterf is offline   Reply With Quote
Old 13th February 2025, 14:18   #3067  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by pinterf View Post
If you read your problematic expression aloud in your native language, you'll likely start to sense what's wrong with it.
I'm not going to think about it.

It doesn't work. when I delete the record it works.
z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="709:709:709:full=>709:709:709:limited", dither_type="none")

Saved by fastblur
for (int pid = 0; pid < vi.NumComponents(); pid++) {
bool uv = _planes[pid] == PLANAR_U || _planes[pid] == PLANAR_V;
planes.push_back({
vi.IsPlanar() ? _planes[pid] : 0,
vi.IsPlanar() ? 0 : pid,
vi.IsPlanar() ? 0 : vi.NumComponents(),
!(uv || _planes[pid] == PLANAR_A), uv,
uv ? uv_pyramid : y_pyramid,
uv ? sub_w : 0,
uv ? sub_h : 0
});
}

Edit: For gcc 11.5.0 IsPlanar() doesn't work. So my previous arguments are worthless since the basic function doesn't work.
https://www.sendspace.com/file/16t0ja

Last edited by Jamaika; 13th February 2025 at 14:29.
Jamaika is offline   Reply With Quote
Old 13th February 2025, 14:31   #3068  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,108
Again, your logic is wrong.
One of the correct ones given
Code:
if (!vi.IsPlanar() && !vi.IsPlanarRGB() && !vi.IsPlanarRGBA())
            throw_error("clip must be planar");
Code:
!IsPlanar   !IsPlanarRGB    !IsPlanarRGBA       AND
0           0               0                   0
0           0               1                   0
0           1               0                   0
0           1               1                   0
1           0               0                   0
1           0               1                   0
1           1               0                   0
1           1               1                   1    NOT Planar && NOT PlanarRGB  && NOT PlanarRGBA, then ThrowError
EDIT: OR,
Code:
if (!(vi.IsPlanar() || vi.IsPlanarRGB() || vi.IsPlanarRGBA()))
            throw_error("clip must be planar");

Code:
IsPlanar    IsPlanarRGB     IsPlanarRGBA        OR        NOT
0           0               0                   0         1     ! (Planar || PlanarRGB || PlanarRGBA), then ThrowError
0           0               1                   1         0
0           1               0                   1         0
0           1               1                   1         0
1           0               0                   1         0
1           0               1                   1         0
1           1               0                   1         0
1           1               1                   1         0
__________________
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 ???

Last edited by StainlessS; 13th February 2025 at 14:41.
StainlessS is offline   Reply With Quote
Old 13th February 2025, 14:37   #3069  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by StainlessS View Post
Code:
!IsPlanar   !IsPlanarRGB    !IsPlanarRGBA       AND
0           0               0                   0
0           0               1                   0
0           1               0                   0
0           1               1                   0
1           0               0                   0
1           0               1                   0
1           1               0                   0
1           1               1                   1    NOT Planar && NOT PlanarRGB  && NOT PlanarRGBA, then ThrowError
Correct train of thought, but it would mean that videos for avsresize must always be interlaced. I don't know anything about that.
http://avisynth.nl/index.php/Avsresize
Jamaika is offline   Reply With Quote
Old 13th February 2025, 14:47   #3070  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,108
What has interlaced got to do with your assertion about IsPlanar being wrong ???
EDIT: Planar has nothing to do with being interlaced, it is the color format in memory [being in planes, rather than interleaved eg RGB24 or YUY2]
[ Planar can be interlaced or not (ie Progressive), Interleaved color formats can be interlaced or not (ie Progressive) ]

Planar means storage for each color channel is stored separately and contiguously, eg
RGB planar, stored as RRRRRRRRRR, GGGGGGGGGG, BBBBBBBBBB. Each channels pixel values stored together, in planes.
RGB24, RGB Interleaved stored as RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB. Each pixel channels stored together Interleaved (although usually as BGR, I think).

EDIT: Wiki Color Format:- https://avisynthplus.readthedocs.io/...#color-formats
EDIT: The color formats: RGB, YUY2 and YV12:- https://avisynthplus.readthedocs.io/...-yuy2-and-yv12
EDIT: Colorspaces:- https://avisynthplus.readthedocs.io/...lorSpaces.html
Planar:- http://avisynth.nl/index.php/Planar
Interleaved:- http://avisynth.nl/index.php/Interleaved

Interlaced versus field-based video :- http://avisynth.nl/index.php/Interlaced_fieldbased
Advanced topics:- http://avisynth.nl/index.php/Advanced_topics
__________________
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 ???

Last edited by StainlessS; 13th February 2025 at 15:35.
StainlessS is offline   Reply With Quote
Old 13th February 2025, 15:40   #3071  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by StainlessS View Post
What has interlaced got to do with your assertion about IsPlanar being wrong ???
EDIT: Planar has nothing to do with being interlaced, it is the color format in memory [being in planes, rather than interleaved eg RGB24 or YUY2]
[ Planar can be interlaced or not (ie Progressive), Interleaved color formats can be interlaced or not (ie Progressive) ]

Planar means storage for each color channel is stored separately and contiguously, eg
RGB planar, stored as RRRRRRRRRR, GGGGGGGGGG, BBBBBBBBBB. Each channels pixel values stored together, in planes.
RGB24, RGB Interleaved stored as RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB,RGB. Each pixel channels stored together Interleaved (although usually as BGR, I think).

EDIT: Wiki Color Format:- https://avisynthplus.readthedocs.io/...#color-formats
EDIT: The color formats: RGB, YUY2 and YV12:- https://avisynthplus.readthedocs.io/...-yuy2-and-yv12
EDIT: Colorspaces:- https://avisynthplus.readthedocs.io/...lorSpaces.html
Planar:- http://avisynth.nl/index.php/Planar
Interleaved:- http://avisynth.nl/index.php/Interleaved

Interlaced versus field-based video :- http://avisynth.nl/index.php/Interlaced_fieldbased
Advanced topics:- http://avisynth.nl/index.php/Advanced_topics
Maybe, my input codec is:
Planar YUV Formats: I420 0x30323449 12 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.

Code:
  Avisynth function: LWLibavVideoSource [input_yuv420p.mp4, 30000, 1001]
Input #0, avisynth, from 'AudioBoost3.avs':   0KB sq=    0B
  Duration: 00:42:05.52, start: 0.000000, bitrate: 0 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 704x480, 29.97 fps, 29.97 tbr, 29.97 
tbn
The problem is with:
Code:
  Avisynth function: LWLibavVideoSource [input_yuv420p.mp4, 30000, 1001]
  Avisynth function: z_ConvertFormat [YUV420P8, 709:709:709:limited=>709:709:709:limited, none]
[avisynth @ 000002f02ad57f60] avsresize: clip must be planar.
test wiki:
LWLibavVideoSource("input_rgb24.avi",fpsnum=30000,fpsden=1001)
ConvertToPlanarRGB()
z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:full=>709:709:709:limited")

[avisynth @ 000002f02ad57f60] avsresize: clip must be planar.

Last edited by Jamaika; 13th February 2025 at 15:51.
Jamaika is offline   Reply With Quote
Old 13th February 2025, 15:48   #3072  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,465
This one is really tricky: I420 is a variant of YV12, but their colorspace constants differ. Some filters can only accept and check against the exact YV12 format.

This is why VideoInfo::IsSameColorspace
- first checks for exact code match,
then if no exact match then
- it compares the two VideoInfo's IsYV12() which reports true even if the clip is I420 _or_ YV12.
pinterf is offline   Reply With Quote
Old 13th February 2025, 15:57   #3073  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,641
Some questions spring to mind:

Can we see the whole script, just to make absolutely sure nothing else is happening?
Did you compile both AviSynth+ and AVSResize with GCC? Have you made any other changes to either of them?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 13th February 2025, 16:09   #3074  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 861
Quote:
Originally Posted by wonkey_monkey View Post
Did you compile both AviSynth+ and AVSResize with GCC? Have you made any other changes to either of them?
Everything is possible, but this is a curiosity. Is this a gcc, mingw64 bug? Others on this forum add codecs x264,x265,vvenc,...
Jamaika is offline   Reply With Quote
Old 13th February 2025, 16:23   #3075  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,641
Quote:
Originally Posted by Jamaika View Post
Everything is possible, but this is a curiosity. Is this a gcc, mingw64 bug? Others on this forum add codecs x264,x265,vvenc,...
That doesn't answer my question. I think we may struggle here...
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 13th February 2025, 21:00   #3076  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,108
By Pinterf
Quote:
This one is really tricky: I420 is a variant of YV1
I don't really think it is relevant. [But maybe]
It's the c code he's using somewhere [???, wherever he was using it, it WAS WRONG],
Don't know where he's using it.
On occasion some users change avs functions so they don't havta
provide fn args [ EDIT: bad idea ], me is guessing it's something like that.
{ Changes function, then wants help to make it work without telling what weird changes have been made/hard_coded }

Also, maybe should answer Wonkey Donkey questions.
__________________
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 ???

Last edited by StainlessS; 14th February 2025 at 00:00.
StainlessS is offline   Reply With Quote
Old 14th February 2025, 00:45   #3077  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,888
Pinterf, hats off to you ! You did it. Beautiful.
Your AviSynth64+ version r4178-4182-uncommitted loads & unloads my reduced script in AvsPmod 2.7.9.2.
Processing finally with even CPU load, no more pulsing, and a beautiful speed gain !
And Topaz 2.6.4 eats the script happily and sees all frames. A dream came true.
Going deeper soon.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 14th February 2025 at 01:02.
Emulgator is offline   Reply With Quote
Old 14th February 2025, 09:19   #3078  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,465
Quote:
Originally Posted by Emulgator View Post
Pinterf, hats off to you ! You did it. Beautiful.
Your AviSynth64+ version r4178-4182-uncommitted loads & unloads my reduced script in AvsPmod 2.7.9.2.
Processing finally with even CPU load, no more pulsing, and a beautiful speed gain !
And Topaz 2.6.4 eats the script happily and sees all frames. A dream came true.
Going deeper soon.
... Somewhere I knew it I received a fabulous Sleep Score of 82 from my Garmin. Thanks for your time. I'll make these commits live now.
pinterf is offline   Reply With Quote
Old 14th February 2025, 09:30   #3079  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,919
If only Dogway would take advantage of the new features in his scripts…
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 14th February 2025, 11:43   #3080  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,465
Freshly built v4193.

- 32 and 64-bit XP compatible versions
- 64 bit Intel ICX compiled version (only Avisynth.dll, plugins were just copied)
May require Intel C++ 2025 redistributable: https://www.intel.com/content/www/us...y-version.html

Download Avisynth+ 3.7.3 r4193 test:
https://github.com/pinterf/AviSynthP...ag/v3.7.3.4193

Changes since official 3.7.3
https://avisynthplus.readthedocs.io/...gelist374.html
and
https://avisynthplus.readthedocs.io/...-v11-whats-new
and millions of updated documentation pages.

Last edited by pinterf; 14th February 2025 at 12:02.
pinterf 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 09:54.


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