diff --git a/source/row_lasx.cc b/source/row_lasx.cc index e0802c15e..f83a4984f 100644 --- a/source/row_lasx.cc +++ b/source/row_lasx.cc @@ -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 // B * 0.1140 coefficient = 29 // G * 0.5870 coefficient = 150 // R * 0.2990 coefficient = 77 // Add 0.5 = 0x80 static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0}, - 128, - 0}; + {0}, + {0}, + {128}, + {0}}; static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0}, - 128, - 0}; + {0}, + {0}, + {128}, + {0}}; // RGB to BT.601 coefficients // B * 0.1016 coefficient = 25 @@ -2041,13 +2037,16 @@ static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0}, // Add 16.5 = 0x1080 static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0}, - 0x1080, - 0}; + {0}, + {0}, + {0x1080}, + {0}}; static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0}, - 0x1080, - 0}; -#endif // ArgbConstants + {0}, + {0}, + {0x1080}, + {0}}; // ARGB expects first 3 values to contain RGB and 4th value is ignored. 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 $xr1, %3, 1 \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 "1: \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" "xvmaddwod.h.bu $xr12, $xr8, $xr2 \n\t" // R "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" "xvpickod.b $xr10, $xr13, $xr12 \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 $xr1, %3, 1 \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 "1: \n\t" "xvld $xr4, %0, 0 \n\t" diff --git a/source/row_lsx.cc b/source/row_lsx.cc index 3e6d5154c..1d75a2198 100644 --- a/source/row_lsx.cc +++ b/source/row_lsx.cc @@ -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 // B * 0.1140 coefficient = 29 // G * 0.5870 coefficient = 150 // R * 0.2990 coefficient = 77 // Add 0.5 = 0x80 + static const struct ArgbConstants kRgb24JPEGConstants = {{29, 150, 77, 0}, - 128, - 0}; + {0}, + {0}, + {128}, + {0}}; static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0}, - 128, - 0}; + {0}, + {0}, + {128}, + {0}}; // RGB to BT.601 coefficients // B * 0.1016 coefficient = 25 @@ -2826,13 +2823,16 @@ static const struct ArgbConstants kRawJPEGConstants = {{77, 150, 29, 0}, // Add 16.5 = 0x1080 static const struct ArgbConstants kRgb24I601Constants = {{25, 129, 66, 0}, - 0x1080, - 0}; + {0}, + {0}, + {0x1080}, + {0}}; static const struct ArgbConstants kRawI601Constants = {{66, 129, 25, 0}, - 0x1080, - 0}; -#endif // ArgbConstants + {0}, + {0}, + {0x1080}, + {0}}; // ARGB expects first 3 values to contain RGB and 4th value is ignored. 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 $vr1, %3, 1 \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" "vld $vr4, %0, 0 \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" "vmaddwod.h.bu $vr12, $vr8, $vr2 \n\t" // R "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" "vpickod.b $vr10, $vr13, $vr12 \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 $vr1, %3, 1 \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" "vld $vr4, %0, 0 \n\t" "vld $vr5, %0, 16 \n\t"