Skip to content

Commit a4a1196

Browse files
committed
Remove omp
1 parent dd84216 commit a4a1196

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class MainActivity : AppCompatActivity() {
9898
var allFiles = mutableListOf<String>()
9999
allFiles.addAll(allFiles2)
100100
allFiles.addAll(allFiles1)
101-
// allFiles = allFiles.filter { it.contains("test_avif.avif") }.toMutableList()
101+
allFiles = allFiles.takeLast(4).toMutableList()
102102
for (file in allFiles) {
103103
try {
104104
val buffer = this@MainActivity.assets.open(file).source().buffer()
@@ -109,9 +109,10 @@ class MainActivity : AppCompatActivity() {
109109
buffer,
110110
if (size.width > 1800 || size.height > 1800) size.width / 2 else size.width,
111111
if (size.width > 1800 || size.height > 1800) size.height / 2 else size.height,
112-
PreferredColorConfig.HARDWARE,
112+
PreferredColorConfig.RGBA_8888,
113113
ScaleMode.RESIZE
114114
)
115+
coder.encodeAvif(bitmap)
115116
lifecycleScope.launch(Dispatchers.Main) {
116117
val imageView = BindingImageViewBinding.inflate(layoutInflater, binding.scrollViewContainer, false)
117118
imageView.root.setImageBitmap(bitmap)

avif-coder/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ afterEvaluate {
4242
create<MavenPublication>("mavenJava") {
4343
groupId = "com.github.awxkee"
4444
artifactId = "avif-coder"
45-
version = "1.6.0"
45+
version = "1.6.2"
4646
from(components["release"])
4747
// artifact("androidSourcesJar")
4848
}
@@ -70,8 +70,6 @@ android {
7070
cppFlags.addAll(
7171
listOf(
7272
"-std=c++20",
73-
"-fopenmp",
74-
"-static-openmp"
7573
)
7674
)
7775
abiFilters += setOf("armeabi-v7a", "arm64-v8a", "x86_64", "x86")

avif-coder/src/main/cpp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,5 @@ include_directories(icc)
7777

7878
target_link_libraries( # Specifies the target library.
7979
coder
80-
-static-openmp
8180
${log-lib} libaom libx265 libheif cpufeatures libyuv -ljnigraphics
8281
libde265 libdav1d libsharpyuv ${android-lib})

avif-coder/src/main/cpp/imagebits/RGBAlpha.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,18 @@ namespace coder::HWY_NAMESPACE {
8181
void UnpremultiplyRGBA_HWY(const uint8_t *src, int srcStride,
8282
uint8_t *dst, int dstStride, int width,
8383
int height) {
84-
const FixedTag<uint8_t, 16> du8x16;
85-
const FixedTag<uint16_t, 8> du16x8;
86-
const FixedTag<uint8_t, 8> du8x8;
84+
#pragma omp parallel for num_threads(4) schedule(dynamic)
85+
for (int y = 0; y < height; ++y) {
8786

88-
using VU8x16 = Vec<decltype(du8x16)>;
89-
using VU16x8 = Vec<decltype(du16x8)>;
87+
const FixedTag<uint8_t, 16> du8x16;
88+
const FixedTag<uint16_t, 8> du16x8;
89+
const FixedTag<uint8_t, 8> du8x8;
9090

91-
VU16x8 mult255 = Set(du16x8, 255);
91+
using VU8x16 = Vec<decltype(du8x16)>;
92+
using VU16x8 = Vec<decltype(du16x8)>;
93+
94+
VU16x8 mult255 = Set(du16x8, 255);
9295

93-
#pragma omp parallel for num_threads(4) schedule(dynamic)
94-
for (int y = 0; y < height; ++y) {
9596
auto mSrc = reinterpret_cast<const uint8_t *>(src + y * srcStride);
9697
auto mDst = reinterpret_cast<uint8_t *>(dst + y * dstStride);
9798

@@ -191,17 +192,18 @@ namespace coder::HWY_NAMESPACE {
191192
void PremultiplyRGBA_HWY(const uint8_t *src, int srcStride,
192193
uint8_t *dst, int dstStride, int width,
193194
int height) {
194-
const FixedTag<uint8_t, 16> du8x16;
195-
const FixedTag<uint16_t, 8> du16x8;
196-
const FixedTag<uint8_t, 8> du8x8;
195+
#pragma omp parallel for num_threads(4) schedule(dynamic)
196+
for (int y = 0; y < height; ++y) {
197197

198-
using VU8x16 = Vec<decltype(du8x16)>;
199-
using VU16x8 = Vec<decltype(du16x8)>;
198+
const FixedTag<uint8_t, 16> du8x16;
199+
const FixedTag<uint16_t, 8> du16x8;
200+
const FixedTag<uint8_t, 8> du8x8;
200201

201-
VU16x8 mult255d2 = Set(du16x8, 255 / 2);
202+
using VU8x16 = Vec<decltype(du8x16)>;
203+
using VU16x8 = Vec<decltype(du16x8)>;
204+
205+
VU16x8 mult255d2 = Set(du16x8, 255 / 2);
202206

203-
#pragma omp parallel for num_threads(4) schedule(dynamic)
204-
for (int y = 0; y < height; ++y) {
205207
auto mSrc = reinterpret_cast<const uint8_t *>(src + y * srcStride);
206208
auto mDst = reinterpret_cast<uint8_t *>(dst + y * dstStride);
207209

0 commit comments

Comments
 (0)