video-format: add big-endian versions of RGB/BGR 15/16 pack/unpack

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745337
This commit is contained in:
Wim Taymans 2015-03-02 12:26:23 +01:00
parent 12ed0428a9
commit 569ca5770c
4 changed files with 3991 additions and 239 deletions

View file

@ -1001,10 +1001,17 @@ unpack_RGB16 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
const guint16 *restrict s = GET_LINE (y);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_RGB16_trunc (dest, s + x, width);
video_orc_unpack_RGB16_le_trunc (dest, s + x, width);
else
video_orc_unpack_RGB16 (dest, s + x, width);
video_orc_unpack_RGB16_le (dest, s + x, width);
#else
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_RGB16_be_trunc (dest, s + x, width);
else
video_orc_unpack_RGB16_be (dest, s + x, width);
#endif
}
static void
@ -1015,7 +1022,11 @@ pack_RGB16 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
guint16 *restrict d = GET_LINE (y);
video_orc_pack_RGB16 (d, src, width);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
video_orc_pack_RGB16_le (d, src, width);
#else
video_orc_pack_RGB16_be (d, src, width);
#endif
}
#define PACK_BGR16 GST_VIDEO_FORMAT_ARGB, unpack_BGR16, 1, pack_BGR16
@ -1026,10 +1037,17 @@ unpack_BGR16 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
const guint16 *restrict s = GET_LINE (y);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_BGR16_trunc (dest, s + x, width);
video_orc_unpack_BGR16_le_trunc (dest, s + x, width);
else
video_orc_unpack_BGR16 (dest, s + x, width);
video_orc_unpack_BGR16_le (dest, s + x, width);
#else
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_BGR16_be_trunc (dest, s + x, width);
else
video_orc_unpack_BGR16_be (dest, s + x, width);
#endif
}
static void
@ -1040,7 +1058,11 @@ pack_BGR16 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
guint16 *restrict d = GET_LINE (y);
video_orc_pack_BGR16 (d, src, width);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
video_orc_pack_BGR16_le (d, src, width);
#else
video_orc_pack_BGR16_be (d, src, width);
#endif
}
#define PACK_RGB15 GST_VIDEO_FORMAT_ARGB, unpack_RGB15, 1, pack_RGB15
@ -1051,10 +1073,17 @@ unpack_RGB15 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
const guint16 *restrict s = GET_LINE (y);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_RGB15_trunc (dest, s + x, width);
video_orc_unpack_RGB15_le_trunc (dest, s + x, width);
else
video_orc_unpack_RGB15 (dest, s + x, width);
video_orc_unpack_RGB15_le (dest, s + x, width);
#else
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_RGB15_be_trunc (dest, s + x, width);
else
video_orc_unpack_RGB15_be (dest, s + x, width);
#endif
}
static void
@ -1065,7 +1094,11 @@ pack_RGB15 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
guint16 *restrict d = GET_LINE (y);
video_orc_pack_RGB15 (d, src, width);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
video_orc_pack_RGB15_le (d, src, width);
#else
video_orc_pack_RGB15_be (d, src, width);
#endif
}
#define PACK_BGR15 GST_VIDEO_FORMAT_ARGB, unpack_BGR15, 1, pack_BGR15
@ -1076,10 +1109,17 @@ unpack_BGR15 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
const guint16 *restrict s = GET_LINE (y);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_BGR15_trunc (dest, s + x, width);
video_orc_unpack_BGR15_le_trunc (dest, s + x, width);
else
video_orc_unpack_BGR15 (dest, s + x, width);
video_orc_unpack_BGR15_le (dest, s + x, width);
#else
if (flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)
video_orc_unpack_BGR15_be_trunc (dest, s + x, width);
else
video_orc_unpack_BGR15_be (dest, s + x, width);
#endif
}
static void
@ -1090,7 +1130,11 @@ pack_BGR15 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
{
guint16 *restrict d = GET_LINE (y);
video_orc_pack_BGR15 (d, src, width);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
video_orc_pack_BGR15_le (d, src, width);
#else
video_orc_pack_BGR15_be (d, src, width);
#endif
}
#define PACK_BGRA GST_VIDEO_FORMAT_ARGB, unpack_BGRA, 1, pack_BGRA

File diff suppressed because it is too large Load diff

View file

@ -113,18 +113,30 @@ void video_orc_pack_NV24 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, co
void video_orc_unpack_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
void video_orc_pack_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n);
void video_orc_pack_AY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15 (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB15 (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15 (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR15 (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16 (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB16 (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16 (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR16 (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15_be (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15_le_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB15_be_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB15_le (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB15_be (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15_be (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15_le_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR15_be_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR15_le (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR15_be (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16_be (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16_le_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_RGB16_be_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB16_le (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_pack_RGB16_be (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16_le (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16_be (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16_le_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_unpack_BGR16_be_trunc (guint32 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR16_le (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_pack_BGR16_be (guint16 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n);
void video_orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
void video_orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int n);
void video_orc_memset_2d (guint8 * ORC_RESTRICT d1, int d1_stride, int p1, int n, int m);

View file

@ -461,7 +461,7 @@ select0lw ay, ayuv
select1wb y, ay
select0wb a, ay
.function video_orc_unpack_RGB15
.function video_orc_unpack_RGB15_le
.dest 4 argb guint32
.source 2 rgb15 guint16
.temp 2 t
@ -484,7 +484,30 @@ mergewl rb, r, b
shll rb, rb, 8
orl argb, ag, rb
.function video_orc_unpack_RGB15_trunc
.function video_orc_unpack_RGB15_be
.dest 4 argb guint32
.source 2 rgb15 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ag
.temp 4 rb
loadw t, rgb15
andw r, t, 0x7c00
andw g, t, 0x03e0
andw b, t, 0x001f
shlw b, b, 5
mulhsw r, r, 0x0210
mulhsw g, g, 0x4200
mulhsw b, b, 0x4200
mergewl ag, g, 0xff
mergewl rb, b, r
shll ag, ag, 8
orl argb, ag, rb
.function video_orc_unpack_RGB15_le_trunc
.dest 4 argb guint32
.source 2 rgb15 guint16
.temp 2 t
@ -506,7 +529,29 @@ mergewl rb, r, b
shll rb, rb, 8
orl argb, ag, rb
.function video_orc_pack_RGB15
.function video_orc_unpack_RGB15_be_trunc
.dest 4 argb guint32
.source 2 rgb15 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ag
.temp 4 rb
loadw t, rgb15
andw r, t, 0x7c00
andw g, t, 0x03e0
andw b, t, 0x001f
shruw r, r, 7
shruw g, g, 2
shlw b, b, 3
mergewl ag, 0xff, g
mergewl rb, r, b
shll ag, ag, 8
orl argb, ag, rb
.function video_orc_pack_RGB15_le
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
@ -526,7 +571,27 @@ orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_unpack_BGR15
.function video_orc_pack_RGB15_be
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
.temp 4 r
.temp 4 g
.temp 4 b
.temp 4 t2
loadl t, argb
andl r, t, 0xf80000
andl g, t, 0xf800
andl b, t, 0xf8
shrul r, r, 9
shrul g, g, 6
shrul b, b, 3
orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_unpack_BGR15_le
.dest 4 argb guint32
.source 2 bgr15 guint16
.temp 2 t
@ -549,7 +614,30 @@ mergewl rb, r, b
shll rb, rb, 8
orl argb, ag, rb
.function video_orc_unpack_BGR15_trunc
.function video_orc_unpack_BGR15_be
.dest 4 argb guint32
.source 2 bgr15 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ag
.temp 4 rb
loadw t, bgr15
andw b, t, 0x7c00
andw g, t, 0x03e0
andw r, t, 0x001f
shlw r, r, 5
mulhsw b, b, 0x0210
mulhsw g, g, 0x4200
mulhsw r, r, 0x4200
mergewl ag, g, 0xff
mergewl rb, b, r
shll ag, ag, 8
orl argb, ag, rb
.function video_orc_unpack_BGR15_le_trunc
.dest 4 argb guint32
.source 2 bgr15 guint16
.temp 2 t
@ -571,7 +659,29 @@ mergewl rb, r, b
shll rb, rb, 8
orl argb, ag, rb
.function video_orc_pack_BGR15
.function video_orc_unpack_BGR15_be_trunc
.dest 4 argb guint32
.source 2 bgr15 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ag
.temp 4 rb
loadw t, bgr15
andw b, t, 0x7c00
andw g, t, 0x03e0
andw r, t, 0x001f
shruw b, b, 7
shruw g, g, 2
shlw r, r, 3
mergewl ag, g, 0xff
mergewl rb, b, r
shll ag, ag, 8
orl argb, ag, rb
.function video_orc_pack_BGR15_le
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
@ -591,7 +701,27 @@ orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_unpack_RGB16
.function video_orc_pack_BGR15_be
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
.temp 4 r
.temp 4 g
.temp 4 b
.temp 4 t2
loadl t, argb
andl r, t, 0xf80000
andl g, t, 0xf800
andl b, t, 0xf8
shll b, b, 7
shrul g, g, 6
shrul r, r, 19
orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_unpack_RGB16_le
.dest 4 argb guint32
.source 2 rgb16 guint16
.temp 2 t
@ -616,7 +746,32 @@ mergewl gb, g, b
mergelq t2, ar, gb
x4 convsuswb argb, t2
.function video_orc_unpack_RGB16_trunc
.function video_orc_unpack_RGB16_be
.dest 4 argb guint32
.source 2 rgb16 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ar
.temp 4 gb
.temp 8 t2
loadw t, rgb16
andw r, t, 0xf800
andw g, t, 0x07e0
andw b, t, 0x001f
shruw r, r, 6
shlw b, b, 5
mulhsw r, r, 0x4200
mulhsw g, g, 0x2080
mulhsw b, b, 0x4200
mergewl ar, r, 0xff
mergewl gb, b, g
mergelq t2, gb, ar
x4 convsuswb argb, t2
.function video_orc_unpack_RGB16_le_trunc
.dest 4 argb guint32
.source 2 rgb16 guint16
.temp 2 t
@ -639,7 +794,30 @@ mergewl gb, g, b
mergelq t2, ar, gb
x4 convsuswb argb, t2
.function video_orc_pack_RGB16
.function video_orc_unpack_RGB16_be_trunc
.dest 4 argb guint32
.source 2 rgb16 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ar
.temp 4 gb
.temp 8 t2
loadw t, rgb16
andw r, t, 0xf800
andw g, t, 0x07e0
andw b, t, 0x001f
shruw r, r, 8
shruw g, g, 3
shlw b, b, 3
mergewl ar, r, 0xff
mergewl gb, b, g
mergelq t2, gb, ar
x4 convsuswb argb, t2
.function video_orc_pack_RGB16_le
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
@ -658,7 +836,27 @@ orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_unpack_BGR16
.function video_orc_pack_RGB16_be
.dest 2 rgb16 guint16
.source 4 argb guint32
.temp 4 t
.temp 4 r
.temp 4 g
.temp 4 b
.temp 4 t2
loadl t, argb
andl r, t, 0xf80000
andl g, t, 0xfc00
andl b, t, 0xf8
shrul r, r, 8
shrul g, g, 5
shrul b, b, 3
orl t2, r, g
orl t2, t2, b
select0lw rgb16, t2
.function video_orc_unpack_BGR16_le
.dest 4 argb guint32
.source 2 bgr16 guint16
.temp 2 t
@ -683,7 +881,32 @@ mergewl gb, g, b
mergelq t2, ar, gb
x4 convsuswb argb, t2
.function video_orc_unpack_BGR16_trunc
.function video_orc_unpack_BGR16_be
.dest 4 argb guint32
.source 2 bgr16 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ar
.temp 4 gb
.temp 8 t2
loadw t, bgr16
andw b, t, 0xf800
andw g, t, 0x07e0
andw r, t, 0x001f
shruw b, b, 6
shlw r, r, 5
mulhsw b, b, 0x4200
mulhsw g, g, 0x2080
mulhsw r, r, 0x4200
mergewl ar, r, 0xff
mergewl gb, b, g
mergelq t2, gb, ar
x4 convsuswb argb, t2
.function video_orc_unpack_BGR16_le_trunc
.dest 4 argb guint32
.source 2 bgr16 guint16
.temp 2 t
@ -706,7 +929,30 @@ mergewl gb, g, b
mergelq t2, ar, gb
x4 convsuswb argb, t2
.function video_orc_pack_BGR16
.function video_orc_unpack_BGR16_be_trunc
.dest 4 argb guint32
.source 2 bgr16 guint16
.temp 2 t
.temp 2 r
.temp 2 g
.temp 2 b
.temp 4 ar
.temp 4 gb
.temp 8 t2
loadw t, bgr16
andw b, t, 0xf800
andw g, t, 0x07e0
andw r, t, 0x001f
shruw b, b, 8
shruw g, g, 3
shlw r, r, 3
mergewl ar, r, 0xff
mergewl gb, b, g
mergelq t2, gb, ar
x4 convsuswb argb, t2
.function video_orc_pack_BGR16_le
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
@ -726,6 +972,26 @@ orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_pack_BGR16_be
.dest 2 rgb15 guint16
.source 4 argb guint32
.temp 4 t
.temp 4 r
.temp 4 g
.temp 4 b
.temp 4 t2
loadl t, argb
andl r, t, 0xf80000
andl g, t, 0xfc00
andl b, t, 0xf8
shll b, b, 8
shrul g, g, 5
shrul r, r, 19
orl t2, r, g
orl t2, t2, b
select0lw rgb15, t2
.function video_orc_resample_bilinear_u32
.dest 4 d1 guint8
.source 4 s1 guint8