[FFmpeg-cvslog] avfilter/vf_pseudocolor: do not leave alpha uninitialized

Paul B Mahol git at videolan.org
Thu Feb 11 15:40:25 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 11 14:33:40 2021 +0100| [44facfb845563b3fc2a12cc3fbefc86ea72dea0b] | committer: Paul B Mahol

avfilter/vf_pseudocolor: do not leave alpha uninitialized

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44facfb845563b3fc2a12cc3fbefc86ea72dea0b
---

 libavfilter/vf_pseudocolor.c | 15 +++++++++------
 1 file 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;
                     }
                 }
             }



More information about the ffmpeg-cvslog mailing list