Skip to content

Commit afc276b

Browse files
committed
prepare to release
1 parent 1236a75 commit afc276b

File tree

7 files changed

+509
-20
lines changed

7 files changed

+509
-20
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Extremly fast in decoding large HDR images or just large images.
99
The most featured AVIF, HEIF library in android.
1010
Supported decoding in all necessary pixel formats in Android and avoids android decoding bugs.
1111

12-
Image processing speeded up by [libhwy](https://github.com/google/highway)
13-
1412
# Usage example
1513

1614
```kotlin

app/src/main/java/com/radzivon/bartoshyk/avif/MainActivity.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class MainActivity : AppCompatActivity() {
121121
var allFiles = mutableListOf<String>()
122122
allFiles.addAll(allFiles2)
123123
allFiles.addAll(allFiles1)
124-
allFiles = allFiles.filter { it.contains("bt_2020_pq.avif") }.toMutableList()
124+
allFiles = allFiles.filter { it.contains("test_4.avif") }.toMutableList()
125125
// allFiles = allFiles.filter { it.contains("bbb_alpha_inverted.avif") }.toMutableList()
126126
for (file in allFiles) {
127127
try {
@@ -143,10 +143,10 @@ class MainActivity : AppCompatActivity() {
143143

144144
var bitmap0 = coder.decodeSampled(
145145
byteArray = buffer,
146-
scaledWidth = size.width,
147-
scaledHeight = size.height,
146+
scaledWidth = size.width / 3,
147+
scaledHeight = size.height / 3,
148148
preferredColorConfig = PreferredColorConfig.RGBA_8888,
149-
scaleMode = ScaleMode.FILL,
149+
scaleMode = ScaleMode.FIT,
150150
scaleQuality = ScalingQuality.HIGH,
151151
)
152152

@@ -158,7 +158,7 @@ class MainActivity : AppCompatActivity() {
158158

159159
Log.i("AVIFFFF", "Starts encoding")
160160

161-
val encode = coder.encodeAvif(bitmap = bitmap0, quality = 55, avifChromaSubsampling = AvifChromaSubsampling.YUV420)
161+
val encode = coder.encodeAvif(bitmap = bitmap0, quality = 55, avifChromaSubsampling = AvifChromaSubsampling.YUV400)
162162

163163
Log.i("AVIFFFF", "Encoding time ${System.currentTimeMillis() - start}, encoded size ${encode.size}")
164164

avif-coder/src/main/cpp/YuvConversion.cpp

+4-13
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void RgbaToYuv420(const uint8_t *sourceRgba, uint32_t sourceStride,
267267
int16x8_t vCrB = vdupq_n_s16(static_cast<int16_t>(CrB));
268268
int32x4_t v_zeros = vdupq_n_s32(0);
269269

270-
for (; x < width; x += 16) {
270+
for (; x + 16 < width; x += 16) {
271271
uint8x16x4_t pixel = vld4q_u8(mSrc);
272272

273273
int16x8_t r_high = vreinterpretq_s16_u16(vmovl_high_u8(pixel.val[0]));
@@ -550,7 +550,7 @@ void RgbaToYuv422(const uint8_t *sourceRgba, uint32_t sourceStride,
550550
int16x8_t vCrB = vdupq_n_s16(static_cast<int16_t>(CrB));
551551
int32x4_t v_zeros = vdupq_n_s32(0);
552552

553-
for (; x < width; x += 16) {
553+
for (; x + 16 < width; x += 16) {
554554
uint8x16x4_t pixel = vld4q_u8(mSrc);
555555

556556
int16x8_t r_high = vreinterpretq_s16_u16(vmovl_high_u8(pixel.val[0]));
@@ -826,7 +826,7 @@ void RgbaToYuv444(const uint8_t *sourceRgba, uint32_t sourceStride,
826826
int16x8_t vCrB = vdupq_n_s16(static_cast<int16_t>(CrB));
827827
int32x4_t v_zeros = vdupq_n_s32(0);
828828

829-
for (; x < width; x += 16) {
829+
for (; x + 16 < width; x += 16) {
830830
uint8x16x4_t pixel = vld4q_u8(mSrc);
831831

832832
int16x8_t r_high = vreinterpretq_s16_u16(vmovl_high_u8(pixel.val[0]));
@@ -1043,13 +1043,11 @@ void RgbaToYuv400(const uint8_t *sourceRgba, uint32_t sourceStride,
10431043

10441044
const auto scale = static_cast<float>( 1 << precision );
10451045
const auto iBiasY = static_cast<uint16_t>((static_cast<float>(biasY) + 0.5f) * scale);
1046-
const auto iBiasUV = static_cast<uint16_t>((static_cast<float>(biasUV) + 0.5f) * scale);
10471046

10481047
auto yStore = reinterpret_cast<uint8_t *>(yPlane);
10491048

10501049
auto mSource = reinterpret_cast<const uint8_t *>(sourceRgba);
10511050

1052-
int maxChroma = biasY + rangeUV;
10531051
int maxLuma = biasY + rangeY;
10541052

10551053
for (uint32_t y = 0; y < height; ++y) {
@@ -1066,19 +1064,12 @@ void RgbaToYuv400(const uint8_t *sourceRgba, uint32_t sourceStride,
10661064
int16x8_t i_cap_uv = vdupq_n_u16(static_cast<int16_t>(biasY + rangeUV));
10671065

10681066
int16x8_t y_bias = vdupq_n_s32(iBiasY);
1069-
int16x8_t uv_bias = vdupq_n_s32(iBiasUV);
10701067
int16x8_t vYr = vdupq_n_s16(static_cast<int16_t>(YR));
10711068
int16x8_t vYg = vdupq_n_s16(static_cast<int16_t>(YG));
10721069
int16x8_t vYb = vdupq_n_s16(static_cast<int16_t>(YB));
1073-
int16x8_t vCbR = vdupq_n_s16(static_cast<int16_t>(CbR));
1074-
int16x8_t vCbG = vdupq_n_s16(static_cast<int16_t>(CbG));
1075-
int16x8_t vCbB = vdupq_n_s16(static_cast<int16_t>(CbB));
1076-
int16x8_t vCrR = vdupq_n_s16(static_cast<int16_t>(CrR));
1077-
int16x8_t vCrG = vdupq_n_s16(static_cast<int16_t>(CrG));
1078-
int16x8_t vCrB = vdupq_n_s16(static_cast<int16_t>(CrB));
10791070
int32x4_t v_zeros = vdupq_n_s32(0);
10801071

1081-
for (; x < width; x += 16) {
1072+
for (; x + 16 < width; x += 16) {
10821073
uint8x16x4_t pixel = vld4q_u8(mSrc);
10831074

10841075
int16x8_t r_high = vreinterpretq_s16_u16(vmovl_high_u8(pixel.val[0]));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* H.265 video codec.
3+
* Copyright (c) 2013-2014 struktur AG, Dirk Farin <[email protected]>
4+
*
5+
* This file is part of libde265.
6+
*
7+
* libde265 is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as
9+
* published by the Free Software Foundation, either version 3 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* libde265 is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with libde265. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
/* de265-version.h
22+
*
23+
* This file was generated by autoconf when libde265 was built.
24+
*
25+
* DO NOT EDIT THIS FILE.
26+
*/
27+
#ifndef LIBDE265_VERSION_H
28+
#define LIBDE265_VERSION_H
29+
30+
/* Numeric representation of the version */
31+
#define LIBDE265_NUMERIC_VERSION 0x01001500
32+
33+
/* Version string */
34+
#define LIBDE265_VERSION "1.0.15"
35+
36+
#endif

0 commit comments

Comments
 (0)