GNOME Bugzilla – Bug 761851
video: add orc UYVY422 to GRAY8 conversion function
Last modified: 2016-02-27 01:17:40 UTC
Created attachment 320855 [details] [review] gst-plugins-base patch This is the same as in ticket 569655 but now for video-converter. !!Obs I put in this little change in gst-plugins-base/gst-libs/gst/video/video-orc.orc .function video_orc_convert_UYVY_GRAY8 .flags 2d .dest 1 d guint8 .source 1 s guint8 ldresnearb d, s, 0x10000, 0x20000 Then I do orcc --implementation video-orc.orc -o video-orc-dist.c orcc --implementation video-orc.orc -o tmp-orc.c orcc --header video-orc.orc -o video-orc-dist.h orcc --header video-orc.orc -o video-orc.h I use orc that I clone some days ago. commit e0d39f67ca8c22af3923ed886a313c0052708f8f Author: Sebastian Dröge <sebastian@centricular.com> Date: Wed Dec 30 20:52:58 2015 +0200 ,,,, This causes that all the files video-orc-dist.c tmp-orc.c video-orc-dist.h video-orc.h Loses the line #include <glib.h> So this causes build errors when building gst-plugins-base with make. ( I added the include again as seen in attached patch ) Also massive (1000:s of lines ) code changes in video-orc-dist.c take place as you can see in patch. I suppose I have done something wrong but I don't know what can you tell me what I do wrong ? My guess is I using wrong version of orc or I should use some options to orcc. Regards Göran Jönsson
Try 'make orc-update' in gst-libs/gst/video/ after your changes.
Created attachment 320859 [details] [review] new gst-plugins-base patch The problem with the #include disappear, but there are still format changes in video-orc-dist.c but not so many as before.
Created attachment 320863 [details] [review] new gst-plugins-base patch New patch without video-orc-dist.c and video-orc-dist.h
Comment on attachment 320863 [details] [review] new gst-plugins-base patch >+.function video_orc_convert_UYVY_GRAY8 >+.flags 2d >+.dest 1 d guint8 >+.source 1 s guint8 >+ >+ldresnearb d, s, 0x10000, 0x20000 Could you explain how that works? Does that actually work for you? What's the output of: ORC_DEBUG=2 gst-launch-1.0 videotestsrc num-buffers=1 pattern=red ! video/x-raw,format=UYVY,width=4,height=4 ! videoconvert ! video/x-raw,format=GRAY8 ! fakesink dump=true
>+.function video_orc_convert_UYVY_GRAY8 >+.flags 2d >+.dest 1 d guint8 >+.source 1 s guint8 >+ >+ldresnearb d, s, 0x10000, 0x20000 Generates +#ifdef DISABLE_ORC +void +video_orc_convert_UYVY_GRAY8 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) +{ + int i; + int j; + orc_int8 *ORC_RESTRICT ptr0; + const orc_int8 *ORC_RESTRICT ptr4; + orc_int8 var32; + + for (j = 0; j < m; j++) { + ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); + ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); + + + for (i = 0; i < n; i++) { + /* 0: ldresnearb */ + var32 = ptr4[(65536 + i * 131072) >> 16]; + /* 1: storeb */ + ptr0[i] = var32; + } + } + +} If look at var32 = ptr4[(65536 + i * 131072) >> 16]; => var32 = ptr4[(0x10000 + i * 0x20000) >> 16]; => var32 = ptr4[(0x10000 + i * 0x20000)/ 0x10000]; => var32 = ptr4[(1 + i * 2)];
Surely there are easier ways to do this without the ldresnearb op?
Do it all in one instruction is easy I will say, but the last word will be yours of course. Do you want me to implement something different ? Or maybe I should commented it for better readability ? When I run ORC_DEBUG=2 installation/bin/gst-launch-1.0 videotestsrc num-buffers=1 pattern=red ! video/x-raw,format=UYVY,width=4,height=4 ! videoconvert ! video/x-raw,format=GRAY8 ! fakesink dump=true I got ORC: WARNING: orccompiler.c(392): orc_program_compile_full(): program video_orc_convert_UYVY_GRAY8 failed to compile, reason: no code generation rule for ldresnearb on target sse Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock 00000000 (0x190e8b0): 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 QQQQQQQQQQQQQQQQ Got EOS from element "pipeline0". Execution ended after 0:00:00.000071883 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... Maybe the print ORC: WARNING: orccompiler.c(392): orc_program_compile_full(): program video_orc_convert_UYVY_GRAY8 failed to compile, reason: no code generation rule for ldresnearb on target sse gives another reason for not using ldresnearb ?
I think it would be better to implement it differently, seeing that ldresnearb is not implemented for any backend currently.
I tryed this code but it will not compile .function video_orc_convert_UYVY_GRAY8 .flags 2d .dest 1 d guint8 .source 1 s guint8 .accumulator 4 a glong .temp 1 t1 accl a,1 loadoffb t1, s, a storeb d,t1 accl a,1 output when compile, Failed to compile no orc for 'video_orc_convert_UYVY_GRAY8' Failed to compile backup code for 'video_orc_convert_UYVY_GRAY8'
.function video_orc_convert_UYVY_GRAY8 .flags 2d .dest 1 d guint8 .source 1 s guint8 .accumulator 4 a glong .temp 1 t1 accl a,1 loadoffb t1, s, a storeb d,t1 output when compile, Failed to compile no orc for 'video_orc_convert_UYVY_GRAY8' Failed to compile backup code for 'video_orc_convert_UYVY_GRAY8'
Skip that I have another idea.
Created attachment 322441 [details] [review] new gst-plugins-base patch New patch for review.
commit b424712644363288405c911d22b5d028d174db23 Author: Tim-Philipp Müller <tim@centricular.com> Date: Sat Feb 27 00:11:02 2016 +0000 video: update disted orc backup file https://bugzilla.gnome.org/show_bug.cgi?id=761851 commit babcf4d30cf84f9f2c849ae309932e136ba37e4c Author: Göran Jönsson <goranjn@axis.com> Date: Thu Feb 11 11:27:57 2016 +0100 video-converter: add direct UYVY to GRAY8 conversion function https://bugzilla.gnome.org/show_bug.cgi?id=761851