Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barrbrain
barrbrain / Chroma from Luma Basis Functions.ipynb
Last active August 3, 2017 15:43
Chroma from Luma Basis Functions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barrbrain
barrbrain / Median of the maximum of independent poisson random variables.ipynb
Last active January 23, 2017 14:08
Median of the maximum of independent poisson random variables
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barrbrain
barrbrain / AV1 PVQ delta rate analysis.ipynb
Last active February 15, 2017 13:32
Simulate Daala quantization-bitrate trends for subset3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barrbrain
barrbrain / filter.js
Last active April 9, 2016 08:13 — forked from anonymous/filter.lljs
ll.js based daala technology demos
/*Daala video codec
Copyright (c) 2003-2010 Daala project contributors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
@barrbrain
barrbrain / generate_table.py
Created November 6, 2015 08:50
Chroma quantization curve table generation for Daala
import math
P = 2.25
def quant(cq): return math.trunc(math.exp((cq-6.235)*.10989525)*16.0)
def curve(cq): return quant(cq-math.pow(cq-1,P)/(2.0*P*math.pow(62.0,P-1)))
print(', '.join(['0x%04X' % n for n in [0] + [curve(cq) for cq in range(1,64)]]))
@barrbrain
barrbrain / analyze_ciede2000.py
Last active December 4, 2015 15:14
Color Image Quality Assessment Based on CIEDE2000, Yang Yang, Jun Ming and Nenghai Yu, 2012
#!/usr/bin/env python3.4
from collections import deque
import sys
import numpy as np
from skimage import color
import random
from scipy import ndimage
# Assuming BT.709
yuv2rgb = np.array([
@barrbrain
barrbrain / PSNR-CIE76.bash
Last active October 31, 2015 02:56
Calculate PSNR with CIE76 difference method
#!/bin/bash
# REQUIRES imagemagick compiled with HDRI feature enabled
SIZE=$(head -n1 "$1" | sed -E 's/.*W([0-9]*) H([0-9]*).*/\1x\2/')
FMT="-size $SIZE -depth 8 -sampling-factor 4:2:0 -interlace plane -set colorspace Rec709YCbCr"
convert $FMT YUV:<(tail -n+3<"$1") YUV:<(tail -n+3<"$2") \
-colorspace Lab -compose difference \
-composite -evaluate Pow 2 -separate -evaluate-sequence Add \
-filter box -resize 1x1\! -format "%[fx:-10*log(u)]\n" info:
@barrbrain
barrbrain / visualize_quality_curve.sh
Last active November 30, 2015 07:00
Script to render a video of quantization effects in daala
#!/bin/bash
readlinkf(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";}
DAALA_ROOT="$(readlinkf ${DAALA_ROOT:-.})"
INPUT_IMAGE="$(readlinkf $1)"
OUTPUT_VIDEO="$(readlinkf ${2:-$(basename "$INPUT_IMAGE").webm})"
cq="0 1 2 3 4 5 7 9 11 13 16 19 22 25 28 33 38 44 50 57 64 73 82 92 104 117 132 148 166 187 209 235 263 295 330 369 413 462"
P=${P:-4}
(
cd /tmp
FIFOS="`echo -n $cq|sed 's/[0-9][0-9]*/&.y4m/g'`"
@barrbrain
barrbrain / xwn2dict.py
Last active August 29, 2015 14:08
Generate English vocabulary guide from eXtended WordNet; requires python-igraph
#!/usr/bin/python
import xml.sax
from igraph import Graph
from collections import defaultdict
class XWN( xml.sax.ContentHandler ):
def __init__(self):
self.graph = Graph(directed = True)
self.synSets = []
self.currentTag = ""