Remove dead code
This commit is contained in:
+1
-40
@@ -91,7 +91,6 @@ void ImageWidget::setImage(std::shared_ptr<RawImage> image, int index)
|
|||||||
m_imgWidth = image->width();
|
m_imgWidth = image->width();
|
||||||
m_imgHeight = image->height();
|
m_imgHeight = image->height();
|
||||||
m_currentImg = index;
|
m_currentImg = index;
|
||||||
m_whiteBalance[0] = m_whiteBalance[1] = m_whiteBalance[2] = 1.0f;
|
|
||||||
|
|
||||||
if(!m_image)return;
|
if(!m_image)return;
|
||||||
|
|
||||||
@@ -114,30 +113,7 @@ void ImageWidget::setImage(std::shared_ptr<RawImage> image, int index)
|
|||||||
m_image->generateMipMaps();
|
m_image->generateMipMaps();
|
||||||
qDebug() << "setImage" << timer.elapsed();
|
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)
|
if(m_debayerTex)
|
||||||
{
|
{
|
||||||
@@ -391,8 +367,6 @@ void ImageWidget::paintGL()
|
|||||||
m_program->setUniformValue("bw", m_bwImg && !m_superpixel);
|
m_program->setUniformValue("bw", m_bwImg && !m_superpixel);
|
||||||
m_program->setUniformValue("false_color", m_falseColor && m_bwImg);
|
m_program->setUniformValue("false_color", m_falseColor && m_bwImg);
|
||||||
m_program->setUniformValue("invert", m_invert);
|
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
|
#ifdef COLOR_MANAGMENT
|
||||||
m_program->setUniformValue("srgb", m_srgb);
|
m_program->setUniformValue("srgb", m_srgb);
|
||||||
#endif
|
#endif
|
||||||
@@ -704,19 +678,6 @@ void ImageWidget::debayer()
|
|||||||
f->glGenerateMipmap(GL_TEXTURE_2D);
|
f->glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_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()
|
void ImageWidget::updateScrollBars()
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class ImageWidget : public QOpenGLWidget
|
|||||||
float m_scale = 1.0f;
|
float m_scale = 1.0f;
|
||||||
int m_scaleStop = 0;
|
int m_scaleStop = 0;
|
||||||
bool m_bestFit = false;
|
bool m_bestFit = false;
|
||||||
float m_whiteBalance[3] = {1.0f, 1.0f, 1.0f};
|
|
||||||
bool m_blockRepaint = false;
|
bool m_blockRepaint = false;
|
||||||
bool m_bwImg = false;
|
bool m_bwImg = false;
|
||||||
bool m_falseColor = false;
|
bool m_falseColor = false;
|
||||||
|
|||||||
@@ -545,21 +545,6 @@ bool RawImage::pixel(int x, int y, double &r, double &g, double &b) const
|
|||||||
return true;
|
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)
|
void RawImage::downscaleTo(uint32_t size)
|
||||||
{
|
{
|
||||||
/*if(size < width() || size < height())
|
/*if(size < width() || size < height())
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ public:
|
|||||||
void convertToGLFormat();
|
void convertToGLFormat();
|
||||||
float thumbAspect() const;
|
float thumbAspect() const;
|
||||||
bool pixel(int x, int y, double &r, double &g, double &b) const;
|
bool pixel(int x, int y, double &r, double &g, double &b) const;
|
||||||
void scaleToUnit();
|
|
||||||
void downscaleTo(uint32_t size);
|
void downscaleTo(uint32_t size);
|
||||||
|
|
||||||
static std::shared_ptr<RawImage> fromPlanar(const RawImage &img);
|
static std::shared_ptr<RawImage> fromPlanar(const RawImage &img);
|
||||||
|
|||||||
Reference in New Issue
Block a user