Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
on going

yoh yohhoy

🐢
on going
View GitHub Profile
@yohhoy
yohhoy / yuvrgb.md
Last active Aug 14, 2020
RGB <=> YCbCr(YPbPr) color space conversion
View yuvrgb.md
Y  = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 BT.709 BT.2020
a 0.299 0.2126 0.2627
b 0.587 0.7152 0.6780
View unscoped_enum.rs
//--------------------------------------------------------
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[repr(u8)]
enum UnscopedEnum {
AAA = 1,
BBB = 2,
CCC = 3,
}
const AAA: UnscopedEnum = UnscopedEnum::AAA;
@yohhoy
yohhoy / as_num.rs
Created Jul 6, 2018
Numeric cast (as operator) in generics
View as_num.rs
trait FromU32 {
fn from_u32(v: u32) -> Self;
}
macro_rules! impl_from_u32 {
($($ty:ty)*) => {
$(
impl FromU32 for $ty {
#[inline]
fn from_u32(v: u32) -> $ty {
View so45180.py
#!/usr/bin/env python3
# https://ja.stackoverflow.com/questions/45180/
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.colors as colors
n = 10
x_list = np.array(list(range(n*2)))
t_list = np.array(list(range(n*2)))
@yohhoy
yohhoy / m2tsdump.sh
Created Jun 6, 2018
hexdump MPEG-2 TS/PAT
View m2tsdump.sh
# PAT(PID=0x0000)
xxd -s ${offset} -c 188 -ps input.ts | grep -E "^47[46]000"
@yohhoy
yohhoy / sleepsort2.cpp
Last active Aug 10, 2019
"Sleep Sort" implementation with C++ Coroutines TS
View sleepsort2.cpp
#include <condition_variable>
#include <chrono>
#include <iostream>
#include <mutex>
#include <thread>
#include <utility>
#include <vector>
#include <experimental/coroutine>
@yohhoy
yohhoy / delayqueue.cpp
Last active Aug 24, 2020
C++ delay queue - unbound blocking queue with delay of element deque (like Java's java.util.concurrent.DelayQueue)
View delayqueue.cpp
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <utility>
#include <vector>
struct closed_queue : std::exception {};
template <typename T, typename Clock = std::chrono::system_clock>
@yohhoy
yohhoy / sleepsort.cpp
Created Apr 11, 2018
"Sleep Sort" implementation with C++ Coroutines TS
View sleepsort.cpp
#include <condition_variable>
#include <chrono>
#include <iostream>
#include <mutex>
#include <thread>
#include <utility>
#include <vector>
#include <experimental/coroutine>
@yohhoy
yohhoy / jls10-var.txt
Created Apr 1, 2018
var x = new ArrayList<>();
View jls10-var.txt
>>
15.9. Class Instance Creation Expressions
A class instance creation expression is a poly expression (§15.2) if it uses the diamond form for type arguments to the class, and it appears in an assignment context or an invocation context (§5.2, §5.3). Otherwise, it is a standalone expression.
We say that a class is instantiated when an instance of the class is created by a class instance creation expression. Class instantiation involves determining the class to be instantiated (§15.9.1), the enclosing instances (if any) of the newly created instance (§15.9.2), and the constructor to be invoked to create the new instance (§15.9.3).
<<
>>
15.9.1. Determining the Class being Instantiated
@yohhoy
yohhoy / av1-codec.md
Last active Aug 14, 2019
AV1 video codec memorandum
View av1-codec.md

AV1 coding scheme

  • Arithmetic coding
    • multi-symbols (up to 16 values)
    • Coefficients coding: lv_map
    • CDF: Cumulative distribution function
      • CDF update (at the end of frame)
      • CDF update (adaptive per symbol)
  • Image blocking
You can’t perform that action at this time.