MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / loadImageData

Function loadImageData

cpp/4_CUDA_Libraries/cudaNvSci/main.cpp:36–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#include "cudaNvSci.h"
35
36void loadImageData(const std::string &filename,
37 const char **argv,
38 unsigned char **image_data,
39 uint32_t &imageWidth,
40 uint32_t &imageHeight)
41{
42 // load image (needed so we can get the width and height before we create
43 // the window
44 char *image_path = sdkFindFilePath(filename.c_str(), argv[0]);
45
46 if (image_path == 0) {
47 printf("Error finding image file '%s'\n", filename.c_str());
48 exit(EXIT_FAILURE);
49 }
50
51 sdkLoadPPM4(image_path, image_data, &imageWidth, &imageHeight);
52
53 if (!image_data) {
54 printf("Error opening file '%s'\n", image_path);
55 exit(EXIT_FAILURE);
56 }
57
58 printf("Loaded '%s', %d x %d pixels\n", image_path, imageWidth, imageHeight);
59}
60
61int main(int argc, const char **argv)
62{

Callers 1

mainFunction · 0.70

Calls 2

sdkFindFilePathFunction · 0.85
sdkLoadPPM4Function · 0.85

Tested by

no test coverage detected