From a11dffd5cfb283dac3bd09cf8e56b85f1c358ccf Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Sat, 12 Jun 2021 12:33:54 +0200 Subject: [PATCH] Expose bitdepth to ImProcCoordinator --- rtengine/imagesource.h | 5 +++++ rtengine/improccoordinator.cc | 4 +++- rtengine/rawimage.h | 5 +++++ rtengine/rawimagesource.cc | 5 +++++ rtengine/rawimagesource.h | 2 ++ rtengine/stdimagesource.cc | 5 +++++ rtengine/stdimagesource.h | 2 ++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index a1c3731f16..ebf9bc7c11 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -124,6 +124,11 @@ class ImageSource : public InitialImage virtual void WBauto(double &tempref, double &greenref, array2D &redloc, array2D &greenloc, array2D &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const procparams::WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw) = 0; virtual void getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) = 0; + virtual unsigned int getBitDepth() const + { + return 0; + } + virtual double getDefGain () const { return 1.0; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6ce7e96c5f..002fcef146 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -105,7 +105,6 @@ ImProcCoordinator::ImProcCoordinator() : histGreen(65536), histGreenRaw(65536), histBlue(65536), histBlueRaw(65536), histLuma(65536), - histChroma(65536), histToneCurve(256), histToneCurveBW(256), @@ -117,6 +116,7 @@ ImProcCoordinator::ImProcCoordinator() : histCCAM(256), histClad(256), bcabhist(256), + histChroma(65536), histLRETI(256), @@ -1810,6 +1810,8 @@ void ImProcCoordinator::notifyHistogramChanged() bool ImProcCoordinator::updateLRGBHistograms() { + printf("%u bit image - update histogram\n",imgsrc->getBitDepth()); + if (!hist_lrgb_dirty) { return false; } diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index 871267dac5..3af2cebb2f 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -108,6 +108,11 @@ class RawImage: public DCraw { return fuji_width; } + + unsigned int get_bitdepth() const + { + return tiff_bps; + } float const * get_FloatRawImage() const { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 5dde838a2a..1467c9fc96 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -517,6 +517,11 @@ int RawImageSource::getRotateDegree() const return ri->get_rotateDegree(); } +unsigned int RawImageSource::getBitDepth() const +{ + return ri->get_bitdepth(); +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void RawImageSource::transformRect (const PreviewProps &pp, int tran, int &ssx1, int &ssy1, int &width, int &height, int &fw) diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index b463ea7884..57f06587ce 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -168,6 +168,8 @@ class RawImageSource final : public ImageSource void getSize (const PreviewProps &pp, int& w, int& h) override; int getRotateDegree() const override; + unsigned int getBitDepth() const override; + ImageMatrices* getImageMatrices () override { return &imatrices; diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 8cb8fa7925..fc0c1042f2 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -297,6 +297,11 @@ void StdImageSource::getSize (const PreviewProps &pp, int& w, int& h) h = pp.getHeight() / pp.getSkip() + (pp.getHeight() % pp.getSkip() > 0); } +unsigned int StdImageSource::getBitDepth() const +{ + return img->getBPS(); +} + void StdImageSource::getAutoExpHistogram (LUTu & histogram, int& histcompr) { if (img->getType() == sImage8) { diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 9b95fe34ea..de65002183 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -87,6 +87,8 @@ class StdImageSource : public ImageSource void getFullSize (int& w, int& h, int tr = TR_NONE) override; void getSize (const PreviewProps &pp, int& w, int& h) override; + unsigned int getBitDepth() const override; + ImageIO* getImageIO () { return img;