video: improve YUV -> RGB conversion

Reorganize orc instructions to free up some registers.
We can reuse the ORC code to implement the generic AYUV->ARGB matrix.
This commit is contained in:
Wim Taymans 2014-09-26 18:14:11 +02:00
parent 2977ef5281
commit 07d1d7ba38
2 changed files with 61 additions and 51 deletions

View file

@ -367,6 +367,15 @@ video_converter_matrix8 (GstVideoConverter * convert, gpointer pixels)
}
}
static void
video_converter_matrix8_AYUV_ARGB (GstVideoConverter * convert, gpointer pixels)
{
video_orc_convert_AYUV_ARGB (pixels, 0, pixels, 0,
convert->cmatrix[0][0], convert->cmatrix[0][2],
convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
convert->width, 1);
}
static void
video_converter_matrix16 (GstVideoConverter * convert, gpointer pixels)
{
@ -559,7 +568,11 @@ video_converter_compute_matrix (GstVideoConverter * convert)
else
duinfo = gst_video_format_get_info (GST_VIDEO_FORMAT_AYUV64);
} else {
convert->matrix = video_converter_matrix8;
if (GST_VIDEO_FORMAT_INFO_IS_YUV (suinfo)
&& GST_VIDEO_FORMAT_INFO_IS_RGB (duinfo))
convert->matrix = video_converter_matrix8_AYUV_ARGB;
else
convert->matrix = video_converter_matrix8;
}
color_matrix_set_identity (&dst);

View file

@ -990,21 +990,21 @@ splatbw wv, v
mulhsw wy, wy, p1
mulhsw wr, wv, p2
addssw wr, wy, wr
addw wr, wy, wr
convssswb r, wr
mergebw wr, a, r
mulhsw wb, wu, p3
addssw wb, wy, wb
mulhsw wg, wu, p4
addssw wg, wy, wg
mulhsw wy, wv, p5
addssw wg, wg, wy
convssswb r, wr
convssswb g, wg
addw wb, wy, wb
convssswb b, wb
mergebw wr, a, r
mulhsw wg, wu, p4
addw wg, wy, wg
mulhsw wy, wv, p5
addw wg, wg, wy
convssswb g, wg
mergebw wb, g, b
mergewl x, wr, wb
x4 addb argb, x, c128
@ -1046,22 +1046,22 @@ splatbw wv, v
mulhsw wy, wy, p1
mulhsw wr, wv, p2
addssw wr, wy, wr
addw wr, wy, wr
convssswb r, wr
mergebw wr, r, a
mulhsw wb, wu, p3
addssw wb, wy, wb
mulhsw wg, wu, p4
addssw wg, wy, wg
mulhsw wy, wv, p5
addssw wg, wg, wy
convssswb r, wr
convssswb g, wg
addw wb, wy, wb
convssswb b, wb
mulhsw wg, wu, p4
addw wg, wy, wg
mulhsw wy, wv, p5
addw wg, wg, wy
convssswb g, wg
mergebw wb, b, g
mergebw wr, r, a
mergewl x, wb, wr
x4 addb bgra, x, c128
@ -1103,21 +1103,21 @@ splatbw wv, v
mulhsw wy, wy, p1
mulhsw wr, wv, p2
addssw wr, wy, wr
addw wr, wy, wr
convssswb r, wr
mulhsw wb, wu, p3
addssw wb, wy, wb
addw wb, wy, wb
convssswb b, wb
mergebw wb, a, b
mulhsw wg, wu, p4
addssw wg, wy, wg
addw wg, wy, wg
mulhsw wy, wv, p5
addssw wg, wg, wy
addw wg, wg, wy
convssswb r, wr
convssswb g, wg
convssswb b, wb
mergebw wb, a, b
mergebw wr, g, r
mergewl x, wb, wr
x4 addb argb, x, c128
@ -1159,27 +1159,25 @@ splatbw wv, v
mulhsw wy, wy, p1
mulhsw wr, wv, p2
addssw wr, wy, wr
addw wr, wy, wr
convssswb r, wr
mulhsw wb, wu, p3
addssw wb, wy, wb
addw wb, wy, wb
convssswb b, wb
mergebw wb, b, a
mulhsw wg, wu, p4
addssw wg, wy, wg
addw wg, wy, wg
mulhsw wy, wv, p5
addssw wg, wg, wy
addw wg, wg, wy
convssswb r, wr
convssswb g, wg
convssswb b, wb
mergebw wr, r, g
mergebw wb, b, a
mergewl x, wr, wb
x4 addb argb, x, c128
.function video_orc_convert_I420_BGRA
.dest 4 argb guint8
.source 1 y guint8
@ -1214,22 +1212,21 @@ splatbw wv, r
mulhsw wy, wy, p1
mulhsw wr, wv, p2
addssw wr, wy, wr
addw wr, wy, wr
convssswb r, wr
mergebw wr, r, 127
mulhsw wb, wu, p3
addssw wb, wy, wb
mulhsw wg, wu, p4
addssw wg, wy, wg
mulhsw wy, wv, p5
addssw wg, wg, wy
convssswb r, wr
convssswb g, wg
addw wb, wy, wb
convssswb b, wb
mulhsw wg, wu, p4
addw wg, wy, wg
mulhsw wy, wv, p5
addw wg, wg, wy
convssswb g, wg
mergebw wb, b, g
mergebw wr, r, 127
mergewl x, wb, wr
x4 addb argb, x, c128