Skip to content

Instantly share code, notes, and snippets.

View reorder_args.py
#!/bin/env python
# reorder_args.py for Python 2.x
# written by Chikuzen
import sys
import os
def usage():
print "usage : reorder_args.py <func name> <num of args> <new order> <filename>\n"
@chikuzen
chikuzen / jpeg2yuv.c
Created Oct 14, 2012
JPEG2YUV - TurboJPEG/OSS sample
View jpeg2yuv.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "turbojpeg.h"
typedef struct {
tjhandle tjh;
FILE *src;
unsigned char *src_buff;
unsigned char *dst_buff;
@chikuzen
chikuzen / finesharp.py
Last active Oct 13, 2015
vapoursynth sample
View finesharp.py
#finesharp.py - finesharp module for VapourSynth
#original author : Didee (http://forum.doom9.org/showthread.php?t=166082)
# requirement: RemoveGrain.dll, Repair.dll
import vapoursynth as vs
class InvalidArgument(Exception):
def __init__(self, value):
self.value = value
@chikuzen
chikuzen / histeresis.cpp
Last active Dec 20, 2015
Hysteresis mask for avisynth2.6
View histeresis.cpp
#include <windows.h>
#include "avisynth.h"
static const AVS_Linkage* AVS_linkage = 0;
class Footprint {
int index;
int width;
int height;
BYTE* map;
@chikuzen
chikuzen / transpose.cpp
Last active Dec 21, 2015
Transpose for avisynth2.6x
View transpose.cpp
#include <stdint.h>
#include <malloc.h>
#include <windows.h>
#include <emmintrin.h>
#include "avisynth.h"
static const AVS_Linkage* AVS_linkage = 0;
static __forceinline __m128i mm_movehl_si128(const __m128i& xmm0)
{
View RemoveGrain.cpp
#define LOGO "RemoveGrain 1.0\n"
// An Avisynth plugin for removing grain from progressive video
//
// By Rainer Wittmann <gorw@gmx.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
@chikuzen
chikuzen / vsenc.py
Last active Mar 27, 2016
vapoursynth sample
View vsenc.py
#vsenc.py
#coding: utf-8
import sys
from subprocess import Popen, PIPE
import vapoursynth as vs
x264_binary_path = 'D:/tools/x86/x264.exe'
avconv_binary_path = 'D:/tools/x86/avconv.exe'
@chikuzen
chikuzen / transpose_8x8_ps_avx.cpp
Last active Jul 31, 2016
why there is no_MM_TRANSPOSE_8_PS macro ?
View transpose_8x8_ps_avx.cpp
#include <immintrin.h>
void transpose_8x8_avx(const float* srcp, float* dstp) noexcept
{
__m256 a = _mm256_load_ps(srcp + 0); // a0 a1 a2 a3 a4 a5 a6 a7
__m256 b = _mm256_load_ps(srcp + 8); // b0 b1 b2 b3 b4 b5 b6 b7
__m256 c = _mm256_load_ps(srcp + 16); // c0 c1 c2 c3 c4 c5 c6 c7
__m256 d = _mm256_load_ps(srcp + 24); // d0 d1 d2 d3 d4 d5 d6 d7
__m256 e = _mm256_load_ps(srcp + 32); // e0 e1 e2 e3 e4 e5 e6 e7
__m256 f = _mm256_load_ps(srcp + 40); // f0 f1 f2 f3 f4 f5 f6 f7
View mygreyscale.cpp
#include <algorithm>
#include <tmmintrin.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <avisynth.h>
typedef IScriptEnvironment ise_t;
View rgba_to_grey.cpp
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <tmmintrin.h>
// pattern0: (R + G + B) / 3
// pattern1: max(R, G, B)
// pattern2: (R + 2*G + B) / 4
// pattern3: R*0.299 + G*0.587 + B*0.114