From d5b8add8bc0168cfbf8c4b33386100abbd21e2ec Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 28 Mar 2016 11:39:24 +0200 Subject: some experiments --- gst-libs/gst/audio/gstaudiopack.orc | 56 ++++++++++++++++++++++++++++++++++++ gst-libs/gst/video/video-converter.c | 29 +++++++++++-------- gst-libs/gst/video/video-orc.orc | 45 ++++++++++++++++++++++++++--- tests/check/Makefile.am | 14 ++++----- 4 files changed, 121 insertions(+), 23 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiopack.orc b/gst-libs/gst/audio/gstaudiopack.orc index c13a688ce..e7bf3aa79 100644 --- a/gst-libs/gst/audio/gstaudiopack.orc +++ b/gst-libs/gst/audio/gstaudiopack.orc @@ -423,3 +423,59 @@ divd d1, t1, 2147483648.0L muld t1, s1, 2147483648.0L convdl d1, t1 +.function audio_orc_v_linear_s16 +.dest 2 d gint16 +.source 2 s1 gint16 +.source 2 s2 gint16 +.param 2 p1 +.param 2 p2 +.temp 2 t1 +.temp 4 t2 +.temp 4 t3 + +mulswl t1, s1, p1 +mulswl t2, s2, p2 +addl t1, t1, t2 +addl t1, t1, 16384 +shrsl t1, t1, 15 +convlw d, t1 + +.function audio_orc_v_linear_s32 +.dest 4 d gint32 +.source 4 s1 gint32 +.source 4 s2 gint32 +.param 4 p1 +.param 4 p2 +.temp 8 t1 +.temp 8 t2 + +mulslq t1, s1, p1 +mulslq t2, s2, p2 +addq t1, t1, t2 +addq t1, t1, 1073741824 +shrsq t1, t1, 15 +convql d, t1 + + +.function audio_orc_v_linear_f32 +.dest 4 d gfloat +.source 4 s1 gfloat +.source 4 s2 gfloat +.param 4 p1 +.temp 4 t1 + +subf t1, s1, s2 +mulf t1, t1, p1 +addf d, t1, s2 + +.function audio_orc_v_linear_f64 +.dest 8 d gdouble +.source 8 s1 gdouble +.source 8 s2 gdouble +.param 8 p1 +.temp 8 t1 + +subd t1, s1, s2 +muld t1, t1, p1 +addd d, t1, s2 + diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index f29278d02..9f036ce01 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -937,17 +937,17 @@ videoconvert_convert_init_tables (MatrixData * data) gint64 r = 0, g = 0, b = 0; for (j = 0; j < 3; j++) { - r = (r << 16) + data->im[j][0] * i; - g = (g << 16) + data->im[j][1] * i; - b = (b << 16) + data->im[j][2] * i; + r = (r << 16) + data->im[2 - j][0] * i; + g = (g << 16) + data->im[2 - j][1] * i; + b = (b << 16) + data->im[2 - j][2] * i; } - data->t_r[i] = r; - data->t_g[i] = g; - data->t_b[i] = b; + data->t_r[i] = r << 16; + data->t_g[i] = g << 16; + data->t_b[i] = b << 16; } - data->t_c = ((gint64) data->im[0][3] << 32) - + ((gint64) data->im[1][3] << 16) - + ((gint64) data->im[2][3] << 0); + data->t_c = ((gint64) data->im[2][3] << 48) + + ((gint64) data->im[1][3] << 32) + + ((gint64) data->im[0][3] << 16); } void @@ -1000,6 +1000,10 @@ video_converter_matrix8 (MatrixData * data, gpointer pixels) static void video_converter_matrix8_table (MatrixData * data, gpointer pixels) { +#if 1 + video_orc_matrix8_table (pixels, pixels, data->t_r, data->t_g, data->t_b, + data->t_c, data->width); +#else gint i, width = data->width * 4; guint8 r, g, b; gint64 c = data->t_c; @@ -1013,10 +1017,11 @@ video_converter_matrix8_table (MatrixData * data, gpointer pixels) x = data->t_r[r] + data->t_g[g] + data->t_b[b] + c; - p[i + 1] = x >> (32 + SCALE); - p[i + 2] = x >> (16 + SCALE); - p[i + 3] = x >> (0 + SCALE); + p[i + 1] = x >> (16 + SCALE); + p[i + 2] = x >> (32 + SCALE); + p[i + 3] = x >> (48 + SCALE); } +#endif } static void diff --git a/gst-libs/gst/video/video-orc.orc b/gst-libs/gst/video/video-orc.orc index 60d7c95d1..185e0403b 100644 --- a/gst-libs/gst/video/video-orc.orc +++ b/gst-libs/gst/video/video-orc.orc @@ -908,7 +908,7 @@ ldreslinl d1, s1, p1, p2 .dest 1 d1 .source 1 s1 .source 1 s2 -.param 1 p1 +.param 2 p1 .temp 2 t1 .temp 2 t2 .temp 1 a @@ -1663,6 +1663,7 @@ x4 addb argb, x, c128 .temp 1 b .temp 4 x .const 1 c128 128 +.const 1 c1284 128 subb r, y, c128 splatbw wy, r @@ -1693,7 +1694,7 @@ convssswb g, wg mergebw wb, b, g mergewl x, wb, wr -x4 addb argb, x, c128 +x4 addb argb, x, c1284 .function video_orc_matrix8 .backup _custom_video_orc_matrix8 @@ -1751,6 +1752,41 @@ x4 addw aq, aq, q1 x4 convssswb ayuv2, aq x4 addb ayuv, ayuv2, c128 +.function video_orc_matrix8_table +.dest 4 d1 +.source 4 s1 +.source 8 t_r gint64 +.source 8 t_g gint64 +.source 8 t_b gint64 +.param 8 c +.temp 2 tw1 +.temp 2 tw2 +.temp 1 tba +.temp 1 tbr +.temp 1 tbg +.temp 1 tbb +.temp 8 tq1 +.temp 8 tq2 +.temp 8 tq3 +.temp 4 tla +.temp 4 tl1 + +andl tla, s1, 0xff +select0lw tw1, s1 +select1wb tbr, tw1 +select1lw tw2, s1 +select0wb tbg, tw2 +select1wb tbb, tw2 +transbq tq1, tbr, t_r +transbq tq2, tbg, t_g +transbq tq3, tbb, t_b +addq tq1, tq1, tq2 +addq tq1, tq1, tq3 +addq tq1, tq1, c +x4 convhwb tl1, tq1 +orl d1, tl1, tla + + #.function video_orc_resample_h_near_u32 #.source 4 src guint32 #.source 4 idx @@ -1782,7 +1818,8 @@ ldreslinb d1, s1, p1, p2 .param 4 p1 .param 4 p2 -ldreslinl d1, s1, p1, p2 +#ldreslinl d1, s1, p1, p2 +x4 ldreslinb d1, s1, p1, p2 .function video_orc_resample_h_2tap_u8_lq .source 1 s1 guint8 @@ -2154,7 +2191,7 @@ addl d, d, t1 .function video_orc_resample_v_multaps_u16 .source 2 s guint16 -.param 2 t gint16 +.param 4 t gint32 .dest 4 d gint32 .temp 4 l1 diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index ed1d02654..245555480 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -658,25 +658,25 @@ pipelines_simple_launch_lines_LDADD = \ $(GST_BASE_LIBS) \ $(LDADD) -orc_video_CFLAGS = $(ORC_CFLAGS) -orc_video_LDADD = $(ORC_LIBS) -lorc-test-0.4 +orc_video_CFLAGS = $(ORC_CFLAGS) $(GLIB_CFLAGS) +orc_video_LDADD = $(ORC_LIBS) -lorc-test-0.5 nodist_orc_video_SOURCES = orc/video.c orc_audio_CFLAGS = $(ORC_CFLAGS) -orc_audio_LDADD = $(ORC_LIBS) -lorc-test-0.4 +orc_audio_LDADD = $(ORC_LIBS) -lorc-test-0.5 nodist_orc_audio_SOURCES = orc/audio.c orc_adder_CFLAGS = $(ORC_CFLAGS) -orc_adder_LDADD = $(ORC_LIBS) -lorc-test-0.4 +orc_adder_LDADD = $(ORC_LIBS) -lorc-test-0.5 nodist_orc_adder_SOURCES = orc/adder.c orc_volume_CFLAGS = $(ORC_CFLAGS) -orc_volume_LDADD = $(ORC_LIBS) -lorc-test-0.4 +orc_volume_LDADD = $(ORC_LIBS) -lorc-test-0.5 nodist_orc_volume_SOURCES = orc/volume.c orc_videotestsrc_CFLAGS = $(ORC_CFLAGS) -orc_videotestsrc_LDADD = $(ORC_LIBS) -lorc-test-0.4 +orc_videotestsrc_LDADD = $(ORC_LIBS) -lorc-test-0.5 nodist_orc_videotestsrc_SOURCES = orc/videotestsrc.c orc/video.c: $(top_srcdir)/gst-libs/gst/video/video-orc.orc $(MKDIR_P) orc/ - $(ORCC) --test -o $@ $< + $(ORCC) --test --include glib.h -o $@ $< orc/audio.c: $(top_srcdir)/gst-libs/gst/audio/gstaudiopack.orc $(MKDIR_P) orc/ -- cgit v1.2.3