Cropped zebra or zebra specific OSD - page 2 - Feature Requests - CHDK Forum
supplierdeeply

Cropped zebra or zebra specific OSD

  • 90 Replies
  • 30161 Views
*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #10 on: 12 / July / 2008, 08:54:58 »
Advertisements
YES, I've got it to work!

Attaching gui_osd.c for trunk / AllBest 441 and a build for the A720IS.

I've employed the same ugly trick I've used for shooting on face detection, i.e. I draw a pixel in both buffers and then see which pixel gets cleared - and use that buffer. What the heck, it works.

(The A720 build also includes my BSS function, which you should only use if you're brave, and an experimental thing that hinders you from zooming in manual focus mode - just don't zoom in MF mode, or build your own from trunk ;) )
« Last Edit: 12 / July / 2008, 08:58:40 by LjL »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #11 on: 12 / July / 2008, 10:06:46 »
Great work LjL!  :D

I tried this with trunk 442 on my a570is and now it works beautifully over the entire LCD area. Canon OSD is a bit harder to read as I previously described (maybe this should be combined with cyril4e's "don't show zebra if unnecessary"), but that's a small price to pay for ergonomic zebra!


*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #12 on: 12 / July / 2008, 10:34:59 »
Actually, I'm not sure what you mean about the ghostly appearance... here, the OSD is the exact same OSD I get with this feature disabled, except if zebra needs to show up, it will be drawn beneath it (if no zebra warnings need to be shown, it's just the usual Canon OSD without anything else).

Can you give me a screenshot? By the way, how does one take screenshots in the first place (I see a few in the wiki)?

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #13 on: 12 / July / 2008, 11:19:49 »
Actually, I'm not sure what you mean about the ghostly appearance... here, the OSD is the exact same OSD I get with this feature disabled, except if zebra needs to show up, it will be drawn beneath it (if no zebra warnings need to be shown, it's just the usual Canon OSD without anything else).

Can you give me a screenshot? By the way, how does one take screenshots in the first place (I see a few in the wiki)?

I vaguely remember something about screendumps being discussed, possibly by mx3 but it's been a while. Here are links to two webcam closeups of the LCD, one with no zebra, one with zebra enabled:

http://img134.imagevenue.com/img.php?image=75678_OSD_no_zebra_122_826lo.jpg
http://img133.imagevenue.com/img.php?image=75684_OSD_with_zebra_122_969lo.jpg

White background is the worst, OSD is more legible when pointing at something darker.

Btw, while shooting these examples the camera once again failed to show the exposure OSD during a couple of half-shoots. I didn't notice this behavior before...It's much rarer than before and may be linked to some specific shooting condition I'm not aware of.


*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #14 on: 12 / July / 2008, 11:43:01 »
I don't know why that happens on your camera, but see if this version makes it any better (zebra isn't drawn not only on pixels where the OSD is present, but also the ones horizontally adjacent).

As for the wrong-OSD problem, yes, I noticed now too that it still happens sometimes  :(

But maybe I've fixed that, too, with this version... it doesn't seem to do it anymore for me now.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #15 on: 13 / July / 2008, 03:39:36 »
Ah, now I get it.

First, yes, I don't seem to be getting "wrong-OSD" any more either.

Second, there's still that ghostly appearance in Canon OSD. I tried masking all 9 surrounding pixels (in addition to those two horizontally adjacent ones) but it had no effect either. But then I disabled RGB mode from zebra options (yep, I've had that enabled all this time) and everything including the OSD works flawlessly even without that two adjacent pixels mask (which I believe reads outside the buffer twice unless there's a limit to the loop somewhere I didn't look at?).  :D

Btw, the zebra options "restore osd" and "restore original screen" don't seem to have an effect (any more? I think I previously had to set them both for zebra+histogram+osd all to be shown)

*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #16 on: 13 / July / 2008, 07:45:29 »
Uhm, I had never tried RGB mode to be honest, my bad.
The problem you mentioned does happen in that mode, but that good news is that I know why: RGB mode involves skipping every odd pixel (s+=step_x). And there is no bad news.

You're right that "Restore OSD" and "Restore original screen" don't behave as intended anymore... but I think those should be removed completely. If you don't want the CHDK OSD to show up during zebra, you can just select that behavior in "Draw over zebra", and as for the "original screen" (i.e. the Canon OSD), I see no reason to make it disappear at any time, now that it can be made to stay all the time.

P.S.: ah, and yes, the previous workaround wrote out of bounds twice. I hoped nobody would notice :P Anyway, it's gone now.
« Last Edit: 13 / July / 2008, 07:48:52 by LjL »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #17 on: 13 / July / 2008, 08:28:28 »
Uhm, I had never tried RGB mode to be honest, my bad.
The problem you mentioned does happen in that mode, but that good news is that I know why: RGB mode involves skipping every odd pixel (s+=step_x). And there is no bad news.

Yup, now it works in RGB mode too. Perfect! We need to get this thing to trunk, or can anyone think of a reason not to? This is a major improvement.

You're right that "Restore OSD" and "Restore original screen" don't behave as intended anymore... but I think those should be removed completely. If you don't want the CHDK OSD to show up during zebra, you can just select that behavior in "Draw over zebra", and as for the "original screen" (i.e. the Canon OSD), I see no reason to make it disappear at any time, now that it can be made to stay all the time.

I agree. There isn't a way to disable the half-shoot exposure OSD witout CHDK either, is there? If someone wants it gone for some reason, that's a separate feature which needs more work I guess. And it shouldn't be zebra related. I find it unlikely that anyone has used zebra for that particular purpose...someone speak out if you did ;)

P.S.: ah, and yes, the previous workaround wrote out of bounds twice. I hoped nobody would notice :P Anyway, it's gone now.

Yea I figured it was just a quick test to see if it helped. My diagonal mask test went past the buffer an entire line, which made me think twice...didn't crash the camera though...  :haha


As for what could be further improved in zebra: I think those slowest blink zebra modes are now unnecessary (Blink 3 and 2), but faster blink rates could now be useful instead. A quick change to make each blink mode one step faster seems like a good idea to me (from gui_osd.c):

Code: [Select]
            case ZEBRA_MODE_BLINKED_1:
                f = timer&1;
                break;
            case ZEBRA_MODE_BLINKED_3:
                f = timer&4;
                break;
            case ZEBRA_MODE_BLINKED_2:
            default:
                f = timer&2;
                break;


Also, it would be nice if zebra could be also drawn under CHDK OSD gray transparent areas (I keep a 6-line misc osd on display, the rectangle takes up quite a bit of space while most of it is just background, not text) and histogram transparent areas (one thing that especially catches my attention is the histogram multiplier field on top-left corner of the histogram... it's empty when the histogram isn't scaled, but zebra never draws there).


*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #18 on: 13 / July / 2008, 09:45:18 »
Yup, now it works in RGB mode too. Perfect! We need to get this thing to trunk, or can anyone think of a reason not to? This is a major improvement.

Well, as PhyrePhoX said, I might be confusing trunk a little with all these patches. Now that a couple of them are in apparently good shape, I should put them together in a single, clean patch for trunk to look at, I think.

For instance, the draw_guard_pixel() function that I used both here and in the face detection patch should really be exported from gui_draw.c instead of duplicated.

Quote
I agree. There isn't a way to disable the half-shoot exposure OSD witout CHDK either, is there? If someone wants it gone for some reason, that's a separate feature which needs more work I guess. And it shouldn't be zebra related. I find it unlikely that anyone has used zebra for that particular purpose...someone speak out if you did ;)

Honestly, I'm not sure why anyone would disable half-shoot OSD at all :o)
Maybe in manual mode, but in the automatic modes it contains pretty much essential information...

Quote
As for what could be further improved in zebra: I think those slowest blink zebra modes are now unnecessary (Blink 3 and 2), but faster blink rates could now be useful instead.

Yeah, that works and makes sense.

Quote
Also, it would be nice if zebra could be also drawn under CHDK OSD gray transparent areas (I keep a 6-line misc osd on display, the rectangle takes up quite a bit of space while most of it is just background, not text) and histogram transparent areas (one thing that especially catches my attention is the histogram multiplier field on top-left corner of the histogram... it's empty when the histogram isn't scaled, but zebra never draws there).

Hm, this makes a lot of sense (consider that the Canon OSD itself disables all elements that have a background, in half-shoot mode), but it's harder to implement than it sounds.

I can ask the OSD to use COLOR_TRANSPARENT for the background during half-shoot/zebra mode, but that will just make the background transparent, it won't let zebra draw over it.

That's because the buffer I'm keeping to check for whether or not I should draw zebra on pixels only contains the Canon OSD at the time just after pressing the half-shoot button. It's not updated, and it doesn't contain the CHDK OSD. It could be made to contain the CHDK OSD, but then it wouldn't get updated. And if it were updated, the problem of zebra "leaving trails" would surface back.

I could keep yet another separate buffer just for the CHDK OSD, but I feel I'm starting to allocate a tad too much precious memory.


But don't despair! If it can't be done in gui_osd.c, it can be done further up the hill in gui_draw.c.
I modified draw_char() so that, then the background color is transparent, nothing at all is drawn there.
That made the text unreadable on white backgrounds, so I also did something to give text a black border (much like Canon's own font; I like it).

The only problem is that, erm... I wouldn't suggest using color 0x00 as the standard background color anymore. Perhaps a new "fake" color should be defined, like COLOR_NEVER_DRAW. Except all 255 of them are already taken.

I also had to modify the histogram drawing code, because it wouldn't use the standard OSD colors. There are a couple of other things in the OSD that don't use OSD colors, so they'll still not be transparent, but I couldn't modify those now as they're scattered in several files.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #19 on: 13 / July / 2008, 11:52:10 »
Misc values OSD looks pretty nice now... but things like the file browser look quite awful; that black border should only appear when the text is on transparent background I suppose. Also, the grey background of misc values OSD doesn't always disappear when half shooting, and sometimes it disappears only partly.

I didn't try modifying my OSD settings, but I keep SD card free space in MB and battery voltage on screen (quite important even during half shoot since that's where fast MD runs). Curiously the free space indication always has it's gray background, battery voltage doesn't.

Btw. you broke zebra mode Blink 1, it doesn't actually ever draw zebra with f=timer&0.  ::)


 

Related Topics