-------------------------
In my camera.h, I added CAM_MASKED_AREA_... values (pointing to Canon Masked Area)
Here is my values:
/* lebeau :
The Canon raw data contains a masked area and an active are which contains the JPEG area.
The mask area could be usefull for some software, to evaluate black level.
In fact, the masked area reflect a quasi Gaussian distribution of black values,
between 0 to, about, twice the black level, making an average of black level.
Mask Area Values are set in camera.h and could be approximative.
Select an area at the left of the active area, not so near the overall raw area.
All numbers shall be even for CFA pattern
example for my A650, but not tested on other cam !!!
CAM_MASKED_AREA_X1 >= 12
CAM_MASKED_AREA_Y1 = CAM_ACTIVE_AREA_Y1
CAM_MASKED_AREA_X2 <= ( CAM_ACTIVE_AREA_X1 - 4 )
CAM_MASKED_AREA_Y2 = CAM_ACTIVE_AREA_Y2
*/
#define CAM_MASKED_AREA_X1 12
#define CAM_MASKED_AREA_Y1 14
#define CAM_MASKED_AREA_X2 48
#define CAM_MASKED_AREA_Y2 3030
/* Masked Area
This tag contains a list of non-overlapping rectangle coordinates of fully masked pixels, which can be optionally used by DNG readers to measure the black encoding level.
The order of each rectangle's coordinates is: top, left, bottom, right.
If the raw image data has already had its black encoding level subtracted, then this tag should not be used, since the masked pixels are no longer useful.
Note that DNG writers are still required to include estimate and store the black encoding level using the black level DNG tags. Support for the MaskedAreas tag is not required of DNG readers.
*/
-------------------------
CAM_RAW_ROW_LEN were in raw.h and I move it to camera.h because it is usefull, from the begining, for other #define AND CAM_stuff are defined there. Therefore, I also modified RAW_ROW_LEN to CAM_RAW_ROW_LEN
"were in raw.h"
//#define RAW_ROWLEN ((CAM_RAW_ROWPIX*CAM_SENSOR_BITS_PER_PIXEL)/8)
"move to camera.h, with prefixed CAM_"
-------------------------
Yes, I made a junior error writing "stats_domain = RAW_STATS_MASKED" instead of "stats_domain == RAW_STATS_MASKED", sorry
Also, I don't know why that code section is compile (and generate error) if your "CAM_MASKED_AREA_X1" is not defined" ? May be because of my junior error?
-------------------------
Yes, direct check instead of getrawpixel is really faster since it conditionnally access less addr[val] and, also, compute less often the addr value.
-------------------------
I will come back with a Lua function interface as soon as tested which will look like that.
// selectively set hdr stats mode, called before capturing raw data
static int luaCB_set_hdr_stats_mode( lua_State* L )
{
set_hdr_stats_mode ( luaL_checknumber(L,1) ); // HDR_STATS_NONE (=0), HDR_STATS_BLACK (=1), HDR_STATS_WHITE (=2) or HDR_STATS_BLACK_WHITE (=3)
return 0;
}
// return count of the active area cells, upon requested color
static int luaCB_get_hdr_stats( lua_State* L )
{
int hdr_stats = (luaL_checknumber(L,1)); // HDR_STATS_BLACK (=1) or HDR_STATS_WHITE (=2)
int stats_color = (luaL_checknumber(L,2)); // STATS_ALL, STATS_RED, STATS_GREEN1, STATS_GREEN2 or STATS_BLUE
lua_pushnumber( L, get_hdr_stats ( hdr_stats, stats_color ) ); // return counts of black or white region, upon requested color
return 1;
}
#if defined CAM_MASKED_AREA_X1
// set noise stats mode, called before capturing raw data
static int luaCB_set_noise_stats_mode( lua_State* L )
{
set_noise_stats_mode ( luaL_checknumber(L,1) ); // false (=0) or true (=1)
return 0;
}
// return standard deviation of the masked area cells, upon requested color
static int luaCB_get_noise_stats( lua_State* L )
{
int stats_color = (luaL_checknumber(L,1)); // STATS_ALL, STATS_RED, STATS_GREEN1, STATS_GREEN2 or STATS_BLUE
lua_pushnumber( L, get_noise_stats ( stats_color ) );
return 1;
}
#endif