supplierdeeply

DNG active area

  • 6 Replies
  • 661 Views
*

Offline reyalp

  • ******
  • 9803
  • Publish
    DNG active area
    « on: 04 / March / 2015, 00:08:21 »
    Advertisements
    From the sample c_joerg sent me, I noticed the s110 has
    Code: [Select]
       #define CAM_ACTIVE_AREA_Y1                  11
       #define CAM_ACTIVE_AREA_Y2                  3059
    This is correct in terms of which pixels have data in them, but camera.h says

    Code: [Select]
        #undef  CAM_ACTIVE_AREA_X1                  // Define usable area of the sensor - needs to be divisible by 4 - calibrate using a CHDK RAW image converted with rawconvert.exe (eg :rawconvert -12to8 -pgm -w=4480 -h=3348 photo.crw photo.pgm)
        #undef  CAM_ACTIVE_AREA_Y1                  // Define usable area of the sensor - needs to be divisible by 2 - "
        #undef  CAM_ACTIVE_AREA_X2                  // Define usable area of the sensor - needs to be divisible by 4 - "
        #undef  CAM_ACTIVE_AREA_Y2                  // Define usable area of the sensor - needs to be divisible by 2 = "
    The rawop code assumes the the values are even, and IIRC some of the other code depends on this as well. It is not a requirement of the DNG spec, but it makes our code simpler.

    I don't recall where the divisible by 4 requirement comes from, quite a few ports seem to violate it. If anyone can remind me, it would be appreciated.

    From a quick look s110 is the only port that uses and odd value.

    Unless there are objections, I'll make s110 use 12,  3058

    Once this is sorted out I'll add some #error checks to camera.h to make the build fail if the values aren't acceptable. A similar check for jpeg area > active area would be a good idea too.
    Don't forget what the H stands for.

    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: DNG active area
    « Reply #1 on: 04 / March / 2015, 00:28:23 »
    From the sample c_joerg sent me, I noticed the s110 has
    Code: [Select]
       #define CAM_ACTIVE_AREA_Y1                  11
       #define CAM_ACTIVE_AREA_Y2                  3059
    This is correct in terms of which pixels have data in them, but camera.h says

    Code: [Select]
        #undef  CAM_ACTIVE_AREA_X1                  // Define usable area of the sensor - needs to be divisible by 4 - calibrate using a CHDK RAW image converted with rawconvert.exe (eg :rawconvert -12to8 -pgm -w=4480 -h=3348 photo.crw photo.pgm)
        #undef  CAM_ACTIVE_AREA_Y1                  // Define usable area of the sensor - needs to be divisible by 2 - "
        #undef  CAM_ACTIVE_AREA_X2                  // Define usable area of the sensor - needs to be divisible by 4 - "
        #undef  CAM_ACTIVE_AREA_Y2                  // Define usable area of the sensor - needs to be divisible by 2 = "
    The rawop code assumes the the values are even, and IIRC some of the other code depends on this as well. It is not a requirement of the DNG spec, but it makes our code simpler.

    I don't recall where the divisible by 4 requirement comes from, quite a few ports seem to violate it. If anyone can remind me, it would be appreciated.

    From a quick look s110 is the only port that uses and odd value.

    Unless there are objections, I'll make s110 use 12,  3058

    Once this is sorted out I'll add some #error checks to camera.h to make the build fail if the values aren't acceptable. A similar check for jpeg area > active area would be a good idea too.

    Not sure where the divisible by 4 comes from - although this does ensure you are starting on a byte boundary.

    If you change the active area you may also need to change the CFA value.
    I've played with this in the past and making the X1 value odd causes Adobe software to screw up the de-bayering unless the CFA is also changed to match.

    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)

    *

    Offline reyalp

    • ******
    • 9803
  • Publish
    Re: DNG active area
    « Reply #2 on: 04 / March / 2015, 16:52:55 »
    I've played with this in the past and making the X1 value odd causes Adobe software to screw up the de-bayering unless the CFA is also changed to match.
    Yes, the CFA is relative to the active area, so shifting by an odd value changes it. This should affect all viewers, but some might make assumptions about it being even like CHDK.

    I've checked in the change for s110.

    I added checks to camera.h, but am still going through the batch build to find all the cameras that have bad values.
    Don't forget what the H stands for.

    *

    Offline reyalp

    • ******
    • 9803
  • Publish
    Re: DNG active area
    « Reply #3 on: 04 / March / 2015, 22:48:59 »
    Additional cameras with issues;

    A2200, G15, S100:
    Y1 and Y2 odd

    SX1
    X2 and Y2 odd, active area smaller than jpeg area. The jpeg area matches canon specs.

    Attached patch should fix these and adds the checks to camera.h.
    For SX1, I enlarged the active area to equal the jpeg area. I have no idea what the actual active area is, but it should be bigger than a camera jpeg  :-[

    I'll probably check this in if there are no objections. I thought about making the code accept odd values, but (among other things) that would mean the CFA would need to change on these cameras when the "default crop" is switched between "sensor" and the other settings.

    I don't have any of these cameras, so if anyone can test that would be appreciated. For S110, I checked by modifying the sample DNG with the new values.
    Don't forget what the H stands for.


    *

    Offline reyalp

    • ******
    • 9803
  • Publish
    Re: DNG active area
    « Reply #4 on: 07 / March / 2015, 15:26:50 »
    I checked this in for 1.4, changeset 4044. All untested.

    G15, S100 and S110 all have the "Jpeg area" (used for default crop in CHDK DNG) defined larger than the actual canon spec. For the S100, I reduced it slightly to keep jpeg <= active.
    Don't forget what the H stands for.

  • Publish
    Re: DNG active area
    « Reply #5 on: 08 / March / 2015, 22:24:35 »
    S100 tests okay.  Wiki page updated.

  • Publish
    Re: DNG active area
    « Reply #6 on: 24 / November / 2015, 08:01:38 »
    First experience with dng. Based on this http://chdk.wikia.com/wiki/Testing_Needed

    "Test needed
    DNG colors roughly correct, i.e. red, green, blue not swapped
    Active area does not included completely black pixels
    Posting a sample DNG will also allow verifying the change."


    dng (sx150is-100a-1.4.0-4297-full) available here https://onedrive.live.com/redir?resid=B7647D7153DD07D%21215&authkey=%21AKd7tOfC2Os5mwM&ithint=file%2cDNG

    dng_validate.exe results attached
    cchdk4.cfg (as txt) used attached

    Haven't yet read enough to determine significance of warnings etc.

    « Last Edit: 24 / November / 2015, 08:05:54 by andrew.stephens.754365 »
    "...I know all the crazy unsafe things it does under the hood, and I know that what passes for "QA" is mostly people who don't really know how it's supposed to work trying random stuff on a tiny subset of the supported hardware."

     

    Related Topics