Kaydet (Commit) c0c03aad authored tarafından Luboš Luňák's avatar Luboš Luňák

make OpenCL SLOPE() handle problems more gracefully

It's silly to just return NaN just because the function can't handle
something. If nothing else, at least a proper error should be reported
(or in this case, the fallback to the core function will take care of it).

Change-Id: I9c971082f4c5c9836318cf63d15fa7c278274273
Reviewed-on: https://gerrit.libreoffice.org/64244
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 93054cd0
...@@ -2548,6 +2548,7 @@ void OpStDevP::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -2548,6 +2548,7 @@ void OpStDevP::GenSlidingWindowFunction(std::stringstream &ss,
void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
const std::string &sSymName, SubArguments &vSubArguments) const std::string &sSymName, SubArguments &vSubArguments)
{ {
CHECK_PARAMETER_COUNT(2,2);
ss << "\ndouble " << sSymName; ss << "\ndouble " << sSymName;
ss << "_" << BinFuncName() << "("; ss << "_" << BinFuncName() << "(";
for (size_t i = 0; i < vSubArguments.size(); i++) for (size_t i = 0; i < vSubArguments.size(); i++)
...@@ -2567,12 +2568,6 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -2567,12 +2568,6 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
ss << " double fCount = 0.0;\n"; ss << " double fCount = 0.0;\n";
ss << " double argX = 0.0;\n"; ss << " double argX = 0.0;\n";
ss << " double argY = 0.0;\n"; ss << " double argY = 0.0;\n";
if(vSubArguments.size() != 2)
{
ss << " return NAN;\n";
ss << "}\n";
return ;
}
FormulaToken *pCur = vSubArguments[1]->GetFormulaToken(); FormulaToken *pCur = vSubArguments[1]->GetFormulaToken();
FormulaToken *pCur1 = vSubArguments[0]->GetFormulaToken(); FormulaToken *pCur1 = vSubArguments[0]->GetFormulaToken();
assert(pCur); assert(pCur);
...@@ -2591,11 +2586,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -2591,11 +2586,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
pDVR1->GetArrayLength() ? pDVR->GetArrayLength(): pDVR1->GetArrayLength() ? pDVR->GetArrayLength():
pDVR1->GetArrayLength(); pDVR1->GetArrayLength();
if(nCurWindowSize != nCurWindowSize1) if(nCurWindowSize != nCurWindowSize1)
{ throw Unhandled(__FILE__, __LINE__);
ss << " return NAN;\n";
ss << "}\n";
return ;
}
ss << " for (int i = "; ss << " for (int i = ";
if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed()) if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed())
&&(!pDVR1->IsStartFixed() && pDVR1->IsEndFixed())) &&(!pDVR1->IsStartFixed() && pDVR1->IsEndFixed()))
...@@ -2626,13 +2617,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -2626,13 +2617,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
} }
else else
{ {
ss << "0; i < " << nCurWindowSize << "; i++)\n"; throw Unhandled(__FILE__, __LINE__);
ss << " {\n";
ss << " break;\n";
ss << " }";
ss << " return NAN;\n";
ss << "}\n";
return ;
} }
ss << " argX = "; ss << " argX = ";
...@@ -2701,8 +2686,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -2701,8 +2686,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss,
} }
else else
{ {
ss << " return NAN;\n"; throw Unhandled(__FILE__, __LINE__);
ss << "}\n";
} }
} }
void OpSTEYX::GenSlidingWindowFunction(std::stringstream &ss, void OpSTEYX::GenSlidingWindowFunction(std::stringstream &ss,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment