projects
/
colorize.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9b04385
)
Fix and option for "fields"
author
Andreas Eversberg
<andreas@eversberg.eu>
Thu, 25 Jun 2015 11:59:04 +0000
(13:59 +0200)
committer
Andreas Eversberg
<andreas@eversberg.eu>
Thu, 25 Jun 2015 11:59:04 +0000
(13:59 +0200)
tools/fields.c
patch
|
blob
|
history
diff --git
a/tools/fields.c
b/tools/fields.c
index
8649a65
..
508afbc
100644
(file)
--- a/
tools/fields.c
+++ b/
tools/fields.c
@@
-40,7
+40,7
@@
int main(int argc, char *argv[])
{
unsigned short *field1_img = NULL, *field2_img = NULL, *frame_img = NULL;
int width, height;
{
unsigned short *field1_img = NULL, *field2_img = NULL, *frame_img = NULL;
int width, height;
- int frame, field;
+ int frame, field
, swap = 0
;
int _argc = argc - 1;
int _arg = 1;
int _argc = argc - 1;
int _arg = 1;
@@
-50,13
+50,20
@@
int main(int argc, char *argv[])
_argc -= 2;
}
_argc -= 2;
}
+ if (_argc > 0 && !strcmp(argv[_arg], "--even")) {
+ swap = 1;
+ _arg += 1;
+ _argc -= 1;
+ }
+
if (_argc != 4) {
usage:
printf("This tool will split images to fields or join from frames.\n");
printf("The odd lines (second line, fourth line, ...) is the first field.\n\n");
if (_argc != 4) {
usage:
printf("This tool will split images to fields or join from frames.\n");
printf("The odd lines (second line, fourth line, ...) is the first field.\n\n");
- printf("Usage: %s [--depth 8] frame2field <f
ield> <frame
> <first>\n", argv[0]);
- printf(" %s [--depth 8] field2frame <f
rame> <field
> <first>\n", argv[0]);
+ printf("Usage: %s [--depth 8] frame2field <f
rame> <field
> <first>\n", argv[0]);
+ printf(" %s [--depth 8] field2frame <f
ield> <frame
> <first>\n", argv[0]);
printf(" --depth <bits> Change color depth from default %d to given bits\n", save_depth);
printf(" --depth <bits> Change color depth from default %d to given bits\n", save_depth);
+ printf(" --even Use even lines for first field and odd for second\n");
return 0;
}
return 0;
}
@@
-67,7
+74,7
@@
usage:
else
goto usage;
else
goto usage;
- frame = field = atoi(argv[_arg+
2
]);
+ frame = field = atoi(argv[_arg+
3
]);
next_frame:
printf("\n\nProcessing frame %d, field %d+%d\n", frame, field, field+1);
next_frame:
printf("\n\nProcessing frame %d, field %d+%d\n", frame, field, field+1);
@@
-79,7
+86,10
@@
next_frame:
goto out;
if (!(field2_img = malloc(width * height/2 * 3 * sizeof(unsigned short))))
goto out;
goto out;
if (!(field2_img = malloc(width * height/2 * 3 * sizeof(unsigned short))))
goto out;
- split_image(frame_img, field1_img, field2_img, width, height);
+ if (swap)
+ split_image(frame_img, field2_img, field1_img, width, height);
+ else
+ split_image(frame_img, field1_img, field2_img, width, height);
if (save_img(field1_img, width, height/2, 0, argv[_arg+2], field++))
goto out;
if (save_img(field2_img, width, height/2, 0, argv[_arg+2], field++))
if (save_img(field1_img, width, height/2, 0, argv[_arg+2], field++))
goto out;
if (save_img(field2_img, width, height/2, 0, argv[_arg+2], field++))
@@
-98,7
+108,10
@@
next_frame:
goto out;
if (!(frame_img = malloc(width * height*2 * 3 * sizeof(unsigned short))))
goto out;
goto out;
if (!(frame_img = malloc(width * height*2 * 3 * sizeof(unsigned short))))
goto out;
- join_image(field1_img, field2_img, frame_img, width, height*2);
+ if (swap)
+ join_image(field2_img, field1_img, frame_img, width, height*2);
+ else
+ join_image(field1_img, field2_img, frame_img, width, height*2);
if (save_img(frame_img, width, height*2, 0, argv[_arg+2], frame++))
goto out;
free(field1_img);
if (save_img(frame_img, width, height*2, 0, argv[_arg+2], frame++))
goto out;
free(field1_img);