two viewports on the A570is - General Discussion and Assistance - CHDK Forum

two viewports on the A570is

  • 3 Replies
  • 2027 Views
two viewports on the A570is
« on: 25 / September / 2008, 18:25:52 »
Advertisements
Hi,

I have some code that reads and writes to the viewport in play mode.  Code that worked well on the A720is didn't work on the A570is.  For every other image nothing happened.  My firmware is 101a.

I did some investigating and found that there are two addresses for the play viewport display, each used on every other image.
The existing routine for getting the viewport address is vid_get_viewport_fb_d().  It reads the viewport address from 0x7C090.  I searched around that area and found a suitable address at 0x7C0A4.  This seems to work.  The address at 0x7C0A4 is 0x104B8F50.

EDIT: Doesn't work for zoomed images.  Needs more investigation.  One address seems to hold the unzoomed image, the other is used for zooming.

So I have a new routine:
Code: [Select]
void *vid_get_viewport_fb_d2()
{
    return (void*)(*(int*)0x7C0A4);
}

It seems that the viewport data is always at the original address, but the display for every other image is at the new address.  So I can read the data from the original address, then have to write to both to always get it displayed.

Anyone have an idea what is going on?

Why is the viewport address read from another place.  Can it change during camera operation?

Jon
« Last Edit: 25 / September / 2008, 18:45:08 by hiker_jon »

Re: two viewports on the A570is
« Reply #1 on: 26 / September / 2008, 12:35:33 »
This is my latest understanding of the viewport behavior on the A570:

There are two buffers that hold the viewport image.
Their addresses are kept in 0x7C090 and 0x7C0A4.
The address kept at 0x7C090 is 0x105BFC00.   
The address at 0x7C0A4 is 0x104B8F50.
CHDK uses 0x7C090 to get the viewport address.

The two buffers start out with the same data (unzoomed image).  On some images one buffer is displayed, on other images the other is displayed.  (My guess is that when you move to a new image the other buffer is loaded with the new image and then is displayed.  Next the new image is moved to the old buffer.)  As you zoom in or pan in a zoomed image the buffers are used alternately.  One will hold the current display, one will hold the previous display.  I guess that this is a sort of frame buffer strategy that gives a clean zoom.  It might also give a quick display of the previous zoom or pan position.

Interesting that Canon seems to have abandoned this scheme for the A720.

This behavior is hard to deal with unless there is some way to tell which buffer is currently being displayed or there is some address that holds the actual display.



« Last Edit: 26 / September / 2008, 12:41:28 by hiker_jon »

Re: two viewports on the A570is
« Reply #2 on: 13 / October / 2008, 11:28:29 »
Hi,
I think I have figured out the viewport buffers on the A570is (101a).

In PLAY mode:
There are two buffers that hold the viewport image.
Their addresses are kept in 0x7C090 and 0x7C0A4.
The address kept at 0x7C090 is 0x105BFC00.   
The address at 0x7C0A4 is 0x104B8F50.

At 0x7C0a0 is an int that = 2 if the address kept at 0x7C090 is the buffer being displayed, =0 if not.
At 0x7C0B4 is an int that = 2 if the address kept at 0x7C0A4 is the buffer being displayed, =0 if not.

So if the int at 0x7C0a0 = 2 then 0x7C0B4 = 0 and vice versa.  This holds in "play" mode and recreview mode, I haven't checked it in record mode where another buffer is used.

This is my modification to lib.c:
Code: [Select]
void *vid_get_viewport_fb_d()
{
    if(*(int*)0x7C0A0) return (void*)(*(int*)0x7C090);
else return (void*)(*(int*)0x7C0A4);
}



« Last Edit: 13 / October / 2008, 11:59:34 by hiker_jon »

Re: two viewports on the A570is
« Reply #3 on: 15 / October / 2008, 16:57:15 »
Great work, hiker_jon. I'll try to locate these display flags on SD1000. I'll try the same offset (16 bytes) from the locations where the addresses are kept and surrounding locations. Please share if you figure out how it works in record mode.


 

Related Topics