[emphatic] Wish List

Posted by: tonyc

[emphatic] Wish List - 29/07/2004 01:40

Please post any new feature requests or general wishes for emphatic in this thread.
Posted by: tfabris

Re: [emphatic] Wish List - 29/07/2004 04:43

My only wish at the moment is to have every song in my collection SYLT-tagged. And with the ease of the new SYLT plugin and LRCDB, that's something that could theoretically happen now.

A long time ago, I said that my head would explode if I saw scrolling lyrics on the empeg screen. Well, I'm well past the Go Boom stage, but I still just sit back and think "how cool is this?" every time I see it. Of course having Toby's visuals blended behind those lyrics is grounds for complete spontaneous combustion.

I can't imagine anything more geek-perfect than this. It just doesn't get any better. Excellent work, man.
Posted by: mcomb

Re: [emphatic] Wish List - 29/07/2004 17:53

Quote:
It just doesn't get any better.

Hmm, well I'd like to see emphatic use less CPU, scroll smoother (when overlaid on a visual), and start automatically rather than requiring you to select it from the hijack menu. Thats not to say it isn't pretty damn cool as is.

-Mike
Posted by: tonyc

Re: [emphatic] Wish List - 29/07/2004 18:00

Less CPU and smooth scrolling go hand in hand, don't they? How are those different issues? Try turning off the "burnin" effect in the XML file. That uses a TON of CPU. If you're still not happy with scroll speed, then it won't get any better, because the player gets CPU when it wants it. Without the burnin effect, CPU usage for me is typically 5% or less, even with visuals in the background.

As for starting automatically, I believe that belongs in the Hijack wish list, not mine.
Posted by: wfaulk

Re: [emphatic] Wish List - 29/07/2004 18:12

Quote:
scroll smoother
scroll more smoothly.

Sorry. I'm on a kick today for some reason.
Posted by: tfabris

Re: [emphatic] Wish List - 29/07/2004 18:53

Quote:
Try turning off the "burnin" effect in the XML file. That uses a TON of CPU.


Yeah, but it looks SO COOL.

Speaking of which, if anyone has got access to a good fast algorithm for doing that trick (bitmap A overlaid atop bitmap B, draw a black outline around all non-transparent pixels in bitmap A), please share it.

When TonyC was developing it, we discussed the brute-force method he was using to do that trick and I was sure there had to be a faster way to get the job done that wouldn't require so many if/then tests. Unfortunately my feeble little brain couldn't come up with any alternatives, nor could I find an example to convince him that a faster algorithm must exist somewhere. But in my heart of hearts, I just KNOW there's gotta be a faster way to do it.

Tony, wanna post a brief description of your current method?
Posted by: tonyc

Re: [emphatic] Wish List - 29/07/2004 19:21

Quote:

Tony, wanna post a brief description of your current method?


Okay. I'm merging the foreground (text) with the background (player screen.) It's basically 4 nested for() loops, the innermost two of which can short-circuit if we decide that the current pixel we'll be working on needs to be "burned in" (set to black.)

The loops are, basically:

for each row in the text (foreground) bitmap
for each column in the text (foreground) bitmap
for (one column to the left, this column, one column to the right)
for (one row above, this row, one row below)

The innermost two make up 9 total iterations per pixel in the image, but we don't do anything with the middle pixel. Within these loops, the algorithm is basically "if any one of the eight surrounding pixels in the foreground is not black, make this pixel in the background black, and if we do that, short-circuit the rest of the loops." So best-case is 4096 full loop iterations, worst-case is 32,768 (4096 * 8.)

If anyone can think of a simpler way, by all means share it (and feel free to send a patch.)
Posted by: tonyc

Re: [emphatic] Wish List - 29/07/2004 19:29

Relevant source code attached.
Posted by: tfabris

Re: [emphatic] Wish List - 29/07/2004 20:14

Ah, right, I remember now. Cool.

My thinking was that you're looping the WORST on things that never get set to black. In other words, your algorithm uses up more CPU the less text there is in the foreground layer. One word by itself on the screen uses up more CPU than a dense paragraph of text.

Since the text is usually fewer pixels than the bacground, my thinking was that it'd make more sense to do it the other way round, not doing an inner loop until you hit some lit text in the foreground layer.

There's gotta be a way where you scan through the pixels looking for the lit text in the foreground layer, and only THEN do your little circle around that pixel looking for transparent pixels and marking the black spots onto the background layer where the foreground is NOT lit. The trick is coming up with a simple system whereby you can short-circuit that inner loop the most efficiently so that you're not re-blacking stuff that's already been blacked. Looking at the problem from that angle, I keep telling myself there's gotta be a way to do that efficiently and shortcut a lot of the brute force work.

Or, perhaps there's a totally lateral-thinking way of getting the same effect without having to iterate through every single pixel. That'd be the real win, and there's so many examples of this kind of thing in other fields (edge-finding algorithms in paint programs, chroma-key applications in digital video), that there's gotta be some prior art which shows how to do it. There's just gotta be. I have no idea where, but hopefully someone else here on the board would know.
Posted by: mlord

Re: [emphatic] Wish List - 29/07/2004 20:52

Quote:
As for starting automatically, I believe that belongs in the Hijack wish list, not mine.

Hijack v403: ;@MENUEXEC menu_label command args optional_ampersand

Posted by: tonyc

Re: [emphatic] Wish List - 29/07/2004 21:17

Quote:
Quote:
As for starting automatically, I believe that belongs in the Hijack wish list, not mine.

Hijack v403: ;@MENUEXEC menu_label command args optional_ampersand



Cool. Is there any way to have the apps automatically foreground as if it was selected from the menu? That's kinda what I was looking for.
Posted by: mlord

Re: [emphatic] Wish List - 29/07/2004 22:34

Hijack doesn't attempt to deal with handing the screen to the apps right now -- can the app instead simply grab the screen at startup? Oh, wait.. we don't have an ioctl for that..

Gimme a few more minutes..
Posted by: mlord

Hijack v405: new TAKEOVER ioctl for apps - 29/07/2004 23:08

Okay, Hijack v405 is out.

The only change is a new untested ioctl() call that apps can use to immediately takeover the display/buttons, as if they'd just been selected from a menu, but without the need to bind to the menu (in fact, crazy things could happen if they DID bind to the menu first.. or not.. haven't thought about it much).
Code:
if (0 == ioctl(fd, EMPEG_HIJACK_TAKEOVER, NULL)) {
// success, we now own the display
} else {
// probably got EINTR, or some other error
}


The practical use of this new ioctl is in combination with the v403 ;@MENUEXEC feature, so that ;@MENUEXEC can be used to select/activate the app from scratch, and the app then invokes EMPEG_HIJACK_TAKEOVER to foreground itself on startup.

If another app already has the display (in use), then EMPEG_HIJACK_TAKEOVER will block until the first app releases the display.

Cheers
Posted by: mlord

Re: Hijack v406: bugfix for TAKEOVER ioctl - 29/07/2004 23:11

Hijack v406 will be out Real Soon Now, fixing a slight logic error on the new TAKEOVER ioctl.

-ml
Posted by: tonyc

Re: Hijack v406: bugfix for TAKEOVER ioctl - 29/07/2004 23:36

While you're in a giving mood, care to give me an ioctl which blocks until the player's finished starting up? Or can you detect that? (By start up, I mean it's gone through the "reading databases" and all that stuff.)

Problem is, my app starts up and calls TAKEOVER (which works great in v406, BTW) and wants to change info modes, but the player isn't ready to accept button presses yet. My other alternative is sleeping for some period of time, but that's hokey.
Posted by: mlord

Re: Hijack v406: bugfix for TAKEOVER ioctl - 29/07/2004 23:41

Well, internally Hijack has a concept of "player started", but I don't recall how it treats poweron->standby.

I'll stick a waitq and ioctl onto it for you, and you can play with it.

EMPEG_HIJACK_WAIT_FOR_PLAYER

Cheers
Posted by: mlord

Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 29/07/2004 23:55

Another new ioctl() call for use from apps. This one pauses the app until the player is deemed "started" by Hijack. No effect if player was already up and running.

-ml
Posted by: mlord

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 29/07/2004 23:58

Okay. v407 is now up on the server.

-ml
Posted by: tonyc

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 30/07/2004 00:13

WAIT_FOR_PLAYER works very well.

I'm a little confused about using TAKEOVER though. It works, but if I quit my app (call WAITMENU with NULL) my program exits, but the screen is frozen (i.e. the player buffer doesn't go back to the foreground.) I think I understand why (I didn't originally call WAITMENU to bind to the menu to begin with.) Any way around this? Maybe some operation that's the inverse of TAKEOVER and explicitly hands control back to the player or the hijack menu? I guess my problem is I'd like to TAKEOVER in the beginning, but I'd like to give the user the option to close my app temporarily (leaving it running and available in the Hijack menu) which I presently accomplish using the WAITMENU ioctl. Can these two play nicely together?
Posted by: mlord

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 30/07/2004 00:21

I think I can fix TAKEOVER so that a WAITMENU(NULL) works correctly -- v408 shortly.
Posted by: mlord

Hijack v408. - 30/07/2004 00:27

Fixed.
Posted by: tonyc

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 30/07/2004 00:33

Any way to fix it so that I can start with TAKEOVER but then bind to the menu? i.e. logic like this (apologies for slacker pseudocode syntax)

Code:

WAIT_FOR_PLAYER
TAKEOVER

while (!quit)
{
while (!hide)
{



}
WAITMENU(menulabels) // to bind to the hijack menu
}
WAITMENU(NULL) // to quit

Posted by: mcomb

Re: [emphatic] Wish List - 30/07/2004 00:38

Quote:
Less CPU and smooth scrolling go hand in hand, don't they? How are those different issues?

In practice they may be, but I wasn't sure if the scrolling smoothness was strictly due to CPU load or some other limited resource (how quickly the screen can be refreshed or how quickly a non-realtime process can grab control of it as examples).

The complaint about CPU load was more in reference to how emphatic seems to slow down the player. Trying to skip a track with emphatic running (with burnin on at least) and visuals going causes a couple seconds of dropped audio on my player.

These may not be things that are possible to fix, but the thread title is "Wish List"

-Mike
Posted by: mlord

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 30/07/2004 00:48

Just do a WAITMENU(NULL) before the first WAITMENU(non-NULL).

-ml
Posted by: tonyc

Re: Hijack v407: EMPEG_HIJACK_WAIT_FOR_PLAYER - 30/07/2004 01:13

Quote:
Just do a WAITMENU(NULL) before the first WAITMENU(non-NULL).

-ml


Perfect! As if it needed restating, you are the man.
Posted by: tfabris

Re: [emphatic] Wish List - 30/07/2004 20:56


Couple of unrelated wishes...

------ Emphatic wish: -------

Have some sort of a file, most likely XML, which you do NOT supply in the emphatic distribution, which can contain overrides to the current XML file. In this file, I could place my own personal customizations that are above and beyond the default settings supplied with the "factory" distribution.

For instance, if I want to customize one of the visual modes, or change the exit_visual and exit_info settings, currently I must do so by editing the main "emphatic.xml" file directly.

This means that if you do a new release of emphatic with new visual modes in the main XML file, then I must merge my changes into your new file before placing it on the player.

But if I had my own override file, and it contained ONLY the things I wanted to be different from your XML file, then updates of the original XML wouldn't be a pain to install.

Please forgive me if this feature already exists and I just missed it.


------ LrcDB wish: --------

A link I can click on that would let me see a single list containing all the songs I have submitted.

Again, if this exists already and I just missed it, my apologies.
Posted by: tfabris

Re: [emphatic] Wish List - 30/07/2004 21:07

Oh, Tony, while watching a lyric scroll by, I had an epiphany about the CPU usage with the burnin feature.

Are you recalculating the burnin pixels for every frame?

The text doesn't change nearly as many times per second as the visual does. If the burnin pixels and/or text were somehow stored in a third buffer (perhaps using an intermediate pixel value as the value for transparancy), and just the buffer-overlay-onto-background operation happened every frame, then you'd only need to rewrite the buffer when the foreground layer changed (say, when the user presses a button, or when the time index counter rolls over and you draw a time, etc.).

This means the burnin code would eat a lot less CPU. It would still make a stutter when it *did* run, it just wouldn't happen every frame any more.
Posted by: newguy1

Re: [emphatic] Wish List - 02/08/2004 01:11

Is it possible to mark a track and apply a value other than marked? Similar to how the song rating feature works,select mark and then choose 1,2,3 a,b,c or whatever to mean different things.Such as A=lyric errors, B=encoding errors,C=delete track

Also the ability to see the new mark meaning in emplode or jemplode
Posted by: tonyc

Re: [emphatic] Wish List - 02/08/2004 01:58

Quote:
Is it possible to mark a track and apply a value other than marked?

Yes. Well, sort of. There's only one bit set aside for "marked" in the dyndata partition, but I could write to another unused byte there and interpret the value for different marked flags.
Quote:
Also the ability to see the new mark meaning in emplode or jemplode

This is the problem, and what kept me from implementing multiple mark flags when I first thought of your idea. I have no way to get these special mark flags over to emplode or jEmplode. I think it'd require a change to the empeg sync protocol to get it over there... So wouldn't be very useful to just have them on the empeg.
Posted by: genixia

Re: [emphatic] Wish List - 02/08/2004 04:19

Hmm...You could try the following;

Create 2 copies of the text buffer.
Shift copy A 1 pixel right and add it pixelwise to B.
A down and add to B,
A Left, add to B.
A Left, add to B
A Up, add to B
A Up, add to B
A Right, add to B
A Right, add to B.

8 * 4096 = 32768 integer additions per screen (fast). Anything non-zero in B is to be burned, so that adds 4096 simple compares per screen.

Hmm. Quick gimp mock up, achieved by manually following the above process with multiple offset layers in 'lighten' mode.



Note that I inverted the original to show the contrast. In reality the mask ends up inverted against the background image and the original stays non-inverted. I suppose I could have imported a visual background and done it right, but I couldn't be bothered.
Posted by: tfabris

Re: [emphatic] Wish List - 02/08/2004 05:31

I could swear I'd thought of doing that and then something in my head told me it wouldn't work, that somehow it wouldn't do the same kind of outline. Either that or it some how ended up using the same amount of CPU. But from what you're showing there, it looks like it works, the outlines look like the exact same thing, and from what you're saying, it would theoretically use less CPU. So why had I discounted the idea before? Anyway, that's pretty cool and I hope it's something Tony can use!

By the way: You know you've used bitmap editors too much when you see a screenshot like that, and your brain automatically fillis in the animation of the dotted selection outlines. I kept thinking I saw them move out of my peripheral vision.
Posted by: tonyc

Re: [emphatic] Wish List - 02/08/2004 16:05

Cool. I think I'll try either this or the "save the mask and only update the mask when the foreground changes" idea sometime soon.
Posted by: tfabris

Re: [emphatic] Wish List - 02/08/2004 16:44

Or both.
Posted by: genixia

Re: [emphatic] Wish List - 03/08/2004 16:58

I've been studying your code and thinking more about the problem.

It may not be quite as straightforward as I originally thought as I had forgotten about the 2 pixels per byte packing.
Code:

{
fy = iy + py;
fx = ix + px;
if ( fy < 0 || fy >= EMPEG_SCREEN_ROWS || fx < 0 || fx >= EMPEG_SCREEN_COLS )
continue;
if ( px == 0 && py == 0 )
continue;

n = 64 * fy + fx / 2;



This kills you because you hit it (or its sister) every time until done=1. An immediate obvious improvement would be to shift the "if ( px == 0 && py == 0 )" test up a few lines so that you can avoid the two additions and tortuous bounds test for that pixel. The real killer is the bounds test - it only has any effect for 318 out of 4096 pixels, yet you have to do the 4 comparisons every time.

This is something that I hope my method will avoid. By doing the 8 additions sequentially in turn, each addition could be bounded within the 'for' loops.

However, your algorithm only has to deal with the buffer packing problem once per pixel when you burn the bg buffer, or 4096 times per screen refresh. My solution would require this to be done for every addition...ie in the order of 32768 times. It's not the straightforward addition that I thought it was. You can't bytewise add either as you'd get carry problems between the nibbles.

There may be a way around this...it occurs to me that we only care if a pixel in our temporary buffer is non-zero after all the additions. Whether a nibble is 0x1 or 0xf is irrelevant - we burn the bg buffer for that pixel.
Because of that we may be able to use a bitwise OR instead of addition and actually achieve the same result in half the operations.

In order to shift the fg buffer one pixel left or right still is an issue though. If we could 'rotate with carry bits' across 64 bytes then it would be fairly easy.

I'm beginning to wonder whether unpacking the fg image into a byte per pixel copy might be worth considering to make the math faster.
Posted by: tfabris

Re: [emphatic] Wish List - 03/08/2004 17:03

Or you could just draw the text in black eight times, then in white once. No separate layer, just draw it directly onto the buffer.

I know it's not a generic solution, doesn't allow for certain kinds of interesting combinations, and means that things like the progress bar would have to be special-case coded, but perhaps it would be simplest and fastest.
Posted by: genixia

Re: [emphatic] Wish List - 03/08/2004 17:18

Hmm. I can't remember how flexible vfdlib is with regards to this. I wonder how fast drawing the text is...
Posted by: tman

Re: [emphatic] Wish List - 03/08/2004 17:20

Doesn't it keep an unpacked representation of the display buffer in memory and blats that when you tell it to?
Posted by: SE_Sport_Driver

Re: [emphatic] Wish List - 03/08/2004 18:21

Dumb question here.. I haven't even played with this yet so I apologize if this is something that is painfully obvious:

My database size is "too large" at the moment, and I've been going through all my songs in emplode removing the "Comment" field (and have been toying with the idea of removing Genre) to reduce the size of the database. Since the lyrics are stored in the id3v2 tags, will this cause any issues?

Can I install this on top of 2.00final and select when to boot into it via HiJack or does it always run after it's installed?
Posted by: tonyc

Re: [emphatic] Wish List - 03/08/2004 21:32

Quote:
Since the lyrics are stored in the id3v2 tags, will this cause any issues?

I don't know what you mean by "your database is too large." Is it taking up too much memory? If that's the case, emphatic will take up another 200-400k (ish) while running, so you'll have to consider that. Having said that, the lyrics are indeed in the ID3 tag, so tagging your tracks won't add to your DB size.

Quote:
Can I install this on top of 2.00final and select when to boot into it via HiJack or does it always run after it's installed?

Well, that depends on what you mean by "run." The more recent versions of Hijack add the MENU_EXEC command which can launch emphatic only when you want to via the Hijack menu. If you just use EXEC or EXEC_ONCE, then the emphatic process starts up when the player boots, but doesn't "run" (do anything) until you select it from the Hijack menu. Actually, v2.01 (which I'm probably releasing tonight) will have the ability to automatically bring itself to the foreground and "run" without being selected from the Hijack menu. So it's up to you.

Seriously though, quit your bellyaching and install the damn thing.