[Feature Request] Add support for more filters from libavfilter
It would be nice if it was possible to configure the pipeline of video/audio filters to apply during playback. For example, I'm most interested in the gradfun filter, which is useful to hide compression artifacts like blocking or banding in gradient areas of video. Such artifacts are most apparent in animation or gaming content. Another example might be selection of the scaling method.
I wrote it a few years ago, but I never published it. I already have it in plans.
Another example might be selection of the scaling method.
You can go to OpenGL2 module settings and check "High quality video scaling" for bicubic filter (available since 18.03.02).
You can go to OpenGL2 module settings and check "High quality video scaling" for bicubic filter
I was thinking about something better, like Lanczos filter for example.
Lanczos
Isn't it too slow for CPU? It is simple to achieve this using libswscale and QPainter module :smile: But requires code change and manual compilation.
diff --git a/src/modules/QPainter/QPainterWriter.cpp b/src/modules/QPainter/QPainterWriter.cpp
index a2708e93..4b4806f7 100644
--- a/src/modules/QPainter/QPainterWriter.cpp
+++ b/src/modules/QPainter/QPainterWriter.cpp
@@ -47,7 +47,7 @@ void Drawable::draw(const VideoFrame &newVideoFrame, bool canRepaint, bool entir
update();
return;
}
- m_scaleByQt = (imgW > videoFrame.size.width) || (imgH > videoFrame.size.height);
+ m_scaleByQt = false; // (imgW > videoFrame.size.width) || (imgH > videoFrame.size.height);
if (imgScaler.create(videoFrame.size, m_scaleByQt ? videoFrame.size.width : imgW, m_scaleByQt ? videoFrame.size.height : imgH))
{
if (m_scaleByQt && (img.width() != videoFrame.size.width || img.height() != videoFrame.size.height))
diff --git a/src/qmplay2/ImgScaler.cpp b/src/qmplay2/ImgScaler.cpp
index 580bdbe0..d188a4b2 100644
--- a/src/qmplay2/ImgScaler.cpp
+++ b/src/qmplay2/ImgScaler.cpp
@@ -34,7 +34,7 @@ bool ImgScaler::create(const VideoFrameSize &size, int newWdst, int newHdst, boo
{
m_srcH = size.height;
m_dstLinesize = newWdst << 2;
- return (m_swsCtx = sws_getCachedContext(m_swsCtx, size.width, m_srcH, isNV12 ? AV_PIX_FMT_NV12 : (AVPixelFormat)size.getFormat(), newWdst, newHdst, AV_PIX_FMT_RGB32, SWS_BILINEAR, nullptr, nullptr, nullptr));
+ return (m_swsCtx = sws_getCachedContext(m_swsCtx, size.width, m_srcH, isNV12 ? AV_PIX_FMT_NV12 : (AVPixelFormat)size.getFormat(), newWdst, newHdst, AV_PIX_FMT_RGB32, SWS_LANCZOS, nullptr, nullptr, nullptr));
}
void ImgScaler::scale(const VideoFrame &src, void *dst)
{
It is very slow and quality is worse than GIMP Lanczos and QMPlay2 OpenGL bicubic.