Skip to content

Instantly share code, notes, and snippets.

@layneson
layneson / Makefile
Created January 25, 2019 12:29
Video Codec Experimentation Starter Pack
SOURCES=main.cpp camera.cpp
HEADERS=camera.hpp
CFLAGS=-std=c++11 -Wall -g `sdl2-config --cflags` -I/opt/libjpeg-turbo/include
LFLAGS=`sdl2-config --libs` -L/opt/libjpeg-turbo/lib64 -l:libturbojpeg.a
OUT=../../bin/av1_video
$(OUT): $(SOURCES) $(HEADERS)
g++ -o $@ $(CFLAGS) $(SOURCES) $(LFLAGS)
@layneson
layneson / build.zig
Created April 15, 2020 15:33
Custom step in build.zig
const std = @import("std");
const Builder = std.build.Builder;
const Step = std.build.Step;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("hw", "hw.zig");
exe.setTarget(target);
@layneson
layneson / fragment.glsl
Last active January 14, 2022 03:39
OpenGL shader texture issue
#version 400
uniform usamplerBuffer u_indexer;
uniform sampler2D u_tex;
out vec4 out_color;
void main() {
// THIS IS WHAT I WANT TO WORK:
@layneson
layneson / bitreader.zig
Created November 18, 2022 22:18
Bit-wise reader for Zig
const std = @import("std");
pub fn BitReader(comptime UnderlyingReader: type) type {
return struct {
const Self = @This();
underlying_reader: UnderlyingReader,
current_byte: u8 = 0,
offset_into_current_byte: u8 = 8,