I need to write an external for LiveCode in C++, but I doubt my ability to do it.

Jonathan Lynch jonathandlynch at gmail.com
Sun Mar 6 18:36:52 EST 2016


A green-screen extraction on a large image requires millions of
calculations. I am not using a flood-fill based extraction, so that helps a
bit, but it still requires looking at every single pixel and checking to
see if the colors are within a certain range. I want to improve the
algorithm, so that it uses both a color-range comparison and a hue
comparison. Colors that are outside of the color-range comparison but
within the hue comparison probably have splashback from the green screen,
and I could remove some of the green from those pixels - maybe cut the
green component of the pixel in half or something like that.

So, well, that is a whole ton of calculations right there. I really worked
to optimize it in LC, but those optimizations only made a small difference.
An interpreted language would be very unlikely to come close in speed on
raw numerical comparisons like that. From what I understand, even LCB is
more like Java than like C++, so it might be a bit faster than LC, but not
in the range I need. Don't quote me on that.

In general, LC is supposed to be able to to be extended with externals. In
practical terms, this means it should work with the current version of
Visual Studio. I don't have much C++ experience. I was hoping to just
trudge through setting up the external so that I could focus on the
algorithm. Instead, I could not even use the tutorial.

I will try to find a way, though. I am just hoping for advice so that I can
avoid any more blind alleys.

Thanks,

J



On Sun, Mar 6, 2016 at 5:49 PM, Roland Huettmann <roland.huettmann at gmail.com
> wrote:

> But I would also appreciate a reply, maybe from Peter, which is of general
> interest to all of us.
>
> Optimizing is one possibility, then the question about what would LC
> Builder accomplish, and then C++, if nothing else does the job fast enough?
>
> I am thinking about some optimisation algorithms which are already
> available in C++ and would probably execute not well enough in LCS.
>
> Roland
>
> On Sun, Mar 6, 2016, 23:10 Phil Davis <revdev at pdslabs.net> wrote:
>
> > Hi Jonathan,
> >
> > I would start by seeing if your LC code can be optimized so the time it
> > takes per screen is acceptable. There are many small changes a person
> > can sometimes make to code that causes dramatic speed increases.
> >
> > Or is the bulk of the time spent in areas LC can't address natively?
> > Maybe that's why you want to go toward an external.
> >
> > Thanks -
> > Phil Davis
> >
> >
> > On 3/6/16 1:55 PM, Jonathan Lynch wrote:
> > > Hello fellow LiveCoders,
> > >
> > > I need to write an external and it needs to be fast. It is for
> extracting
> > > images from a green screen. I wrote a good algorithm for this in
> > LiveCode,
> > > but it takes 20-30 seconds to handle all of the data processing. I want
> > to
> > > use C++ for speed advantages.
> > >
> > > I tried following the desktop externals tutorial that LiveCode uses,
> but
> > it
> > > seems that the external generator that LiveCode offers does not work
> > > properly with Visual Studio 2015.
> > >
> > > Should I try to find a free version of VS 2010? Should I try to fix the
> > C++
> > > library files so that they work with VS 2015? Is there some other very
> > fast
> > > compiled language, like Fortran, that I should try?
> > >
> > > I welcome any advice on how to do this.
> > >
> > > Thanks,
> > >
> > > Jonathan
> > >
> > >
> > >
> >
> > --
> > Phil Davis
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Do all things with love



More information about the use-livecode mailing list