ultravideo/kvazaar

Request: error messages and switching off logging

farindk opened this issue · 5 comments

I have just added a kvazaar encoder plugin to libheif as an alternative HEIC encoder:
strukturag/libheif@2fb1063

I came across two things that I could not find:

  • When an API function returns an error, is there any error message or further information that I could pass on?
  • Could you add a config parameter to switch off the logging to stdout through the API?

When an API function returns an error, is there any error message or further information that I could pass on?

No, not really. Since error handling in general is not easy in C, we do the bare minimum.

Could you add a config parameter to switch off the logging to stdout through the API?

Kvazaar shouldn't output anything to stdout (except help or version message), so I assume you mean stderr? Even then do you mean error messages from the config parsing, since the actual logging by the encoder is performed by the CLI and not the API version of Kvazaar that you are using. Nevertheless, there is no such option, but if you want to create it yourself we would be happy to accept a pull request for such feature.

The following is printed to stderr in api->encoder_open():

Compiled: INTEL, flags: MMX SSE SSE2
Detected: INTEL, flags: MMX SSE SSE2 SSE3 SSSE3 SSE41 SSE42 AVX AVX2
Available: avx(11) avx2(54) sse2(2) sse41(4) 
In use: avx(1) avx2(54) 
--owf=auto value set to 2.
--threads=auto value set to 8.

Printing is done here:

fprintf(stderr, "Compiled: INTEL, flags:");
#if COMPILE_INTEL_MMX
fprintf(stderr, " MMX");
#endif
#if COMPILE_INTEL_SSE
fprintf(stderr, " SSE");
#endif
#if COMPILE_INTEL_SSE2
fprintf(stderr, " SSE2");
#endif
#if COMPILE_INTEL_SSE3
fprintf(stderr, " SSE3");
#endif
#if COMPILE_INTEL_SSSE3
fprintf(stderr, " SSSE3");
#endif
#if COMPILE_INTEL_SSE41
fprintf(stderr, " SSE41");
#endif
#if COMPILE_INTEL_SSE42
fprintf(stderr, " SSE42");
#endif
#if COMPILE_INTEL_AVX
fprintf(stderr, " AVX");
#endif
#if COMPILE_INTEL_AVX2
fprintf(stderr, " AVX2");
#endif
fprintf(stderr, "\nDetected: INTEL, flags:");
if (kvz_g_hardware_flags.intel_flags.mmx) fprintf(stderr, " MMX");
if (kvz_g_hardware_flags.intel_flags.sse) fprintf(stderr, " SSE");
if (kvz_g_hardware_flags.intel_flags.sse2) fprintf(stderr, " SSE2");
if (kvz_g_hardware_flags.intel_flags.sse3) fprintf(stderr, " SSE3");
if (kvz_g_hardware_flags.intel_flags.ssse3) fprintf(stderr, " SSSE3");
if (kvz_g_hardware_flags.intel_flags.sse41) fprintf(stderr, " SSE41");
if (kvz_g_hardware_flags.intel_flags.sse42) fprintf(stderr, " SSE42");
if (kvz_g_hardware_flags.intel_flags.avx) fprintf(stderr, " AVX");
if (kvz_g_hardware_flags.intel_flags.avx2) fprintf(stderr, " AVX2");
fprintf(stderr, "\n");
#endif //COMPILE_INTEL
#if COMPILE_POWERPC
if (cpuid) {
kvz_g_hardware_flags.powerpc_flags.altivec = altivec_available();
}
fprintf(stderr, "Compiled: PowerPC, flags:");
#if COMPILE_POWERPC_ALTIVEC
fprintf(stderr, " AltiVec");
#endif
fprintf(stderr, "\nDetected: PowerPC, flags:");
if (kvz_g_hardware_flags.powerpc_flags.altivec) fprintf(stderr, " AltiVec");
fprintf(stderr, "\n");
#endif

Sorry, yes you are correct, this was already brought up in #292 and then answer is pretty much the same still.

And all over in this function:

encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg)