float val; // input 0.0 ~ 1.0 unsigned char R, G, B; // output 0 ~ 255 R = (unsigned char)(( val > 0.5f ? 0.0f : ( val < 0.25f ? 1.0f : (2.0f - 4.0f*val)) ) * 255.0f ); G = (unsigned char)(( val < 0.25f ? 4.0f*val : ( val > 0.75f ? (4.0f - 4.0f*val) : 1.0f ) ) * 255.0f ); B = (unsigned char)(( val < 0.5f ? 0.0f : ( val > 0.75f ? 1.0f : (4.0f*val - 2.0f) )) * 255.0f );
February 6, 2018
0.0 ~ 1.0 to RGB (Red - Yellow - Green - Cyan - Blue)
June 29, 2017
Compiling RetroArch (avdmame + FBA + PSX + N64) with attract mode on Raspberry Pi 3
1. raspbian
1.1 Download raspbian jessie lite image file
1.2 diskutil list
1.3 diskutil unmountDisk /dev/disk4
1.4 sudo dd bs=1m if=raspbian-jessie.img of=/dev/rdisk4
https://www.raspberrypi.org/downloads/raspbian/
https://www.raspberrypi.org/documentation/installation/installing-images/mac.md
2. setup
id: pi pw: raspberry2.1 [option] set static ip 2.1.1 sudo vi /etc/network/interfaces
#auto lo #iface lo inet loopback #iface eth0 inet manual auto eth0 iface eth0 inet static address IP netmask MASK gateway GATEWAY dns-nameservers DNS2.1.2 sudo /etc/init.d/networking restart 2.2 [option] wifi setup 2.3 config 2.3.1 sudo raspi-config
1 Change User Password 4 Localization Options -> I3 Change Keyboard Layout -> Generic 101-key PC -> Other -> English (US) 5 Interfacing Options -> P2 SSH 7 Advanced Options -> A1 Expand Filesystem 7 Advanced Options -> A3 Memory Split -> 128 7 Advanced Options -> A4 Audio -> Force HDMI2.4 hdmi force output 2.4.1 sudo vi /boot/config.txt
hdmi_force_hotplug=12.5 update 2.5.1 sudo apt-get update 2.5.2 sudo apt-get dist-upgrade 2.6 prepare 2.6.2 cd ~ 2.6.2 mkdir build http://elinux.org/Configuring_a_Static_IP_address_on_your_Raspberry_Pi https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md 3. avdmame 3.1 cd ~/build 3.2 sudo apt-get install git autoconf automake libasound2-dev libfreetype6-dev zlib1g-dev libexpat1-dev libslang2-dev libncurses5-dev 3.3 git clone https://github.com/amadvance/advancemame.git 3.4 cd advancemame 3.5 sh autogen.sh 3.6 ./configure 3.7 make -j4 3.8 sudo make install http://www.advancemame.it/doc-build 4. sfml 4.1 cd ~/build 4.2 sudo apt-get install cmake libflac-dev libogg-dev libvorbis-dev libopenal-dev libjpeg8-dev libfreetype6-dev libudev-dev libraspberrypi-dev 4.3 git clone --depth 1 https://github.com/mickelson/sfml-pi.git 4.4 cd sfml-pi 4.5 mkdir build 4.6 cd build 4.7 cmake .. -DSFML_RPI=1 -DEGL_INCLUDE_DIR=/opt/vc/include -DEGL_LIBRARY=/opt/vc/lib/libEGL.so -DGLES_INCLUDE_DIR=/opt/vc/include -DGLES_LIBRARY=/opt/vc/lib/libGLESv1_CM.so 4.8 sudo make install 4.9 sudo ldconfig https://github.com/mickelson/sfml-pi 5. ffmpeg 5.1 cd ~/build 5.2 sudo apt-get install libomxil-bellagio-dev libmp3lame-dev 5.3 git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git 5.4 cd ffmpeg 5.5 ./configure --arch=armhf --target-os=linux --enable-gpl --enable-mmal --enable-omx --enable-omx-rpi --enable-nonfree --enable-libfreetype --extra-libs=-lasound --enable-libmp3lame --disable-debug --enable-shared 5.6 make -j4 5.7 sudo make install 5.8 sudo ldconfig https://github.com/FFmpeg/FFmpeg https://trac.ffmpeg.org/wiki/CompilationGuide/RaspberryPi 6. retroarch 6.1 sudo vi /usr/local/lib/pkgconfig/bcm_host.pc
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: bcm_host
Description: Broadcom VideoCore host API library
Version: 1
Libs: -L${libdir} -lbcm_host -lvcos -lvchiq_arm -pthread
Cflags: -I${includedir} -I${includedir}/interface/vmcs_host/linux -I${includedir}/interface/vcos/pthreads -DUSE_VCHIQ_ARM
6.2 sudo vi /usr/local/lib/pkgconfig/egl.pc
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: EGL
Description: Fake EGL package for RPi
Version: 10
Requires: bcm_host
Libs: -L${libdir} -lEGL -lGLESv2 -lbcm_host -lvchostif
Cflags: -I${includedir} -I${includedir}/interface/vmcs_host/linux -I${includedir}/interface/vcos/pthreads
6.3 sudo vi /usr/local/lib/pkgconfig/glesv2.pc
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: GLESv2
Description: Fake GL ES 2 package for RPi
Version: 10
Requires: bcm_host
Libs: -L${libdir} -lGLESv2
Cflags: -I${includedir}
6.4 cd ~/build
6.5 sudo apt-get install libusb-1.0-0-dev libavresample-dev libdrm-dev libgbm-dev libxml2-dev libv4l-dev libxkbcommon-dev libdbus-1-dev
6.6 git clone --depth 1 https://github.com/libretro/RetroArch.git
6.7 cd RetroArch
6.8 ./configure --enable-neon --enable-floathard --enable-alsa --enable-udev --enable-opengl --enable-opengles --enable-egl --enable-fbo --enable-dispmanx --enable-ffmpeg --disable-sdl --disable-sdl2 --disable-opengles3 --disable-vg --disable-cg --disable-x11 --disable-wayland --disable-pulse
6.9 vi qb/config.libs.sh
line 47 HAVE_OPENGLES='auto' -> HAVE_OPENGLES='yes'6.10 vi config.mk
CFLAGS = -mfpu=neon-fp-armv8 -mfloat-abi=hard -march=armv8-a+crc -mtune=cortex-a53 ASFLAGS = -mfpu=neon-fp-armv8 -mfloat-abi=hard -march=armv8-a+crc -mtune=cortex-a536.11 make -j4 6.12 launch and quit retroarch once 6.13 cd /home/pi/.config/retroarch 6.14 rm -rd assets 6.15 wget https://github.com/libretro/retroarch-assets/archive/master.zip 6.16 unzip master.zip 6.17 mv ./retroarch-assets-master/ ./assets/ 6.18 rm ./master.zip https://github.com/libretro/RetroArch https://www.raspberrypi.org/forums/viewtopic.php?t=56070 http://alexmax2742.blogspot.kr/2016/07/retroarch-on-raspberry-pi.html https://github.com/raspberrypi/userland/issues/245 7. fb alpha 7.1 cd ~/build 7.2 git clone https://github.com/libretro/fbalpha.git 7.3 cd fbalpha 7.4 make -j4 -f makefile.libretro platform=rpi3 https://github.com/libretro/fbalpha 8. PSX 8.1 cd ~/build 8.2 git clone https://github.com/libretro/pcsx_rearmed.git 8.3 cd pcsx_rearmed 8.4 make -j4 -f Makefile.libretro platform=rpi3 https://github.com/libretro/pcsx_rearmed 9. N64 9.1 cd ~/build 9.2 git clone --depth=1 https://github.com/libretro/mupen64plus-libretro.git 9.3 cd mupen64plus-libretro 9.4 platform=rpi3 make -j4 https://github.com/libretro/mupen64plus-libretro 10. attract 10.1 cd ~/build 10.2 git clone --depth 1 https://github.com/mickelson/attract.git 10.3 cd attract 10.4 make -j4 USE_GLES=1 10.5 sudo make install
Configure-->General-->Window Mode = FullScreen Mode Configure-->General-->Video Decoder = mmalhttps://github.com/mickelson/attract/wiki/Compiling-on-the-Raspberry-Pi-%28Raspbian-Jessie%29 11. [option] bluetooth 11.1 sudo bluetoothctl 11.2 agent on 11.3 default-agent 11.4 scan on 11.5 pair xx:xx 11.6 trust xx:xx 11.7 connect xx:xx https://www.cnet.com/how-to/how-to-setup-bluetooth-on-a-raspberry-pi-3/ 12. [option] GPIO https://github.com/recalbox/mk_arcade_joystick_rpi
February 3, 2017
Installing Emby server on the raspberry pi 3 with ffmpeg
Refs:
https://emby.media/community/index.php?/topic/43166-arm-devices-official-instructions/
http://hannes.enjoys.it/blog/2016/03/ffmpeg-on-raspbian-raspberry-pi/
https://akosresch.wordpress.com/2016/05/11/installing-emby-server-on-raspberry-pi-3/
https://github.com/FFmpeg/FFmpeg
https://trac.ffmpeg.org/wiki/CompilationGuide/RaspberryPi
1. Emby server
1.1 wget -qO - http://download.opensuse.org/repositories/home:emby/xUbuntu_14.04/Release.key | sudo apt-key add -
1.2 sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/emby/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/emby-server.list"
1.3 sudo apt-get update
1.4 sudo apt-get install emby-server
2. ffmpeg
2.1 sudo apt-get install git libasound2-dev libfreetype6-dev libomxil-bellagio-dev libmp3lame-dev
2.2 git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
2.3 cd ffmpeg
2.4 ./configure --arch=armhf --target-os=linux --enable-gpl --enable-mmal --enable-omx --enable-omx-rpi --enable-nonfree --enable-libfreetype --extra-libs=-lasound --enable-libmp3lame --disable-debug --enable-shared
2.5 make -j4
2.6 sudo make install
2.7 sudo ldconfig
3. Setting and running Emby server
3.1 sudo vi /usr/bin/emby-server
3.2 Change
FFMPEG_BIN=$(command -v ffmpeg) FFPROBE_BIN=$(command -v ffprobe)to
FFMPEG_BIN=/usr/local/bin/ffmpeg FFPROBE_BIN=/usr/local/bin/ffprobe3.3 sudo service emby-server start 3.4 http://localhost:8096 on the web browser
January 25, 2017
Build Caffe on OS X using MacPorts and Anaconda
URLs:
Caffe MacPorts Anaconda 1. MacPorts 1.1 Install MacPorts 1.2 Open Terminal 1.3 sudo port selfupdate 1.4 sudo port upgrade outdated 1.5 sudo port install gflags 1.6 sudo port install google-glog 1.8 sudo port install leveldb 1.7 sudo port install opencv +python27 2. Anaconda 2.1 Install Anaconda 2.2 Open Terminal 2.3 sudo conda update conda 2.4 sudo conda install -c conda-forge boost=1.63.0 2.5 sudo conda install -c conda-forge openblas=0.2.19 2.6 sudo conda install -c conda-forge protobuf=3.0.0 2.7 sudo conda install -c conda-forge hdf5=1.8.17 2.8 sudo conda install -c conda-forge lmdb=0.9.18 2.9 sudo conda install -c conda-forge snappy=1.1.3 2.10 sudo conda install -c conda-forge numpy=1.11.3 2.11 sudo conda install -c conda-forge python-leveldb=0.193 3. Caffe 3.1 Download Caffe source code 3.2 Extract zip file and move to Caffe folder 3.3 Open Terminal 3.4 cp Makefile.config.example Makefile.config 3.5 Modify Makefile.config file
Caffe MacPorts Anaconda 1. MacPorts 1.1 Install MacPorts 1.2 Open Terminal 1.3 sudo port selfupdate 1.4 sudo port upgrade outdated 1.5 sudo port install gflags 1.6 sudo port install google-glog 1.8 sudo port install leveldb 1.7 sudo port install opencv +python27 2. Anaconda 2.1 Install Anaconda 2.2 Open Terminal 2.3 sudo conda update conda 2.4 sudo conda install -c conda-forge boost=1.63.0 2.5 sudo conda install -c conda-forge openblas=0.2.19 2.6 sudo conda install -c conda-forge protobuf=3.0.0 2.7 sudo conda install -c conda-forge hdf5=1.8.17 2.8 sudo conda install -c conda-forge lmdb=0.9.18 2.9 sudo conda install -c conda-forge snappy=1.1.3 2.10 sudo conda install -c conda-forge numpy=1.11.3 2.11 sudo conda install -c conda-forge python-leveldb=0.193 3. Caffe 3.1 Download Caffe source code 3.2 Extract zip file and move to Caffe folder 3.3 Open Terminal 3.4 cp Makefile.config.example Makefile.config 3.5 Modify Makefile.config file
# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1
# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3
# BLAS choice:
BLAS := open
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := /Users/maninara/anaconda2
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python2.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := $(ANACONDA_HOME)/lib
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /opt/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /opt/local/lib
# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
# enable pretty build (comment to see full commands)
Q ?= @
3.6 sudo make all
3.7 sudo make pycaffe
July 21, 2016
Pokemon Go Individual Value Calculator (Last updated Feb 28 2019)
https://www.reddit.com/r/TheSilphRoad/comments/4tbp3r/find_your_hidden_iv_scores_determine_which_ones/
https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_National_Pok%C3%A9dex_number
Subscribe to:
Posts (Atom)