Add a premultiply filter to sources with an alpha channel (#2681).
authorCarl Hetherington <cth@carlh.net>
Sun, 10 Dec 2023 15:20:51 +0000 (16:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Dec 2023 14:03:23 +0000 (15:03 +0100)
src/lib/ffmpeg_content.cc
src/lib/filter.cc

index ceebb5572ed03df1a176629eec4d4f940d236482..20fe7776bd9aafb80ca12c0fbd035875c0551aaf 100644 (file)
@@ -299,6 +299,9 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                                        _filters.push_back(*Filter::from_id("90anticlock"));
                                }
                        }
+                       if (examiner->has_alpha()) {
+                               _filters.push_back(*Filter::from_id("premultiply"));
+                       }
                }
 
                if (!examiner->audio_streams().empty()) {
index 5a94c0b43ecd5a8c7d1a6aa39bab4c46d7a3d897..9a14795eccf70c9ebe26427ff35c058da262c4d2 100644 (file)
@@ -103,6 +103,7 @@ Filter::setup_filters ()
        maybe_add (N_("hqdn3d"),      _("High quality 3D denoiser"),         _("Noise reduction"), N_("hqdn3d"));
        maybe_add (N_("telecine"),    _("Telecine filter"),                  _("Misc"),            N_("telecine"));
        maybe_add (N_("ow"),          _("Overcomplete wavelet denoiser"),    _("Noise reduction"), N_("mp=ow"));
+       maybe_add (N_("premultiply"), _("Premultiply alpha channel"),        _("Misc"),            N_("premultiply=inplace=1"));
 }