MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / do_setup

Method do_setup

examples/neon_scale.cpp:36–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34{
35public:
36 bool do_setup(int argc, char **argv) override
37 {
38 PPMLoader ppm;
39
40 if (argc < 2)
41 {
42 // Print help
43 std::cout << "Usage: ./build/neon_scale[input_image.ppm]\n\n";
44 std::cout << "No input_image provided, creating a dummy 640x480 image\n";
45 // Create an empty grayscale 640x480 image
46 src.allocator()->init(TensorInfo(640, 480, Format::U8));
47 }
48 else
49 {
50 ppm.open(argv[1]);
51 ppm.init_image(src, Format::U8);
52 }
53
54 constexpr int scale_factor = 2;
55
56 TensorInfo dst_tensor_info(src.info()->dimension(0) / scale_factor, src.info()->dimension(1) / scale_factor,
57 Format::U8);
58
59 // Configure the destination image
60 dst.allocator()->init(dst_tensor_info);
61
62 // Configure Scale function object:
63 scale.configure(&src, &dst,
64 ScaleKernelInfo{InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED, PixelValue(),
65 SamplingPolicy::CENTER, false});
66
67 // Allocate all the images
68 src.allocator()->allocate();
69 dst.allocator()->allocate();
70
71 // Fill the input image with the content of the PPM image if a filename was provided:
72 if (ppm.is_open())
73 {
74 ppm.fill_image(src);
75 output_filename = std::string(argv[1]) + "_out.ppm";
76 }
77
78 return true;
79 }
80 void do_run() override
81 {
82 // Run the scale operation:

Callers

nothing calls this directly

Calls 12

PixelValueClass · 0.85
init_imageMethod · 0.80
fill_imageMethod · 0.80
TensorInfoClass · 0.50
initMethod · 0.45
allocatorMethod · 0.45
openMethod · 0.45
dimensionMethod · 0.45
infoMethod · 0.45
configureMethod · 0.45
allocateMethod · 0.45
is_openMethod · 0.45

Tested by

no test coverage detected