Skip to content

Commit

Permalink
v0.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
succlz123 committed Nov 13, 2018
1 parent 6a635f5 commit f159544
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ task clean(type: Delete) {
}

ext {
burstLinkerVer = '0.0.11'
burstLinkerVer = '0.0.12'
libs = ['burstLinkerVer': "com.bilibili:$burstLinkerVer"]
}
2 changes: 1 addition & 1 deletion android/lib/src/main/cpp/BurstLinker.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void release() {
if (mNative == 0) {
return;
}
// jniRelease(mNative);
jniRelease(mNative);
mNative = 0;
}
}
2 changes: 1 addition & 1 deletion example/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void addImage(const char *fileName, uint32_t width, uint32_t height, uint32_t de
std::vector<std::vector<uint32_t >> images;
images.emplace_back(image);
images.emplace_back(image);
burstLinker.connect(images, delay, quantizerType, ditherType, transparencyOption, 0, 0);
burstLinker.connect(images, delay, quantizerType, ditherType, transparencyOption, 0, 0);
}

void
Expand Down
4 changes: 2 additions & 2 deletions src/Ditherer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace blk {
// only for bayer
int bayerScale = 1;

uint16_t width;
uint16_t width = 0;

uint16_t height;
uint16_t height = 0;

virtual ~Ditherer() = default;

Expand Down
12 changes: 4 additions & 8 deletions src/GifEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ std::vector<uint8_t> GifEncoder::addImage(const std::vector<uint32_t> &original,
bool ignoreTranslucency = (((transparencyOption >> 8) & 0xff) == 1);
bool hasTransparentColor = false;
uint8_t a = 255;
uint8_t r;
uint8_t g;
uint8_t b;
for (uint32_t i = 0; i < size; i++) {
auto color = original[i];
if (enableTransparentColor) {
Expand All @@ -138,9 +135,9 @@ std::vector<uint8_t> GifEncoder::addImage(const std::vector<uint32_t> &original,
}
}
}
b = static_cast<uint8_t>((color >> 16) & 0xff);
g = static_cast<uint8_t>((color >> 8) & 0xff);
r = static_cast<uint8_t>(color & 0xff);
auto b = static_cast<uint8_t>((color >> 16) & 0xff);
auto g = static_cast<uint8_t>((color >> 8) & 0xff);
auto r = static_cast<uint8_t>(color & 0xff);
if (a == 255 || (!ignoreTranslucency && a != 0)) {
quantizeIn.emplace_back(a, r, g, b, i);
}
Expand All @@ -150,8 +147,7 @@ std::vector<uint8_t> GifEncoder::addImage(const std::vector<uint32_t> &original,
quantizeOut.reserve(256);
int quantizeSize = 0;
if (size > 256) {
quantizeSize = colorQuantizer->quantize(quantizeIn, hasTransparentColor ? 255 : 256,
quantizeOut);
quantizeSize = colorQuantizer->quantize(quantizeIn, hasTransparentColor ? 255 : 256, quantizeOut);
} else {
quantizeSize = size;
quantizeOut.assign(quantizeIn.begin(), quantizeIn.end());
Expand Down
10 changes: 4 additions & 6 deletions src/OctreeQuantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ OctreeQuantizer::Node *OctreeQuantizer::createNode(int inLevel) {
}

bool OctreeQuantizer::addColor(Node **node, uint32_t r, uint32_t g, uint32_t b, int level) {
int index, shift;

if (*node == nullptr) {
*node = createNode(level);
}
Expand All @@ -75,10 +73,10 @@ bool OctreeQuantizer::addColor(Node **node, uint32_t r, uint32_t g, uint32_t b,
(*node)->gSum += g;
(*node)->bSum += b;
} else {
shift = 7 - level;
index = (((r & mask[level]) >> shift) << 2)
| (((g & mask[level]) >> shift) << 1)
| ((b & mask[level]) >> shift);
int shift = 7 - level;
int index = (((r & mask[level]) >> shift) << 2)
| (((g & mask[level]) >> shift) << 1)
| ((b & mask[level]) >> shift);
if (!addColor(&((*node)->child[index]), r, g, b, level + 1)) {
return false;
}
Expand Down

0 comments on commit f159544

Please sign in to comment.