Skip to content

Instantly share code, notes, and snippets.

View hi2p-perim's full-sized avatar
💭
Nothing just works

Hisanari Otsu hi2p-perim

💭
Nothing just works
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hi2p-perim
hi2p-perim / loadhdr.py
Created March 4, 2014 12:48
Load Radiance HDR file (.hdr) with python. Used : smc.freeimage, Pillow, OpenCV
import array
import smc.freeimage as fi
from PIL import Image
import numpy as np
import cv2
def gamma_correction(a, gamma):
return np.power(a, 1/gamma)
def load_hdr(file):
@hi2p-perim
hi2p-perim / dynamiccastunique.cpp
Created March 22, 2015 17:37
dynamic_cast with unique_ptr
#include <iostream>
#include <memory>
struct A
{
virtual ~A() {}
};
struct B : public A
{
@hi2p-perim
hi2p-perim / 3dmathbench.cpp
Created July 12, 2013 12:52
Simple benchmark of 3D math libraries
//
// 3D math library benchmark
// Entries
// - glm 0.9.4.4
// -- http://glm.g-truc.net/
// - Eigen 3.1.3
// -- http://eigen.tuxfamily.org
// - DirectXMath
// -- http://msdn.microsoft.com/en-us/library/ee415571(v=vs.85).aspx
// -- http://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef
@hi2p-perim
hi2p-perim / rdrandsmallpt.cpp
Last active December 29, 2023 23:39
RdRand version of smallpt (http://www.kevinbeason.com/smallpt/)
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <random>
#include <iostream>
#include <intrin.h>
#include <stdint.h>
#include <chrono>
#define M_PI 3.14159265358979323846
@hi2p-perim
hi2p-perim / ssecheck.cpp
Last active March 17, 2024 14:50
Check SSE/AVX instruction support.
/*
Check SSE/AVX support.
This application can detect the instruction support of
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX.
*/
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#endif