Kiyamou / VapourSynth-RealSR-ncnn-Vulkan

RealSR super resolution plugin for VapourSynth implemented with ncnn library
MIT License
19 stars 3 forks source link

Support progress display and a cache question #5

Open YohoYang opened 2 years ago

YohoYang commented 2 years ago

VapourSynth-RealSR-ncnn-Vulkan is great.

Hope to show progress as it is processed.

One problem is that if the path contains Chinese, the following error will be prompted, maybe the path does not support UTF-8?

Python exception: RealSR: can't open model file

Traceback (most recent call last):
  File "src\cython\vapoursynth.pyx", line 2832, in vapoursynth._vpy_evaluate
  File "src\cython\vapoursynth.pyx", line 2833, in vapoursynth._vpy_evaluate
  File "D:\CONAN\OUT\TEST\OVA7.vpy", line 15, in <module>
    video = core.rsnv.RealSR(video, tilesize_x=300, tilesize_y=300, gpu_thread=2)
  File "src\cython\vapoursynth.pyx", line 2580, in vapoursynth.Function.__call__
vapoursynth.Error: RealSR: can't open model file

By the way, are there caches generated during processing, and where are they all stored?

Kiyamou commented 2 years ago

Maybe the path of model can't contain Chinese. Because in code std::ifstream is used to check if model exists. std::ifstream is not friendly to Chinese. (But I haven't tested it so far.)

To be honest, the cache mechanism depends on ncnn frame. Generally, VapourSynth plugins use the function filterFree() to free memory. Especially, in this plugin, we call ncnn::destroy_gpu_instance() in filterFree() to end ncnn and free cache.

Showing progress is a good idea. But I need to learn ncnn to figure out how to do it.

YohoYang commented 2 years ago

About the cache question, before, I am worried that there will be a lot of cache files in the system disk, but it seems to use memory to write, then there is no problem.

About the progress, thanks for your hard work.

As for the problem of Chinese paths, I tried to search the Internet for errors in reading Chinese paths with std::ifstream. There are many articles discussing this, and some solutions are also given, as follows, hope that helps, I can help with testing: Use the _TEXT() macro to specify string constants as TCHAR* types

file.open(_TEXT("c://测试//测试文本.txt"));

Another method is to set the locale to the value of the user system first, and then restore it after using ifstream

locale::global(locale(""));
//open file
locale::global(locale("C"));

Finally, thank you again for your hard work again.