IVGCVSW-2199 Call Resize only if H and/or W changes
authorJames Conroy <james.conroy@arm.com>
Mon, 26 Nov 2018 09:48:30 +0000 (09:48 +0000)
committerJames Conroy <james.conroy@arm.com>
Mon, 26 Nov 2018 11:16:32 +0000 (11:16 +0000)
* Wrap Resize function call with conditional checking
  if height and/or width need to be changed.

Change-Id: Ic33c3ed29cc985c147d29db8e9dd237ab9c741d1

tests/YoloDatabase.cpp

index 0f5dee0..472fc80 100644 (file)
@@ -83,7 +83,10 @@ std::unique_ptr<YoloDatabase::TTestCaseData> YoloDatabase::GetTestCaseData(unsig
     try
     {
         InferenceTestImage image(imagePath.c_str());
-        image.Resize(YoloImageWidth, YoloImageHeight, CHECK_LOCATION());
+        if (YoloImageWidth != image.GetWidth() || YoloImageHeight != image.GetHeight())
+        {
+            image.Resize(YoloImageWidth, YoloImageHeight, CHECK_LOCATION());
+        }
         imageData = GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout::Rgb, image);
     }
     catch (const InferenceTestImageException& e)