summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-11 14:33:40 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-11 14:37:14 +0100
commit44facfb845563b3fc2a12cc3fbefc86ea72dea0b (patch)
treec187d2963ff93a1b17f965d9241d4ca9e2997293
parent0ef53cc72f7b3fdc1537cb75b74ea9115912a491 (diff)
avfilter/vf_pseudocolor: do not leave alpha uninitialized
-rw-r--r--libavfilter/vf_pseudocolor.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c
index 665f8212b2..fad7be600c 100644
--- a/libavfilter/vf_pseudocolor.c
+++ b/libavfilter/vf_pseudocolor.c
@@ -88,7 +88,7 @@ typedef struct Curve {
} Curve;
typedef struct Fill {
- float fill[3];
+ float fill[4];
} Fill;
typedef struct Range {
@@ -108,10 +108,10 @@ static const Range spec2_range[] = {{0, 16}, {16, 22}, {22, 226}, {226, 236}, {2
static const Range shadows_range[] = {{0, 32}, {32, 256}};
static const Range highlights_range[] = {{0, 214}, {214, 224}, {224, 256}};
-static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
-static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
-static const Fill shadows_fills[] = {{0.8f, 0.4f, .8f}, {-1.f, -1.f, -1.f}};
-static const Fill highlights_fills[] = {{-1.f, -1.f, -1.f}, {1.f, 0.3f, 0.6f}, {1.f, 0.2f, .5f}};
+static const Fill spec1_fills[] = {{0.5f, 0.f, .5f, 1.f}, {-1.f, -1.f, -1.f, 1.f}, {1.f, 0.f, 0.f, 1.f}};
+static const Fill spec2_fills[] = {{0.5f, 0.f, .5f, 1.f}, {0.f, 1.f, 1.f, 1.f}, {-1.f, -1.f, -1.f, 1.f}, {1.f, 1.f, 0.f, 1.f}, {1.f, 0.f, 0.f, 1.f}};
+static const Fill shadows_fills[] = {{0.8f, 0.4f, .8f, 1.f}, {-1.f, -1.f, -1.f, 1.f}};
+static const Fill highlights_fills[] = {{-1.f, -1.f, -1.f, 1.f}, {1.f, 0.3f, 0.6f, 1.f}, {1.f, 0.2f, .5f, 1.f}};
static const Curve curves[] =
{
@@ -627,11 +627,12 @@ static int config_input(AVFilterLink *inlink)
const Fill fill = presets[s->preset].fills[seg];
for (int j = 0; j < factor; j++) {
- double r, g, b;
+ double r, g, b, a;
g = fill.fill[1];
b = fill.fill[2];
r = fill.fill[0];
+ a = fill.fill[3];
if (g >= 0.f && b >= 0.f && r >= 0.f) {
g *= s->max;
@@ -652,6 +653,7 @@ static int config_input(AVFilterLink *inlink)
s->lut[0][i*factor+j] = g;
s->lut[1][i*factor+j] = b;
s->lut[2][i*factor+j] = r;
+ s->lut[3][i*factor+j] = a * s->max;
}
} else {
const Curve curve = presets[s->preset].curves[seg];
@@ -677,6 +679,7 @@ static int config_input(AVFilterLink *inlink)
s->lut[0][i*factor+j] = g;
s->lut[1][i*factor+j] = b;
s->lut[2][i*factor+j] = r;
+ s->lut[3][i*factor+j] = 1.f * s->max;
}
}
}