IXUS 500 HS - ELPH 520 Porting Thread - page 7 - DryOS Development - CHDK Forum
supplierdeeply

IXUS 500 HS - ELPH 520 Porting Thread

  • 76 Replies
  • 15330 Views
*

Offline ux

  • *
  • 11
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #60 on: 30 / November / 2014, 18:49:42 »
Advertisements
So, I had a discussion with nafraf today on IRC. Here is a followup/summary.

Context: testing ixus500_elph520hs / sub 101a from nafraf repository rev 753 and chdk rev 3762.

First, some random problems I had (not very interesting):
  • keys can be found at 0x629F2C (FI2KEY) and 0xFF3CE0 (FI2IV) offsets in 101a firmware dump. The encoding is d4c, so same keys that other wiki documented devices apparently.
  • since I git-svn cloned the repositories, the directories bin and CHDK/MODULES needed to be created (git can't track empty directories. The former prevents build, and the later was causing the full zip generated by make firzipsubcomplete to not contain the any modules at its first run (because ZIPDIRS makes a ls and the directory was not present initially)

What worked so far:
  • CHDK Color Test seems OK AFAICT
  • The USB remote shoot seems to work (I was able to trigger a photo by plugging in/out an USB cable)

What doesn't work so well:
« Last Edit: 30 / November / 2014, 18:54:00 by ux »

*

Offline ux

  • *
  • 11
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #61 on: 28 / March / 2015, 04:18:34 »
Good news everyone, I think I fixed the raw output.

So here is the diff:

Code: [Select]
diff --git a/platform/ixus500_elph520hs/platform_camera.h b/platform/ixus500_elph520hs/platform_camera.h
index 88a09c3..a40ab39 100644
--- a/platform/ixus500_elph520hs/platform_camera.h
+++ b/platform/ixus500_elph520hs/platform_camera.h
@@ -27,8 +27,8 @@
     #define CAM_DRYOS_2_3_R39               1       // Defined for cameras with DryOS version R39 or higher
     #define CAM_DRYOS_2_3_R47               1       // Defined for cameras with DryOS version R47 or higher
 
-    #define CAM_RAW_ROWPIX                  4704 // Found @0xff92def4 a810
-    #define CAM_RAW_ROWS                    3504 // Found @0xff92df00 a810
+    #define CAM_RAW_ROWPIX                  3808 // Found @0xff160d0c
+    #define CAM_RAW_ROWS                    2796 // Found @0xff160d14
 
     #undef  CAM_UNCACHED_BIT
     #define CAM_UNCACHED_BIT                0x40000000 // Found @0xff832e74 a810
@@ -45,7 +45,7 @@
     #undef  CAM_SENSOR_BITS_PER_PIXEL
     #define CAM_SENSOR_BITS_PER_PIXEL       12
 
-    #define cam_CFAPattern                  0x01000201   // [Green Blue Red Green]
+    #define cam_CFAPattern                  0x02010100   // [Red Green Green Blue]
 
     #define CAM_COLORMATRIX1                             \
     827547, 1000000, -290458, 1000000, -126086, 1000000, \

For the record, this is my build script:

Code: [Select]
#!/bin/sh

set -x
set -e

dump=PRIMARY.BIN

get_fi(){
    xxd -l16 -u -plain -s$1 $dump
}

pushd chdk_trunk
git clean -fdx
mkdir -p bin CHDK/MODULES
popd

cat <<EOF > chdk_trunk/platform/fi2.inc
FI2KEY=$(get_fi 0xFF3CE0)
FI2IV =$(get_fi 0x629F2C)
EOF

pushd chdk_nafraf/
git clean -fdx
popd

cp $dump chdk_nafraf/platform/ixus500_elph520hs/

cp -r chdk_nafraf/loader/ixus500_elph520hs   chdk_trunk/loader/
cp -r chdk_nafraf/platform/ixus500_elph520hs chdk_trunk/platform/

pushd chdk_trunk
make PLATFORM=ixus500_elph520hs PLATFORMSUB=101a OPT_FI2=1 firzipsubcomplete
popd

rm -rf img
unzip -d img chdk_trunk/bin/ixus500_elph520hs-101a-1.3.0-0-full.zip

(and then I sync img to the micro sd)

But a few comments:

- I'm using nafraf/chdk @ r753 and chdk/trunk @ r3765 because I was unable to rebase properly this code (way too much changes)
- The colormatrix is probably wrong, but I have no idea how to define it.
- The specifications states the following lens information: "4.0 - 48.0 mm (35 mm equivalent: 28 - 336 mm)", so I tried
Code: [Select]
#define CAM_DNG_LENS_INFO               { 28,1,  336,1,  34,10, 56,10 } instead of
Code: [Select]
#define CAM_DNG_LENS_INFO               { 40,10, 480,10, 34,10, 56,10 } but it seems darktable isn't able to correct the fisheye effect anyway.
- The preview in the DNG seems to be broken somehow (bottom slice shows garbage)

Anyway, here is what the raw looks like in darktable: http://lucy.pkh.me/chdk-ixus500hs/CRW_4453.jpg
And here is what the IXUS outputs: http://lucy.pkh.me/chdk-ixus500hs/IMG_4453.JPG

We can observe a few things:
- There is a left black bar and a smaller top one. These black bars just looks like obstructed areas (raising the light shows noise)
- There is a very marked fisheye effect
- There is a lot more noise (expected I guess)
- The colors are definitely differents

I can probably upload more examples...


*

Offline nafraf

  • *****
  • 1305
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #62 on: 28 / March / 2015, 10:09:58 »
Good news everyone, I think I fixed the raw output.
:)

Quote
- I'm using nafraf/chdk @ r753 and chdk/trunk @ r3765 because I was unable to rebase properly this code (way too much changes)
Please test nafraf/chdk @ r763, port was updated to be compatible with chdk/trunk r4116

Fisheye effect is expected in RAW capture, you have to fix it during image post-processing. CAM_DNG_LENS_INFO was not modified.

*

Offline ux

  • *
  • 11
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #63 on: 30 / March / 2015, 07:12:49 »
Quote
- I'm using nafraf/chdk @ r753 and chdk/trunk @ r3765 because I was unable to rebase properly this code (way too much changes)
Please test nafraf/chdk @ r763, port was updated to be compatible with chdk/trunk r4116

Done. It still works as expected, and thanks for integrating my changes. By the way, I think you forgot to fix the comment for cam_CFAPattern.

Fisheye effect is expected in RAW capture, you have to fix it during image post-processing. CAM_DNG_LENS_INFO was not modified.

Alright.

Here is another verbatim export of the raw from darktable:
RAW export: http://lucy.pkh.me/chdk-ixus500hs/CRW_4552.jpg
IXUS filtered: http://lucy.pkh.me/chdk-ixus500hs/IMG_4552.JPG

BTW, where is the current colormatrix picked from? It seems to be shared between something like 30 cameras. Why isn't it the same as for instance... ixus310_elph500hs (random pick from a similar name)?

Ah and by the way, the keyboards refactoring didn't help for the annoying problem of the alt menu taking ~5 seconds to pop up :(

Edit: down/left/right (overrides/zebra/osd) still have no effects in the alt menu, and zebra mode still shows over exposure in the bottom rectangle all the time (which seems to match the glitch area we observe in preview image of the raw)
« Last Edit: 30 / March / 2015, 07:28:48 by ux »


*

Offline nafraf

  • *****
  • 1305
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #64 on: 30 / March / 2015, 20:48:56 »
Done. It still works as expected, and thanks for integrating my changes. By the way, I think you forgot to fix the comment for cam_CFAPattern.
Fixed, please update your working copy. Thanks

Quote
Edit: down/left/right (overrides/zebra/osd) still have no effects in the alt menu
KEYS_MASK[0-2] were defined using values automatically detected, but probably are wrong. Please use the version on attachment to detect which bits are masked on pressing each key.
« Last Edit: 31 / March / 2015, 22:27:27 by nafraf »

*

Offline ux

  • *
  • 11
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #65 on: 31 / March / 2015, 08:24:38 »
Quote
Edit: down/left/right (overrides/zebra/osd) still have no effects in the alt menu
KEYS_MASK[0-2] were defined using values automatically detected, but probably are wrong. Please use the version on attachment to detect which bits are masked on pressing each key.
I see a -1 displayed on the bottom; is that what you need? It doesn't change if by pressing the buttons.

*

Offline nafraf

  • *****
  • 1305
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #66 on: 31 / March / 2015, 22:27:10 »
I see a -1 displayed on the bottom; is that what you need? It doesn't change if by pressing the buttons.
No, the idea is to see the value of physw_status[0-2] on screen.

Please try the following:
1. edit core/gui_osd.c and uncomment the code to "debug keymap, KEYS_MASKx..." (line1139), and change the conditional to show those values always.
2. edit platform/ixus500_elph520hs/platform_camera.h set KEYS_MASKx to 0x0
3. Compile and test.

*

Offline ux

  • *
  • 11
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #67 on: 01 / April / 2015, 05:55:31 »
I see a -1 displayed on the bottom; is that what you need? It doesn't change if by pressing the buttons.
No, the idea is to see the value of physw_status[0-2] on screen.

Please try the following:
1. edit core/gui_osd.c and uncomment the code to "debug keymap, KEYS_MASKx..." (line1139), and change the conditional to show those values always.
2. edit platform/ixus500_elph520hs/platform_camera.h set KEYS_MASKx to 0x0
3. Compile and test.

AFAICT, this is the layout (bit0 = lsb):
physw_status0 -> bit0 right, bit1 down, bit2 left, bit3 up
physw_status1 -> bit1 video/record
physw_status2 -> bit12 dezoom, bit13 dezoom++, bit14 zoom, bit15 zoom++, bit16 set = auto mode toggle on (warn: bit to 1 for this one)

It's hard to tell about the others. The bits are 1 by default, pressing set them to 0.

Now this seems to somehow match the key masks. Also, in the CHDK menu (not the alt one), the buttons seems to work very well, so what makes you think this is the problem?

Anyway, at rest the values looks like this:
Code: [Select]
PS1: 0xd[048c][0123]c0c[08]f
PS2: 0x[47][1d5]4100fb
PS3: 0x2020ff00


*

Offline srsa_4c

  • ******
  • 3920
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #68 on: 01 / April / 2015, 19:33:29 »
Also, in the CHDK menu (not the alt one)
The "menu" you get with a 3 second delay after entering ALT mode is a "help screen". It's meant to provide hints for new users (some people find it annoying and turn it off right away). It can be switched off from the CHDK menu: CHDK settings -> Menu settings -> Show <ALT> help screen.

*

Offline nafraf

  • *****
  • 1305
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #69 on: 01 / April / 2015, 22:32:09 »
Now this seems to somehow match the key masks. Also, in the CHDK menu (not the alt one), the buttons seems to work very well, so what makes you think this is the problem?
Now I think that there is not problem :)

 

Related Topics