From 8e3c1b35db33e771065cf00c785cc135e53d56b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 15 Nov 2023 10:02:16 +0100 Subject: [PATCH] Remove dead code --- imagescrollareagl.cpp | 41 +---------------------------------------- imagescrollareagl.h | 1 - rawimage.cpp | 15 --------------- rawimage.h | 1 - 4 files changed, 1 insertion(+), 57 deletions(-) diff --git a/imagescrollareagl.cpp b/imagescrollareagl.cpp index 3de26d8..f09e299 100644 --- a/imagescrollareagl.cpp +++ b/imagescrollareagl.cpp @@ -91,7 +91,6 @@ void ImageWidget::setImage(std::shared_ptr image, int index) m_imgWidth = image->width(); m_imgHeight = image->height(); m_currentImg = index; - m_whiteBalance[0] = m_whiteBalance[1] = m_whiteBalance[2] = 1.0f; if(!m_image)return; @@ -114,30 +113,7 @@ void ImageWidget::setImage(std::shared_ptr image, int index) m_image->generateMipMaps(); qDebug() << "setImage" << timer.elapsed(); - /*QElapsedTimer timer; - RawImage xxx(8192, 8192, 4, RawImage::UINT32); - uint32_t *p = (uint32_t*)xxx.data(); - for(int i=0; i<8192*8192*4; i++) - p[i] = rand(); - auto test = [&](QOpenGLTexture::PixelFormat format) - { - timer.start(); - m_image->destroy(); - //m_image->setAutoMipMapGenerationEnabled(false); - m_image->setFormat(QOpenGLTexture::TextureFormat::RGBA8_UNorm); - m_image->setSize(8192, 8192); - //m_image->setMipLevels([&](){ int c = 0; int s = std::min(m_imgWidth, m_imgHeight); while(s>>=1)c++; return c; }()); - m_image->allocateStorage(); - m_image->setMinMagFilters(QOpenGLTexture::LinearMipMapLinear, QOpenGLTexture::Linear); - m_image->setWrapMode(QOpenGLTexture::ClampToEdge); - m_image->setBorderColor(0, 0, 0, 0); - m_image->setData(0, format, QOpenGLTexture::UInt8, (const void*)p, m_transferOptions.get()); - qDebug() << format << timer.elapsed(); - }; - test(QOpenGLTexture::PixelFormat::BGR); - test(QOpenGLTexture::PixelFormat::RGB); - test(QOpenGLTexture::PixelFormat::BGRA); - test(QOpenGLTexture::PixelFormat::RGBA);*/ + if(m_debayerTex) { @@ -391,8 +367,6 @@ void ImageWidget::paintGL() m_program->setUniformValue("bw", m_bwImg && !m_superpixel); m_program->setUniformValue("false_color", m_falseColor && m_bwImg); m_program->setUniformValue("invert", m_invert); - if(m_superpixel)m_program->setUniformValue("whiteBalance", m_whiteBalance[0], m_whiteBalance[1], m_whiteBalance[2]); - else m_program->setUniformValue("whiteBalance", 1.0f, 1.0f, 1.0f); #ifdef COLOR_MANAGMENT m_program->setUniformValue("srgb", m_srgb); #endif @@ -704,19 +678,6 @@ void ImageWidget::debayer() f->glGenerateMipmap(GL_TEXTURE_2D); f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - - int size = std::max(m_imgWidth, m_imgHeight); - int level = 0; - while(size >>= 1)level++; - int w,h; - f3->glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, &w); - f3->glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, &h); - uint16_t pixel[w*h*4]; - f3->glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_UNSIGNED_SHORT, pixel); - float maxRGB = std::max(std::max(pixel[0], pixel[1]), pixel[2]); - m_whiteBalance[0] = maxRGB / pixel[0]; - m_whiteBalance[1] = maxRGB / pixel[1]; - m_whiteBalance[2] = maxRGB / pixel[2]; } void ImageWidget::updateScrollBars() diff --git a/imagescrollareagl.h b/imagescrollareagl.h index 53cb7b1..29fc441 100644 --- a/imagescrollareagl.h +++ b/imagescrollareagl.h @@ -52,7 +52,6 @@ class ImageWidget : public QOpenGLWidget float m_scale = 1.0f; int m_scaleStop = 0; bool m_bestFit = false; - float m_whiteBalance[3] = {1.0f, 1.0f, 1.0f}; bool m_blockRepaint = false; bool m_bwImg = false; bool m_falseColor = false; diff --git a/rawimage.cpp b/rawimage.cpp index b03eb41..ed176e5 100644 --- a/rawimage.cpp +++ b/rawimage.cpp @@ -545,21 +545,6 @@ bool RawImage::pixel(int x, int y, double &r, double &g, double &b) const return true; } -void RawImage::scaleToUnit() -{ - /*if(CV_MAT_DEPTH(m_img.type()) == CV_32F) - { - double min, max; - cv::minMaxIdx(m_img, &min, &max); - if(min < 0 || max > 1) - { - float scale = 1.0 / (max - min); - float zero = min * scale; - m_img = m_img * scale - zero; - } - }*/ -} - void RawImage::downscaleTo(uint32_t size) { /*if(size < width() || size < height()) diff --git a/rawimage.h b/rawimage.h index c65d6cf..54e77db 100644 --- a/rawimage.h +++ b/rawimage.h @@ -97,7 +97,6 @@ public: void convertToGLFormat(); float thumbAspect() const; bool pixel(int x, int y, double &r, double &g, double &b) const; - void scaleToUnit(); void downscaleTo(uint32_t size); static std::shared_ptr fromPlanar(const RawImage &img);