Skip to content

Instantly share code, notes, and snippets.

View astiob's full-sized avatar

Oleg Oshmyan astiob

View GitHub Profile
@astiob
astiob / bit.c
Created April 23, 2016 12:08
Dynamic [i, n] range maximum query
T range_max(const T *binary_indexed_tree, size_t size, size_t first)
{
T value = T_MIN;
for (; first < size; first |= first + 1)
if (value < binary_indexed_tree[first])
value = binary_indexed_tree[first];
return value;
}
void increase(T *binary_indexed_tree, size_t pos, T value)
@astiob
astiob / base.base36
Created January 25, 2019 22:32
bn.js computes incorrect new BN(base, 36).sqr().sqr().sqr()
7pdsv7ss6kribm8z2p4ypobswmu5j1zdo0q3nsyfepmf4qx86v3xd21z0sp8nv0sno7wttqk0skz305ylk6nbpde9z1bxgtss8x3ejqd3t4x6287voymm7qh11e6k3g6unz0uphaofbudolf4nonc9dqxeqnjrrmue195509t6athw0ld5co90g1wo88tl5vh08rjif3n2ekwowm09i697i5799tj9ll4zywzuabhfos03eghr8jkn41io6oplpnv00hzvpu2omd2y3q0ky4f0bhv5vnggft1sqwiv9vv1p5ei9pz9bze4yleg5stn58tutdb7odtx6kjrmul9kppaeevc5k6bb4bz5950j8i7eerr91qje2ajosxu3lqrxv14v7oscg4nk4bokl9mfn5rfvqles1vapmcwcyp0gm7wri6n7zqp0k856xlf76ui1sjca1jqqeb9rua3psh97256zrigbzar2v02qu80a1yaj9wqhptvfao6wppgm8cxzulzdbzdmosya2btt3cc1uv90vaf5bg4av1lutlbkyvp046jgszyf3ruw93mb27m5scn7koiu1oecdsm3rjb828v0sloj4fgrf7sgslkkjn6ztxh30hwby52wqxjwirae6comqaf36g01nv3jghuxo44rnzqz67eixyb3jr24bz1cy4gbin0h0ueqrsl3z0f6b7z2srojcbrqiyqzmp1bt51wv2jc2eqs4ub3w3rezu5cna75gys9c90rpfajyuowo7cq4mtccdwbpy4yxwwbczgqz6nmsmw54z0aog3c3cgq5110q2l9x7jvb1u9g4ga6pt0bumawhighx4hdx8d0g99r4zkf4b0pumx8jfc5o438fid1n8qk940kf2uwlfdwnm6w2rlklnq0adbyt0rz83gyxzf5623xxxa3tqxlcp347g8fljro1geq3u9hb2yc5e08zmkuraagq46dloatjn1dhg9bpgyg6e9a3fnspzc696linjba00e2ygaobry
@astiob
astiob / crossfades.py
Last active April 28, 2025 01:16
VapourSynth script for converting interlaced fades over telecined content to pure-progressive fades
import vapoursynth as vs
from vsdeinterlace import vinverse
__all__ = (
'smooth_stable_fade',
'unfade_unique_into_repeating',
'unfade_repeating_into_unique',
'fade_unique_into_repeating',
'fade_repeating_into_unique',
@astiob
astiob / delowpass.py
Last active January 28, 2025 22:34
Delowpass with DFT
# Full-frequency source (US)
full = depth(full, 32)
# Low-frequency source (JP)
blurred = depth(blurred, 32)
full = full.resize.Point(format=vs.YUV444PS, matrix_s='170m')
blurred = blurred.resize.Point(format=vs.YUV444PS, matrix_s='170m')
full = get_y(full)
blurred = get_y(blurred)
@astiob
astiob / dehdcam.py
Created February 25, 2025 01:13
HDCAM dehalo experiments
from vskernels import Bilinear, Box, Catrom, Hermite
from vsscale import ArtCNN
from vstools import vs, core, depth, limiter, set_output, get_y, get_u, get_v, join
def disc(n):
return (core.dgdecodenv.DGSource(f'YESPRECURE5_DISC{n}.dgi')
.std.SetFrameProps(_Matrix=vs.MATRIX_BT709, _Transfer=vs.TRANSFER_BT709, _Primaries=vs.PRIMARIES_BT709)
.std.SetFieldBased(vs.FIELD_PROGRESSIVE)
.resize.Point(format=vs.YUV420PS)
)