G7 X porting thread - page 6 - DryOS Development - CHDK Forum
supplierdeeply

G7 X porting thread

  • 167 Replies
  • 152515 Views
*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #50 on: 29 / September / 2016, 22:51:51 »
Advertisements
Hi,
I will look at the sx60 stuff.
To be clear, the buffer suggested for vid_get_viewport_fb_d in that thread is implemented in the current svn G7X code.

Quote
I want to modify the image shown: for instance show a stereo pair using side by side or anaglyph or do some image processing on the image, like sharpen it.  This used to be possible in CHDK.
You mean in custom code you wrote? It has certainly never been a feature of mainline CHDK, and I don't recall ever seeing source for such a feature.

Quote
I can write to the buffer vid_get_viewport_fb_d().  This works fine (at least the buffer can be modified, I am not sure of the colors) for every second displayed image. 

What do you mean by "full color".  For the bitmap?
In cameras before digic 6, the canon UI used a paletted display, with 256 (or less) possible colors, so displaying something like a camera jpeg was not practical. In digic6, it's a full UYVY in the same format as the viewport, plus an alpha buffer.

Quote
  Is the viewport encoding not UYVY 4 bytes for 2 pixels?  Is the color a different format from the old UYVYYY format?  I think I am seeing this.
Yes, it's UYVY (two Y values per UV pair rather than 4). For most buffers (the viewport and bitmap used by the G7X) port, it is also in a different format: you have to subtract 0x80 from the U and V values when converting to RGB.

Reading up through some of the general digic 6 related threads might save you some time.

Thread about digic 6 display https://chdk.setepontos.com/index.php?topic=12788.0

sx280 porting thread (first digic 6 port, by srsa_4c)  https://chdk.setepontos.com/index.php?topic=11550.0

General CHDK/D6 https://chdk.setepontos.com/index.php?topic=11316.0 (old, might want to start at the end)

Discussion of PTP live view in chdkptp (starting around https://chdk.setepontos.com/index.php?topic=6231.msg125027#msg125027, recently added to trunk https://chdk.setepontos.com/index.php?topic=6231.msg129812#msg129812)
Don't forget what the H stands for.

Re: G7 X porting thread
« Reply #51 on: 30 / September / 2016, 23:20:19 »
I guess it has been a long time.  For old cameras I would read the u as follows:u = (signed char)src;
What should I change?  maybe: u = (unsigned char) src - 128?
Why would Canon change this?

I will have time to look more at the videwport bufs next week.
Jon

*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #52 on: 01 / October / 2016, 02:59:59 »
What should I change?  maybe: u = (unsigned char) src - 128?
It depends what you are doing, the subtracting 128 applies to converting to RGB. For that, you can see an example at https://app.assembla.com/spaces/chdkptp/subversion/source/712/trunk/liveimg.c#ln296

https://en.wikipedia.org/wiki/YCbCr may provide some insight.
Quote
Why would Canon change this?
You'd have to ask them ;)
Don't forget what the H stands for.

Re: G7 X porting thread
« Reply #53 on: 01 / October / 2016, 05:10:35 »
I would like to try out your CHDK on my G7X. Its firmware version is 100c instead of 100d, and I cannot launch the CHDK from "Firm update". Do you know if the migration is easy to do - if you explain it to me, I could be able to do it. I could not find how to switch from 100c to 100d for my G7X either.
AFAIK you're the first person reporting a 100c firmware revision. Please make a dump of your camera's firmware: http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper

Hello. With a little delay, here is the firmware dump https://drive.google.com/open?id=0B3QGa8gm4F_TMEhtVFVBaUluTHc
I've tested with the Update firmware menu when starting camera in Play mode, and the green led blinks continuously without ever showing the chdk logo. I've also tested the "lock sd card" install, but then the camera starts in normal mode, and says the card is not writable. Thanks a lot!


*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #54 on: 01 / October / 2016, 14:06:44 »
Hello. With a little delay, here is the firmware dump https://drive.google.com/open?id=0B3QGa8gm4F_TMEhtVFVBaUluTHc
Thanks. From a quick look it appears 100c is not quite compatible with 100d (all the functions we use are the the same places, but some ROM data has moved), so a new sub port will be needed. I will post a test build when I get a chance, but I'm not sure how much time it will take.
Quote
I've tested with the Update firmware menu when starting camera in Play mode, and the green led blinks continuously without ever showing the chdk logo.
There is code that does this if it detects an different version than the build was created for. Nice to know it works :)
Quote
I've also tested the "lock sd card" install, but then the camera starts in normal mode, and says the card is not writable. Thanks a lot!
This means that the card was not actually made bootable. Most likely the canon BOOTDISK string isn't set correctly, or the card is formatted exFAT rather than FAT32. In any case, there's no need to worry about this until there is a build for your firmware version.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #55 on: 01 / October / 2016, 21:20:04 »
edit: See https://chdk.setepontos.com/index.php?topic=12692.msg131768#msg131768 for the latest 100c build.

Here's a test build for g7x firmware 100c.

This is completely untested, although it's very similar to 100d so there's a fair chance it will work. See the "G7 X notes" section of the included readme for known issues that apply to the G7X port in general.

I strongly recommend using the bootable SD card method to load CHDK for actual shooting, as the "Update firmware" method does not appear to initialize some hardware correctly.

Using the "Update firmware" to load CHDK and make FAT 32 formatted card bootable seems to be OK.
« Last Edit: 13 / March / 2017, 01:16:49 by reyalp »
Don't forget what the H stands for.

Re: G7 X porting thread
« Reply #56 on: 02 / October / 2016, 18:50:49 »
Hi,
I've looked into some of the buffers used to hold viewport  data  on the G7X in play mode.
If unzoomed the camera used either 0x5e608000 (first image displayed) or 0x5e208000 (second image displayed) and alternates them.
If you zoom and pan then other buffers are also used.
I looked at these:
edit: Corrected these addresses
0x5e208000; // used for 2nd unzoomed display and every other after (unless a zoom happens)not used for zoom, pans (as far as I can tell)
0x5e608000; // used for 1st unzoomed display, some zooms, pans
0x5ea08000; //  some zooms, pans
There may be other ones used as well.

The big problem is how to find out which one the camera is using.  Any suggestions how to find this out?

Jon

« Last Edit: 02 / October / 2016, 20:38:08 by hiker_jon »

*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #57 on: 02 / October / 2016, 19:08:52 »
The big problem is how to find out which one the camera is using.  Any suggestions how to find this out?
On my g7x, the current svn implementation of vid_get_viewport_fb_d() appears to return the correct playback buffer in pretty much every situation, as verified by using chdkptp live view.

If you explain in what way you believe this is wrong, that might help.

In my earlier investigation, I found some other variables that contained recent, but not entirely up to date buffers, see https://chdk.setepontos.com/index.php?topic=12532.msg129905#msg129905

Quote
0x5e208000; // used for 2nd unzoomed display and every other after (unless a zoom happens)not used for zoom, pans (as far as I can tell)
0x5e608000; // used for 1st unzoomed display, some zooms, pans
0x5ea08000; //  some zooms, pans
0x5ea08000; //  some zooms, pans
IMO, it's extremely unlikely that these are specific to zoom, pan etc. More likely, the camera rotates through a sequence of buffers, and some variable points the current buffer or indexes an array of buffer addresses.

edit:
I understand from the previous posts you want to write to the buffer, but if it contains the most recent data and writing does not have the desired effect, it's seems like getting the current buffer may not be your problem.
« Last Edit: 02 / October / 2016, 19:22:11 by reyalp »
Don't forget what the H stands for.


Re: G7 X porting thread
« Reply #58 on: 02 / October / 2016, 20:05:28 »
Hi,
Another way to check is to turn on the histogram display.  The histogram it displays may be wrong, but it does reflect the buffer data it is accessing. 
Notice that it repeats and does not show a unique histogram for each image.

I am using trunk 4685

Jon
« Last Edit: 02 / October / 2016, 20:09:31 by hiker_jon »

*

Offline reyalp

  • ******
  • 14082
Re: G7 X porting thread
« Reply #59 on: 02 / October / 2016, 20:59:41 »
Another way to check is to turn on the histogram display.  The histogram it displays may be wrong, but it does reflect the buffer data it is accessing. 
Unless you have re-written the histogram code for d6, I wouldn't use it for anything.
Quote
I am using trunk 4685
Try the version from r4690. You could have saved both of us some time by looking at the svn log or svn blame to see when that code changed.

Don't forget what the H stands for.

 

Related Topics