Skip to content

Instantly share code, notes, and snippets.

View k-ye's full-sized avatar
😇

yekuang k-ye

😇
  • Santa Clara, CA
View GitHub Profile
@k-ye
k-ye / YUV_formats.md
Created May 23, 2022 14:11 — forked from Jim-Bar/YUV_formats.md
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.

import taichi as ti
ti.init(arch=ti.gpu) # Try to run on GPU
quality = 1 # Use a larger value for higher-res simulations
n_particles, n_grid = 9000 * quality**2, 128 * quality
dx, inv_dx = 1 / n_grid, float(n_grid)
dt = 1e-4 / quality
p_vol, p_rho = (dx * 0.5)**2, 1
p_mass = p_vol * p_rho
# C++ reference and tutorial (Chinese): https://zhuanlan.zhihu.com/p/26882619
import taichi as ti
ti.init(arch=ti.gpu)
eps = 0.01
dt = 0.005
n_vortex = 4
@k-ye
k-ye / taichi_zoo_lissajous.py
Last active August 31, 2021 01:51
A Lissajous demo, produced by the intersection of two sinusoidal curves
import taichi as ti
ti.init(ti.gpu)
A = 0.2
B = 0.3
PI = 3.141592653
TWO_PI = PI * 2
alpha = 5.0 * TWO_PI
beta = 3.0 * TWO_PI
import taichi as ti
# import math
ti.init(ti.gpu)
# global control
paused = ti.field(ti.i32, ())
# gravitational constant 6.67408e-11, using 1 for simplicity
G = 1
@k-ye
k-ye / metadata
Last active March 30, 2022 09:38
Taichi CLA
{
"name": {
"title": "Full Name",
"type": "string",
"githubKey": "name"
},
"email": {
"title": "E-Mail",
"type": "string",
"githubKey": "email"
@k-ye
k-ye / update-golang.md
Created June 22, 2019 05:57 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@k-ye
k-ye / GitHub-Forking.md
Created March 27, 2019 01:33 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j