Mercurial > hg > svcore
comparison data/model/PowerOfSqrtTwoZoomConstraint.cpp @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | 59e7fe1b1003 |
children | d4a28d1479a8 48e9f538e6e9 |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
42 type = -1; | 42 type = -1; |
43 power = 0; | 43 power = 0; |
44 float val = 1.0, prevVal = 1.0; | 44 float val = 1.0, prevVal = 1.0; |
45 while (val + 0.01 < blockSize) { | 45 while (val + 0.01 < blockSize) { |
46 prevVal = val; | 46 prevVal = val; |
47 val *= sqrt(2.f); | 47 val *= sqrtf(2.f); |
48 } | 48 } |
49 int rval; | 49 int rval; |
50 if (dir == RoundUp) rval = int(val + 0.01); | 50 if (dir == RoundUp) rval = int(val + 0.01f); |
51 else if (dir == RoundDown) rval = int(prevVal + 0.01); | 51 else if (dir == RoundDown) rval = int(prevVal + 0.01f); |
52 else if (val - blockSize < blockSize - prevVal) rval = int(val + 0.01); | 52 else if (val - float(blockSize) < |
53 float(blockSize) - prevVal) rval = int(val + 0.01f); | |
53 else rval = int(prevVal + 0.01); | 54 else rval = int(prevVal + 0.01); |
54 // SVDEBUG << "returning " << rval << endl; | 55 // SVDEBUG << "returning " << rval << endl; |
55 return rval; | 56 return rval; |
56 } | 57 } |
57 | 58 |