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.
This commit is contained in:
Wim Taymans 2017-06-01 17:45:41 +02:00
parent 173396d524
commit 103d265cf0
2 changed files with 70 additions and 8 deletions

View file

@ -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

View file

@ -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