IXUS 1000 HS Porting Thread - page 24 - DryOS Development - CHDK Forum  

IXUS 1000 HS Porting Thread

  • 440 Replies
  • 166326 Views
*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #230 on: 28 / December / 2010, 17:09:04 »
Advertisements
@realyp
That's what I get with rawconvert, with a picture of red, green and blue, how can I get from this the right weights to build a new cam_CFAPattern


*

Offline reyalp

  • ******
  • 14080
Re: IXUS 1000 HS Porting Thread
« Reply #231 on: 28 / December / 2010, 22:30:06 »
That looks normal to me, not some weird pattern like http://en.wikipedia.org/wiki/File:Kodak_RGBW_patterns.svg

Format of CFAPattern is simple, it's an int that gives 4 values per http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/cfapattern.html  The value is sequence of bytes, so the digits in the int are reversed. You could just hex the value in the dng to try all the combinations instead of changing CHDK code and taking a new pic each time.

The code with CFAPattern in raw.c is only for thumbnail, you can ignore it.

Since the bayer pattern is clearly visible, seems to me packing of 12 bit data is correct.

Can you upload a sample image somewhere ? (with jpeg, so I can see what is supposed to be there)

It seems like this should be very very similar to ixus300hs, have you checked the what pixeldoc used there ?
Don't forget what the H stands for.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #232 on: 29 / December / 2010, 03:51:07 »
Thanks reyalp,

Here is the test of a jpg and a crw(no dng) : http://www.4shared.com/file/ol8TPVVZ/ixus1000rawtest.html

yes 12 bit data is correct

Where exactly in the DNG is the cfapattern, have to look for A302 in the header?

pixeldocs, ixus300hs, seams to be using the RGGB pattern

Re: IXUS 1000 HS Porting Thread
« Reply #233 on: 29 / December / 2010, 04:49:41 »
Here i have find out how to get some better colors for IX 1000 Port.

http://chdk.setepontos.com/index.php?topic=5930.msg58886#msg58886

But this camera does not have colors as red, green, blue, yellow, blue.so maybe a expert can tell if it is possible to set a rgb value to a palette at boot.

@reyalp
>It seems like this should be very very similar to ixus300hs, have you checked the what pixeldoc used >there ?

i test all values pixeldoc port used, but it not work.maybe i miss some more values that are Sensor specific ?.


this are the values

#define CAM_COLORMATRIX1 \
      640019, 1000000, -220031, 1000000, -96241, 1000000, \
     -77419, 1000000, 639766, 1000000, 44009, 1000000, \
      17965, 1000000, 78396, 1000000, 231868, 1000000

#define cam_CFAPattern 0x02010100 // Red Green Green Blue

the next 2 defines are too same on IX300 Port.

#define CAM_RAW_ROWPIX              3816 // from calcs see 100C lib.c   //ASM1989
    #define CAM_RAW_ROWS                2784 //  "     "    "    "    "  //ASM1989


He use as aspect this values, but too not work on IX1000

#define CAM_ACTIVE_AREA_X1 10 // ToDo, just guesswork
    #define CAM_ACTIVE_AREA_Y1 8 // ToDo, just guesswork
    #define CAM_ACTIVE_AREA_X2 3600 // ToDo, just guesswork
    #define CAM_ACTIVE_AREA_Y2 2750 // ToDo, just guesswork

very strange wy raw on this cam not work.
« Last Edit: 29 / December / 2010, 06:20:47 by Bernd R »
Ixus 1000 HS


Re: IXUS 1000 HS Porting Thread
« Reply #234 on: 31 / December / 2010, 13:14:21 »
I have try the enhancement from philmoz here

http://chdk.setepontos.com/index.php?topic=5641.msg58970#msg58970

with this address for the 100D Firmware

NHSTUB(GetImageFolder,0xFF952D1C)   // function before 'GetCameraObjectTmpPath ERROR' string

It work good in daily and monthly generate directory now.
Ixus 1000 HS

Re: IXUS 1000 HS Porting Thread
« Reply #235 on: 04 / January / 2011, 07:26:30 »
I see now

#define PROPCASE_ASPECT_RATIO                    300

this work on IX1000 too, when 16:9 shooting mode is use, then its 1.on 4:3 mode its 0.
so its possible for edge overlay grid and zebra if 0 (Mode 4:3) add an offset of 60 to x and reduce the width by 120.

this is need because on 4:3 modes Canon software show the image on display from  X 60 to X420 (360 pixel width).on the left and right side are some info text and black bar.So edge, zebra, and grid work ok on 4:3 modes too

but where best add the offsets and widths ?
« Last Edit: 04 / January / 2011, 07:33:17 by Bernd R »
Ixus 1000 HS

Re: IXUS 1000 HS Porting Thread
« Reply #236 on: 04 / January / 2011, 08:12:07 »
I see in the IX 1000 Port, the Zoom values are wrong.I see in prop 199 that the IX1000 have  100 zoom positions,(value from 0 at min zoom and 100 on max zoom

its a 10* zoom Camera from 36 to 360 (simular to 35 mm).real lens values are 6.3 to 63.

Can somebody help and explain more what CF_EFL values and  fl_tb tables i need ?
I understand not what values i need, please help

this are the values copy from SX210

//zoom position is get_parameter_data(87)
static const struct {
   int zp, fl;
} fl_tbl[] = {
  {   0,   5000},
  {  16,   6800},
  {  32,   9100},
  {  62,  16200},
  {  78,  22300},
  { 102,  35900},
  { 125,  60000},
};
#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))


// Focal length range is 5.0 - 70,0 mm, 27.3 - 392 in 35-mm equivalent.
// So, CF_EFL = 27.3/5.0*10000=54600 or392/70*10000=56000
// diff = 54600 - 54566.6 = 1400, split it 1400 / 2 = 700
// add to base 56000 + 700 = 56700
// divide by 10 to avoid overflow in get_effective_focal_length()
#define CF_EFL  5670
const int zoom_points = 126;

int get_effective_focal_length(int zp) {
   return (CF_EFL*get_focal_length(zp))/1000;
}

int get_focal_length(int zp) {
   int i;

   if (zp<fl_tbl[0].zp)
      return fl_tbl[0].fl;
   else if (zp>fl_tbl[NUM_FL-1].zp)
      return fl_tbl[NUM_FL-1].fl;
   else
      for (i=1; i<NUM_FL; ++i) {
         if (zp==fl_tbl[i-1].zp)
            return fl_tbl[i-1].fl;
         else if (zp==fl_tbl.zp)
            return fl_tbl.fl;
         else if (zp<fl_tbl.zp)
            return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl.fl-fl_tbl[i-1].fl)/(fl_tbl.zp-fl_tbl[i-1].zp);
      }
   return fl_tbl[NUM_FL-1].fl;
}

int get_zoom_x(int zp) {
   return get_focal_length(zp)*10/fl_tbl[0].fl;
}
« Last Edit: 04 / January / 2011, 08:15:18 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #237 on: 05 / January / 2011, 04:36:39 »
@Bernd
I updated sources to the latest trunk
http://www.4shared.com/file/0bXOeCi6/sx210-ixus1000asm1989trunk1023.html

About the aspect ratio:

at camera.h

Code: [Select]
   #undef CAM_USES_ASPECT_CORRECTION
    #undef CAM_USES_ASPECT_YCORRECTION
    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate

        #undef ASPECT_XCORRECTION
    #define ASPECT_XCORRECTION(x)  (((x)<<1))   //correction x*screen_buffer_width/screen_width = x*960/480 = x*2/1
    #undef ASPECT_GRID_XCORRECTION
    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/8  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9  ,  8 is the right value for sx210
    #undef ASPECT_GRID_YCORRECTION
    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.


    #undef ASPECT_VIEWPORT_XCORRECTION
    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
    #undef ASPECT_VIEWPORT_YCORRECTION
    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )

Make a text search of all the source files involved it this probably at gui.... files
« Last Edit: 05 / January / 2011, 04:44:35 by asm1989 »


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: IXUS 1000 HS Porting Thread
« Reply #238 on: 05 / January / 2011, 04:50:23 »
I see now

#define PROPCASE_ASPECT_RATIO                    300

this work on IX1000 too, when 16:9 shooting mode is use, then its 1.on 4:3 mode its 0.
so its possible for edge overlay grid and zebra if 0 (Mode 4:3) add an offset of 60 to x and reduce the width by 120.

this is need because on 4:3 modes Canon software show the image on display from  X 60 to X420 (360 pixel width).on the left and right side are some info text and black bar.So edge, zebra, and grid work ok on 4:3 modes too

but where best add the offsets and widths ?

Have a look at what I did for the SX30 and G12 - I've implemented a vertical and horizontal offset system that fixes zebra, histogram, edge overlay and motion detect for cases where the image aspect ratio does not match the viewport.

You have to define some functions in lib.c to return the x & y offsets, and modify the viewport width and height routines to return the correct values based on the aspect ratio.

SX30 has 16:9 mode as the only alternate aspect ratio (other than the default 4:3) so it is probably closest to what you need. G12 has 16:9, 3:2, 1:1 and 4:5.

All the code is in the latest trunk.

Regards,
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 philmoz

  • *****
  • 3450
    • Photos
Re: IXUS 1000 HS Porting Thread
« Reply #239 on: 05 / January / 2011, 05:25:30 »
Can somebody help and explain more what CF_EFL values and  fl_tb tables i need ?

The CF_EFL value is used to convert a camera focal length to a 35mm effective focal length.
In the case of the IX 1000 it will be a constant 360/63 = 5.714. To avoid floating point math most implementations use a CF_EFL of 1000x the actual value then divide by 1000 to get the final value. So you could use 5714 as the CF_EFL value.
Personally I think in your case it would be cleaner to change the divisor in get_effective_focal_length from 1000 to 63 and set CF_EFL to 360. This then exactly matches the camera focal length values.

fl_tbl is used to convert a focus position to a focal length (* 1000) - in your case the focus position will range from 0 to 100 (101 positions). This table is used by get_focal_length to return the camera focal length for each position. In cases where there aren't many positions fl_tbl will have a value for each position. Where there are lots it only has key positions and the values are interpolated as needed (this is what the code you posted from the SX210 is doing).

I use a different method for the SX30 (201 focus positions). I found the focus position table in the firmware so I simply map this address as a integer array and then index into this table to get the focal length.

Code: [Select]
// Focus length table in firmware @ FFFEA5CC
#define NUM_FL 201 // 0 - 200, entries in firmware
extern int focus_len_table[NUM_FL];

int get_focal_length(int zp) {
if (zp < 0) zp = 0;
else if (zp >= NUM_FL) zp = NUM_FL-1;
return focus_len_table[zp];
}

Hope this helps,
Phil.
« Last Edit: 05 / January / 2011, 17:03:05 by philmoz »
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