How to understand CHDK source code, raw.c - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

How to understand CHDK source code, raw.c

  • 14 Replies
  • 13313 Views
*

Offline reyalp

  • ******
  • 14117
Re: How to understand CHDK source code, raw.c
« Reply #10 on: 15 / October / 2012, 16:22:33 »
Advertisements
Another Question is , if anyone want to do something to the raw image pixel,  should they put their own code between read and close(fd)
The "read" is only used for the raw develop operation. See http://chdk.wikia.com/wiki/CHDK_User_Manual#RAW_develop for a description of this.  If you put your operation there, then it will only work in raw develop, not normal shooting.

If you want to modify pixels in a normal shot, doing it just before or after
Code: [Select]
    if (conf.bad_pixel_removal) patch_bad_pixels();
should be OK.

Quote
After this comment , there is again a   started() .......  finished(); structure, I guess that is related to write the file to the SD card, right?
No, you should look at the definitions, don't make assumptions. These just control an LED so you know something is happening.
Don't forget what the H stands for.

Re: How to understand CHDK source code, raw.c
« Reply #11 on: 15 / October / 2012, 16:26:54 »
These just control an LED so you know something is happening.
And IIRC,  it might control an LED on some cameras.  On others is actually ends up doing nothing as the LED code is not always implemented.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: How to understand CHDK source code, raw.c
« Reply #12 on: 17 / October / 2012, 06:01:57 »
Thanks reyalp, I mean the codes (for example libdng->write_dng(fd, rawadr, altrawadr, CAM_UNCACHED_BIT );) between the second  started() .......  finished() is the actual SD card raw file writing process. Is my guess right?

And I also noticed , in RAW.C,   the function    void raw_postprocess() {} is empty, so I suppose it is reserved for users to put their own codes here? For example to modify raw image pixels?
But what confused me is that, in order to call this function in main.c , the returned value of raw_savefile() should be 1, which means the variable ret defined in above function should be 1. My question is in which case this will happen?

Great Thanks in advance!

Re: How to understand CHDK source code, raw.c
« Reply #13 on: 17 / October / 2012, 06:25:49 »
in order to call this function in main.c , the returned value of raw_savefile() should be 1, which means the variable ret defined in above function should be 1. My question is in which case this will happen?

If a raw file was opened and presumably the sensor data was saved to that file :-

ret = (fd >= 0);

'fd' is a file descriptor and it is not -1 if the file was opened.


*

Offline reyalp

  • ******
  • 14117
Re: How to understand CHDK source code, raw.c
« Reply #14 on: 18 / October / 2012, 00:22:24 »
Thanks reyalp, I mean the codes (for example libdng->write_dng(fd, rawadr, altrawadr, CAM_UNCACHED_BIT );)
between the second  started() .......  finished() is the actual SD card raw file writing process. Is my guess right?
[/quote]
This is completely different form the code you quoted before. The DNG code will be used if you are shooting DNG, the raw code will be used if you are shooting CHDK raw.

It's not clear to me if you are trying to alter the pixels in the raw file, or just the data in the buffer so it will show up in the camara jpeg.
Quote
And I also noticed , in RAW.C,   the function    void raw_postprocess() {} is empty, so I suppose it is reserved for users to put their own codes here? F
As far as I know raw_postprocess() is some kind of unfinished project or leftover. I said where I would modify the raw buffer, and it's not there...
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal