SX50 HS porting thread - page 7 - DryOS Development - CHDK Forum

SX50 HS porting thread

  • 350 Replies
  • 165313 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #60 on: 01 / February / 2013, 17:42:39 »
Advertisements
What do you get if you try and save a .DNG image?
I hadn't checked that. The .DNG image looks good now, so the buffer addresses are correct. You're right as usual, Phil, thanks.

The problem is with the shot meter routines, so it must be something else. I'll have to test it some more.

Thanks, I'll update SVN with the corrected code.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: SX50 HS porting thread
« Reply #61 on: 01 / February / 2013, 22:18:20 »
Thanks, I'll update SVN with the corrected code.
At least we have raw save working now. I haven't figured out the shot meter problem on this camera yet, but I did find a way to improve get_raw_pixel(..) and set_raw_pixel(..)

First, make rawadr static at the beginning of raw.c
Code: [Select]
  static char* rawadr; // = get_raw_image_addr()
Then, set rawadr and altrawadr at the very beginning of raw_savefile()
Code: [Select]
int raw_savefile() {
    // Get pointers to RAW buffers (will be the same on cameras that don't have two or more buffers)
    rawadr = get_raw_image_addr();
    char* altrawadr = get_alt_raw_image_addr();
Now you can replace all the references to "get_raw_image_addr()" to just, "rawdr". For example:
Code: [Select]
void set_raw_pixel(unsigned int x, unsigned int y, unsigned short value) {
#if CAM_SENSOR_BITS_PER_PIXEL==10
    unsigned char* addr=(unsigned char*)rawadr+y*camera_sensor.raw_rowlen+(x/8)*10;
This cuts my shot meter computation time for 4 meters from about 50 msec, down to about 30 msec. I think that's worth doing, especially since I've added an option to compute the full shot histogram, i.e. with every pixel counted (step size 1). That takes around 16 seconds, so this change should save at least 6 seconds.

It works on the G1X with my get_shot_meter() function, and on the SX50, it still saves good DNG files.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #62 on: 02 / February / 2013, 04:33:57 »
Thanks, I'll update SVN with the corrected code.
At least we have raw save working now. I haven't figured out the shot meter problem on this camera yet, but I did find a way to improve get_raw_pixel(..) and set_raw_pixel(..)

First, make rawadr static at the beginning of raw.c
Code: [Select]
  static char* rawadr; // = get_raw_image_addr()
Then, set rawadr and altrawadr at the very beginning of raw_savefile()
Code: [Select]
int raw_savefile() {
    // Get pointers to RAW buffers (will be the same on cameras that don't have two or more buffers)
    rawadr = get_raw_image_addr();
    char* altrawadr = get_alt_raw_image_addr();
Now you can replace all the references to "get_raw_image_addr()" to just, "rawdr". For example:
Code: [Select]
void set_raw_pixel(unsigned int x, unsigned int y, unsigned short value) {
#if CAM_SENSOR_BITS_PER_PIXEL==10
    unsigned char* addr=(unsigned char*)rawadr+y*camera_sensor.raw_rowlen+(x/8)*10;
This cuts my shot meter computation time for 4 meters from about 50 msec, down to about 30 msec. I think that's worth doing, especially since I've added an option to compute the full shot histogram, i.e. with every pixel counted (step size 1). That takes around 16 seconds, so this change should save at least 6 seconds.

It works on the G1X with my get_shot_meter() function, and on the SX50, it still saves good DNG files.


Looks ok. I can't think of any case where the get_raw_pixel or set_raw_pixel functions could be called outside of raw_savefile.

I did a quick test and the time required to call get_raw_pixel on the entire G1X buffer drops from 15 seconds to 10 seconds (without actually doing anything with the values).

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: SX50 HS porting thread
« Reply #63 on: 02 / February / 2013, 18:59:34 »
After more testing, it looks like I'm using the right addresses for my shot meters. I draw lines around them into the raw buffer on the first shot, and the lines appear in the correct positions in the dng file. The only thing I can think of is that get_raw_pixel(x,y) is returning the wrong values. Maybe the offset is wrong. Here's what I printed from camera_sensor.

raw_rows, raw_rowpix, raw_rowlen, raw_size
3062, 4176, 6264, 19180368

Here's the size entries in platform_camera.h
I notice that the jpg size is the entire active area, which seems unusual.

Code: [Select]
    // Sensor size, DNG image size & cropping
#define CAM_RAW_ROWPIX    4176 // Found @0xff1ae73c
#define CAM_RAW_ROWS      3062 // Found @0xff1ae748
    #define CAM_JPEG_WIDTH                      4072
    #define CAM_JPEG_HEIGHT                     3044
    #define CAM_ACTIVE_AREA_X1                  96
    #define CAM_ACTIVE_AREA_Y1                  16
    #define CAM_ACTIVE_AREA_X2                  4168
    #define CAM_ACTIVE_AREA_Y2                  3060
Here's a dng file from the sx50:

https://www.box.com/files/0/f/597049076/1/f_5907230451
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #64 on: 02 / February / 2013, 19:22:34 »
After more testing, it looks like I'm using the right addresses for my shot meters. I draw lines around them into the raw buffer on the first shot, and the lines appear in the correct positions in the dng file. The only thing I can think of is that get_raw_pixel(x,y) is returning the wrong values. Maybe the offset is wrong. Here's what I printed from camera_sensor.

raw_rows, raw_rowpix, raw_rowlen, raw_size
3062, 4176, 6264, 19180368

Here's the size entries in platform_camera.h
I notice that the jpg size is the entire active area, which seems unusual.

Code: [Select]
    // Sensor size, DNG image size & cropping
#define CAM_RAW_ROWPIX    4176 // Found @0xff1ae73c
#define CAM_RAW_ROWS      3062 // Found @0xff1ae748
    #define CAM_JPEG_WIDTH                      4072
    #define CAM_JPEG_HEIGHT                     3044
    #define CAM_ACTIVE_AREA_X1                  96
    #define CAM_ACTIVE_AREA_Y1                  16
    #define CAM_ACTIVE_AREA_X2                  4168
    #define CAM_ACTIVE_AREA_Y2                  3060
Here's a dng file from the sx50:

https://www.box.com/files/0/f/597049076/1/f_5907230451

Everything looks ok, I can't see how get_raw_pixel could return the wrong value (unless you've made other changes to the code).

You had this working on the SX260 which is also a 12 bit sensor - does that camera still work.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: SX50 HS porting thread
« Reply #65 on: 03 / February / 2013, 00:17:33 »
Everything looks ok, I can't see how get_raw_pixel could return the wrong value (unless you've made other changes to the code).

You had this working on the SX260 which is also a 12 bit sensor - does that camera still work.
Thanks for checking it. My SX260 wouldn't power on, so I sent it to Canon a few days ago. Hopefully, I'll have it back in a week.

I'll check the unmodified shot histogram in the trunk tomorrow and see if it comes out right. It also uses get_raw_pixel.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline yukia10

  • *
  • 32
  • SX50_100c
Re: SX50 HS porting thread
« Reply #66 on: 06 / February / 2013, 06:50:18 »
I have missed changing the address in stubs_min.S (i.e. viewport_buffers).
I did a new ALPHA Build for FW 1.00c.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #67 on: 06 / February / 2013, 07:12:56 »
I have missed changing the address in stubs_min.S (i.e. viewport_buffers).
I did a new ALPHA Build for FW 1.00c.


Can you upload the firmware dump to a file share site and post a link so it can be added to the repository.

I wasn't able to use your patch file. If you zip up your sub/100c directory and post it here I will add it to SVN.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline yukia10

  • *
  • 32
  • SX50_100c
Re: SX50 HS porting thread
« Reply #68 on: 07 / February / 2013, 07:03:27 »
Hi, Phil.

Firmware dump of SX50HS 1.00c is availabe here:
http://www.sendspace.com/file/qr4jkv
http://www.sendspace.com/file/gc174e

and zipped sub/100c is attached.

I also swapped jog dial directions in sx50hs/kbd.c when I build.

Code: [Select]
long get_jogdial_direction(void)
{
    old_jogdial = new_jogdial;
    new_jogdial = rear_dial_position;
    if (old_jogdial < new_jogdial) return JOGDIAL_RIGHT;
    else if (old_jogdial > new_jogdial) return JOGDIAL_LEFT;
    else return 0;
}
« Last Edit: 01 / March / 2013, 08:35:45 by yukia10 »

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #69 on: 08 / February / 2013, 03:29:19 »
Hi, Phil.

Dump is availabe here:
http://www.sendspace.com/file/qr4jkv

and zipped sub/100c is attached.

I also swapped jog dial directions in sx50hs/kbd.c when I build.

Code: [Select]
long get_jogdial_direction(void)
{
    old_jogdial = new_jogdial;
    new_jogdial = rear_dial_position;
    if (old_jogdial < new_jogdial) return JOGDIAL_RIGHT;
    else if (old_jogdial > new_jogdial) return JOGDIAL_LEFT;
    else return 0;
}


Thanks for that. I've added it to both the trunk and release-1.1 versions; but with auto build turned off for now.

On my cameras the jogdial works as:
- right (clockwise) moves down in the CHDK menus
- left (anti-clockwise) moves up in the CHDK menus
If you're mod to kbd.c works like this then I can add this change as well.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal