A Pen by Shanqing Cai on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install termux from f-droid | |
#copy commands or just use the command: | |
# pkg install curl -y && curl -s https://gist.githubusercontent.com/BenjaminWegener/94c3a293994b3050cff880c4f802fd62/raw/92b1c7056764af7e8548f66b4412c0615da46175/gistfile1.txt | bash | |
termux-setup-storage | |
pkg update -y | |
pkg upgrade -y | |
pkg install wget build-essential cmake git -y | |
git clone https://github.com/antimatter15/alpaca.cpp | |
cd alpaca.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LICENSE | |
// ======= | |
// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. | |
// ------- | |
// 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 furnished to do so, subject to the following conditions: | |
// ------- | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================================================================== | |
// An optimized AMD FSR's EASU implementation for Mobiles | |
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h | |
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/ | |
// Distributed under the MIT License. Copyright (c) 2021 atyuwen. | |
// -- FsrEasuSampleH should be implemented by calling shader, like following: | |
// AH3 FsrEasuSampleH(AF2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; } | |
//============================================================================================================================== | |
void FsrEasuL( | |
out AH3 pix, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sub_pixel_conv(inputs, height, width, out_channels): #keras version of 2x pixel shuffle | |
x = inputs | |
x = SeparableConv2D(out_channels * 4, kernel_size = 9, depth_multiplier = 1, activation = 'tanh', padding = 'same')(x) | |
x = Reshape((height, width, out_channels, 2, 2))(x) | |
x = Permute((3, 2, 4, 1, 5))(x) | |
x = Reshape((out_channels, height * 2, height * 2))(x) | |
x = Permute((2, 3, 1))(x) | |
return x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_gaussian_noise(image): | |
# image must be scaled in [0, 1] | |
with tf.name_scope('Add_gaussian_noise'): | |
noise = tf.random_normal(shape=tf.shape(image), mean=0.0, stddev=(50)/(255), dtype=tf.float32) | |
noise_img = image + noise | |
noise_img = tf.clip_by_value(noise_img, 0.0, 1.0) | |
return noise_img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Bitmap invert(Bitmap src) | |
{ | |
int height = src.getHeight(); | |
int width = src.getWidth(); | |
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(bitmap); | |
Paint paint = new Paint(); | |
ColorMatrix matrixGrayscale = new ColorMatrix(); |