Author Topic: Cropped zebra or zebra specific OSD  (Read 12508 times)

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Cropped zebra or zebra specific OSD
« on: 05 / July / 2008, 16:39:34 »
As we know, zebra draws over the camera's built-in OSD. What I miss are the camera's metered values (ISO on top left corner and Tv and Av along with Ev offset on bottom). They only blink very shortly when first half pressing and then releasing the shutter.

The blink modes are there to overcome this, but I sort of hate everything that blinks. So I'm left with leaving zebra off and enabling it (thankfully we have a shortcut key) when I need it. But for most of the time I just don't bother, which is a shame since it's a great feature.

Could zebra be drawn in "cropped mode" i.e. just in a (preferably user defined) rectangle in the middle of the screen? Since zebra is updated while one moves the camera, the border areas can be quickly checked if necessary (just like we need to check below histogram and OSD if they are enabled in current builds).

Or if zebra is drawn over some buffer that doesn't have the Canon OSD on it, could at least the upper and lower parts be copied from another buffer where Canon OSD does exist?

Or, if that's just not possible, could we have some OSD options in the zebra menu to display these values when zebra is enabled?

Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #1 on: 05 / July / 2008, 18:04:37 »
I second this.

I'll just note that there is a build (which? I'm losing count) that only draws zebra when there's actually something overexposed, and does without it otherwise - so when your exposure is fine, nothing will blink and the OSD will stay.

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #2 on: 05 / July / 2008, 18:29:43 »
I second this.

I'll just note that there is a build (which? I'm losing count) that only draws zebra when there's actually something overexposed, and does without it otherwise - so when your exposure is fine, nothing will blink and the OSD will stay.


Yes, it's one of cyril42e's improvements http://chdk.setepontos.com/index.php/topic,1687.0.html
and it's been added to the juciphox/collaborative build: http://chdk.setepontos.com/index.php/topic,688.msg5556.html#msg5556 which is actually what I've been running for a couple of days now.


Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #3 on: 08 / July / 2008, 19:51:23 »
Well, I've modified core/gui_osd.c so that areas of the screen that aren't transparent aren't touched by zebra.
This, as far as I can see, means you'll have all the OSD elements always visible - which should satisfy the feature request.

There is also two commented-out lines in my files that do the cropping as requested by the OP, but I don't see the purpose of that, since it appears that I can just draw zebra "under" the OSD.

The attached file is a modified version of the one from DataGhost's build. I don't know if it works with other builds, as the trunk site seems to be down.

BUGS:
- If you move the camera with the shutter half-pressed, the zebra pattern for the previous frame won't go away (it will be treated like a part of the OSD that must not be drawn upon; the "cropping" version shouldn't have this poblem)
- Sometimes the "half-shutter" OSD will be shown as expected, but other times you will see the "no button pressed" OSD (I guess it's because the screen buffer is read very early in the zebra routine)
« Last Edit: 08 / July / 2008, 19:59:16 by LjL »

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #4 on: 08 / July / 2008, 21:51:25 »
Hmm... I built it in trunk 436 I had on my computer (can't get in assembla either) and it definitely does something... but it's the wrong Canon OSD that's sticking on the screen.

The metered Tv, Av and ISO values still only flash on my screen instead of staying there (actually they did stay a few times in a ghostly raster, but almost always they disappeared)

Instead, what's not disappearing is all the settings icons and top-right corner mode indicatiors of the Canon "full OSD" mode -- these are actually normally disabled from the screen by Canon while half-pressing. They are transformed into a ghostly raster.

This was with the gui_osd.c you postes without modifications. Also, the "old zebra lines not being removed" problem happens for me too.


I'm assuming the cropped mode is enabled by uncommenting lines 244 and 326, so I tried that as well. It's different but not much better. It doesn't remove old zebra lines either (expect on the border area outside the crop... it draws zebra there too and it's cleared correctly there). It transforms Canon OSD to that semitransparent raster also. It sometimes leaves the "full Canon OSD" enabled, but unlike the non-cropped version, it sometimes removes it fully or partially. When it does (maybe 1/3 of the time), the Av/Tv/ISO OSD sticks. So, this works better than the non-cropped one, but still not quite usable.

This varying behavior and it's 1/3 nature makes me think that the problem is that we're not fully aware which display buffer (from the MD speedup I remember we have three) is active and being drawn to, or something like that?

And for what it's worth, that ghostly semi-transparent raster is harder to read than the original Canon OSD, but it's readable and way better than not having the OSD there at all.

Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #5 on: 08 / July / 2008, 23:26:12 »
To enable "cropped mode", you should uncomment those line as you said, but also comment out the lines that are relevant to "draw-under mode", if you don't want the problems you mentioned.

But on my camera, the problem of the "wrong" OSD showing up doesn't appear all the times... most/some of the times, the "right" OSD shows up and stays.

I've tried several things now to get rid of the problem, from waiting some ticks and then grabbing the OSD screen, to forcing draw_restore()... none was successful.

I think I should only start doing the zebra drawing after the camera is in "ready to shoot" mode (i.e. has finished focusing and metering), because that appears to be when the "shooting" OSD is drawn.
However, the only function i've found that seems to give that information is _GetShutterReadyStateVar(), but that's weird, because it doesn't seem to be defined for all camera models... although it's used in main.c and I can't see an #ifdef...

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #6 on: 09 / July / 2008, 00:02:52 »
To enable "cropped mode", you should uncomment those line as you said, but also comment out the lines that are relevant to "draw-under mode", if you don't want the problems you mentioned.


Ah...will have to try that one too.

Quote
I think I should only start doing the zebra drawing after the camera is in "ready to shoot" mode (i.e. has finished focusing and metering), because that appears to be when the "shooting" OSD is drawn.


Yes that's probably a good idea. After all, how could zebra even be accurate before exposure has been decided?

Quote
However, the only function i've found that seems to give that information is _GetShutterReadyStateVar(), but that's weird, because it doesn't seem to be defined for all camera models... although it's used in main.c and I can't see an #ifdef...


Wouldn't prop 205 (digic II propset) / prop 206 (digic III propset) somewhat help? Or even better, did you see this thread?:
http://chdk.setepontos.com/index.php/topic,1770.msg16115.html#msg16115


Keep up the good work :)

Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #7 on: 09 / July / 2008, 00:52:18 »
Ah, I've come across PROPCASE_SHOOTING a dozen of minutes ago, but no, I wasn't aware that it returned anything more than 0 or 1.

I will have to try with 7... but the weird thing is that even if I start zebra after a long timer wait, it still sometimes shows the wrong OSD. It's like the system forgets to update the bitmap framebuffer when it draws the OSD... which sounds a bit paradoxical, but.

EDIT: Ok, it's just double-buffered, it probably isn't during half-shoot, and half the times, I end with the wrong buffer... The problem now is, how do I tell which buffer is being used for the half-shoot OSD  :blink:
« Last Edit: 09 / July / 2008, 01:22:40 by LjL »

Offline cyril42e

  • Full Member
  • ***
  • Posts: 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: Cropped zebra or zebra specific OSD
« Reply #8 on: 09 / July / 2008, 02:02:52 »
Ah, I've come across PROPCASE_SHOOTING a dozen of minutes ago, but no, I wasn't aware that it returned anything more than 0 or 1.

I will have to try with 7...

PROPCASE_SHOOTING returns only 0 or 1, it's an experimental memory variable that returns more information (0xAB38 for A720IS).

EDIT: Ok, it's just double-buffered, it probably isn't during half-shoot, and half the times, I end with the wrong buffer... The problem now is, how do I tell which buffer is being used for the half-shoot OSD  :blink:


Which buffer are you using that contains Canon's OSD? I think the buffers used by motion detection does not contain Canon's OSD, right? There is a way to know which buffer is used for motion detection (Motion Detection too slow?), so there is probably a way for your buffer too.

CHDK Forum

Re: Cropped zebra or zebra specific OSD
« Reply #8 on: 09 / July / 2008, 02:02:52 »

Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #9 on: 09 / July / 2008, 02:25:35 »
I'm using vid_get_bitmap_fb(). The secondary buffer appears to be at vid_get_bitmap_fb()+screen_buffer_size (it's in gui_draw).

The first buffer is at 0x10361000 in apparently every model or almost (which, as is explained in the stubs, is 0x10360000 + 0x1000... oh really? ;) I tried looking at the 0x1000 thingies that preceed it, but could find no hint of a variable telling me which buffer is active).

Offline LjL

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #10 on: 12 / July / 2008, 17:54:58 »
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, 17:58:40 by LjL »

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #11 on: 12 / July / 2008, 19: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

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #12 on: 12 / July / 2008, 19: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

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Cropped zebra or zebra specific OSD
« Reply #13 on: 12 / July / 2008, 20: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

  • Sr. Member
  • ****
  • Posts: 266
  • A720IS
Re: Cropped zebra or zebra specific OSD
« Reply #14 on: 12 / July / 2008, 20: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.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal