summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-15 13:25:09 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-15 13:25:09 +0000
commit16e8c1c7222796246f74153bf294909c3efe57dc (patch)
tree34b3a52caf88608a5e5ed0e510c4c159e16042c8 /src
parentafe6ad7ba378ff531de248927d736cdda2724e34 (diff)
Remove support for FFmpeg postprocessing filters.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffmpeg_content.cc4
-rw-r--r--src/lib/ffmpeg_decoder.cc5
-rw-r--r--src/lib/filter.cc79
-rw-r--r--src/lib/filter.h19
-rw-r--r--src/lib/filter_graph.cc2
-rw-r--r--src/lib/image.cc45
-rw-r--r--src/lib/image.h1
-rw-r--r--src/wx/video_panel.cc7
8 files changed, 35 insertions, 127 deletions
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 47fe4f807..e52e36f78 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -215,13 +215,13 @@ FFmpegContent::technical_summary () const
ss = _subtitle_stream->technical_summary ();
}
- pair<string, string> filt = Filter::ffmpeg_strings (_filters);
+ string filt = Filter::ffmpeg_string (_filters);
return Content::technical_summary() + " - "
+ VideoContent::technical_summary() + " - "
+ AudioContent::technical_summary() + " - "
+ String::compose (
- "ffmpeg: audio %1, subtitle %2, filters %3 %4", as, ss, filt.first, filt.second
+ "ffmpeg: audio %1, subtitle %2, filters %3", as, ss, filt
);
}
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 347d8cc08..851c64606 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -468,14 +468,9 @@ FFmpegDecoder::decode_video_packet ()
list<pair<shared_ptr<Image>, int64_t> > images = graph->process (_frame);
- string post_process = Filter::ffmpeg_strings (_ffmpeg_content->filters()).second;
-
for (list<pair<shared_ptr<Image>, int64_t> >::iterator i = images.begin(); i != images.end(); ++i) {
shared_ptr<Image> image = i->first;
- if (!post_process.empty ()) {
- image = image->post_process (post_process, true);
- }
if (i->second != AV_NOPTS_VALUE) {
diff --git a/src/lib/filter.cc b/src/lib/filter.cc
index 640a531e8..a7dd9c5ce 100644
--- a/src/lib/filter.cc
+++ b/src/lib/filter.cc
@@ -24,7 +24,6 @@
#include "filter.h"
extern "C" {
#include <libavfilter/avfilter.h>
-#include <libpostproc/postprocess.h>
}
#include "i18n.h"
@@ -36,15 +35,13 @@ 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 "".
+ * @param v String for a FFmpeg video filter descriptor.
*/
-Filter::Filter (string i, string n, string c, string v, string p)
+Filter::Filter (string i, string n, string c, string v)
: _id (i)
, _name (n)
, _category (c)
, _vf (v)
- , _pp (p)
{
}
@@ -65,75 +62,41 @@ Filter::setup_filters ()
{
/* Note: "none" is a magic id name, so don't use it here */
- maybe_add (N_("pphb"), _("Horizontal deblocking filter"), _("De-blocking"), N_(""), N_("hb"));
- maybe_add (N_("ppvb"), _("Vertical deblocking filter"), _("De-blocking"), N_(""), N_("vb"));
- maybe_add (N_("ppha"), _("Horizontal deblocking filter A"), _("De-blocking"), N_(""), N_("ha"));
- maybe_add (N_("ppva"), _("Vertical deblocking filter A"), _("De-blocking"), N_(""), N_("va"));
- maybe_add (N_("pph1"), _("Experimental horizontal deblocking filter 1"), _("De-blocking"), N_(""), N_("h1"));
- maybe_add (N_("pphv"), _("Experimental vertical deblocking filter 1"), _("De-blocking"), N_(""), N_("v1"));
- maybe_add (N_("ppdr"), _("Deringing filter"), _("Misc"), N_(""), N_("dr"));
- maybe_add (N_("pplb"), _("Linear blend deinterlacer"), _("De-interlacing"), N_(""), N_("lb"));
- maybe_add (N_("ppli"), _("Linear interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("li"));
- maybe_add (N_("ppci"), _("Cubic interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("ci"));
- maybe_add (N_("ppmd"), _("Median deinterlacer"), _("De-interlacing"), N_(""), N_("md"));
- maybe_add (N_("ppfd"), _("FFMPEG deinterlacer"), _("De-interlacing"), N_(""), N_("fd"));
- maybe_add (N_("ppl5"), _("FIR low-pass deinterlacer"), _("De-interlacing"), N_(""), N_("l5"));
- maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"), N_(""));
- maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"), N_(""));
- maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"), N_(""));
- maybe_add (N_("pptn"), _("Temporal noise reducer"), _("Noise reduction"), N_(""), N_("tn"));
- maybe_add (N_("ppfq"), _("Force quantizer"), _("Misc"), N_(""), N_("fq"));
- maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"), N_(""));
- maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"), N_(""));
- maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"), N_(""));
- maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"), N_(""));
- maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"), N_(""));
- maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"), N_(""));
+ maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"));
+ maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"));
+ maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"));
+ maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"));
+ maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"));
+ maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"));
+ 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"));
}
void
-Filter::maybe_add (string i, string n, string c, string v, string p)
+Filter::maybe_add (string i, string n, string c, string v)
{
- if (!v.empty ()) {
- if (avfilter_get_by_name (i.c_str())) {
- _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, c, v, p));
- pp_free_mode (m);
- }
+ if (avfilter_get_by_name (i.c_str())) {
+ _filters.push_back (new Filter (i, n, c, v));
}
}
/** @param filters Set of filters.
- * @return A pair; .first is a string to pass to FFmpeg for the video filters,
- * .second is a string to pass for the post-processors.
+ * @return String to pass to FFmpeg for the video filters.
*/
-pair<string, string>
-Filter::ffmpeg_strings (vector<Filter const *> const & filters)
+string
+Filter::ffmpeg_string (vector<Filter const *> const & filters)
{
string vf;
- string pp;
for (vector<Filter const *>::const_iterator i = filters.begin(); i != filters.end(); ++i) {
- if (!(*i)->vf().empty ()) {
- if (!vf.empty ()) {
- vf += N_(",");
- }
- vf += (*i)->vf ();
- }
-
- if (!(*i)->pp().empty ()) {
- if (!pp.empty()) {
- pp += N_(",");
- }
- pp += (*i)->pp ();
+ if (!vf.empty ()) {
+ vf += N_(",");
}
+ vf += (*i)->vf ();
}
- return make_pair (vf, pp);
+ return vf;
}
/** @param d Our id.
diff --git a/src/lib/filter.h b/src/lib/filter.h
index 5971cd5cf..258e74991 100644
--- a/src/lib/filter.h
+++ b/src/lib/filter.h
@@ -29,12 +29,16 @@
#include <boost/utility.hpp>
/** @class Filter
- * @brief A class to describe one of FFmpeg's video or post-processing filters.
+ * @brief A class to describe one of FFmpeg's video filters.
+ *
+ * We don't support FFmpeg's post-processing filters here as they cannot cope with greater than
+ * 8bpp. FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which
+ * we don't really want to do.
*/
class Filter : public boost::noncopyable
{
public:
- Filter (std::string, std::string, std::string, std::string, std::string);
+ Filter (std::string, std::string, std::string, std::string);
/** @return our id */
std::string id () const {
@@ -51,11 +55,6 @@ public:
return _vf;
}
- /** @return string for a FFmpeg post-processing descriptor */
- std::string pp () const {
- return _pp;
- }
-
std::string category () const {
return _category;
}
@@ -63,7 +62,7 @@ public:
static std::vector<Filter const *> all ();
static Filter const * from_id (std::string);
static void setup_filters ();
- static std::pair<std::string, std::string> ffmpeg_strings (std::vector<Filter const *> const &);
+ static std::string ffmpeg_string (std::vector<Filter const *> const &);
private:
@@ -74,12 +73,10 @@ private:
std::string _category;
/** string for a FFmpeg video filter descriptor */
std::string _vf;
- /** string for a FFmpeg post-processing descriptor */
- std::string _pp;
/** all available filters */
static std::vector<Filter const *> _filters;
- static void maybe_add (std::string, std::string, std::string, std::string, std::string);
+ static void maybe_add (std::string, std::string, std::string, std::string);
};
#endif
diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc
index cd5d19807..a36a41f43 100644
--- a/src/lib/filter_graph.cc
+++ b/src/lib/filter_graph.cc
@@ -60,7 +60,7 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size
{
_frame = av_frame_alloc ();
- string filters = Filter::ffmpeg_strings (content->filters()).first;
+ string filters = Filter::ffmpeg_string (content->filters());
if (filters.empty ()) {
filters = "copy";
}
diff --git a/src/lib/image.cc b/src/lib/image.cc
index c7dfc91cb..25d1ef276 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -167,51 +167,6 @@ Image::scale (libdcp::Size out_size, Scaler const * scaler, AVPixelFormat out_fo
return scaled;
}
-/** Run a FFmpeg post-process on this image and return the processed version.
- * @param pp Flags for the required set of post processes.
- * @return Post-processed image.
- */
-shared_ptr<Image>
-Image::post_process (string pp, bool aligned) const
-{
- shared_ptr<Image> out (new Image (pixel_format(), size (), aligned));
-
- int pp_format = 0;
- switch (pixel_format()) {
- case PIX_FMT_YUV420P:
- pp_format = PP_FORMAT_420;
- break;
- case PIX_FMT_YUV422P10LE:
- case PIX_FMT_YUV422P:
- case PIX_FMT_UYVY422:
- pp_format = PP_FORMAT_422;
- break;
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUV444P9BE:
- case PIX_FMT_YUV444P9LE:
- case PIX_FMT_YUV444P10BE:
- case PIX_FMT_YUV444P10LE:
- pp_format = PP_FORMAT_444;
- default:
- throw PixelFormatError ("post_process", pixel_format());
- }
-
- pp_mode* mode = pp_get_mode_by_name_and_quality (pp.c_str (), PP_QUALITY_MAX);
- pp_context* context = pp_get_context (size().width, size().height, pp_format | PP_CPU_CAPS_MMX2);
-
- pp_postprocess (
- (const uint8_t **) data(), stride(),
- out->data(), out->stride(),
- size().width, size().height,
- 0, 0, mode, context, 0
- );
-
- pp_free_mode (mode);
- pp_free_context (context);
-
- return out;
-}
-
shared_ptr<Image>
Image::crop (Crop crop, bool aligned) const
{
diff --git a/src/lib/image.h b/src/lib/image.h
index b12db3a14..2d9f32231 100644
--- a/src/lib/image.h
+++ b/src/lib/image.h
@@ -58,7 +58,6 @@ public:
int lines (int) const;
boost::shared_ptr<Image> scale (libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
- boost::shared_ptr<Image> post_process (std::string, bool aligned) const;
boost::shared_ptr<Image> crop (Crop c, bool aligned) const;
boost::shared_ptr<Image> crop_scale_window (Crop c, libdcp::Size, libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index aa0f7d019..38604248c 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -240,12 +240,11 @@ VideoPanel::film_content_changed (int property)
_colour_conversion->SetLabel (preset ? std_to_wx (cc[preset.get()].name) : _("Custom"));
} else if (property == FFmpegContentProperty::FILTERS) {
if (fcs) {
- pair<string, string> p = Filter::ffmpeg_strings (fcs->filters ());
- if (p.first.empty () && p.second.empty ()) {
+ string const p = Filter::ffmpeg_string (fcs->filters ());
+ if (p.empty ()) {
_filters->SetLabel (_("None"));
} else {
- string const b = p.first + " " + p.second;
- _filters->SetLabel (std_to_wx (b));
+ _filters->SetLabel (std_to_wx (p));
}
}
}