Skip to content

Instantly share code, notes, and snippets.

View isnullxbh's full-sized avatar
:octocat:

Oleg E. Vorobiov isnullxbh

:octocat:
View GitHub Profile
@colematt
colematt / .Adding-Attributes-to-LLVM.md
Last active August 21, 2025 20:57
[Adding Attributes to LLVM] #llvm

Introduction

This post describes how to add a custom attribute to LLVM and Clang. Why would you want to do such a thing?

  • You have semantic information of which the front-end is aware, but the back-end discards in the Intermediate Representation (IR), and an existing attribute can't be used to retain this information. Adding the attribute using the front-end analysis preserves the information into the back-end generated IR.
  • You've considered using the GCC/LLVM annotate attribute to hold arbitrary strings, but you also need to add a parameter (or more!) to that annotation.

The Clang Internals Manual discusses how to do this, but not with the detail you might like to see. Its description is high-level, and only lists one file that needs to be modified. Tracking down all of the other files that must be changed is left as a frustrating exercise to the reader.

Conventions used i

Git Commands

Getting & Creating Projects

Command Description
git init Initialize a local Git repository
git clone ssh://[email protected]/[username]/[repository-name].git Create a local copy of a remote repository
@MattPD
MattPD / cpp.std.coroutines.draft.md
Last active December 16, 2025 02:40
C++ links: Coroutines (WIP draft)
@Jim-Bar
Jim-Bar / YUV_formats.md
Last active October 26, 2025 15:51
About YUV formats

About YUV formats

First of all: YUV pixel formats and Recommended 8-Bit YUV Formats for Video Rendering. Chromium's source code contains good documentation about those formats too: chromium/src/media/base/video_types.h and chromium/src/media/base/video_frame.cc (search for RequiresEvenSizeAllocation(), NumPlanes() and those kinds of functions).

YUV?

You can think of an image as a superposition of several planes (or layers in a more natural language). YUV formats have three planes: Y, U, and V.

Y is the luma plane, and can be seen as the image as grayscale. U and V are reffered to as the chroma planes, which are basically the colours. All the YUV formats have these three planes, and differ by the different orderings of them.

@xeoncross
xeoncross / sample_fmts.sh
Last active June 27, 2017 06:56
Convert a movie into a variety of sample formats (as in Planar and non-Planar "sampling" formats). Useful for testing.
ffmpeg -i MVI_2595.MOV -sample_fmt u8 mov_u8.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt s16 mov_s16.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt s32 mov_s32.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt flt mov_flt.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt dbl mov_dbl.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt u8p mov_u8p.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt s16p mov_s16p.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt s32p mov_s32p.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt fltp mov_fltp.mp4
ffmpeg -i MVI_2595.MOV -sample_fmt dblp mov_dblp.mp4
@ximeg
ximeg / ThresholdingAlgo.py
Created April 20, 2017 07:20
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
#!/usr/bin/env python
# Implementation of algorithm from http://stackoverflow.com/a/22640362/6029703
import numpy as np
import pylab
def thresholding_algo(y, lag, threshold, influence):
signals = np.zeros(len(y))
filteredY = np.array(y)
avgFilter = [0]*len(y)
stdFilter = [0]*len(y)
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
language: c++
sudo: false
# Do not build branches of the form "pr/*". By prefixing pull requests coming
# from branches inside the repository with pr/, this avoids building both the
# branch push _and_ the pull request.
@xeoncross
xeoncross / smoothing.go
Created February 9, 2017 18:37
Peak detection "Smoothed z-score algo" (in Golang) from http://stackoverflow.com/a/22640362/99923
/*
Settings (the ones below are examples: choose what is best for your data)
set lag to 5; # lag 5 for the smoothing functions
set threshold to 3.5; # 3.5 standard deviations for signal
set influence to 0.5; # between 0 and 1, where 1 is normal influence, 0.5 is half
*/
// ZScore on 16bit WAV samples
func ZScore(samples []int16, lag int, threshold float64, influence float64) (signals []int16) {
//lag := 20
@jlgerber
jlgerber / CMakeLists.txt
Last active May 21, 2024 20:28
cmake - handling executable and library with same name
# Lets say we want to add a library and an executable, both with the same name.
# In this example, it is resman
add_library(resman ${src_cpps} ${src_hpps} )
target_link_libraries(resman ${Boost_LIBRARIES} ${LIBYAML} ${LIBFMT})
#
# Add resman executable
#
# We call the executable resman-bin
add_executable(resman-bin main.cpp )
@nebgnahz
nebgnahz / gstreamer.md
Last active January 9, 2025 13:12
Collections of GStreamer usages

Most GStreamer examples found online are either for Linux or for gstreamer 0.10.

This particular release note seems to have covered important changes, such as:

  • ffmpegcolorspace => videoconvert
  • ffmpeg => libav

Applying -v will print out useful information. And most importantly the negotiation results.