mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-07-30 16:26:19 +08:00
loongarch: fix row_lsx.cc and row_lasx.cc
Remove custom ArgbConstants struct and use unified layout from row.h. Change-Id: I1fa0ed150a09ad659a5e7fff29cb4034e9c0638a Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7997470 Reviewed-by: Wan-Teh Chang <wtc@google.com> Reviewed-by: Frank Barchard <fbarchard@google.com>
This commit is contained in:
parent
078d7f6ffc
commit
26872d1da3
@ -2013,26 +2013,22 @@ void NV21ToARGBRow_LASX(const uint8_t* src_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ArgbConstants
|
|
||||||
struct ArgbConstants {
|
|
||||||
uint8_t kRGBToY[4];
|
|
||||||
uint16_t kAddY;
|
|
||||||
uint16_t pad;
|
|
||||||
};
|
|
||||||
#define ArgbConstants ArgbConstants
|
|
||||||
|
|
||||||
// RGB to JPeg coefficients
|
// RGB to JPeg coefficients
|
||||||
// B * 0.1140 coefficient = 29
|
// B * 0.1140 coefficient = 29
|
||||||
// G * 0.5870 coefficient = 150
|
// G * 0.5870 coefficient = 150
|
||||||
// R * 0.2990 coefficient = 77
|
// R * 0.2990 coefficient = 77
|
||||||
// Add 0.5 = 0x80
|
// Add 0.5 = 0x80
|
||||||
static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0},
|
static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0},
|
||||||
128,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{128},
|
||||||
|
{0}};
|
||||||
|
|
||||||
static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
||||||
128,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{128},
|
||||||
|
{0}};
|
||||||
|
|
||||||
// RGB to BT.601 coefficients
|
// RGB to BT.601 coefficients
|
||||||
// B * 0.1016 coefficient = 25
|
// B * 0.1016 coefficient = 25
|
||||||
@ -2041,13 +2037,16 @@ static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
|||||||
// Add 16.5 = 0x1080
|
// Add 16.5 = 0x1080
|
||||||
|
|
||||||
static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
||||||
0x1080,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{0x1080},
|
||||||
|
{0}};
|
||||||
|
|
||||||
static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
||||||
0x1080,
|
{0},
|
||||||
0};
|
{0},
|
||||||
#endif // ArgbConstants
|
{0x1080},
|
||||||
|
{0}};
|
||||||
|
|
||||||
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
||||||
void ARGBToYMatrixRow_LASX(const uint8_t* src_argb,
|
void ARGBToYMatrixRow_LASX(const uint8_t* src_argb,
|
||||||
@ -2059,7 +2058,8 @@ void ARGBToYMatrixRow_LASX(const uint8_t* src_argb,
|
|||||||
"xvldrepl.b $xr0, %3, 0 \n\t" // load rgbconstants
|
"xvldrepl.b $xr0, %3, 0 \n\t" // load rgbconstants
|
||||||
"xvldrepl.b $xr1, %3, 1 \n\t" // load rgbconstants
|
"xvldrepl.b $xr1, %3, 1 \n\t" // load rgbconstants
|
||||||
"xvldrepl.b $xr2, %3, 2 \n\t" // load rgbconstants
|
"xvldrepl.b $xr2, %3, 2 \n\t" // load rgbconstants
|
||||||
"xvldrepl.h $xr3, %3, 4 \n\t" // load rgbconstants
|
"xvldrepl.b $xr21, %3, 3 \n\t" // load rgbconstants
|
||||||
|
"xvldrepl.h $xr3, %3, 96 \n\t" // load rgbconstants
|
||||||
"xvld $xr20, %4, 0 \n\t" // load shuff
|
"xvld $xr20, %4, 0 \n\t" // load shuff
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
"xvld $xr4, %0, 0 \n\t"
|
"xvld $xr4, %0, 0 \n\t"
|
||||||
@ -2081,6 +2081,8 @@ void ARGBToYMatrixRow_LASX(const uint8_t* src_argb,
|
|||||||
"xvmaddwev.h.bu $xr13, $xr11, $xr1 \n\t"
|
"xvmaddwev.h.bu $xr13, $xr11, $xr1 \n\t"
|
||||||
"xvmaddwod.h.bu $xr12, $xr8, $xr2 \n\t" // R
|
"xvmaddwod.h.bu $xr12, $xr8, $xr2 \n\t" // R
|
||||||
"xvmaddwod.h.bu $xr13, $xr10, $xr2 \n\t"
|
"xvmaddwod.h.bu $xr13, $xr10, $xr2 \n\t"
|
||||||
|
"xvmaddwod.h.bu $xr12, $xr9, $xr21 \n\t" // A
|
||||||
|
"xvmaddwod.h.bu $xr13, $xr11, $xr21 \n\t"
|
||||||
"addi.d %0, %0, 128 \n\t"
|
"addi.d %0, %0, 128 \n\t"
|
||||||
"xvpickod.b $xr10, $xr13, $xr12 \n\t"
|
"xvpickod.b $xr10, $xr13, $xr12 \n\t"
|
||||||
"xvperm.w $xr11, $xr10, $xr20 \n\t"
|
"xvperm.w $xr11, $xr10, $xr20 \n\t"
|
||||||
@ -2121,7 +2123,7 @@ static void RGBAToYMatrixRow_LASX(const uint8_t* src_rgba,
|
|||||||
"xvldrepl.b $xr0, %3, 0 \n\t" // load rgbconstants
|
"xvldrepl.b $xr0, %3, 0 \n\t" // load rgbconstants
|
||||||
"xvldrepl.b $xr1, %3, 1 \n\t" // load rgbconstants
|
"xvldrepl.b $xr1, %3, 1 \n\t" // load rgbconstants
|
||||||
"xvldrepl.b $xr2, %3, 2 \n\t" // load rgbconstants
|
"xvldrepl.b $xr2, %3, 2 \n\t" // load rgbconstants
|
||||||
"xvldrepl.h $xr3, %3, 4 \n\t" // load rgbconstants
|
"xvldrepl.h $xr3, %3, 96 \n\t" // load rgbconstants
|
||||||
"xvld $xr20, %4, 0 \n\t" // load shuff
|
"xvld $xr20, %4, 0 \n\t" // load shuff
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
"xvld $xr4, %0, 0 \n\t"
|
"xvld $xr4, %0, 0 \n\t"
|
||||||
|
|||||||
@ -2798,26 +2798,23 @@ void HalfFloatRow_LSX(const uint16_t* src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ArgbConstants
|
|
||||||
struct ArgbConstants {
|
|
||||||
uint8_t kRGBToY[4];
|
|
||||||
uint16_t kAddY;
|
|
||||||
uint16_t pad;
|
|
||||||
};
|
|
||||||
#define ArgbConstants ArgbConstants
|
|
||||||
|
|
||||||
// RGB to JPeg coefficients
|
// RGB to JPeg coefficients
|
||||||
// B * 0.1140 coefficient = 29
|
// B * 0.1140 coefficient = 29
|
||||||
// G * 0.5870 coefficient = 150
|
// G * 0.5870 coefficient = 150
|
||||||
// R * 0.2990 coefficient = 77
|
// R * 0.2990 coefficient = 77
|
||||||
// Add 0.5 = 0x80
|
// Add 0.5 = 0x80
|
||||||
|
|
||||||
static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0},
|
static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0},
|
||||||
128,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{128},
|
||||||
|
{0}};
|
||||||
|
|
||||||
static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
||||||
128,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{128},
|
||||||
|
{0}};
|
||||||
|
|
||||||
// RGB to BT.601 coefficients
|
// RGB to BT.601 coefficients
|
||||||
// B * 0.1016 coefficient = 25
|
// B * 0.1016 coefficient = 25
|
||||||
@ -2826,13 +2823,16 @@ static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0},
|
|||||||
// Add 16.5 = 0x1080
|
// Add 16.5 = 0x1080
|
||||||
|
|
||||||
static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0},
|
||||||
0x1080,
|
{0},
|
||||||
0};
|
{0},
|
||||||
|
{0x1080},
|
||||||
|
{0}};
|
||||||
|
|
||||||
static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0},
|
||||||
0x1080,
|
{0},
|
||||||
0};
|
{0},
|
||||||
#endif // ArgbConstants
|
{0x1080},
|
||||||
|
{0}};
|
||||||
|
|
||||||
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
// ARGB expects first 3 values to contain RGB and 4th value is ignored.
|
||||||
void ARGBToYMatrixRow_LSX(const uint8_t* src_argb,
|
void ARGBToYMatrixRow_LSX(const uint8_t* src_argb,
|
||||||
@ -2843,7 +2843,8 @@ void ARGBToYMatrixRow_LSX(const uint8_t* src_argb,
|
|||||||
"vldrepl.b $vr0, %3, 0 \n\t" // load rgbconstants
|
"vldrepl.b $vr0, %3, 0 \n\t" // load rgbconstants
|
||||||
"vldrepl.b $vr1, %3, 1 \n\t" // load rgbconstants
|
"vldrepl.b $vr1, %3, 1 \n\t" // load rgbconstants
|
||||||
"vldrepl.b $vr2, %3, 2 \n\t" // load rgbconstants
|
"vldrepl.b $vr2, %3, 2 \n\t" // load rgbconstants
|
||||||
"vldrepl.h $vr3, %3, 4 \n\t" // load rgbconstants
|
"vldrepl.b $vr20, %3, 3 \n\t" // load rgbconstants
|
||||||
|
"vldrepl.h $vr3, %3, 96 \n\t" // load rgbconstants
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
"vld $vr4, %0, 0 \n\t"
|
"vld $vr4, %0, 0 \n\t"
|
||||||
"vld $vr5, %0, 16 \n\t"
|
"vld $vr5, %0, 16 \n\t"
|
||||||
@ -2864,6 +2865,8 @@ void ARGBToYMatrixRow_LSX(const uint8_t* src_argb,
|
|||||||
"vmaddwev.h.bu $vr13, $vr11, $vr1 \n\t"
|
"vmaddwev.h.bu $vr13, $vr11, $vr1 \n\t"
|
||||||
"vmaddwod.h.bu $vr12, $vr8, $vr2 \n\t" // R
|
"vmaddwod.h.bu $vr12, $vr8, $vr2 \n\t" // R
|
||||||
"vmaddwod.h.bu $vr13, $vr10, $vr2 \n\t"
|
"vmaddwod.h.bu $vr13, $vr10, $vr2 \n\t"
|
||||||
|
"vmaddwod.h.bu $vr12, $vr9, $vr20 \n\t" // A
|
||||||
|
"vmaddwod.h.bu $vr13, $vr11, $vr20 \n\t"
|
||||||
"addi.d %0, %0, 64 \n\t"
|
"addi.d %0, %0, 64 \n\t"
|
||||||
"vpickod.b $vr10, $vr13, $vr12 \n\t"
|
"vpickod.b $vr10, $vr13, $vr12 \n\t"
|
||||||
"vst $vr10, %1, 0 \n\t"
|
"vst $vr10, %1, 0 \n\t"
|
||||||
@ -2902,7 +2905,7 @@ static void RGBAToYMatrixRow_LSX(const uint8_t* src_rgba,
|
|||||||
"vldrepl.b $vr0, %3, 0 \n\t" // load rgbconstants
|
"vldrepl.b $vr0, %3, 0 \n\t" // load rgbconstants
|
||||||
"vldrepl.b $vr1, %3, 1 \n\t" // load rgbconstants
|
"vldrepl.b $vr1, %3, 1 \n\t" // load rgbconstants
|
||||||
"vldrepl.b $vr2, %3, 2 \n\t" // load rgbconstants
|
"vldrepl.b $vr2, %3, 2 \n\t" // load rgbconstants
|
||||||
"vldrepl.h $vr3, %3, 4 \n\t" // load rgbconstants
|
"vldrepl.h $vr3, %3, 96 \n\t" // load rgbconstants
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
"vld $vr4, %0, 0 \n\t"
|
"vld $vr4, %0, 0 \n\t"
|
||||||
"vld $vr5, %0, 16 \n\t"
|
"vld $vr5, %0, 16 \n\t"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user