[FFmpeg-cvslog] swscale: [loongarch] Fix checkasm-sw_yuv2rgb failure.
Shiyou Yin
git at videolan.org
Sat Aug 3 00:18:11 EEST 2024
ffmpeg | branch: release/7.0 | Shiyou Yin <yinshiyou-hf at loongson.cn> | Thu Jul 25 17:39:21 2024 +0800| [abd5df3033de4fdbbd907022cf37d16b4d12380a] | committer: Michael Niedermayer
swscale: [loongarch] Fix checkasm-sw_yuv2rgb failure.
Reviewed-by: 陈昊 <chenhao at loongson.cn>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 4713a5cc2478ac94150541918749913d05a54b7f)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abd5df3033de4fdbbd907022cf37d16b4d12380a
---
libswscale/loongarch/swscale_init_loongarch.c | 104 +++++++++++++-------------
libswscale/loongarch/yuv2rgb_lasx.c | 4 +-
2 files changed, 56 insertions(+), 52 deletions(-)
diff --git a/libswscale/loongarch/swscale_init_loongarch.c b/libswscale/loongarch/swscale_init_loongarch.c
index 53e4f970b6..51bfdd56de 100644
--- a/libswscale/loongarch/swscale_init_loongarch.c
+++ b/libswscale/loongarch/swscale_init_loongarch.c
@@ -93,60 +93,64 @@ av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsContext *c)
int cpu_flags = av_get_cpu_flags();
#if HAVE_LASX
if (have_lasx(cpu_flags)) {
- switch (c->dstFormat) {
- case AV_PIX_FMT_RGB24:
- return yuv420_rgb24_lasx;
- case AV_PIX_FMT_BGR24:
- return yuv420_bgr24_lasx;
- case AV_PIX_FMT_RGBA:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_rgba32_lasx;
- case AV_PIX_FMT_ARGB:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_argb32_lasx;
- case AV_PIX_FMT_BGRA:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_bgra32_lasx;
- case AV_PIX_FMT_ABGR:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_abgr32_lasx;
+ if (c->srcFormat == AV_PIX_FMT_YUV420P) {
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB24:
+ return yuv420_rgb24_lasx;
+ case AV_PIX_FMT_BGR24:
+ return yuv420_bgr24_lasx;
+ case AV_PIX_FMT_RGBA:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_rgba32_lasx;
+ case AV_PIX_FMT_ARGB:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_argb32_lasx;
+ case AV_PIX_FMT_BGRA:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_bgra32_lasx;
+ case AV_PIX_FMT_ABGR:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_abgr32_lasx;
+ }
}
}
#endif // #if HAVE_LASX
if (have_lsx(cpu_flags)) {
- switch (c->dstFormat) {
- case AV_PIX_FMT_RGB24:
- return yuv420_rgb24_lsx;
- case AV_PIX_FMT_BGR24:
- return yuv420_bgr24_lsx;
- case AV_PIX_FMT_RGBA:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_rgba32_lsx;
- case AV_PIX_FMT_ARGB:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_argb32_lsx;
- case AV_PIX_FMT_BGRA:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_bgra32_lsx;
- case AV_PIX_FMT_ABGR:
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
- break;
- } else
- return yuv420_abgr32_lsx;
+ if (c->srcFormat == AV_PIX_FMT_YUV420P) {
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB24:
+ return yuv420_rgb24_lsx;
+ case AV_PIX_FMT_BGR24:
+ return yuv420_bgr24_lsx;
+ case AV_PIX_FMT_RGBA:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_rgba32_lsx;
+ case AV_PIX_FMT_ARGB:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_argb32_lsx;
+ case AV_PIX_FMT_BGRA:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_bgra32_lsx;
+ case AV_PIX_FMT_ABGR:
+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
+ break;
+ } else
+ return yuv420_abgr32_lsx;
+ }
}
}
return NULL;
diff --git a/libswscale/loongarch/yuv2rgb_lasx.c b/libswscale/loongarch/yuv2rgb_lasx.c
index 64e434f50c..0ce553005a 100644
--- a/libswscale/loongarch/yuv2rgb_lasx.c
+++ b/libswscale/loongarch/yuv2rgb_lasx.c
@@ -82,8 +82,8 @@
#define YUV2RGB_RES \
m_y1 = __lasx_xvldrepl_d(py_1, 0); \
m_y2 = __lasx_xvldrepl_d(py_2, 0); \
- m_u = __lasx_xvldrepl_d(pu, 0); \
- m_v = __lasx_xvldrepl_d(pv, 0); \
+ m_u = __lasx_xvldrepl_w(pu, 0); \
+ m_v = __lasx_xvldrepl_w(pv, 0); \
m_y1 = __lasx_xvilvl_d(m_y2, m_y1); \
m_u = __lasx_xvilvl_b(m_u, m_u); \
m_v = __lasx_xvilvl_b(m_v, m_v); \
More information about the ffmpeg-cvslog
mailing list