• Stars
    star
    131
  • Rank 265,882 (Top 6 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚀 A simple GIF encoder for Android.

BurstLinker

Download

Idea from: square/gifencoder

BurstLinker is a simple C++ GIF encode library.

Download

Android

Gradle:

implementation 'com.bilibili:burst-linker:latest-version'

Build Environment

Android Studio 3.4.1

NDK r20

Basic usage

int delayMs = 1000;
String filePath = getCacheDir() + File.separator + "out.gif";
BurstLinker burstLinker = new BurstLinker();

try {
    burstLinker.init(width, height, filePath);
    Bitmap colorBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(colorBitmap);
    Paint p = new Paint();
    int[] colors = new int[]{0xFFF00000, 0xFFFFFF00, 0xFFFFFFFF};
    for (int color : colors) {
        p.setColor(color);
        canvas.drawRect(0, 0, width, height, p);
        burstLinker.connect(colorBitmap, BurstLinker.OCTREE_QUANTIZER, 
                BurstLinker.NO_DITHER, 0, 0, delayMs);
    }
} catch (GifEncodeException e) {
    e.printStackTrace();
} finally {
    burstLinker.release();
}

Enable RenderScript Support

This is an untested feature.

  1. Choose the Git branch "/feature/render-script".
  2. Sync Project with Gradle Files, It will generate the required file named "ScriptC_*.cpp".
  3. Uncomment the line 64 of the "/lib/CMakeLists.txt".
  4. Try this function.

Linux & Mac

  1. Install CMake

    • Mac brew install cmake
    • ArchLinux sudo pacman -S cmake
  2. Build

    • cd /BurstLinker
    • mkdir cmake-build-debug; cd cmake-build-debug
    • cmake ..
    • make BurstLinker
  3. Run

    • ./BurstLinker 1000 1.jpg 2.jpg 3.jpg
    • See the "out.gif"

Windows

  1. Install Microsoft Visual Studio & CMake

  2. Build

    • cd /BurstLinker
    • mkdir cmake-build-debug; cd cmake-build-debug
    • cmake ..
    • Open the "BurstLinker.sln"
    • Solution Explorer -> BurstLinker -> Build
  3. Run

    • cd Debug
    • BurstLinker.exe 1000 1.jpg 2.jpg 3.jpg
    • See the "out.gif"

Samples

Different quantizers & ditherers

  • Original

original

  • Uniform + No

uniform

  • MedianCut + No

media-cut

  • KMeans + No

k-means

  • Random + No

random

  • Octree + No

octree

  • NeuQuant - 10 + No

neu-quant-10

  • NeuQuant - 1 + No

neu-quant-1

  • Octree + M2

uniform

  • Octree + Bayer

octree-bayer

  • Octree + FloydSteinberg

octree-floyd-steinberg

Encodes images with transparent channels

  • Original

bilibili

  • Octree + No + Default

    Display all Alpha channels greater than 0. (ARGB.a != 0)

bilibili-octree

  • Octree + No + Ignored translucency

    Display only the Alpha channels equal to 255. (ARGB.a == 255)

bilibili-octree

Thanks

square/gifencoder

waynejo/android-ndk-gif

lucent1090/MCCQ

luxiaoxun/KMeans-GMM-HMM

SimonBoorer/Quantize

dali-neuquant

FFmpeg/FFmpeg

progschj/ThreadPool

License

Copyright 2018 Bilibili

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
C
32,047
star
2

flv.js

HTML5 FLV Player
JavaScript
22,695
star
3

DanmakuFlameMaster

Android开源弹幕引擎·烈焰弹幕使 ~
Java
9,490
star
4

ailab

Python
5,450
star
5

MagicaSakura

MagicaSakura 是 Android 多主题框架。~ is an Android multi theme library which supporting both daily colorful theme and night theme.
Java
3,544
star
6

boxing

Android multi-media selector based on MVP mode.
Java
3,193
star
7

overlord

Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。
Go
2,187
star
8

gengine

Go
1,867
star
9

discovery

A registry for resilient mid-tier load balancing and failover.
Go
1,764
star
10

vim-vide

Lightest vimrc, while strong enough. 最轻的vim配置,却足够强!
Vim Script
781
star
11

drawee-text-view

Simple drawee spannable text view based on Fresco
Java
764
star
12

join-us

大B站需要更多的小伙伴~ ( ゜- ゜)つロ 乾杯~
702
star
13

LastOrder-Dota2

Dota2 AI bot
Python
399
star
14

NativeBitmapFactory

DFM jni
C++
320
star
15

jni4android

JNI Generater for Android
C
305
star
16

BRouter

Kotlin
301
star
17

biliobs

C++
240
star
18

quiche

C++
191
star
19

UnityBVA

C#
189
star
20

kratos-demo

a project that use kratos
Go
188
star
21

bas

Bilibili Animation Script
HTML
187
star
22

apk-channelization

[不支持v2签名]Android多渠道输出脚本
Python
147
star
23

libyuv

mirror of https://chromium.googlesource.com/external/libyuv/
C++
147
star
24

xpref

A SharedPreferences' wrapper that truly supported sharing data across multi-process
Kotlin
85
star
25

soundtouch

SoundTouch library compiled for ijkplayer/Android http://www.surina.net/soundtouch/sourcecode.html
C++
80
star
26

mahimahi

C++
76
star
27

muzei-bilibili

Muzei 插件,bilibili 壁纸源
Java
71
star
28

vlc-android-macbuild

Deprecated, official site is recommended http://git.videolan.org
Java
70
star
29

LastOrder

StarCraft AI bot
C++
61
star
30

vlc-ports-android

fork of git://git.videolan.org/vlc-ports/android.git
C++
56
star
31

bbip

Bilibili High Performance IP Resolve Library
C++
55
star
32

oresty

Lua
52
star
33

SMGo

Shang-Mi cipher library. Constant-time implementation of SM2 and SM4.
Go
40
star
34

bilibili.github.io

35
star
35

adaptation

too painful to work with PagerAdapter
Java
32
star
36

vlc

fork of git://git.videolan.org/vlc.git
C
30
star
37

openssl

mirror of https://www.openssl.org
C
29
star
38

twirp

twirp rpc
Go
26
star
39

ci-ijk-ffmpeg-ios

Prebuilt FFmpeg for ijkplayer on iOS
Shell
18
star
40

abtest

A layered experiment framework for C++/java/go
15
star
41

flvbind

A tools to combine multiple flv file to a single flv file.
C
13
star
42

uptool

JavaScript
12
star
43

gas-preprocessor

personal fork of git://git.libav.org/gas-preprocessor.git
Perl
12
star
44

nginx_quic_module

C
12
star
45

jmp_logpipe

A tool for jumper analyize log and send the command to remove UDP server for aduit. And this tool will denied for lszrz protocol to prevent a large log for storage.
C
10
star
46

nginx_quic_stack

C++
10
star
47

ci-ijk-ffmpeg-android

Continuous integration for ijkplayer on Android
8
star
48

vim

B站Vim会所
6
star
49

arrange-play

Java
5
star
50

bilibili_wtm

Python
1
star