aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-08-08 11:58:19 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2014-08-08 11:58:19 +0200
commitba27273f0363d86bb40057408ee7effdbffbcfef (patch)
treee7fa429814a21c641e1ddc8fbc27d6eeebfe4564
parent313bd4abb6b838ab0507d5eb734514d439e6a1fb (diff)
qv4l2: Add option to enable linear scaling filterdock
New menu option to enable linear scaling filter when using OpenGL. Default is to use nearest neighbour Signed-off-by: Ove Brynestad <ovebryne@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/qv4l2/capture-win-gl.cpp28
-rw-r--r--utils/qv4l2/capture-win-gl.h4
-rw-r--r--utils/qv4l2/capture-win-qt.h1
-rw-r--r--utils/qv4l2/capture-win.cpp1
-rw-r--r--utils/qv4l2/capture-win.h1
-rw-r--r--utils/qv4l2/qv4l2.cpp14
-rw-r--r--utils/qv4l2/qv4l2.h2
7 files changed, 48 insertions, 3 deletions
diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index 6132e3b9..9a4ceff8 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -119,6 +119,13 @@ void CaptureWinGL::setBlending(bool enable)
#endif
}
+void CaptureWinGL::setLinearFilter(bool enable)
+{
+#ifdef HAVE_QTGL
+ m_videoSurface.setLinearFilter(enable);
+#endif
+}
+
#ifdef HAVE_QTGL
CaptureWinGLEngine::CaptureWinGLEngine() :
m_frameWidth(0),
@@ -132,7 +139,9 @@ CaptureWinGLEngine::CaptureWinGLEngine() :
m_formatChange(false),
m_frameFormat(0),
m_frameData(NULL),
- m_blending(false)
+ m_blending(false),
+ m_mag_filter(GL_NEAREST),
+ m_min_filter(GL_NEAREST)
{
m_glfunction.initializeGLFunctions(context());
}
@@ -204,6 +213,19 @@ void CaptureWinGLEngine::setField(unsigned field)
m_formatChange = true;
}
+void CaptureWinGLEngine::setLinearFilter(bool enable)
+{
+ if (enable) {
+ m_mag_filter = GL_LINEAR;
+ m_min_filter = GL_LINEAR;
+ }
+ else {
+ m_mag_filter = GL_NEAREST;
+ m_min_filter = GL_NEAREST;
+ }
+ m_formatChange = true;
+}
+
void CaptureWinGLEngine::clearShader()
{
glDeleteTextures(m_screenTextureCount, m_screenTexture);
@@ -459,8 +481,8 @@ void CaptureWinGLEngine::paintGL()
void CaptureWinGLEngine::configureTexture(size_t idx)
{
glBindTexture(GL_TEXTURE_2D, m_screenTexture[idx]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_min_filter);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_mag_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
diff --git a/utils/qv4l2/capture-win-gl.h b/utils/qv4l2/capture-win-gl.h
index bd7d6d6e..a20e626c 100644
--- a/utils/qv4l2/capture-win-gl.h
+++ b/utils/qv4l2/capture-win-gl.h
@@ -50,6 +50,7 @@ public:
void setDisplayColorspace(unsigned colorspace);
void setField(unsigned field);
void setBlending(bool enable) { m_blending = enable; }
+ void setLinearFilter(bool enable);
protected:
void paintGL();
@@ -99,6 +100,8 @@ private:
QGLShaderProgram m_shaderProgram;
bool m_haveFramebufferSRGB;
bool m_blending;
+ GLint m_mag_filter;
+ GLint m_min_filter;
};
#endif
@@ -116,6 +119,7 @@ public:
void setField(unsigned field);
void setDisplayColorspace(unsigned colorspace);
void setBlending(bool enable);
+ void setLinearFilter(bool enable);
protected:
void resizeEvent(QResizeEvent *event);
diff --git a/utils/qv4l2/capture-win-qt.h b/utils/qv4l2/capture-win-qt.h
index 0c92ce06..cb477ddd 100644
--- a/utils/qv4l2/capture-win-qt.h
+++ b/utils/qv4l2/capture-win-qt.h
@@ -40,6 +40,7 @@ public:
void setField(unsigned field) {}
void setDisplayColorspace(unsigned colorspace) {}
void setBlending(bool enable) {}
+ void setLinearFilter(bool enable) {}
protected:
void resizeEvent(QResizeEvent *event);
diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp
index f0efce3c..ba577583 100644
--- a/utils/qv4l2/capture-win.cpp
+++ b/utils/qv4l2/capture-win.cpp
@@ -339,6 +339,7 @@ void CaptureWin::customMenuRequested(QPoint pos)
menu->addAction(m_appWin->m_scalingAct);
menu->addAction(m_appWin->m_useBlendingAct);
+ menu->addAction(m_appWin->m_useLinearAct);
menu->addAction(m_appWin->m_snapshotAct);
menu->addAction(m_appWin->m_showFramesAct);
diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h
index ebc906db..90fdcfd6 100644
--- a/utils/qv4l2/capture-win.h
+++ b/utils/qv4l2/capture-win.h
@@ -73,6 +73,7 @@ public:
virtual void setField(unsigned field) = 0;
virtual void setDisplayColorspace(unsigned colorspace) = 0;
virtual void setBlending(bool enable) = 0;
+ virtual void setLinearFilter(bool enable) = 0;
void setCropMethod(CropMethod crop);
void makeFullScreen(bool);
QAction *m_exitFullScreen;
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 1ea9d103..dc0e6429 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -186,6 +186,14 @@ ApplicationWindow::ApplicationWindow() :
m_useBlendingAct->setChecked(false);
connect(m_useBlendingAct, SIGNAL(toggled(bool)), this, SLOT(setBlending(bool)));
captureMenu->addAction(m_useBlendingAct);
+
+ m_useLinearAct = new QAction("Enable &Linear filter", this);
+ m_useLinearAct->setStatusTip("Enable linear scaling filter");
+ m_useLinearAct->setCheckable(true);
+ m_useLinearAct->setChecked(false);
+ connect(m_useLinearAct, SIGNAL(toggled(bool)), this, SLOT(setLinearFilter(bool)));
+ captureMenu->addAction(m_useLinearAct);
+
} else {
m_renderMethod = QV4L2_RENDER_QT;
}
@@ -430,6 +438,12 @@ void ApplicationWindow::setBlending(bool checked)
m_capture->setBlending(checked);
}
+void ApplicationWindow::setLinearFilter(bool checked)
+{
+ if (m_capture)
+ m_capture->setLinearFilter(checked);
+}
+
void ApplicationWindow::setAudioBufferSize()
{
bool ok;
diff --git a/utils/qv4l2/qv4l2.h b/utils/qv4l2/qv4l2.h
index 5380b93a..a6e90004 100644
--- a/utils/qv4l2/qv4l2.h
+++ b/utils/qv4l2/qv4l2.h
@@ -145,6 +145,7 @@ private slots:
void saveRaw(bool);
void setRenderMethod(bool);
void setBlending(bool);
+ void setLinearFilter(bool);
void traceIoctls(bool);
void changeAudioDevice();
@@ -192,6 +193,7 @@ public:
void updateLimRGBRange();
QAction *m_resetScalingAct;
QAction *m_useBlendingAct;
+ QAction *m_useLinearAct;
QAction *m_snapshotAct;
QAction *m_showFramesAct;

Privacy Policy