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 20th May 2019, 23:07   #41  |  Link
jconklin
Registered User
 
Join Date: Mar 2006
Posts: 39
Treaties Of Warp. I agree the "Horrible anomalies" really are are horrible.
Selur. Thanks for the side note about 'brightStart=205' making the artifacts disappear.

The problem is that I assumed that the video to be processed would be in the range of 16-235.
Given that I have thought about using amDCT() to clean and modify masks, the 16-235 range assumption is really embarrassing.
A quick workaround until I fix the code is to do the following

temp = orig.levels(0,1,255,16,235)
outTemp = temp.amDCT(...)
out = outTemp.levels(16,1,235,0,255)

This workaround is not as "accurate" as the fix will be.


Treaties Of Warp. I will start testing long runs on a 1920x1080 source and with luck reproduce your error.
It sounds like a memory leak.
jconklin is offline   Reply With Quote
Old 11th June 2019, 00:45   #42  |  Link
jconklin
Registered User
 
Join Date: Mar 2006
Posts: 39
Bug Fix update.

Spent 2 weeks fixing a bad case of software rot.
The build system "Visual Studio" would not build.
I proved to myself that it was Visual Studio by trying several different versions of my shipped code which contained the build system for that version. None of them still worked.
Almost certainly some update to Visual Studio was to blame.

Rebuilt the build system.

Spent 1 week to find the cause and Fix the Horrible anomalies.
It turns out that in 1 place the data returned from the DctLoop routines was stored into an 8 bit value.

If you are just doing smoothing this works fine since the brightest and darkest pixels move toward the mean.
On the other hand range expansion and sharpening can move pixel values toward the extreme.
It never showed up in my testing since I had only tested sources with a range of 16 to 235.
It turns out that provided just enough headroom so the pixel values did not overflow.
Treaties Of Warp. Thank You for reporting the HORRIBLE anomalies and for providing a clip that would produce the problem. I would not have discovered the bug just using my testing.

Selur Thanks for noting that the artifacts disappear when removing 'brightStart=205'. It helped me get to the answer quicker.

Fixed the Horrible anomalies. Download the new version amDCT_v1.2Testing.zip from http://sites.google.com/site/amdctfilter

Now I begin on the memory problems. amDCT() is a memory hog as you can see from the following numbers.
A 1080p source frame is 1920x1080 pixels. Internally the frame has an 8 byte border surrounding the source frame.
Internally a 1080p frame uses 2,121,855 bytes or around 2 megabytes.
Depending on the number of cpus, specified by the ncpu argument, there are up to 4, 16 bit per pixel frames that are used to store the intermediate results of the DCT processing done on the frame.

There are currently 14 frame buffers allocated for things like the smooth buffer, the range expand buffer, the destination buffer, buffers for finding boundaries etc.
By the time you add it all up, amDCT mallocs and frees around 30 million bytes of data for each frame processed. Some of those buffers are used to try out ideas for improving amDCT.


I will try using loop() to feed the same clip to amDCT() forever.
If I can't get loop() to work I will build a very small front end that continually calls amDCT with the same frame.
This will give me a testbed to find any memory leaks.

When version 2.0 is done any frame buffers not used will be removed from the code.

Last edited by jconklin; 19th June 2019 at 18:52. Reason: clarity
jconklin is offline   Reply With Quote
Old 11th June 2019, 01:08   #43  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
My 16gb ram is laughing at 28mb.

And thank you for the update :-)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 11th June 2019 at 01:11.
ChaosKing is offline   Reply With Quote
Old 11th June 2019, 15:35   #44  |  Link
Lirk
Registered User
 
Join Date: Jan 2018
Posts: 33
Is there x64 version?
Lirk is offline   Reply With Quote
Old 5th July 2019, 06:13   #45  |  Link
jconklin
Registered User
 
Join Date: Mar 2006
Posts: 39
Other, Treaties Of Warp, and anyone else having memory problems or crashes using amDCT
I have posted a new version of amDCT at https://sites.google.com/site/amdctfilter/
The new file is amDCT_v1.3_Testing.zip

The problem sounds like a memory leak. Lets stress test it.
The problem sounds like a memory leak. Lets stress test it.

I ran a 1080P .avi video in a loop where each frame was processed 700 times.
Version1.2_Testing ran for 7 days with no errors. The max memory usage was stable around 1,120 MB. Reported by Task Manager for VirtualDub.

While this was running I dug into my memory management code, in Memory.c, carefully matching every malloc with its free.
It is NOT the first time I have done this exercise and almost certainly won't be the last.

What I discovered was a buffer was being freed in one section of code and then also being freed in the calling routine.
I don't know why this did not always crash.

I fixed the code and am currently running another 7 day test.
Then a series of long tests at different resolutions.

There is a new version amDCT_v1.3_Testing.zip that fixes freeing the same memory twice.

Please try it with a script that broke the v1.2 version of amDCT with version v1.3

If the new version doesn't fix the crashes please let me know.
jconklin is offline   Reply With Quote
Old 21st June 2020, 07:32   #46  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I like the filter, any plans for a Vapoursynth version?
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 20th January 2021, 23:29   #47  |  Link
jlpsvk
Registered User
 
Join Date: Dec 2014
Posts: 240
is there 64bit version?
__________________
AMD Ryzen 9 5950X, 32GB DDR4-3200 CL16, RTX 3060, 2TB NVMe PCIE4.0, NAS with 8x16TB HDD
jlpsvk 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 01:10.


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