Skip to content

Instantly share code, notes, and snippets.

View astiob's full-sized avatar

Oleg Oshmyan astiob

View GitHub Profile
@astiob
astiob / crossfades.py
Created May 30, 2024 20:42
VapourSynth script for converting interlaced fades over telecined content to pure-progressive fades
import vapoursynth as vs
from vsdeinterlace.combing import vinverse
__all__ = (
'smooth_stable_fade',
'unfade_unique_into_repeating',
'unfade_repeating_into_unique',
'fade_unique_into_repeating',
'fade_repeating_into_unique',
@astiob
astiob / base.base36
Created January 25, 2019 22:32
bn.js computes incorrect new BN(base, 36).sqr().sqr().sqr()
7pdsv7ss6kribm8z2p4ypobswmu5j1zdo0q3nsyfepmf4qx86v3xd21z0sp8nv0sno7wttqk0skz305ylk6nbpde9z1bxgtss8x3ejqd3t4x6287voymm7qh11e6k3g6unz0uphaofbudolf4nonc9dqxeqnjrrmue195509t6athw0ld5co90g1wo88tl5vh08rjif3n2ekwowm09i697i5799tj9ll4zywzuabhfos03eghr8jkn41io6oplpnv00hzvpu2omd2y3q0ky4f0bhv5vnggft1sqwiv9vv1p5ei9pz9bze4yleg5stn58tutdb7odtx6kjrmul9kppaeevc5k6bb4bz5950j8i7eerr91qje2ajosxu3lqrxv14v7oscg4nk4bokl9mfn5rfvqles1vapmcwcyp0gm7wri6n7zqp0k856xlf76ui1sjca1jqqeb9rua3psh97256zrigbzar2v02qu80a1yaj9wqhptvfao6wppgm8cxzulzdbzdmosya2btt3cc1uv90vaf5bg4av1lutlbkyvp046jgszyf3ruw93mb27m5scn7koiu1oecdsm3rjb828v0sloj4fgrf7sgslkkjn6ztxh30hwby52wqxjwirae6comqaf36g01nv3jghuxo44rnzqz67eixyb3jr24bz1cy4gbin0h0ueqrsl3z0f6b7z2srojcbrqiyqzmp1bt51wv2jc2eqs4ub3w3rezu5cna75gys9c90rpfajyuowo7cq4mtccdwbpy4yxwwbczgqz6nmsmw54z0aog3c3cgq5110q2l9x7jvb1u9g4ga6pt0bumawhighx4hdx8d0g99r4zkf4b0pumx8jfc5o438fid1n8qk940kf2uwlfdwnm6w2rlklnq0adbyt0rz83gyxzf5623xxxa3tqxlcp347g8fljro1geq3u9hb2yc5e08zmkuraagq46dloatjn1dhg9bpgyg6e9a3fnspzc696linjba00e2ygaobry
@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 / 0_id.log
Last active April 13, 2016 21:07
mpv build log on Raspberry Pi 3
pi@raspberrypi:~/mpv-build $ uname -a
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
pi@raspberrypi:~/mpv-build $ gcc --version
gcc (Raspbian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@astiob
astiob / bit.c
Last active April 23, 2016 13:04
Dynamic range maximum query
saidx_t range_max(const saidx_t *restrict data,
const saidx_t *restrict left_tree,
const saidx_t *restrict right_tree,
size_t first, size_t last)
{
assert(first < last);
saidx_t value = -1;
for (; (first | first + 1) < last; first |= first + 1)
if (value < right_tree[first])
@astiob
astiob / libass-asm-test.ass
Last active October 10, 2015 11:07
libass assembler code sanity check
[Script Info]
ScriptType: v4.00+
PlayResX: 1280
PlayResY: 720
ScaledBorderAndShadow: yes
YCbCr Matrix: None
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,18,&H00000000,&H00000000,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,0,0,2,0,0,50,1
@astiob
astiob / render_subtitles_rgb24.c
Last active August 29, 2015 14:13
Code fragment blending ASS_Images onto an RGB surface
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#define dither() (rand() / (RAND_MAX + 1.0L))
typedef struct
{
size_t w, h;
struct rgb24_pixel { uint8_t r, g, b; } samples[];
[Script Info]
ScriptType: v4.00+
PlayResX: 1280
PlayResY: 720
ScaledBorderAndShadow: yes
YCbCr Matrix: None
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,60,&H000000FF,&HFF0000FF,&H00000000,&H000000FF,0,0,0,0,100,100,0,0,1,0,0,5,10,10,20,1
@astiob
astiob / 0001-MSVC-ilog2.patch
Created April 27, 2014 00:30
11rcombs/libass/rasterizer: MSVC ilog2
From 3183dff76442ac06e4fb19fd2f7be99a34d18522 Mon Sep 17 00:00:00 2001
From: Oleg Oshmyan <chortos@inbox.lv>
Date: Sun, 27 Apr 2014 01:28:59 +0100
Subject: [PATCH] MSVC ilog2
---
libass/ass_rasterizer.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libass/ass_rasterizer.c b/libass/ass_rasterizer.c
@astiob
astiob / be.ass
Last active August 29, 2015 13:57
ASS blur tests
[Script Info]
ScriptType: v4.00+
WrapStyle: 0
PlayResX: 1280
PlayResY: 320
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.709
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding