Introduction
Introduction Statistics Contact Development Disclaimer Help
blind-gauss-blur: fix -a - blind - suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log
Files
Refs
README
LICENSE
---
commit bf4b16dc0579b5156bdd78f4eb4722689449660e
parent e17f1326d3a358e280579716c3dfc83dd5337f3c
Author: Mattias Andrée <[email protected]>
Date: Sun, 22 Jan 2017 17:18:37 +0100
blind-gauss-blur: fix -a
Signed-off-by: Mattias Andrée <[email protected]>
Diffstat:
M man/blind-gauss-blur.1 | 3 ++-
M src/blind-gauss-blur.c | 76 ++++++++++++++---------------…
2 files changed, 37 insertions(+), 42 deletions(-)
---
diff --git a/man/blind-gauss-blur.1 b/man/blind-gauss-blur.1
@@ -39,7 +39,8 @@ is ignored but may be partially read.
.TP
.B -a
Used to optimise performance if it is known that
-the video is opaque.
+the video is opaque, and to ensure that the output
+video is opaque.
.TP
.B -c
Blur the chroma only, not the luma.
diff --git a/src/blind-gauss-blur.c b/src/blind-gauss-blur.c
@@ -176,8 +176,7 @@ process_xyza(char *restrict output, char *restrict cbuf, ch…
img[i2][0] += clr[i1][0] * m;\
img[i2][1] += clr[i1][1] * m;\
img[i2][2] += clr[i1][2] * m;\
- if (!noalpha)\
- img[i2][3] += clr[i1][3] * m;\
+ img[i2][3] += clr[i1][3] * m;\
}\
} else {\
blurred = 0;\
@@ -191,21 +190,12 @@ process_xyza(char *restrict output, char *restrict cbuf, …
if (!blur[i])\
continue;\
START;\
- if (!noalpha) {\
- for (LOOP) {\
- d = (DISTANCE);\
- d *= d;\
- m = c[i] * exp(d * k[i]);\
- img[i2][i] += clr[i1][i] * m;\
- img[i2][3] += clr[i1][3] * m / blurred…
- }\
- } else {\
- for (LOOP) {\
- d = (DISTANCE);\
- d *= d;\
- m = c[i] * exp(d * k[i]);\
- img[i2][i] += clr[i1][i] * m;\
- }\
+ for (LOOP) {\
+ d = (DISTANCE);\
+ d *= d;\
+ m = c[i] * exp(d * k[i]);\
+ img[i2][i] += clr[i1][i] * m;\
+ img[i2][3] += clr[i1][3] * m / blurred;\
}\
}\
}
@@ -262,38 +252,42 @@ process_xyza(char *restrict output, char *restrict cbuf, …
y2 = y2start; y2 < y2end; (y2++, i2 += colour->width),
(ssize_t)y1 - (ssize_t)y2);
- if (chroma || !noalpha) {
- start = 0, end = colour->height;
- is_master = efork_jobs(&start, &end, jobs, &children);
+ start = 0, end = colour->height;
+ is_master = efork_jobs(&start, &end, jobs, &children);
- /* convert back to CIE XYZ */
- if (chroma) {
- i1 = start * colour->width;
- for (y1 = start; y1 < end; y1++) {
- for (x1 = 0; x1 < colour->width; x1++, i1++) {
- img[i1][0] = (img[i1][0] + img[i1][1])…
- img[i1][2] = (img[i1][2] + img[i1][1])…
- }
+ /* convert back to CIE XYZ */
+ if (chroma) {
+ i1 = start * colour->width;
+ for (y1 = start; y1 < end; y1++) {
+ for (x1 = 0; x1 < colour->width; x1++, i1++) {
+ img[i1][0] = (img[i1][0] + img[i1][1]) * X;
+ img[i1][2] = (img[i1][2] + img[i1][1]) * Z;
}
}
+ }
- /* unpremultiply alpha channel */
- if (!noalpha) {
- i1 = start * colour->width;
- for (y1 = start; y1 < end; y1++) {
- for (x1 = 0; x1 < colour->width; x1++, i1++) {
- if (!img[i1][3])
- continue;
- img[i1][0] /= img[i1][3];
- img[i1][1] /= img[i1][3];
- img[i1][2] /= img[i1][3];
- }
- }
+ /* unpremultiply alpha channel */
+ i1 = start * colour->width;
+ for (y1 = start; y1 < end; y1++) {
+ for (x1 = 0; x1 < colour->width; x1++, i1++) {
+ if (!img[i1][3])
+ continue;
+ img[i1][0] /= img[i1][3];
+ img[i1][1] /= img[i1][3];
+ img[i1][2] /= img[i1][3];
}
+ }
- ejoin_jobs(is_master, children);
+ /* ensure the video if opaque if -a was used */
+ if (!noalpha) {
+ i1 = start * colour->width;
+ for (y1 = start; y1 < end; y1++)
+ for (x1 = 0; x1 < colour->width; x1++, i1++)
+ img[i1][3] = 1;
}
+ ejoin_jobs(is_master, children);
+
(void) sigma;
(void) sn;
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.