mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-15 12:15:22 +03:00
133 lines
4.3 KiB
Diff
133 lines
4.3 KiB
Diff
Patch-Source: https://github.com/xen0n/loongson-overlay/blob/master/www-client/firefox/files/firefox-125-loong/0004-Fix-libyuv-build-with-LSX-LASX.patch
|
|
|
|
This is needed when building with Clang 19, as LSX is now enabled by default:
|
|
https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html#loongarch-support
|
|
|
|
Rebased by ptrcnull against 131.0.3, might be incorrect actually.
|
|
--
|
|
From 40dedd401a07873e9f43c51bd249a2b9b786ccc5 Mon Sep 17 00:00:00 2001
|
|
From: WANG Xuerui <xen0n@gentoo.org>
|
|
Date: Sun, 31 Dec 2023 13:16:33 +0800
|
|
Subject: [PATCH] Fix libyuv build with LSX & LASX
|
|
|
|
This is not of upstream quality, and will not be upstreamed as-is.
|
|
This is only meant as a quick-and-dirty build fix for LoongArch early
|
|
adopters.
|
|
|
|
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
|
|
---
|
|
media/libyuv/libyuv/libyuv.gypi | 4 ++++
|
|
media/libyuv/libyuv/source/row_lasx.cc | 10 ++++++++++
|
|
media/libyuv/libyuv/source/row_lsx.cc | 10 ++++++++++
|
|
3 files changed, 24 insertions(+)
|
|
|
|
diff --git a/media/libyuv/libyuv/libyuv.gypi b/media/libyuv/libyuv/libyuv.gypi
|
|
index 1fd1be71e3414..fbe35fc42e6dc 100644
|
|
--- a/media/libyuv/libyuv/libyuv.gypi
|
|
+++ b/media/libyuv/libyuv/libyuv.gypi
|
|
@@ -80,11 +80,14 @@
|
|
'source/rotate_argb.cc',
|
|
'source/rotate_common.cc',
|
|
'source/rotate_gcc.cc',
|
|
+ 'source/rotate_lsx.cc',
|
|
'source/rotate_msa.cc',
|
|
'source/rotate_win.cc',
|
|
'source/row_any.cc',
|
|
'source/row_common.cc',
|
|
'source/row_gcc.cc',
|
|
+ 'source/row_lasx.cc',
|
|
+ 'source/row_lsx.cc',
|
|
'source/row_msa.cc',
|
|
'source/row_win.cc',
|
|
'source/scale.cc',
|
|
@@ -92,6 +95,7 @@
|
|
'source/scale_argb.cc',
|
|
'source/scale_common.cc',
|
|
'source/scale_gcc.cc',
|
|
+ 'source/scale_lsx.cc',
|
|
'source/scale_msa.cc',
|
|
'source/scale_rgb.cc',
|
|
'source/scale_uv.cc',
|
|
diff --git a/media/libyuv/libyuv/source/row_lasx.cc b/media/libyuv/libyuv/source/row_lasx.cc
|
|
index 6d49aa5e8b396..b285110e0c772 100644
|
|
--- a/media/libyuv/libyuv/source/row_lasx.cc
|
|
+++ b/media/libyuv/libyuv/source/row_lasx.cc
|
|
@@ -2000,11 +2000,13 @@ void NV21ToARGBRow_LASX(const uint8_t* src_y,
|
|
}
|
|
}
|
|
|
|
+#ifndef RgbConstants
|
|
struct RgbConstants {
|
|
uint8_t kRGBToY[4];
|
|
uint16_t kAddY;
|
|
uint16_t pad;
|
|
};
|
|
+#define RgbConstants RgbConstants
|
|
|
|
// RGB to JPeg coefficients
|
|
// B * 0.1140 coefficient = 29
|
|
@@ -2030,6 +2032,7 @@ static const struct RgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
|
static const struct RgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
|
0x1080,
|
|
0};
|
|
+#endif // RgbConstaints
|
|
|
|
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
|
static void ARGBToYMatrixRow_LASX(const uint8_t* src_argb,
|
|
@@ -2296,6 +2299,13 @@ void ARGBToUVJRow_LASX(const uint8_t* src_argb,
|
|
}
|
|
}
|
|
|
|
+// undef for unified sources build
|
|
+#undef YUVTORGB_SETUP
|
|
+#undef YUVTORGB
|
|
+#undef I444TORGB
|
|
+#undef STOREARGB
|
|
+#undef RGBTOUV
|
|
+
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
} // namespace libyuv
|
|
diff --git a/media/libyuv/libyuv/source/row_lsx.cc b/media/libyuv/libyuv/source/row_lsx.cc
|
|
index fa088c9e78a94..5da7a3cbdfc01 100644
|
|
--- a/media/libyuv/libyuv/source/row_lsx.cc
|
|
+++ b/media/libyuv/libyuv/source/row_lsx.cc
|
|
@@ -2769,11 +2769,13 @@ void HalfFloatRow_LSX(const uint16_t* src,
|
|
}
|
|
}
|
|
|
|
+#ifndef RgbConstants
|
|
struct RgbConstants {
|
|
uint8_t kRGBToY[4];
|
|
uint16_t kAddY;
|
|
uint16_t pad;
|
|
};
|
|
+#define RgbConstants RgbConstants
|
|
|
|
// RGB to JPeg coefficients
|
|
// B * 0.1140 coefficient = 29
|
|
@@ -2799,6 +2801,7 @@ static const struct RgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
|
static const struct RgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
|
0x1080,
|
|
0};
|
|
+#endif // RgbConstaints
|
|
|
|
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
|
static void ARGBToYMatrixRow_LSX(const uint8_t* src_argb,
|
|
@@ -2979,6 +2982,13 @@ void RAWToYRow_LSX(const uint8_t* src_raw, uint8_t* dst_y, int width) {
|
|
RGBToYMatrixRow_LSX(src_raw, dst_y, width, &kRawI601Constants);
|
|
}
|
|
|
|
+// undef for unified sources build
|
|
+#undef YUVTORGB_SETUP
|
|
+#undef YUVTORGB
|
|
+#undef I444TORGB
|
|
+#undef STOREARGB
|
|
+#undef RGBTOUV
|
|
+
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
} // namespace libyuv
|
|
--
|
|
2.46.2
|
|
|