From b189da0b595271094157d87b0df98e62a7be0d76 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 26 Aug 2018 20:46:14 +0200 Subject: [PATCH] nikon_load_raw(): minor changes, #4751 --- rtengine/dcraw.cc | 3 +-- rtengine/dcraw.h | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 51027ecaf..567d52322 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1291,8 +1291,7 @@ BENCHFUN diff -= (1 << len) - 1; if (col < 2) hpred[col] = vpred[row & 1][col] += diff; else hpred[col & 1] += diff; - if((ushort)(hpred[col & 1]) >= max) derror(); -// derror((ushort)(hpred[col & 1]) >= max); + derror((ushort)(hpred[col & 1]) >= max); RAW(row,col) = curve[LIM((short)hpred[col & 1],0,0x3fff)]; } } diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index b17a93c28..9c6ac4aec 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -60,7 +60,7 @@ public: ,RT_matrix_from_constant(0) ,RT_from_adobe_dng_converter(false) ,getbithuff(this,ifp,zero_after_ff) - ,nikbithuff(this,ifp) + ,nikbithuff(ifp) { memset(&hbd, 0, sizeof(hbd)); aber[0]=aber[1]=aber[2]=aber[3]=1; @@ -215,7 +215,7 @@ protected: int fcol (int row, int col); void merror (void *ptr, const char *where); void derror(); -void derror(bool condition) {data_error += condition;} +inline void derror(bool condition) {if(UNLIKELY(condition)) ++data_error;} ushort sget2 (uchar *s); ushort get2(); unsigned sget4 (uchar *s); @@ -257,16 +257,17 @@ getbithuff_t getbithuff; class nikbithuff_t { public: - nikbithuff_t(DCraw *p,IMFILE *&i):parent(p),bitbuf(0),errors(0),vbits(0),ifp(i){} + nikbithuff_t(IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){} void operator()() {bitbuf = vbits = 0;}; unsigned operator()(int nbits, ushort *huff); unsigned errorCount() { return errors; } private: - bool derror(bool condition){ - errors += condition; + inline bool derror(bool condition){ + if (UNLIKELY(condition)) { + ++errors; + } return condition; } - DCraw *parent; unsigned bitbuf, errors; int vbits; IMFILE *&ifp;