Program to batch-set the noise reduction in X3Fs from the SD1M

Started Nov 2, 2012 | Discussions thread
ForumParentFirstPreviousNextNext unread
Flat view
Rodrigo Cunha
Contributing MemberPosts: 698
Like?
Program to batch-set the noise reduction in X3Fs from the SD1M
Nov 2, 2012

Hi!

I made a small C program to batch-set the noise reduction parameters in X3F files, as I find normal noise reduction is far too high at high isos.

Here it goes, in case anyone cares:

/*
Use this program to batch-set the noise reduction in X3F files from the Sigma SD1 Merril.
1st parameter, chroma noise reduction, 0-1-2-3-4.
2nd parameter, luminance noise reduction, 0-1-2-3-4.
3rd parameter, banding noise reduction, 0-1-2-3-4.
Nth parameter, files...
Barely tested! Use at your own risk!
*/
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
if (argc<4) {
exit(1); // no arguments
}
int nr_color = atoi(argv[1]);
int nr_light = atoi(argv[2]);
int nr_band = atoi(argv[3]);
printf("Setting files to nr_color=%d,nr_light=%d,nr_band=%d.\n",nr_color,nr_light,nr_band);
for (int i=4 ; i<argc ; i++) {
FILE *fp = fopen(argv[i],"r+");
if (fp==NULL) {
printf("Error opening file \"%s\".\n",argv[i]);
}
fseek(fp,114,SEEK_SET);
fputc(0x0C,fp);
fputc(0x0D,fp);
fputc(0x17,fp);
fseek(fp,178,SEEK_SET);
if (nr_color==0) {
fputc(0x00,fp);
fputc(0x00,fp);
} else if (nr_color==1) {
fputc(0x80,fp);
fputc(0x3E,fp);
} else if (nr_color==2) {
fputc(0x00,fp);
fputc(0x3F,fp);
} else if (nr_color==3) {
fputc(0x40,fp);
fputc(0x3F,fp);
} else if (nr_color==4) {
fputc(0x80,fp);
fputc(0x3F,fp);
} else {
fputc(0x00,fp);
fputc(0x3F,fp);
}
fseek(fp,182,SEEK_SET);
if (nr_light==0) {
fputc(0x00,fp);
fputc(0x00,fp);
} else if (nr_light==1) {
fputc(0x80,fp);
fputc(0x3E,fp);
} else if (nr_light==2) {
fputc(0x00,fp);
fputc(0x3F,fp);
} else if (nr_light==3) {
fputc(0x40,fp);
fputc(0x3F,fp);
} else if (nr_light==4) {
fputc(0x80,fp);
fputc(0x3F,fp);
} else {
fputc(0x00,fp);
fputc(0x3F,fp);
}
fseek(fp,186,SEEK_SET);
if (nr_band==0) {
fputc(0x00,fp);
fputc(0x00,fp);
} else if (nr_band==1) {
fputc(0x80,fp);
fputc(0x3E,fp);
} else if (nr_band==2) {
fputc(0x00,fp);
fputc(0x3F,fp);
} else if (nr_band==3) {
fputc(0x40,fp);
fputc(0x3F,fp);
} else if (nr_band==4) {
fputc(0x80,fp);
fputc(0x3F,fp);
} else {
fputc(0x00,fp);
fputc(0x3F,fp);
}
fclose(fp);
}
}

Sigma SD1
If you believe there are incorrect tags, please send us this post using our feedback form.
ForumParentFirstPreviousNextNext unread
Flat view
ForumParentFirstPreviousNextNext unread
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark post MMy threads
Color scheme? Blue / Yellow