[Windows 10] [C LIBRARY] : PNG decoding is slower than OpenCV
- Dominant language
- C
- Stars
- 4.8k
- Forks
- 145
- Avg merge
- 11h 48m
- Merged PRs (30d)
- 1
Description
Hello, thanks for helping:
I try to use wuffs to open png files within a c++ project. I use vs2017 to compile this code, but PNG decoding is slower than OpenCV.
OpenCV: 65ms
wuffs: 93ms
```
#include "iostream"
#include "chrono"
#define WUFFS_IMPLEMENTATION
#define WUFFS_CONFIG__MODULE__PNG
#include "wuffs-v0.3.c"
uint32_t g_width = 0;
uint32_t g_height = 0;
wuffs_aux::MemOwner g_pixbuf_mem_owner(nullptr, &free);
wuffs_base__pixel_buffer g_pixbuf = { 0 };
bool load_image(const char* filename)
{
FILE* file = stdin;
const char* adj_filename = "";
if (filename) {
FILE* f = fopen(filename, "rb");
if (f == NULL) {
printf("%s: could not open file\n", filename);
return false;
}
file = f;
adj_filename = filename;
}
g_width = 0;
g_height = 0;
g_pixbuf_mem_owner.reset();
g_pixbuf = wuffs_base__null_pixel_buffer();
wuffs_aux::DecodeImageCallbacks callbacks;
wuffs_aux::sync_io::FileInput input(file);
wuffs_aux::DecodeImageResult res = wuffs_aux::DecodeImage(callbacks, input);
return true;
}
inline auto get_time()
{
return std::chrono::high_resolution_clock::now();
}
int main(int argc, char** argv)
{
auto start = get_time();
bool loaded = load_image("C:/Users/huangry/Desktop/8/IMG_1071.PNG");
if (loaded)
std::cout << loaded << "\n";
auto end = get_time();
std::chrono::duration elapsed = (end - start);
printf("Wuffs : %fs\n", elapsed.count());
return 0;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.