Skip to content

Instantly share code, notes, and snippets.

View matt-42's full-sized avatar

Matthieu Garrigues matt-42

View GitHub Profile
@matt-42
matt-42 / iod_option_parser.cc
Last active September 9, 2016 10:56
Prototype of the iod option parser
#include "iod/parse_options.hh"
#include "symbols.hh"
using namespace s;
int main(int argc, char* argv[])
{
auto options = iod::parse_options(argc, argv,
_size | _s = int(20),
@matt-42
matt-42 / file_recusion.sh
Created September 14, 2016 14:46
Recursively traverse a filesystem
#! /bin/sh
rec() {
for f in `ls $2`; do
echo $1 $f
if [ -d "$2/$f" ]; then
rec $1-- "$2/$f"
fi
@matt-42
matt-42 / aos_view_trailer.cc
Last active November 15, 2016 21:16
iod::aos_view
#include <iostream>
#include <iod/aos_view.hh>
#include "symbols.hh"
#include <cassert>
// aos_view allows to view several arrays as a unique array of structures.
// Any class with a size() method and operator[](int i) is supported.
// The view only hold references to the arrays so no deep array copy is involved.
@matt-42
matt-42 / array_view.cc
Created November 15, 2016 21:24
iod::array_view
#include <iostream>
#include <iod/array_view.hh>
#include "symbols.hh"
#include <cassert>
int main()
{
using namespace iod;
using namespace s;
@matt-42
matt-42 / cvmat_bench.cc
Last active April 14, 2019 15:17
cvmat_bench
#include <opencv2/opencv.hpp>
#include <chrono>
class timer
{
public:
void start() { start_ = std::chrono::high_resolution_clock::now(); }
void end() { end_ = std::chrono::high_resolution_clock::now(); }
@matt-42
matt-42 / android_openmp_bench.cpp
Created June 24, 2016 07:03
Minimal Android OpenMP Benchmark
// Results one OnePlus two (snapdragon 810 - 8 cores ARMv8):
// with optimization -fopenmp -Ofast -mcpu=cortex-a57.cortex-a53
// Serial time: 19.480000 ms
// OpenMP time: 10.000000 ms
{
const int S = 10e6;
auto A = new int[S];
auto B = new int[S];
@matt-42
matt-42 / kitti_pyrlk_opencv.cc
Last active July 26, 2022 13:28
Kitti optical flow 2012 : calcOpticalFlowPyrLK
std::vector<cv::Point2f> pts;
std::vector<cv::Point2f> next_pts;
std::vector<unsigned char> status;
cv::Mat err;
int winsize = 11;
int nscales = 4;
for (auto p : i1_gl.domain())
pts.push_back(cv::Point2f(p[1], p[0]));
calcOpticalFlowPyrLK(to_opencv(i1_gl), to_opencv(i2_gl), pts, next_pts, status, err,
@matt-42
matt-42 / split.cpp
Created July 9, 2020 23:02
C++ split implementation
#include <string_view>
#include <iostream>
#include <cstring>
#include <vector>
std::vector<std::string> split(const std::string& str, char split_char) {
const char* cur = str.c_str();