nikon NEF decoder: ~20% speedup, #4751

This commit is contained in:
heckflosse
2018-08-26 19:04:42 +02:00
parent 1437ab98d8
commit 4ab4e7298d
2 changed files with 133 additions and 58 deletions

View File

@@ -60,6 +60,7 @@ public:
,RT_matrix_from_constant(0)
,RT_from_adobe_dng_converter(false)
,getbithuff(this,ifp,zero_after_ff)
,nikbithuff(this,ifp)
{
memset(&hbd, 0, sizeof(hbd));
aber[0]=aber[1]=aber[2]=aber[3]=1;
@@ -214,6 +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;}
ushort sget2 (uchar *s);
ushort get2();
unsigned sget4 (uchar *s);
@@ -252,6 +254,25 @@ private:
};
getbithuff_t getbithuff;
class nikbithuff_t
{
public:
nikbithuff_t(DCraw *p,IMFILE *&i):parent(p),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;
return condition;
}
DCraw *parent;
unsigned bitbuf, errors;
int vbits;
IMFILE *&ifp;
};
nikbithuff_t nikbithuff;
ushort * make_decoder_ref (const uchar **source);
ushort * make_decoder (const uchar *source);
void crw_init_tables (unsigned table, ushort *huff[2]);