Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several small improvements #3

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
9 changes: 7 additions & 2 deletions lens_shading_analyse.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ int main(int argc, char *argv[])
int bayer_order;
struct brcm_raw_header *hdr;
int width, height, stride;
int grid_width, grid_height;
int single_channel_width, single_channel_height;
unsigned int black_level = 16;

Expand Down Expand Up @@ -208,6 +209,10 @@ int main(int argc, char *argv[])
height = hdr->height;
single_channel_width = width/2;
single_channel_height = height/2;
grid_width = single_channel_width / 32 + (single_channel_width % 32 == 0 ? 0 : 1);
grid_height = single_channel_height / 32 + (single_channel_height % 32 == 0 ? 0 : 1);
printf("Grid size: %d x %d\n", grid_width, grid_height);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quicker to do (single_channel_width + 31) / 32


//Stride computed via same formula as the firmware uses.
stride = (((((width + hdr->padding_right)*5)+3)>>2) + 31)&(~31);

Expand Down Expand Up @@ -340,8 +345,8 @@ int main(int argc, char *argv[])
}
fprintf(header, "};\n");
fprintf(header, "uint32_t ref_transform = %u;\n", hdr->transform);
fprintf(header, "uint32_t grid_width = %u;\n", (single_channel_width>>5)+1);
fprintf(header, "uint32_t grid_height = %u;\n", (single_channel_height>>5)+1);
fprintf(header, "uint32_t grid_width = %u;\n", grid_width);
fprintf(header, "uint32_t grid_height = %u;\n", grid_height);

for (i=0; i<NUM_CHANNELS; i++)
{
Expand Down