diff options
author | Wim Taymans <wtaymans@redhat.com> | 2017-06-01 17:45:41 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2017-06-01 17:45:41 +0200 |
commit | 4584d2e13f86099615754f3afbc1fc8ef0e26c5d (patch) | |
tree | d0996fd60b53e5fd010bfff4488f6207423a7e88 | |
parent | 31c7505600f0a7653de5ba36bd2740b5f16efe4d (diff) | |
download | gstreamer-plugins-base-4584d2e13f86099615754f3afbc1fc8ef0e26c5d.tar.gz |
Fix RGBA and ABGR pack/unpack on big endian cpu
The pack and unpack functions for RGBA and ABGR only work for little
endian cpus. Add variants for big endian as well.
-rw-r--r-- | gst-libs/gst/video/video-format.c | 24 | ||||
-rw-r--r-- | gst-libs/gst/video/video-orc.orc | 54 |
2 files changed, 70 insertions, 8 deletions
diff --git a/gst-libs/gst/video/video-format.c b/gst-libs/gst/video/video-format.c index 6117e7e2f..58176dfff 100644 --- a/gst-libs/gst/video/video-format.c +++ b/gst-libs/gst/video/video-format.c @@ -1328,7 +1328,11 @@ unpack_ABGR (const GstVideoFormatInfo * info, GstVideoPackFlags flags, s += x * 4; - video_orc_unpack_ABGR (dest, s, width); +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + video_orc_unpack_ABGR_le (dest, s, width); +#else + video_orc_unpack_ABGR_be (dest, s, width); +#endif } static void @@ -1339,7 +1343,11 @@ pack_ABGR (const GstVideoFormatInfo * info, GstVideoPackFlags flags, { guint8 *restrict d = GET_LINE (y); - video_orc_pack_ABGR (d, src, width); +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + video_orc_pack_ABGR_le (d, src, width); +#else + video_orc_pack_ABGR_be (d, src, width); +#endif } #define PACK_RGBA GST_VIDEO_FORMAT_ARGB, unpack_RGBA, 1, pack_RGBA @@ -1352,7 +1360,11 @@ unpack_RGBA (const GstVideoFormatInfo * info, GstVideoPackFlags flags, s += x * 4; - video_orc_unpack_RGBA (dest, s, width); +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + video_orc_unpack_RGBA_le (dest, s, width); +#else + video_orc_unpack_RGBA_be (dest, s, width); +#endif } static void @@ -1363,7 +1375,11 @@ pack_RGBA (const GstVideoFormatInfo * info, GstVideoPackFlags flags, { guint8 *restrict d = GET_LINE (y); - video_orc_pack_RGBA (d, src, width); +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + video_orc_pack_RGBA_le (d, src, width); +#else + video_orc_pack_RGBA_be (d, src, width); +#endif } #define PACK_RGB GST_VIDEO_FORMAT_ARGB, unpack_RGB, 1, pack_RGB diff --git a/gst-libs/gst/video/video-orc.orc b/gst-libs/gst/video/video-orc.orc index 3399c8157..f855fd7e7 100644 --- a/gst-libs/gst/video/video-orc.orc +++ b/gst-libs/gst/video/video-orc.orc @@ -333,7 +333,7 @@ swapl argb, bgra swapl bgra, argb -.function video_orc_pack_RGBA +.function video_orc_pack_RGBA_le .dest 4 rgba guint8 .source 4 argb guint8 .temp 4 a @@ -344,7 +344,7 @@ shrul a, r, 8 shll r, r, 24 orl rgba, r, a -.function video_orc_unpack_RGBA +.function video_orc_unpack_RGBA_le .dest 4 argb guint8 .source 4 rgba guint8 .temp 4 a @@ -355,7 +355,30 @@ shll a, r, 8 shrul r, r, 24 orl argb, r, a -.function video_orc_unpack_ABGR +.function video_orc_pack_RGBA_be +.dest 4 rgba guint8 +.source 4 argb guint8 +.temp 4 a +.temp 4 r + +loadl r, argb +shrul a, r, 24 +shll r, r, 8 +orl rgba, r, a + +.function video_orc_unpack_RGBA_be +.dest 4 argb guint8 +.source 4 rgba guint8 +.temp 4 a +.temp 4 r + +loadl r, rgba +shll a, r, 24 +shrul r, r, 8 +orl argb, r, a + + +.function video_orc_unpack_ABGR_le .dest 4 argb guint8 .source 4 abgr guint8 .temp 4 a @@ -366,7 +389,7 @@ shll a, r, 8 shrul r, r, 24 orl argb, r, a -.function video_orc_pack_ABGR +.function video_orc_pack_ABGR_le .dest 4 abgr guint8 .source 4 argb guint8 .temp 4 a @@ -377,6 +400,29 @@ shll a, r, 8 shrul r, r, 24 orl abgr, r, a +.function video_orc_unpack_ABGR_be +.dest 4 argb guint8 +.source 4 abgr guint8 +.temp 4 a +.temp 4 r + +swapl r, abgr +shll a, r, 24 +shrul r, r, 8 +orl argb, r, a + +.function video_orc_pack_ABGR_be +.dest 4 abgr guint8 +.source 4 argb guint8 +.temp 4 a +.temp 4 r + +swapl r, argb +shll a, r, 24 +shrul r, r, 8 +orl abgr, r, a + + .function video_orc_unpack_NV12 .dest 8 d guint8 .source 2 y guint8 |