summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-02 14:49:02 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-02 14:49:02 +0000
commitde4d3d0fdda0f20ccab06877444fc1e5ff362f93 (patch)
tree1b8aa92b795406a0c040ba02381a17cf548d94b1 /src
parent98bbaf1e907e927dbd26131cbdef243a82fdc2d1 (diff)
Tidy up filters dialog; don't show non-existant ones, and categorise them.
Diffstat (limited to 'src')
-rw-r--r--src/lib/filter.cc58
-rw-r--r--src/lib/filter.h9
-rw-r--r--src/wx/filter_view.cc37
3 files changed, 68 insertions, 36 deletions
diff --git a/src/lib/filter.cc b/src/lib/filter.cc
index c23882726..9a662f90f 100644
--- a/src/lib/filter.cc
+++ b/src/lib/filter.cc
@@ -33,12 +33,14 @@ vector<Filter const *> Filter::_filters;
/** @param i Our id.
* @param n User-visible name.
+ * @param c User-visible category.
* @param v String for a FFmpeg video filter descriptor, or "".
* @param p String for a FFmpeg post-processing descriptor, or "".
*/
-Filter::Filter (string i, string n, string v, string p)
+Filter::Filter (string i, string n, string c, string v, string p)
: _id (i)
, _name (n)
+ , _category (c)
, _vf (v)
, _pp (p)
{
@@ -61,43 +63,43 @@ Filter::setup_filters ()
{
/* Note: "none" is a magic id name, so don't use it here */
- maybe_add ("pphb", "Horizontal deblocking filter", "", "hb");
- maybe_add ("ppvb", "Vertical deblocking filter", "", "vb");
- maybe_add ("ppha", "Horizontal deblocking filter A", "", "ha");
- maybe_add ("ppva", "Vertical deblocking filter A", "", "va");
- maybe_add ("pph1", "Experimental horizontal deblocking filter 1", "", "h1");
- maybe_add ("pphv", "Experimental vertical deblocking filter 1", "", "v1");
- maybe_add ("ppdr", "Deringing filter", "", "dr");
- maybe_add ("pplb", "Linear blend deinterlacer", "", "lb");
- maybe_add ("ppli", "Linear interpolating deinterlacer", "", "li");
- maybe_add ("ppci", "Cubic interpolating deinterlacer", "", "ci");
- maybe_add ("ppmd", "Median deinterlacer", "", "md");
- maybe_add ("ppfd", "FFMPEG deinterlacer", "", "fd");
- maybe_add ("ppl5", "FIR low-pass deinterlacer", "", "l5");
- maybe_add ("mcdeint", "Motion compensating deinterlacer", "mcdeint", "");
- maybe_add ("kerndeint", "Kernel deinterlacer", "kerndeint", "");
- maybe_add ("yadif", "Yet Another Deinterlacing Filter", "yadif", "");
- maybe_add ("pptn", "Temporal noise reducer", "", "tn");
- maybe_add ("ppfq", "Force quantizer", "", "fq");
- maybe_add ("gradfun", "Gradient debander", "gradfun", "");
- maybe_add ("unsharp", "Unsharp mask and Gaussian blur", "unsharp", "");
- maybe_add ("denoise3d", "3D denoiser", "denoise3d", "");
- maybe_add ("hqdn3d", "High quality 3D denoiser", "hqdn3d", "");
- maybe_add ("telecine", "Telecine filter", "telecine", "");
- maybe_add ("ow", "Overcomplete wavelet denoiser", "mp=ow", "");
+ maybe_add ("pphb", "Horizontal deblocking filter", "De-blocking", "", "hb");
+ maybe_add ("ppvb", "Vertical deblocking filter", "De-blocking", "", "vb");
+ maybe_add ("ppha", "Horizontal deblocking filter A", "De-blocking", "", "ha");
+ maybe_add ("ppva", "Vertical deblocking filter A", "De-blocking", "", "va");
+ maybe_add ("pph1", "Experimental horizontal deblocking filter 1", "De-blocking", "", "h1");
+ maybe_add ("pphv", "Experimental vertical deblocking filter 1", "De-blocking", "", "v1");
+ maybe_add ("ppdr", "Deringing filter", "Misc", "", "dr");
+ maybe_add ("pplb", "Linear blend deinterlacer", "De-interlacing", "", "lb");
+ maybe_add ("ppli", "Linear interpolating deinterlacer", "De-interlacing", "", "li");
+ maybe_add ("ppci", "Cubic interpolating deinterlacer", "De-interlacing", "", "ci");
+ maybe_add ("ppmd", "Median deinterlacer", "De-interlacing", "", "md");
+ maybe_add ("ppfd", "FFMPEG deinterlacer", "De-interlacing", "", "fd");
+ maybe_add ("ppl5", "FIR low-pass deinterlacer", "De-interlacing", "", "l5");
+ maybe_add ("mcdeint", "Motion compensating deinterlacer", "De-interlacing", "mcdeint", "");
+ maybe_add ("kerndeint", "Kernel deinterlacer", "De-interlacing", "kerndeint", "");
+ maybe_add ("yadif", "Yet Another Deinterlacing Filter", "De-interlacing", "yadif", "");
+ maybe_add ("pptn", "Temporal noise reducer", "Noise reduction", "", "tn");
+ maybe_add ("ppfq", "Force quantizer", "Misc", "", "fq");
+ maybe_add ("gradfun", "Gradient debander", "Misc", "gradfun", "");
+ maybe_add ("unsharp", "Unsharp mask and Gaussian blur", "Misc", "unsharp", "");
+ maybe_add ("denoise3d", "3D denoiser", "Noise reduction", "denoise3d", "");
+ maybe_add ("hqdn3d", "High quality 3D denoiser", "Noise reduction", "hqdn3d", "");
+ maybe_add ("telecine", "Telecine filter", "Misc", "telecine", "");
+ maybe_add ("ow", "Overcomplete wavelet denoiser", "Noise reduction", "mp=ow", "");
}
void
-Filter::maybe_add (string i, string n, string v, string p)
+Filter::maybe_add (string i, string n, string c, string v, string p)
{
if (!v.empty ()) {
if (avfilter_get_by_name (i.c_str())) {
- _filters.push_back (new Filter (i, n, v, p));
+ _filters.push_back (new Filter (i, n, c, v, p));
}
} else if (!p.empty ()) {
pp_mode* m = pp_get_mode_by_name_and_quality (p.c_str(), PP_QUALITY_MAX);
if (m) {
- _filters.push_back (new Filter (i, n, v, p));
+ _filters.push_back (new Filter (i, n, c, v, p));
pp_free_mode (m);
}
}
diff --git a/src/lib/filter.h b/src/lib/filter.h
index e7e8b389f..205d92482 100644
--- a/src/lib/filter.h
+++ b/src/lib/filter.h
@@ -33,7 +33,7 @@
class Filter
{
public:
- Filter (std::string, std::string, std::string, std::string);
+ Filter (std::string, std::string, std::string, std::string, std::string);
/** @return our id */
std::string id () const {
@@ -54,6 +54,10 @@ public:
std::string pp () const {
return _pp;
}
+
+ std::string category () const {
+ return _category;
+ }
static std::vector<Filter const *> all ();
static Filter const * from_id (std::string);
@@ -66,6 +70,7 @@ private:
std::string _id;
/** user-visible name */
std::string _name;
+ std::string _category;
/** string for a FFmpeg video filter descriptor */
std::string _vf;
/** string for a FFmpeg post-processing descriptor */
@@ -73,7 +78,7 @@ private:
/** all available filters */
static std::vector<Filter const *> _filters;
- static void maybe_add (std::string, std::string, std::string, std::string);
+ static void maybe_add (std::string, std::string, std::string, std::string, std::string);
};
#endif
diff --git a/src/wx/filter_view.cc b/src/wx/filter_view.cc
index 8d9535d81..db6728ba5 100644
--- a/src/wx/filter_view.cc
+++ b/src/wx/filter_view.cc
@@ -37,13 +37,38 @@ FilterView::FilterView (wxWindow* parent, vector<Filter const *> const & active)
vector<Filter const *> filters = Filter::all ();
+ typedef map<string, list<Filter const *> > CategoryMap;
+ CategoryMap categories;
+
for (vector<Filter const *>::iterator i = filters.begin(); i != filters.end(); ++i) {
- wxCheckBox* b = new wxCheckBox (this, wxID_ANY, std_to_wx ((*i)->name ()));
- bool const a = find (active.begin(), active.end(), *i) != active.end ();
- b->SetValue (a);
- _filters[*i] = b;
- b->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilterView::filter_toggled), 0, this);
- sizer->Add (b);
+ CategoryMap::iterator j = categories.find ((*i)->category ());
+ if (j == categories.end ()) {
+ list<Filter const *> c;
+ c.push_back (*i);
+ categories[(*i)->category()] = c;
+ } else {
+ j->second.push_back (*i);
+ }
+ }
+
+ for (CategoryMap::iterator i = categories.begin(); i != categories.end(); ++i) {
+
+ wxStaticText* c = new wxStaticText (this, wxID_ANY, std_to_wx (i->first));
+ wxFont font = c->GetFont();
+ font.SetWeight(wxFONTWEIGHT_BOLD);
+ c->SetFont(font);
+ sizer->Add (c);
+
+ for (list<Filter const *>::iterator j = i->second.begin(); j != i->second.end(); ++j) {
+ wxCheckBox* b = new wxCheckBox (this, wxID_ANY, std_to_wx ((*j)->name ()));
+ bool const a = find (active.begin(), active.end(), *j) != active.end ();
+ b->SetValue (a);
+ _filters[*j] = b;
+ b->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilterView::filter_toggled), 0, this);
+ sizer->Add (b);
+ }
+
+ sizer->AddSpacer (6);
}
}