commit eebc4d5fb9cf6d78cbdba7a5aa9be713ddf9959c
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed Jul 26 18:01:15 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Wed Jul 26 18:01:15 2017 +0200
blind{-make,}-kernel: apply identity kernel instead of null kernel to non-selected channels
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/man/blind-kernel.1 b/man/blind-kernel.1
index 5083e75..9dc74a3 100644
--- a/man/blind-kernel.1
+++ b/man/blind-kernel.1
_AT_@ -169,20 +169,20 @@ or
.SH OPTIONS
.TP
.B -a
-Apply the values to the alpha channel, set the
-values for all unselected channels to zero.
+Apply the values to the alpha channel, apply an
+identity kernel to all unselected channels.
.TP
.B -x
-Apply the values to the X channel, set the values
-for all unselected channels to zero.
+Apply the values to the X channel, apply an
+identity kernel to all unselected channels.
.TP
.B -y
-Apply the values to the Y channel, set the values
-for all unselected channels to zero.
+Apply the values to the Y channel, apply an
+identity kernel to all unselected channels.
.TP
.B -z
-Apply the values to the Z channel, set the values
-for all unselected channels to zero.
+Apply the values to the Z channel, apply an
+identity kernel to all unselected channels.
.SH NOTES
.B blind-make-kernel
Create a single frame, to that it can be stored to
diff --git a/man/blind-make-kernel.1 b/man/blind-make-kernel.1
index 69e3739..987ad7a 100644
--- a/man/blind-make-kernel.1
+++ b/man/blind-make-kernel.1
_AT_@ -42,8 +42,8 @@ is used to delimit cells.
.SH OPTIONS
.TP
.B -a
-Apply the values to the alpha channel, set the
-values for all unselected channels to zero.
+Apply the values to the alpha channel, apply an
+identity kernel to all unselected channels.
.TP
.BR -d \ \fIdenominator\fP
Divide the matrix by
_AT_@ -60,16 +60,16 @@ before
.BR -d .
.TP
.B -x
-Apply the values to the X channel, set the values
-for all unselected channels to zero.
+Apply the values to the X channel, apply an
+identity kernel to all unselected channels.
.TP
.B -y
-Apply the values to the Y channel, set the values
-for all unselected channels to zero.
+Apply the values to the Y channel, apply an
+identity kernel to all unselected channels.
.TP
.B -z
-Apply the values to the Z channel, set the values
-for all unselected channels to zero.
+Apply the values to the Z channel, apply an
+identity kernel to all unselected channels.
.SH NOTES
.B blind-make-kernel
Create a single frame, to that it can be stored to
diff --git a/src/blind-kernel.c b/src/blind-kernel.c
index f670886..8d0382e 100644
--- a/src/blind-kernel.c
+++ b/src/blind-kernel.c
_AT_@ -290,23 +290,23 @@ usage:
int
main(int argc, char *argv[])
{
- int null_x = 1, null_y = 1, null_z = 1, null_a = 1;
+ int id_x = 1, id_y = 1, id_z = 1, id_a = 1;
size_t rows, cols, y, x, n;
const double *kernel, *kern;
- double *buffer, *buf, *free_this;
+ double *buffer, *buf, *free_this, id_val;
ARGBEGIN {
case 'x':
- null_x = 0;
+ id_x = 0;
break;
case 'y':
- null_y = 0;
+ id_y = 0;
break;
case 'z':
- null_z = 0;
+ id_z = 0;
break;
case 'a':
- null_a = 0;
+ id_a = 0;
break;
default:
usage();
_AT_@ -315,8 +315,8 @@ main(int argc, char *argv[])
if (!argc)
usage();
- if (null_x && null_y && null_z && null_a)
- null_x = null_y = null_z = null_a = 0;
+ if (id_x && id_y && id_z && id_a)
+ id_x = id_y = id_z = id_a = 0;
if (0);
#define X(FUNC, NAME)\
_AT_@ -337,10 +337,11 @@ main(int argc, char *argv[])
for (y = 0; y < rows; y++) {
buf = buffer;
for (x = 0; x < cols; x++) {
- buf[0] = null_x ? 0.0 : *kern;
- buf[1] = null_y ? 0.0 : *kern;
- buf[2] = null_z ? 0.0 : *kern;
- buf[3] = null_a ? 0.0 : *kern;
+ id_val = (x == cols / 2 && y == rows / 2) ? 1. : 0.;
+ buf[0] = id_x ? id_val : *kern;
+ buf[1] = id_y ? id_val : *kern;
+ buf[2] = id_z ? id_val : *kern;
+ buf[3] = id_a ? id_val : *kern;
buf += 4;
kern++;
}
diff --git a/src/blind-make-kernel.c b/src/blind-make-kernel.c
index 4253a68..45f2cf9 100644
--- a/src/blind-make-kernel.c
+++ b/src/blind-make-kernel.c
_AT_@ -82,10 +82,10 @@ main(int argc, char *argv[])
{
int normalise = 0;
double denominator = 1;
- int null_x = 1, null_y = 1, null_z = 1, null_a = 1;
+ int id_x = 1, id_y = 1, id_z = 1, id_a = 1;
size_t rows, cols, y, x, n;
double *kernel, *kern, sum = 0, value;
- double *buffer, *buf;
+ double *buffer, *buf, id_val;
ARGBEGIN {
case 'd':
_AT_@ -95,23 +95,23 @@ main(int argc, char *argv[])
normalise = 1;
break;
case 'x':
- null_x = 0;
+ id_x = 0;
break;
case 'y':
- null_y = 0;
+ id_y = 0;
break;
case 'z':
- null_z = 0;
+ id_z = 0;
break;
case 'a':
- null_a = 0;
+ id_a = 0;
break;
default:
usage();
} ARGEND;
- if (null_x && null_y && null_z && null_a)
- null_x = null_y = null_z = null_a = 0;
+ if (id_x && id_y && id_z && id_a)
+ id_x = id_y = id_z = id_a = 0;
if (argc)
kernel = read_matrix_cmdline(argv, &rows, &cols);
_AT_@ -136,11 +136,12 @@ main(int argc, char *argv[])
for (y = 0; y < rows; y++) {
buf = buffer;
for (x = 0; x < cols; x++) {
+ id_val = (x == cols / 2 && y == rows / 2) ? 1. : 0.;
value = *kern++ / denominator;
- buf[0] = null_x ? 0.0 : value;
- buf[1] = null_y ? 0.0 : value;
- buf[2] = null_z ? 0.0 : value;
- buf[3] = null_a ? 0.0 : value;
+ buf[0] = id_x ? id_val : value;
+ buf[1] = id_y ? id_val : value;
+ buf[2] = id_z ? id_val : value;
+ buf[3] = id_a ? id_val : value;
buf += 4;
}
ewriteall(STDOUT_FILENO, buffer, n, "<stdout>");
Received on Wed Jul 26 2017 - 18:02:00 CEST
This archive was generated by hypermail 2.3.0
: Wed Jul 26 2017 - 18:14:12 CEST