Skip to content

Commit 9c3a041

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
Fix CQS signal readability-braces-around-statements in xplat/ocean/impl/ocean
Reviewed By: dtolnay Differential Revision: D79328216 fbshipit-source-id: e1b45c8627ace9f9962eda22246f813706b84345
1 parent 196d50f commit 9c3a041

23 files changed

Lines changed: 326 additions & 180 deletions

impl/ocean/test/testcv/TestFrameFilterSeparable.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,11 @@ bool TestFrameFilterSeparable::testSeparableFilterUniversal(const double testDur
986986
Log::info() << " ";
987987
}
988988

989-
if (allSucceeded)
989+
if (allSucceeded) {
990990
Log::info() << "Universal separable filter test succeeded.";
991-
else
991+
} else {
992992
Log::info() << "Universal separable filter test FAILED!";
993+
}
993994

994995
return allSucceeded;
995996
}

impl/ocean/test/testcv/TestFrameFilterTemplate.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,9 @@ bool TestFrameFilterTemplate::validateFilterPixel(const uint8_t* frame, const un
875875
{
876876
const TResponse response0 = TFilterTemplate::template filterPixel<uint8_t, TResponse, TNormalization, tNormalization, tBias, 0u, 1u, tDirection>(frame, width, height, x, y);
877877

878-
if (response0 != testResponse[0])
878+
if (response0 != testResponse[0]) {
879879
return false;
880+
}
880881

881882
break;
882883
}
@@ -886,8 +887,9 @@ bool TestFrameFilterTemplate::validateFilterPixel(const uint8_t* frame, const un
886887
const TResponse response0 = TFilterTemplate::template filterPixel<uint8_t, TResponse, TNormalization, tNormalization, tBias, 0u, 2u, tDirection>(frame, width, height, x, y);
887888
const TResponse response1 = TFilterTemplate::template filterPixel<uint8_t, TResponse, TNormalization, tNormalization, tBias, 1u, 2u, tDirection>(frame, width, height, x, y);
888889

889-
if (response0 != testResponse[0] || response1 != testResponse[1])
890+
if (response0 != testResponse[0] || response1 != testResponse[1]) {
890891
return false;
892+
}
891893

892894
break;
893895
}

impl/ocean/test/testcv/TestFrameInterpolatorBicubic.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ bool TestFrameInterpolatorBicubic::test(const unsigned int width, const unsigned
6262

6363
Log::info() << " ";
6464

65-
if (result)
65+
if (result) {
6666
Log::info() << "Bicubic interpolation test succeeded.";
67-
else
67+
} else {
6868
Log::info() << "Bicubic interpolation test FAILED!";
69+
}
6970

7071
return result;
7172
}

impl/ocean/test/testcv/TestFrameShrinkerAlpha.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,19 @@ void TestFrameShrinkerAlpha::invokeFrameDivideByTwo(const Frame& source, Frame&
185185
{
186186
if (alphaAtFront)
187187
{
188-
if (transparentIs0xFF)
188+
if (transparentIs0xFF) {
189189
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<1u, true, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
190-
else
190+
} else {
191191
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<1u, true, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
192+
}
192193
}
193194
else
194195
{
195-
if (transparentIs0xFF)
196+
if (transparentIs0xFF) {
196197
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<1u, false, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
197-
else
198+
} else {
198199
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<1u, false, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
200+
}
199201
}
200202
break;
201203
}
@@ -204,17 +206,19 @@ void TestFrameShrinkerAlpha::invokeFrameDivideByTwo(const Frame& source, Frame&
204206
{
205207
if (alphaAtFront)
206208
{
207-
if (transparentIs0xFF)
209+
if (transparentIs0xFF) {
208210
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<2u, true, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
209-
else
211+
} else {
210212
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<2u, true, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
213+
}
211214
}
212215
else
213216
{
214-
if (transparentIs0xFF)
217+
if (transparentIs0xFF) {
215218
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<2u, false, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
216-
else
219+
} else {
217220
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<2u, false, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
221+
}
218222
}
219223
break;
220224
}
@@ -223,17 +227,19 @@ void TestFrameShrinkerAlpha::invokeFrameDivideByTwo(const Frame& source, Frame&
223227
{
224228
if (alphaAtFront)
225229
{
226-
if (transparentIs0xFF)
230+
if (transparentIs0xFF) {
227231
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<3u, true, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
228-
else
232+
} else {
229233
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<3u, true, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
234+
}
230235
}
231236
else
232237
{
233-
if (transparentIs0xFF)
238+
if (transparentIs0xFF) {
234239
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<3u, false, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
235-
else
240+
} else {
236241
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<3u, false, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
242+
}
237243
}
238244
break;
239245
}
@@ -242,17 +248,19 @@ void TestFrameShrinkerAlpha::invokeFrameDivideByTwo(const Frame& source, Frame&
242248
{
243249
if (alphaAtFront)
244250
{
245-
if (transparentIs0xFF)
251+
if (transparentIs0xFF) {
246252
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<4u, true, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
247-
else
253+
} else {
248254
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<4u, true, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
255+
}
249256
}
250257
else
251258
{
252-
if (transparentIs0xFF)
259+
if (transparentIs0xFF) {
253260
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<4u, false, true>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
254-
else
261+
} else {
255262
CV::FrameShrinkerAlpha::divideByTwo8BitPerChannel<4u, false, false>(source.constdata<uint8_t>(), target.data<uint8_t>(), source.width(), source.height(), source.paddingElements(), target.paddingElements(), worker);
263+
}
256264
}
257265
break;
258266
}

impl/ocean/test/testcv/TestHistogram.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,8 +1391,9 @@ unsigned int TestHistogram::validateTileLookupTables(const unsigned char* source
13911391
tileHist[t1 >> shift]++;
13921392
}
13931393

1394-
for (; x < tileROIWidth; ++x)
1394+
for (; x < tileROIWidth; ++x) {
13951395
tileHist[ptr[x] >> shift]++;
1396+
}
13961397
}
13971398

13981399
// clip histogram
@@ -1413,11 +1414,13 @@ unsigned int TestHistogram::validateTileLookupTables(const unsigned char* source
14131414
int redistBatch = clipped / histSize;
14141415
int residual = clipped - redistBatch * histSize;
14151416

1416-
for (int i = 0; i < histSize; ++i)
1417+
for (int i = 0; i < histSize; ++i) {
14171418
tileHist[i] += redistBatch;
1419+
}
14181420

1419-
for (int i = 0; i < residual; ++i)
1421+
for (int i = 0; i < residual; ++i) {
14201422
tileHist[i]++;
1423+
}
14211424
}
14221425

14231426
// calc Lut

impl/ocean/test/testcv/TestSSE.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,16 +1267,19 @@ bool TestSSE::testSumInterleave1Channel8Bit15Elements(const double testDuration)
12671267
elements16Back[0] = uint8_t(RandomI::random(255u));
12681268

12691269
__m128i sums = CV::SSE::sum1Channel8BitFront15Elements<false>(elements15);
1270-
if (CV::SSE::value_u32<0u>(sums) != test)
1270+
if (CV::SSE::value_u32<0u>(sums) != test) {
12711271
allSucceeded = false;
1272+
}
12721273

12731274
sums = CV::SSE::sum1Channel8BitFront15Elements<true>(elements16Front);
1274-
if (CV::SSE::value_u32<0u>(sums) != test)
1275+
if (CV::SSE::value_u32<0u>(sums) != test) {
12751276
allSucceeded = false;
1277+
}
12761278

12771279
sums = CV::SSE::sum1Channel8BitBack15Elements(elements16Back);
1278-
if (CV::SSE::value_u32<0u>(sums) != test)
1280+
if (CV::SSE::value_u32<0u>(sums) != test) {
12791281
allSucceeded = false;
1282+
}
12801283
}
12811284
}
12821285
while (startTimestamp + testDuration > Timestamp(true));

impl/ocean/test/testcv/testopencv/TestFeatureDetectors.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,11 @@ bool TestFeatureDetectors::testFeatureDetectors(const cv::Mat& frame, const doub
250250

251251
Log::info() << " ";
252252

253-
if (allSucceeded)
253+
if (allSucceeded) {
254254
Log::info() << "OpenCV feature detectors succeeded.";
255-
else
255+
} else {
256256
Log::info() << "OpenCV feature detectors FAILED!";
257+
}
257258

258259
return allSucceeded;
259260
}

impl/ocean/test/testcv/testopencv/TestGeometry.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,15 @@ bool generateRandomizedPnPData(ObjectPoints& cvObjectPoints, ImagePoints& cvImag
176176
objectPoints[0] = Vector3(Random::scalar(-1, 1), 0, Random::scalar(-1, 1));
177177
objectPoints[1] = Vector3(Random::scalar(-1, 1), 0, Random::scalar(-1, 1));
178178

179-
while (objectPoints[0].distance(objectPoints[1]) < minimumDistance)
179+
while (objectPoints[0].distance(objectPoints[1]) < minimumDistance) {
180180
objectPoints[1] = Vector3(Random::scalar(-1, 1), 0, Random::scalar(-1, 1));
181+
}
181182

182183
objectPoints[2] = Vector3(Random::scalar(-1, 1), 0, Random::scalar(-1, 1));
183184

184-
while (Line3(objectPoints[0], (objectPoints[1] - objectPoints[0]).normalized()).distance(objectPoints[2]) < minimumDistance)
185+
while (Line3(objectPoints[0], (objectPoints[1] - objectPoints[0]).normalized()).distance(objectPoints[2]) < minimumDistance) {
185186
objectPoints[2] = Vector3(Random::scalar(-1, 1), 0, Random::scalar(-1, 1));
187+
}
186188

187189
const Euler euler(Random::euler(Numeric::deg2rad(0), Numeric::deg2rad(30)));
188190
const Quaternion quaternion(euler);
@@ -201,8 +203,9 @@ bool generateRandomizedPnPData(ObjectPoints& cvObjectPoints, ImagePoints& cvImag
201203

202204
const Line2 line(imagePoints[n], (imagePoints[n1] - imagePoints[n]).normalized());
203205

204-
if (line.distance(imagePoints[n2]) < 5)
206+
if (line.distance(imagePoints[n2]) < 5) {
205207
imagePointsColinear = true;
208+
}
206209
}
207210

208211
}
@@ -264,8 +267,9 @@ bool generateRandomizedPnPData(ObjectPoints& cvObjectPoints, ImagePoints& cvImag
264267

265268
// Extract and convert the rotation and translation of the camera from the groundtruth pose
266269
ocean_assert(groundtruthPose.isValid());
267-
if (!groundtruthPose.isValid())
270+
if (!groundtruthPose.isValid()) {
268271
return false;
272+
}
269273

270274
const ExponentialMap rotationEM(groundtruthPose.rotation());
271275
const Vector3 axis = rotationEM.axis().normalized();
@@ -296,8 +300,9 @@ Scalar computeProjectionError(const ObjectPoints& objectPoints, const ImagePoint
296300

297301
Scalar error(0);
298302
ocean_assert(imagePoints.size() == projectedPoints.size());
299-
for (ImagePoints::const_iterator iter0 = imagePoints.begin(), iter1 = projectedPoints.begin(); iter0 != imagePoints.end() && iter1 != projectedPoints.end(); ++iter0, ++iter1)
303+
for (ImagePoints::const_iterator iter0 = imagePoints.begin(), iter1 = projectedPoints.begin(); iter0 != imagePoints.end() && iter1 != projectedPoints.end(); ++iter0, ++iter1) {
300304
error += computeDistance(*iter0, *iter1);
305+
}
301306

302307
return error;
303308
}
@@ -439,8 +444,9 @@ bool runTestPnP(const double testDuration, const PinholeCamera& camera, const si
439444

440445
bool generationSuccessful = generateRandomizedPnPData(objectPoints, imagePoints, trueRotation, numberOfPoints, camera);
441446

442-
if (!generationSuccessful)
447+
if (!generationSuccessful) {
443448
continue;
449+
}
444450

445451
if (numberOfPoints != objectPoints.size() || numberOfPoints != imagePoints.size())
446452
{
@@ -455,8 +461,9 @@ bool runTestPnP(const double testDuration, const PinholeCamera& camera, const si
455461
Scalar error = computeProjectionError(objectPoints, imagePoints, cameraMatrix, estimatedRotation, estimatedTranslation);
456462
projectionErrors.push_back(error);
457463

458-
if (error < Scalar(0.9))
464+
if (error < Scalar(0.9)) {
459465
succeeded++;
466+
}
460467

461468
iterations++;
462469
} while (startTimestamp + testDuration > Timestamp(true));

impl/ocean/test/testcv/testopencv/TestPerformance.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ bool TestPerformance::test(const double testDuration)
5656
}
5757
}
5858

59-
if (allSucceeded)
59+
if (allSucceeded) {
6060
Log::info() << testName << " succeeded.";
61-
else
61+
} else {
6262
Log::info() << testName << " FAILED!";
63+
}
6364

6465
return allSucceeded;
6566

impl/ocean/test/testcv/testopencv/TestPointTracking.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ bool TestPointTracking::testSparseOpticalFlow(const cv::Mat & frame, int window,
255255
cv::destroyAllWindows();
256256
#endif
257257

258-
if (matchRatio == 1.0)
258+
if (matchRatio == 1.0) {
259259
return true;
260-
else
260+
} else {
261261
return false;
262262
}
263+
}
263264

264265
bool TestPointTracking::testTemplateMatching(const cv::Mat & frame)
265266
{

0 commit comments

Comments
 (0)