Skip to content
Snippets Groups Projects
Commit d02633e9 authored by Laurent Van Migroet's avatar Laurent Van Migroet
Browse files

Fix Bug compile on msvc + remove some warning

Change float to double in mpeg_encode/rgbtoycc.cpp ok ?
parent 98a92f25
No related branches found
No related tags found
No related merge requests found
......@@ -825,19 +825,19 @@ void signedDistancesPointsTriangle(std::vector<double>&distances,
SVector3 t3 = p3 - p2;
SVector3 n = crossprod(t1, t2);
n.normalize();
double mat[3][3] = {{t1.x(), t2.x(), -n.x()},
{t1.y(), t2.y(), -n.y()},
{t1.z(), t2.z(), -n.z()}};
double inv[3][3];
double det = inv3x3(mat, inv);
const unsigned pts_size=pts.size();
distances.clear();
distances.resize(pts.size());
distances.resize(pts_size);
closePts.clear();
closePts.resize(pts.size());
closePts.resize(pts_size);
for (unsigned int i = 0; i < pts.size(); i++)
for (unsigned int i = 0; i < pts_size; ++i)
distances[i] = 1.e22;
if(det == 0.0) return;
......@@ -847,7 +847,7 @@ void signedDistancesPointsTriangle(std::vector<double>&distances,
const double n2t3 = dot(t3, t3);
double u, v, d;
for (unsigned int i = 0; i < pts.size();i++){
for (unsigned int i = 0; i < pts_size;++i){
const SPoint3 &p = pts[i];
SVector3 pp1 = p - p1;
u = (inv[0][0] * pp1.x() + inv[0][1] * pp1.y() + inv[0][2] * pp1.z());
......@@ -909,14 +909,15 @@ void signedDistancesPointsLine (std::vector<double>&distances,
SVector3 t1 = p2 - p1;
const double n2t1 = dot(t1, t1);
const unsigned pts_size=pts.size();
distances.clear();
distances.resize(pts.size());
distances.resize(pts_size);
closePts.clear();
closePts.resize(pts.size());
closePts.resize(pts_size);
double d;
for (unsigned int i = 0; i < pts.size();i++){
for (unsigned int i = 0; i <pts_size;++i){
const SPoint3 &p = pts[i];
SVector3 pp1 = p - p1;
const double t12 = dot(pp1, t1) / n2t1;
......
......@@ -32,12 +32,12 @@ void function::setArgument(fullMatrix<double> &v, const function *f, int iMap) {
throw;
arguments.push_back(argument(v, iMap, f));
dependencies.insert(dependency(iMap, f));
for(std::set<dependency>::iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
for(std::set<dependency>::const_iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
if (it->iMap> 0 && iMap >0)
Msg::Error("consecutive secondary caches");
dependencies.insert(dependency(iMap + it->iMap, it->f));
}
for (int i = 0; i < _functionReplaces.size(); i++) {
for (double i = 0; i < _functionReplaces.size(); i++) {
functionReplace &replace = *_functionReplaces[i];
for (std::set<dependency>::iterator it = replace._fromParent.begin(); it != replace._fromParent.end(); it++) {
if (it->iMap> 0 && iMap >0)
......@@ -80,7 +80,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
// can I use the cache of my parent ?
if(_parent && r==NULL) {
bool okFromParent = true;
for (std::set<function::dependency>::iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
for (std::set<function::dependency>::const_iterator it = f->dependencies.begin(); it != f->dependencies.end(); it++) {
if (it->iMap > _parent->_secondaryCaches.size())
okFromParent=false;
dataCacheMap *m = getSecondaryCache(it->iMap);
......@@ -152,9 +152,9 @@ void functionReplace::replace(fullMatrix<double> &v, const function *f, int iMap
void functionReplace::get(fullMatrix<double> &v, const function *f, int iMap) {
bool allDepFromParent = true;
for (std::set<function::dependency>::iterator itDep = f->dependencies.begin(); itDep != f->dependencies.end(); itDep++){
for (std::set<function::dependency>::const_iterator itDep = f->dependencies.begin(); itDep != f->dependencies.end(); itDep++){
bool depFromParent = (_replaced.count(*itDep)==0);
for (std::set<function::dependency>::iterator itDep2 = itDep->f->dependencies.begin(); itDep2 != itDep->f->dependencies.end() && depFromParent; itDep2++)
for (std::set<function::dependency>::const_iterator itDep2 = itDep->f->dependencies.begin(); itDep2 != itDep->f->dependencies.end() && depFromParent; itDep2++)
depFromParent &= (_replaced.count(*itDep2)==0);
if(depFromParent)
_master->dependencies.insert(*itDep);
......
......@@ -16,7 +16,7 @@ class dataCacheDouble;
class functionConstant;
class functionReplace;
class functionReplaceCache;
struct functionReplaceCache;
// An abstract interface to functions
// more explanation at the head of this file
......@@ -26,7 +26,7 @@ class function {
bool _invalidatedOnElement;
std::vector<functionReplace*> _functionReplaces;
class dependency {
public : int iMap; const function *f;
public : unsigned iMap; const function *f;
dependency(int iMap_, const function *f_){iMap = iMap_; f = f_; }
bool operator < (const dependency &d) const {
return (d.iMap <iMap || d.f < f);
......
......@@ -89,9 +89,9 @@ PNMtoYUV(MpegFrame *frame)
register xel *src0, *src1;
register int ydivisor, cdivisor;
static boolean first = TRUE;
static float mult299[1024], mult587[1024], mult114[1024];
static float mult16874[1024], mult33126[1024], mult5[1024];
static float mult41869[1024], mult08131[1024];
static double mult299[1024], mult587[1024], mult114[1024];
static double mult16874[1024], mult33126[1024], mult5[1024];
static double mult41869[1024], mult08131[1024];
if ( first ) {
register int index;
......@@ -256,9 +256,9 @@ PPMtoYUV(MpegFrame *frame)
register uint8 *src0, *src1;
register int cdivisor;
static boolean first = TRUE;
static float mult299[1024], mult587[1024], mult114[1024];
static float mult16874[1024], mult33126[1024], mult5[1024];
static float mult41869[1024], mult08131[1024];
static double mult299[1024], mult587[1024], mult114[1024];
static double mult16874[1024], mult33126[1024], mult5[1024];
static double mult41869[1024], mult08131[1024];
if ( first ) {
register int index;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment