Skip to content

Commit

Permalink
Add Pixly image
Browse files Browse the repository at this point in the history
  • Loading branch information
etemesi254 committed Jan 15, 2024
1 parent 8d4ccde commit 00ffa44
Show file tree
Hide file tree
Showing 11 changed files with 494 additions and 0 deletions.
122 changes: 122 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
GIT
remote: https://github.com/eventmachine/eventmachine.git
revision: 9cb13a8a62363df5ebcc414169a3deb2c1608528
tag: v1.2.7
specs:
eventmachine (1.2.7)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.2.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
forwardable-extended (2.6.0)
google-protobuf (3.25.1-x86_64-linux)
html-proofer (3.19.4)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogiri (~> 1.13)
parallel (~> 1.10)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.8.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (4.3.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-archives (2.2.1)
jekyll (>= 3.6, < 5.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-theme-chirpy (5.6.1)
jekyll (~> 4.3)
jekyll-archives (~> 2.2)
jekyll-paginate (~> 1.1)
jekyll-redirect-from (~> 0.16)
jekyll-seo-tag (~> 2.7)
jekyll-sitemap (~> 1.4)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
parallel (1.24.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.4)
racc (1.7.3)
rainbow (3.1.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.2.0)
safe_yaml (1.0.5)
sass-embedded (1.69.5-x86_64-linux-gnu)
google-protobuf (~> 3.23)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thread_safe (0.3.6)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (1.2.11)
thread_safe (~> 0.1)
tzinfo-data (1.2023.4)
tzinfo (>= 1.0.0)
unicode-display_width (2.5.0)
wdm (0.1.1)
webrick (1.8.1)
yell (2.2.2)

PLATFORMS
x86_64-linux

DEPENDENCIES
eventmachine (= 1.2.7)!
html-proofer (~> 3.18)
jekyll-theme-chirpy (~> 5.2, >= 5.2.1)
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
webrick (~> 1.7)

BUNDLED WITH
2.4.22
20 changes: 20 additions & 0 deletions _drafts/Memory-Optimizations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: post
title: On the underlooked perfomance of less memory allocations
categories: performance
tags: performance, C, Rust
---

In the world of perfomance optimizations, one of the most underlooked optimizations techniques is using less memory, we quickly


## CASE 1: STB JPEG

stb image is a really great library used by a lot of developers when you want a simple image loader as a header file.

It contains some really nice image decoders with some exceptional perfomance for its size, but do note that the library doesn't aim to be 100% performance oriented, this is just something I came by


The library can decode jpeg, and jpegs come in all flavours, a certain number of them require what is commonly known as [chroma-sub-sampling](https://en.wikipedia.org/wiki/Chroma_subsampling), the technique is that you downsample on encoding the image to either half or a quarter of its size and the decoder up-samples it back to original, think of it as a half/quarter resize. You definitely loose quality but it saves big on size since you encode way less pixels.

Now decoding the pixels back usually sucks
Binary file not shown.
Binary file not shown.
58 changes: 58 additions & 0 deletions _manim/pixly_image/overall_architecture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

from manim import *

class OverallArchitecture(Scene):
def construct(self):
windows = create_box(Text("zune-image",font_size=15),
Text("x86-64 Windows",font_size=12))


linux = create_box(Text("zune-image",font_size=15),Text("x86-64 Linux",font_size=12))



stacked_backends = VGroup(windows,linux).set_x(0).set_y(0).arrange(DOWN,0.5)


jni = create_box(Text("JNI layer",font_size=13),Text("Kotlin",font_size=12))

jni_combined = VGroup(stacked_backends,jni).set_x(0).set_y(0).arrange(RIGHT,2.0);


interface = create_box(Text("ZilImageInterface",font_size=13),Text("Image interface",font_size=13))

interface_combined = VGroup(jni_combined,interface).set_x(0).set_y(0).arrange(RIGHT,2.0)


android = create_box(Text("ZilAndroidBitmap",font_size=15),
Text("Android",font_size=12))

desktop = create_box(Text("ZilBitmap",font_size=15),Text("Desktop",font_size=12))

stacked_frontends = VGroup(android,desktop).set_x(0).set_y(0).arrange(DOWN,0.5)

final_combined = VGroup(interface_combined,stacked_frontends).set_x(0).set_y(0).arrange(RIGHT,2.0)




a1 = Arrow(start=windows.get_corner(RIGHT),end=jni.get_corner(LEFT))
a2 = Arrow(start=linux.get_corner(RIGHT),end=jni.get_corner(LEFT))
a3 = Arrow(start=jni.get_corner(RIGHT),end = interface.get_corner(LEFT))
a4 = Arrow(interface.get_corner(RIGHT),android.get_corner(LEFT))
a5 = Arrow(interface.get_corner(RIGHT),desktop.get_corner(LEFT))



self.add(final_combined)
self.add(a1,a2,a3,a4,a5)


pass

def create_box(*args:Any):
sq = Square(side_length=1.8)
text = VGroup(*args).set_x(0).arrange(DOWN,0.3)
sq.add(text)
return sq

45 changes: 45 additions & 0 deletions _manim/pixly_image/zune_image_to_kotlin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

from manim import *

class ZuneImageToKotlin(Scene):
def construct(self):


m0 = Matrix([[0,1],[2,3]],h_buff=1.0)
m1 = Matrix([[4,5],[6,7]],h_buff=1.0)
m2 = Matrix([[8,9],[10,11]],h_buff=1.0)
m3 = Matrix([[255,255],[255,255]],h_buff=1.0)
# Change colors
m0.color = RED
m1.color= GREEN
m2.color= BLUE
# # Add texts
# t1 = Text("Red Channel")
# t2 = Text("Green Channel")
# t3 = Text("Blue Channel")
# t4 = Text("Alpha Channel")
# y = VGroup(t1,t2,t3,t4).set_x(-10).arrange(buff=1.0)
# self.add(y)
x = VGroup(m0, m1, m2, m3).set_x(0).arrange(buff=1.0)

combined = Matrix([[255, 0,4,8, 255, 2, 6, 10],
[255, 1,5,9, 255, 3, 7, 11]])
#combined.color()

# manually add colors
ent = combined.get_entries()
colors = [WHITE,RED,GREEN,BLUE]
for k in range(len(ent)):
ent[k].set_color(colors[k % 4])
self.add(m0)
# self.color(3,6,combined,RED);
# self.color(9,12,combined,RED);
# self.color(15,18,combined,RED);


self.play(Create(x)) # animate the creation of the first matrix
self.wait()
self.play(Transform(x, combined)) # interpolate transposition
self.wait()
self.play(FadeOut(combined))
#self.add(m1)
Loading

0 comments on commit 00ffa44

Please sign in to comment.