Custom processing for JPEG (Tone curve, CA ...) - page 8 - Feature Requests - CHDK Forum supplierdeeply

Custom processing for JPEG (Tone curve, CA ...)

  • 101 Replies
  • 71194 Views
Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #70 on: 03 / October / 2008, 02:19:04 »
Advertisements
I also tried curves and found some strange things (see attached picture, 100% crop at right border of image):
- Some unprocessed vertical band at right side of image. Maybe, skippings of last 40 columns is too much.
I guess not skipping any column at all would be good for all cameras. The column skipping is only to save some ridiculous processing time on a610. It was tested with a A610 which does not use those columns at all.

Quote
- Multiple black points on image. Maybe (only maybe!) this is defect pixels on CCD, stored in RAW with value 0. After curve processing this pixels must be stored back with the same value 0 (not black level (31)).

Why store back 0? Unless the camera JPEG processing engine is doing something with it.

Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #71 on: 03 / October / 2008, 02:50:02 »
I just tried the "Collaborative Build" and see that several curves are built in: +1,2 ev and hdr.  That is great, glad to see it in there.  I have a request: How about adding -2,-1 ev and perhaps also the .5 ev steps.  That would give some nice exposure choices when developing raws.  I didn't look at the code, but these choices do not need a pre-calculated curve.  It can be easily calculated on the fly.

What will be the use of -2, -1 curves?
Calculation on the fly may not be optimal for a real time development to JPG if done at development time. It can be done at selection time though.

I had a non public build with 1/3 EV step (in the Auto DR mode) in order to follow the camera EV steps. Nice but - I still user test it. I have not feel that this is really useful.

Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #72 on: 03 / October / 2008, 10:37:10 »

What will be the use of -2, -1 curves?
Calculation on the fly may not be optimal for a real time development to JPG if done at development time. It can be done at selection time though.

I find it very useful.  I often get overexposed images (in fact that is a characteristic of Canon Powershots) that need a little -ev compensation.

I wrote code to do this on the fly (i.e. calculate the curve when it is needed.)  The amount of computation is minimal.  Here is the beginning of my routine.
Jon

Code: [Select]
#define CURVE_SIZE 1024
unsigned short curve[CURVE_SIZE];

void raw_change_ev() {
double mult;
double black;
short i,j;
unsigned short pixVal0, pixVal1, pixVal2;
unsigned char *src;

black = 0;
for(i=10;i<20;i++) black += get_raw_pixel(i,1);
black = black / 10;// calculate the black value using pixels that are always black

mult = 1;
if(conf.raw_ev == 0) return;
if(conf.raw_ev == 1) mult = 1.5;//ev+.5
if(conf.raw_ev == 2) mult = 2;//ev +1
if(conf.raw_ev == 3) mult = 3;//ev+1.5
if(conf.raw_ev == 4) mult = 4;//ev+2
if(conf.raw_ev == 5) mult = .25;//ev-2
if(conf.raw_ev == 6) mult = .375;//ev-1.5
if(conf.raw_ev == 7) mult = .5;//ev-1
if(conf.raw_ev == 8) mult = .75;//ev-.5

for(i=0;i<CURVE_SIZE;i++) {
j = (short) ((i * mult) + black - mult * black);
if(j > 1023) j = 1023;
if(j < 0) j = 0;
curve[i] = j;
}


Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #73 on: 07 / October / 2008, 22:25:33 »
Hum...
I've always been able to reduce the blown out with in camera negative EV adjustment.
Applying curves always incurs some data loss due to quantification. That's why I always
avoid using digital level gain/attenuation if the in camera EV adjustment does the job.

Then I would not use the digital gain/attenuation outsideof the following context:
- Increase apparent ISO beyond current camera ISO capability to maintain same shutter speed.
- Decrease apparent ISO beyond current camera ISO capability (eg. Electronic ND filter).

The +1, +2 EV syscurves provided has a factor of +1 or +2 EV with the lower luminance
and reducing the slope for higher luminance value to reduce highlight blown out when
combined with in camera -1, -2EV - creating a non linear response curve.



Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #74 on: 08 / October / 2008, 22:58:43 »
Hi Toinech,

I think I don't entirely understand how you use this.  Do you use it while shooting?  That's not how I use it.

I use curves when developing raw in camera that I have already shot.  You can't change the ev using the camera button in that situation. The on-camera ev button changes the exposure when taking a picture, but makes no difference if you are using CHDK to redevelop a raw that has already been captured.  So I use curves to adjust exposure on raws that I have already taken.  In that case  brightening or darkening the image is a common need and can't be done in camera any other way.

Going from 10bit data to 8 bit display must unavoidably involve some loss of data.  Giving people flexibility in how this is done is good.   +/- ev changes to the raw data are straightforward and useful.
Jon

Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #75 on: 21 / November / 2008, 03:01:03 »
I also tried curves and found some strange things (see attached picture, 100% crop at right border of image):
- Some unprocessed vertical band at right side of image. Maybe, skippings of last 40 columns is too much.
The same things reported in russian forum user of S3IS, his image:


Here are the fixes for those columns and the deactivation of curve when RAW is activated.
« Last Edit: 21 / November / 2008, 03:09:26 by toinech »

*

Offline reyalp

  • ******
  • 14086
Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #76 on: 18 / January / 2009, 23:25:58 »
Looking at this code to reduce memory use, I noticed a couple things:

in curve_apply()
Code: [Select]
switch(conf.curve_enable) {
...
case 2:
case 3: // +1EV,  +2EV
if (drcurve_loaded) drcurve_apply( conf.curve_enable >> 1 );

the >> is useless since 10b >> 1 == 11b >> 1

perhaps &1 does what was intended ?

also
Code: (C) [Select]
f read(drcurve0, 1, 4*CURVE_SIZE*sizeof(unsigned short), fd); // load a set of 4 curves - only 2 are used
Any reason not to just load 2 ?
Don't forget what the H stands for.

Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #77 on: 22 / January / 2009, 00:02:24 »
Looking at this code to reduce memory use, I noticed a couple things:

in curve_apply()
Code: [Select]
switch(conf.curve_enable) {
...
case 2:
case 3: // +1EV,  +2EV
if (drcurve_loaded) drcurve_apply( conf.curve_enable >> 1 );

the >> is useless since 10b >> 1 == 11b >> 1

perhaps &1 does what was intended ?
You are right. This was a leftover from some code that I experimented. That would explain why +2EV never get works for some user.

Quote
also
Code: (C) [Select]
f read(drcurve0, 1, 4*CURVE_SIZE*sizeof(unsigned short), fd); // load a set of 4 curves - only 2 are used
Any reason not to just load 2 ?

You are also right here - some left over code from some experimentation.

Thank you for your feed back. I am getting sloppy ...


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #78 on: 22 / January / 2009, 12:54:04 »
awrite, i guess reyalp is cleaning up the code... can't take long and he finds my messy loc, i should start hiding and renting a house in Hawa- erh, wouldnt make sense posting my hiding spot here, would it.

*

Offline reyalp

  • ******
  • 14086
Re: Custom processing for JPEG (Tone curve, CA ...)
« Reply #79 on: 22 / January / 2009, 20:21:53 »
Hrm:
raw.c 203
Code: [Select]
        finished();

        return (fd >= 0);
    }

#ifdef OPT_CURVES
    if (conf.curve_enable) curve_apply();
#endif
    return 0;

if raw is enabled, curve is not applied to jpeg ?
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal