Log in

View Full Version : New filter: Autolevels


Pages : 1 2 [3]

StainlessS
31st May 2019, 17:43
AutoAdjust source aint available, methinks.
EDIT: LaTo likes to keep his source secret.

ChaosKing
31st May 2019, 18:59
Oh I missed that >_<

StainlessS
31st May 2019, 20:27
It did give me opportunity to see how eg GamMac should cope with some stuff, defo gonna update that.
EDIT: and if lord Pinterf were to correct and up for 16 bit, then would include such improvements also.
[ I pretty much understand Avs levels now,although my strange autogamma thing posted (but now delteted)
let me now understand some stuff, was real problem trying to work out autogamma script prob, I thought
I had GetFrame() recursive probs, was most confused.]

StainlessS
1st June 2019, 08:01
Oops, bugfix version AutoLevels v0.8 update (avs v2.58, avs/+ v2.6 x86 & x64)
8 Bit only.
Req VS 2008 Runtimes.
Includes 3 dll's, + source + Full VS2008 project files for easy rebuild.
See HOSTED directory @ MediaFire in sig below this post.

Bugfix:- Only scanned left half of YUY2 frame, fixed.
Also, made small mod to avoid overflow of accumulator on big (~ 8 million+ high value luma pixels) frames.

BugFix 1:

void Autolevels::GetAvgLumaYUY2(PVideoFrame &frame, int *yhisto)
{
const int src_pitch = frame->GetPitch();
const BYTE *srcp = (BYTE *)frame->GetReadPtr(PLANAR_Y) + (src_pitch * border_t) + (2*border_l);
const int ylim = vi.height - border_t - border_b;
const int xlim = (vi.width - border_l - border_r) * 2; # Multiply by 2 [1 Luma sample + 1 Chroma]
for (int y=ylim; --y>=0;) {
for (int x=xlim; (x-=2)>=0;) {
yhisto[srcp[x]]++;
}
srcp += src_pitch;
}
}



Mod 2:

__int64 wsum = 0; # Was int
int pixcnt = 0;
// compute the mean from the histogram
for(int bkt=ymininner; bkt <= ymaxinner; bkt++) {
pixcnt += yhisto[bkt];
wsum += yhisto[bkt] * bkt;
}
mean = (double)wsum / (double)pixcnt;
DPRINTF("getStats wsum=%I64d pixcnt=%d mean=%f",wsum,pixcnt,mean)

StainlessS
5th June 2019, 16:40
Oops again, Ver$ AutoLevels v0.9 update (avs v2.58, avs/+ v2.6 x86 & x64)
8 Bit only.
Req VS 2008 Runtimes.
Includes 3 dll's, + source + Full VS2008 project files for easy rebuild.
See HOSTED directory @ MediaFire in sig below this post.

Left debugging switch on, below should have been commented out for release, fixed. Probably was a bit slower than necessary.

#define BUG // Uncomment to enable DPRINTF() output



EDIT: Created new thread in Usage forum( AutoLevels v0.9 ) :- http://forum.doom9.org/showthread.php?p=1876317#post1876317