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 | 
| # I was looking for a rate limiting library to call rate limited apis as closely | |
| # as possible to their enforced limits. I looked at the first few python libraries | |
| # that I found, and when I glanced at the source, they were all clearly broken. | |
| # Curious how this could be, I took all the top google and pip search results for: python rate limiting | |
| # and tried to get them to do the wrong thing and fail to rate limit in situations that could come up | |
| # in normal use (though in some cases very specific use) | |
| # https://github.com/tomasbasham/ratelimit | |
| # Where broken: | 
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 | 
| package jp.wasabeef.sample; | |
| import android.content.Context; | |
| import android.graphics.SurfaceTexture; | |
| import android.opengl.GLDebugHelper; | |
| import android.util.AttributeSet; | |
| import android.util.Log; | |
| import android.view.TextureView; | |
| import android.view.View; | |
| import java.io.Writer; | 
| /* | |
| Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/ | |
| USAGE: | |
| ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { | |
| @Override | |
| public void onItemClicked(RecyclerView recyclerView, int position, View v) { | |
| // do it | |
| } | |
| }); | 
| /** | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2015 Circle Internet Financial | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is | 
| from Crypto.Cipher import AES | |
| from Crypto import Random | |
| BS = 16 | |
| pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) | |
| unpad = lambda s : s[0:-ord(s[-1])] | |
| class AESCipher: | |
| def __init__( self, key ): | |
| """ | 
| 0 = Success | |
| 1 = Operation not permitted | |
| 2 = No such file or directory | |
| 3 = No such process | |
| 4 = Interrupted system call | |
| 5 = Input/output error | |
| 6 = No such device or address | |
| 7 = Argument list too long | |
| 8 = Exec format error |