« first day (4071 days earlier)      last day (868 days later) » 

12:00 AM
This one looks slightly better than moving average: en.wikipedia.org/wiki/Exponential_smoothing.
However, if that's too complicated, just do a simple moving average: en.wikipedia.org/wiki/Moving_average#Simple_moving_average.
With these names, surely you can find a routine somewhere to copy (and license and attribute).
 
NEEEEERD
:-P <3
 
Definitely not a math nerd; I just know enough to know there are names for these things to search for them ^_^
 
Nov 17 '17 at 21:37, by DaveRandom
user image
 
Wes
that is useful. looks like what i need. and yes i've already found several implementations
 
whatever
 
12:06 AM
Girgias is the math nerd
 
Wes
#cargocult
 
@Wes if you just want smoothing, averaging will do it, but from your diagram it seems you want to switch between smoothing and not smoothing the data......for that you can't do a simple algorithm, you need to store a 'window' into the bit of data you consider noisy.
 
@PeeHaa ohhhh right, I thought it was complicated
 
stuff goes in, stuff comes out
easy
 
12:16 AM
GIGO applies to this civilisation as a whole, for sure
"civil"
 
looking good
 
Wes
SMA seems to be working. thanks Levi
there are several moving averages functions
 
12:39 AM
(currently not feeling great about Cricket)
 
Wes
maybe SMA is not what i want it to do after all
problem is, i have no idea what it should do
 
...now you understand why I avoid stats like the plague... no-one knows what they want, even if they do they have no idea how to acheive it...
 
Wes
i avoid math in general :B
 
more helpfully, an alternate approach would be to exclude outlying data points, feels like this might be easier
 
Wes
i need to remove the spikes, not average them
 
12:47 AM
though I'm still not sure how one would achieve that without being a human
 
Wes
that's what i just understood
a spike could be like +-25% compared to the previous and next values
in that case i would smooth it by setting to (previous + next) / 2
 
there's the rub, if you have a magic number (25) then it's a simple problem
figuring out the magic number is the hard part
if you know that number it's easy though, calculate the line and then remove any data points outside
you know X, just remove all the Ys that don't make sense
 
Wes
i am basically eyeballing the whole thing
i'd say more than 25% difference should be smoothed out
 
in the real world, in english, what is the problem you are trying to solve?
or is a pure math thing?
(XY check)
 
Wes
it's luminance values of videos. basically if a frame is very dark, i apply some brightness programmatically
problem is, doing it frame by frame takes a lot of time
 
12:55 AM
that feels like a very solved problem for which ffmpeg (amongt others) will have solutions...
 
Wes
so i pick the luminance every n frames rather than every frame, and fill the gaps
 
@Wes again, very much susceptible to compunding errors...
apart from anything else, doesn't mpeg keyframing elimated a lot of that?
if there is a sudden shift in colour density it mpeg encoding should create a keyframe
lol suddenly I actually know (a bit) what I am talking about :-P
 
Wes
keyframes are at constant offsets
like every 2 seconds
 
not in variable rate streams
it's like mp3 magical bit reserviours, they only work if the change isn't too sudden, otherwise you have to create a whole frame snapshot
 
Wes
anyway, it's videos that are shot too dark sometimes, so i want to color correct them slightly
 
12:59 AM
yeh but surely that's constant across the whole media stream?
or at least needs to be cut on scene jumps
needs some human involvement unless you are dealing with sudden e.g. sun glare
in which case that shit is a frame-by-frame problem (sorry)
what is the input video?
 
@Wes "doing it frame by frame takes a lot of time". Wait, in which way does it take too much time? Per video, or just for how many videos you have to do?
 
Wes
it's tours of apartments and houses on sale/rent
 
ffs that's can't be a hard problem unless the camera man is a full blow idiot
 
Wes
basically in the same video you go from the garden outside of the house which is very bright, to inside the house, which is much darker
 
hell, iOS does most of the work for you :-P
@Wes that's exactly one human-controlled cut you have described so far :-P
 
Wes
1:04 AM
they are not too bad, it's just that people on the internet expect the super best epic quality
so even if the video is mostly ok, if i can manage to increase the brightness slightly, there will be less people asking for better photos/videos
 
fine, so just divvy up each house nto individual room cuts, that's 2 mins per house and you can make the sales c**t do it for you
btw sales people who sell houses professionally are the worst people on earth, I regard them as being below internet scammers
I know one since we were both ~3 and he is one of the few people on earth I actually hate
 
Wes
it takes ages to edit the videos, and encode them
like even 4 hours for a single video
 
lol sorry got off track there :-P
@Wes I only mean, put it on the user to tell you where the cuts are
i.e. treat a single vid as multiple scenes without trying to be psychic
 
Wes
i am not understanding
they are not computer people, they are probably recording these videos with a phone
 
I do not belive it is reasonable for someone to give you a single video of a tour of a house and expect you to break it up into individual part of the house without telling you which part of the house they are in at which point in the video
 
Wes
1:12 AM
also maybe they sell the house the next week so it's not you want to have the best equipment and spend a lot of time on it
 
if it's only based on light levels then fine, that should be doable with 5 years and a team of 20, but if you want me to automatically the part where you point your phone at your shoes and talk about the match last night, fuck off
 
Wes
lol
 
feeling a bit of this, basically, like you may have been asked for something unreasonable :-P
 
Wes
i think the method will work just fine once i figure out how to smooth the peaks
anyway i wasn't given any significant amount of work yet. but if i find this solution, i can ask for more videos to process, and that's the idea
 
OK so I think you need to divide the thing up into "scenes", so say computer your 10-point luminosity value as sugested ealier, and also as you said earlier do a multi-pass aproach to figure out where the break points are, then apply SMA (or similar?) to those chunks
 
Wes
1:18 AM
can't do that now when it takes me 2 hours to encode a 10 minute video -.-
there are no scenes it's a single cut i believe for most of the videos
 
seriously I am done trying to make intelligent comments, it's 1:18am and I am now hammered because I had two extra beers during this convo :-P
 
Wes
so if i detect the luminosity every like half a second
 
@Wes ugh ffs you may also need more compute power...
 
Wes
unless someone is running from inside to outside of the house, it will work fine
but sometimes i get false positives with luminance, and that's what i am trying to smooth out
like just for a few frames luminosity goes up a lot because the camera man focused slightly on the window
 
@Wes that stuff is detectable with a 2-pass approach relatively trivially, though obv it will increase your pre-encode phase a lot
i.e. sudden, large, lengthy changes aren't hard to find
 
Wes
1:22 AM
2 pass approach how?
 
so go through and take e.g. the avg luminosity for every second, then if luminosity has been e.g. 50% higher for all 5 secs than the 6th secs, consider 5 secs ago to be a scene change
basically index the luminosity at, say 0.25 sec intervals to produce a smaller data set that is much cheaper to work with
and only look for "sudden and sustained" changes
8 mins ago, by DaveRandom
OK so I think you need to divide the thing up into "scenes", so say computer your 10-point luminosity value as sugested ealier, and also as you said earlier do a multi-pass aproach to figure out where the break points are, then apply SMA (or similar?) to those chunks
this is what I meant, tho feel like didn't come across
 
Wes
i am extra tired and it doesn't quite compute
but it's hard to find any kind of scene
 
sleep also a good plan :-) I should have done it a while ago...
 
Wes
like even in the same room if the cameraman rotates 180° you can get totally different luminance, because a window (with sunlight outside) goes in or out of view
 
yeh but only for <1sec
 
Wes
1:29 AM
yeah
 
hence only cut view if lumo changes for e.g. 3 sec
> consider 5 secs ago to be a scene change
 
Wes
hm
aaaaaaah now i understand
 
:-)
/me actually sleeps
 
Wes
gn \o thanks for the help
 
inhabit <3
 
1:50 AM
one last thought @Wes, TV companies are shit at what you are trying to do, so many times you get adverts mid scene, it's a really hard problem you are trying to solve, results will always be horrible and you should do all you can to persuade people to try harder to make better videos because computers are not fucking magic :-P
actually sleeping x
 
 
6 hours later…
Wes
8:17 AM
i haz sleep. and now i am just as clueless as before
 
8:32 AM
Hello can I ask something?
I have CI4 app, if I execute code via CLI like this codeigniter4.github.io/userguide/cli/cli.html its not working, however if I navigate to web e.g. example.com/index.php/tools/message/to its working. What should I check?
 
 
2 hours later…
11:00 AM
o/
 
 
2 hours later…
12:55 PM
Hello folks. Recently I've noticed many people who genuinely think that generators are used to reduce the memory overhead. I think it's because of the phrasing in the corresponding man page, https://www.php.net/manual/en/language.generators.overview.php
Would it be a good idea to add an note that explicitly states that generators are essentially a syntax sugar and the mechanism that actually reduces the memory overhead is the code wrapped inside? Which always could be used without generators at all, just like the for loop in the provided example?
 
Wes
1:06 PM
@DaveRandom i am trying to implement your idea but can't figure out how.
maybe i am overthinking it
i think i got an idea
 
cmb
@YourCommonSense maybe it would be sufficient to start the second paragraph with "Like an iterator, a generator allows …"?
 
Wes
this kind of problems is fun, even if i am clueless about it
 
cmb
1:22 PM
And has likely been solved already :) Did you try to search the Web?
 
Wes
it's hard to search anything
i tried to google smooth peaks algorithms, but they are not quite what i am looking for
maybe noise reduction, i should try
actually i think i got one right
 
 
1 hour later…
Wes
2:32 PM
 
Is that your heart beat? Because if that's the case I'd speak to a doctor.
@Wes What you're looking for is a "smoothing average"
 
Wes
or maybe i'll buy myself a defib on amazon
 
morning
float PHP type translates to a double C type correct ?
 
cmb
yes
 
Hey ... "Historical reasons"
lol
 
cmb
yeah, algol :)
 
The only language I have officially received any education in is Fortran '77.
 
Wes
3:19 PM
@Derick i tried with the moving average but that's not it. i just need to get rid of too sudden changes
 
You want to get rid of sudden changes?
not smooth them?
 
15 hours ago, by Danack
@Wes if you just want smoothing, averaging will do it, but from your diagram it seems you want to switch between smoothing and not smoothing the data......for that you can't do a simple algorithm, you need to store a 'window' into the bit of data you consider noisy.
apparently I forgot to post the actual code... gist.github.com/Danack/1b7dbc506b02cca67d2caf1128fab10a
 
I'd say, get better data :D
 
cmb
If Data ain't good enough, try Riker. ;)
5
 
Wes
@Danack when i drew that i wasn't even sure how i wanted it to work
 
3:27 PM
And you probably still aren't sure. But it sounds like some of the time you want no effect, other times, you want some munging of the data, based on values around a 'noisy' point.
 
@Danack Oh boy
 
btw, the other bit you haven't mentioned yet is what happens when there are two 'noisy' points near each other.....I'm guessing you either want to extend the window to be bigger, or to exclude noisy points from the averaging.
 
Wes
$values = array_values($km);
foreach($values as $index => $value){
    $prev = $values[$index - 1] ?? $value;
    $minValue = max($prev - 10, 0);
    $maxValue = min($prev + 10, 255);
    $values[$index] = min(max($value, $minValue), $maxValue);
}
this is what i am using
 
I have the opposite algorithm (RDP, en.wikipedia.org/wiki/…) implemented in github.com/php-geospatial/geospatial/blob/master/…
 
Wes
basically allow increases/decreases of max 10
 
3:30 PM
It discards all points that are too close to the "base line"
 
Wes
so like if i have +100, it will be converted to +10
if i have two consecutive +100s, rather than getting +200 i will get +20
so if it keeps staying at +200 eventually it will get there, in 20 steps rather than 2
but if it's +200 only for a brief while, it will only increase by a little, and then go back down
[0,0,0,100,100,100,100,100,100,100,100,100,100,100]
becomes
[0,0,0,10,20,30,40,50,60,70,80,90,100,100,100]
-------

[0,0,0,1000,0,0,0,0,0]
becomes
[0,0,0,10,0,0,0,0,0]
 
What are you actually trying to display?
 
Wes
it's the luminance of each frame in a video
according to that, i am applying brightness to the videos
so that changes in luminance are less noticeable
 
If you put some runnable code and a video file somewhere, it would be easier to suggest changes.
 
Wes
3:47 PM
i am actually fairly happy with the code above. totally makes sense in my head................... at least for now :B
 
yesterday, by Crell
I'm thinking of cases where you want the operator to be dynamic based on user input.
@JRL when you're programming a calculator, and you want to have an 'undo' button.
Or any thing where the operations are being done by a user, rather than raw code.
which is part of why in my opinion - "Operand implementations cannot be called on an instance of an object the way normal methods can." is a bit rubbish.....that makes it harder to write unit tests for that code.
 
Wes
time to load it up in after effects. i can't believe i got this done
 
I'll save most of the rest for the mailing list.....but I'm finding the reasoning behind the "Symbols Instead Of Method Names" is just not convincing.
 
Wes
4:16 PM
KEK it works
surely i am not the only one thinking of this scene when they succeed at anything
LOOK WHAT I HAVE CREATED I HAVE MADE PHP SCRIPT
sorry.
 
:P
it's a lovely feeling
 
4:37 PM
Any way to catch that ?
 
Yes, it
s an \Error, not an \Exception
you can also catch \Throwable
 
oh cool
Makes sense
Thanks Derick o/
 
cmb
IMO it's better not to catch Error exceptions ever; in this case checking instanceof Stringableappears to be preferable.
 
JRL
5:07 PM
@Danack You should still be able to write unit tests, you would just have to use the operators.
These are not for handling the entire application concept of adding, or subtracting, or so on. You could still have a function named add() on your object that is called from operator +(), and i could see many cases where that happens.
These are specifically to control the way your objects interact with code, not with users.
if your object does depend on user input during operation +(), that should be part of the object state
 
5:25 PM
o/
 
5:47 PM
unsure who updated the wiki CSS, but I love it
consistency :D
 
now it looks like we care about it ... which could have unexpected consequences
because we really don't ... but it is prettier ...
 
6:11 PM
is there a colloquial or formal name for a/c cables with the plug on the right side? m.media-amazon.com/images/I/51ZyeD85fLL._AC_SL1000_.jpg
 
dangerous
 
JRL
hmmm. that's the plug the switch uses isn't it?
 
power bank, yeah
the one my laptop came with is really short and I wanted to buy a longer one
but I don't know what it's called
@Derick this about summarizes how the US has implemented our electric grid :P based on what I've heard from people in other countries
I guess "two prong"
 
cmb
@Tiffany de.wikipedia.org/wiki/… (German only)
 
JRL
well of course there's a german word for it, lol
 
6:26 PM
google translate calls it "small device coupling," interesting
power coupling for small devices
 
6:54 PM
No
"the thing that looks like a pair of binoculars which runs on electricity"
German works by cramming some words together, then you get a new word! Works 90% of the times
 
7:12 PM
there's probably a word for the glorious over-generalization you just did (:
 
In German, it probably translates as "Very large generalization that is excessive."
 
cmb
more like "Überverallgemeinerung" :)
 
7:58 PM
@FélixAdriyelGagnon-Grenier See? cmb just did it :)
@Crell xD exactly
not-so-overly-generalized, in English just use hyphens !
 
JRL
8:55 PM
what's a decent way to actually inspect the value of a zval in the debugger?
 
@JRL do 'source .gdbinit' when in the root of php src. That loads github.com/php/php-src/blob/master/.gdbinit which has macros like printzv
 
JRL
where do i run those macros?
oh, these are for gdb specifically
this is pretty handy :) thanks
huh
apparently, the first argument is coming through with an unknown type in the zval
printzv just says Unknown type 40
i don't see how that's possible considering it is just copied using ZVAL_COPY_VALUE
and the op that's copied has the right type, and the params array its copied into also has the right type and value prior to passing it off to the function call
 
 
1 hour later…
10:18 PM
1 hour later...
 
JRL
you bastard, lol. that got me, i thought my browser window was broken.
 
:-P
 
 
1 hour later…
11:20 PM
Not only are PHP's array functions incapable of working on iterables, half of them can't handle non-strings, either. Because PHP.
And enums cannot implement __toString(). Because of course.
So, I cannot array_diff() a list of enums. Thanks, PHP!
 
You're welcome
 
IGP
each enum is basically it's own class.
so, not even the same type
 
JRL
@IGP are you saying different enums are different classes, or that different cases are different classes? because they share the same class entry
 
Under the hood, enums are basically classes
 
JRL
right. basically. but not quite. which is causing me headaches right now, lol.
 
11:35 PM
Ahh
 
IGP
@JRL I got mixed up with the way enums work in postgres where they're their own types.
 
JRL
but, im certain its because i don't understand something/am missing something
 
Enums are classes, enum cases are objects. So an array of enum values is an array of objects.
 
IGP
I haven't really done anything with php8 enums yet
 
array_intersect(), array_diff(), etc. can only work on stringable values.
Enums explicitly cannot declare __toString().
So... fail.
 
JRL
11:36 PM
right
 
Who wrote that RFC? We should kick their ass.
 
JRL
lol
 
@Crell any reason why you didn't include that in the RFC? :P
XD
 
JRL
enums can declare operators
in my RFC :D
 
I guess it's an implementation limitation?
 
JRL
11:37 PM
not really, it's just checked and errors
it would work fine
it's just restricted
 
I believe it was because __toString() would get confused with ->value on backed enums, and we weren't sure yet if that was a good idea. We wanted to reserve Stringable in case we figured out a generic use for it later.
 
JRL
(the __toString() limitation)
 
@JRL I am sure I will do all sorts of evil things with that.
 
Ah
 
Yeah, we explicitly blocked it.
 
11:39 PM
"TBD in a later version"
 
JRL
@Crell i have refused to separate the inequality operators into pieces, or to separate the == and != operators, or to provide == or <=> with an operator position argument to try and limit evil
but... evil will be done
 
I forget, why is concat not included?
 
JRL
because __toString() is already called for concat
 
Ah, gotcha. I guess I'll have to horribly abuse + for monadic purposes instead.
 
JRL
right now my zval is gettign mangled somehow between the do_operation handler and the user function ex. it's showing up with an unreadable Z_TYPE
which is bonkers, i haven't touched that variable at all since my last working build
i just swapped the other operand from a bool to an enum
it's not copying into the params array correctly for some reason
 
IGP
11:49 PM
Found a way to array diff enums
It's not quite pretty
enum E1 {
    case Circle;
    case Square;
}

enum E2 {
    case Circle;
    case Triangle;
}

prinr_r(array_diff(
    array_map(fn($case) => $case->name, E1::cases()),
    array_map(fn($case) => $case->name, E2::cases())
));
@Crell Does the above work for you?
 
It probably would, but I already did this:
function enum_intersect(array $enums, array $include): array
{
    return array_filter($enums, static fn (UnitEnum $e): bool => in_array($e, $include, true));
}

function enum_diff(array $enums, array $exclude): array
{
    return array_filter($enums, static fn (UnitEnum $e): bool => !in_array($e, $exclude, true));
}
Which doesn't have to worry about 2 enums with the same name, as it's comparing object identities.
 
JRL
okay, can someone please tell me what i'm doing stupid here:

`zval params[2];`
`zend_fcall_info fci;`

`ZVAL_COPY_VALUE(&params[0], op1);`
`ZVAL_COPY_VALUE(&params[1], &op_pos);`
`fci.params = params;`
 
IGP
@Crell static callbacks? Didn't know that was a thing.
 
@JRL Use ZVAL_COPY, then zval_ptr_dtor on both after zend_call_function.
 
A static anon function means "don't capture an object scope if we're inside an object scope when this is called." If you're not using $this, it's a good idea.
Although in this case I'm not in an object scope so it doesn't matter; it's more out of habit.
 
JRL
11:57 PM
@Trowski not on op1 since it's a pointer from the argument i presume
 
Not on op1 or op_pos, on params[0] and params[1].
 
JRL
ohhhh.
 
IGP
@Crell Interesting. I assume this gives a bit of a performance boost if the object is complicated.
 
JRL
im not sure why that would fix it exactly. after the last line above, gdb says that params[0] is long 6, and fci.params[0] is Unknown type 40
but i shall try
 
@IGP In theory. I don't know how much difference it actually makes, but static analyzers get cranky if you don't. :-)
 

« first day (4071 days earlier)      last day (868 days later) »