Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Upcoming plugins: call for testers
Started by StarCrunch Apr 11 2016 03:57 PM

5 replies to this topic
plugins threads gpu textures dynamic libraries
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 848 posts
  • Corona SDK

Hi!

 

This is a companion post to some in-development plugins I discussed during the first half or so of today's Corona Geek (EDIT: link):

 

 * luaffifb

 * luaproc

 * FreeImage

 * ArrayFire

 

We looked over some material related to the luaffifb and showed some quick examples of luaproc and FreeImage. It was really a spur-of-the-moment decision to bring up the idea of going over them, so I hope it was coherent.  :P

 

Anyhow, at least a couple of these are fairly niche, so I'm hoping to draw some users by putting them out there. In the first couple cases, I've basically got the plugin running on at least one system and would really just like to throw it at a few real-world cases. In the latter two, the project is still in the works but could also benefit from a little bit of direction.

 

A little about each:

 

* Lua FFI is a port of a key component in Mike Pall's amazing LuaJIT, allowing for fairly seamless interop (the eponymous Foreign Function Interface) between Lua code and binary libraries. At some point an intrepid developer used some of the building blocks to port it to stock Lua. He seemed to be making decent headway, then got tied up in day-to-day things. The library seemed to be in limbo.

 

The above-linked Facebook fork came to my attention just recently. If I'm following some of their discussions correctly, they use it as an alternative for Torch. (Some related comments on this thread. Speaking of Torch, I just discovered this today too.)

 

As we discuss on the show, I certainly don't see this as a replacement for Enterprise. Neither is it meant to displace plugins; indeed, I hope it encourages new uses of them!

 

At the moment this is Mac-only, as per what the project itself reports, though I certainly intend to update if and when that changes. Coincidentally, it looks like the project has just added a wiki, so more docs should be forthcoming.

 

The initial idea is to open up some already-available libraries, for instance those in Luapower, perhaps some of William Adams's and Dimiter Stanev's bindings, and plenty more. Almost unavoidably, this library isn't 100% LuaJIT-compatible, but it would be good to get some real-world test cases. So, if any FFI code in the wild looks inviting, I'd love you to give this a whirl and report back!

 

* luaproc is a multithreading library. It allows you to create bits of code that run independently (basically, in different Lua universes) along with a means of communicating among them.

 

I've been using this on Windows to run and interact with a second process, to make some 32- and 64-bit code talk to each other. Another obvious use case is that of heavy loading tasks that you can't break up, say by streaming in the texture or using coroutines.

 

I'd be interested in applications that might benefit from this. This should be portable.

 

Note that this is NOT intended for casual use, say for updating game state.

 

* FreeImage is a library that supports a huge list of image formats, as well as lots of operations on the images once loaded. Recently, some features have been added to Corona opening up the ability to load custom textures. So, putting the two together, this allows opening up all kinds of files.

 

This is a rather huge library, so I have limited hope of testing it well on my own. Anybody out there doing anything interesting with images?  :) This one also ought to be portable.

 

I've followed the FreeImagePlus library, though I'll be glad to add any stragglers from the more basic API as I come across them.

 

* ArrayFire is a library for doing (extremely) large numeric tasks, in the same vein as the earlier-mentioned Torch, that can take advantage of OpenCL and / or CUDA when available. A few of its APIs even use FreeImage, which was the motivation for choosing that versus a few other contenders.

 

I have this at least functional on OS X. This is 64-bit only, thus Windows is a bit iffy (it's the reason behind the 32-bit / 64-bit stuff above). Actually, I still need to augment the Lua side of the API quite a lot, so this would probably be awkward to try now, but all the same like to know of anybody out there who could put something like this to use.

 

*Pauses for breath*

 

Anyhow, if any of this sounds interesting, let me know, either in this thread or mailing steve at xibalbastudios dot com.



[TOPIC: post.html]
#2

remiduchalard

[GLOBAL: userInfoPane.html]
remiduchalard
  • Contributor

  • 306 posts
  • Corona SDK

Hi, it's very intersting.

On android and IOS someone has test the luaproc?



[TOPIC: post.html]
#3

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 848 posts
  • Corona SDK

Hi, @remiduchalard.

 

Iuaproc is now available, actually, as my first marketplace entry (for desktop, iOS, Android, and tvOS). Docs are here. Let me know if you'd like to preview it on desktop.

 

Out of curiosity, do you have any use cases in mind?

 

GENERAL UPDATES ON THE REST:

 

Functionally, the FFI library is basically ready, but I'm sitting on it until I'm confident it plays well with the plugin ecosystem.

 

FreeImage is pretty heavyweight and a bit low-level, so I've been devoting my attention lately to a smaller, more focused library, which should arrive in the marketplace relatively soon.

 

I got a bit stuck with FreeImage because various APIs were awkward in Lua (these might be obvious if you browse through the current docs). I think, with some of the things I've done since then, I could now go back and smooth much of that out, but of course it's a question of time. Anyhow, despite some crossover, these two will be independent plugins. (Of course, if marketplace bundles become available, offering them together seems like a no-brainer.)

 

It will probably be quite a while before I can give ArrayFire more love, though largely that's because I've been sinking considerable effort into making a more lightweight array / tensor-style object (along with some related libraries) in the same vein, but one that can hit the non-desktop platforms as well. Lots of good research, iteration, implementation, and redesign out of the way, lots more left to do!  :)



[TOPIC: post.html]
#4

remiduchalard

[GLOBAL: userInfoPane.html]
remiduchalard
  • Contributor

  • 306 posts
  • Corona SDK

For luaproc, I would like to reduce loading time. And put in different thread some enterframe event who are heavy

I had problem on mediatek (and not on qualcom) with enterframe and other event. If a lot of event write in the same table at the same moment (exemple: table[#table+1]=x) there is a lot of event who write in the same row. And I want to know limit of the luaproc on every system (android, windows, IOS) and architecture (arm,x86) and mediateck,qualcom, samsung...

Do you know if there is a plugin who can load image and choose for png the number of bit (8bit, 16bit and 32 bit)



[TOPIC: post.html]
#5

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 848 posts
  • Corona SDK

Well, unfortunately I don't have a huge inventory of devices, so I don't have a big list of timing info on hand. (Maybe the plugin QA guys would know, though I'd be surprised if they decided to take notes. :)) But in all my usage the processes have been running smoothly in tandem with Corona's main thread, which was the principal goal. (I might send you a PM later about some of this stuff, by the way.)

 

If you're simply stuffing items one by one into tables--more specifically, if you're only doing basic Lua calls, but an immense number of them--you might not see any advantage over a coroutine-based solution. The big improvements would come if you can load multiple batches simultaneously and / or have to wait a lot for file I/O and / or you now have some free time to do important work in enterFrame while the process(es) crunches away.

 

With respect to PNG files, do you mean bits-per-pixel (monochrome, monochrome + alpha, RGB, RGBA) or bits-per-component? FreeImage will pretty much support everything (scan fipImage's doc for some idea), whereas impack's underlying machinery has some limitations for bits-per-component (see the beginning of its image module's doc; I'm not even aware of 32-bits as an option...).

 

Assuming I haven't broken anything, I'm also writing these image libraries so that you can run them from a luaproc process, e.g. for more expensive image decodes. Then, since they give you byte streams (strings), you can just pass them back to Corona. I've made another (free) plugin that I hope to release around the same time that you can populate from these bytes.



[TOPIC: post.html]
#6

sierramanagement

[GLOBAL: userInfoPane.html]
sierramanagement
  • Enthusiast

  • 63 posts
  • Corona SDK

StarCrunch, on 04 Nov 2017 - 1:18 PM, said:

snapback.png

Hi.

 

It might be possible to do this with a plugin I've been taking my sweet time submitting: luaffifb

 

This provides a "foreign function interface" (FFI): it lets you import public functions from dynamic libraries into Lua, from Lua. (Desktop-only at the moment, alas; I have a seemingly functional Windows port.) The steps you seem to need look like they might be exposed in luapower's objc library. (Likewise Windows.) I don't know the API much at all, but I imagine you have to discover the current window somehow and then go to town.

 

If you're brave you could give it a shot, with my most recent binaries. Drop the appropriate one on your platform in the folder indicated by the following:

print(system.pathForFile("plugin", system.PluginsDirectory))

and then do

local ffi = require("plugin.ffi")

The FFI basically adheres to the LuaJIT documentation, subject to the provisos mentioned in the plugin page above, though digging into the luapower examples might be informative as well.

 

(As I've mentioned elsewhere in the past, the big holdup submission-wise has been the need to sit down and try out various FFI modules to see if luaffifb is adequate, rather than needing LuaJIT proper. I assume it had to meet a high bar for Facebook to use it with Torch, but it won't hurt to check. That will probably tease out some decent samples, at any rate. I'd gladly include a working window resize example.  :) Or any other contributions, of course.)

 

Of course, I offer the above as an alternative to using native code directly, which is another choice.

Can you please post example  (for Mac) 




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: plugins, threads, gpu, textures, dynamic libraries