team-charls/charls

Encoding problem in GCC 12

Jamaika1 opened this issue · 12 comments

Hi Charls
I don't know wherebug is. I can't create jpegls file in GCC 12.0.0.
g++.exe -std=gnu++14 -Wall -Wextra -ftree-vectorize -g0 -O3 -fPIC ...
jpegLS.exe -encodepnm image_21448_24bit.ppm image_21448_24bit.jls

Hi @Jamaika1,
I would need more information to be able to reproduce the problem:

  • Which OS?
  • Which CPU?
  • Can you upload the image that fails?

I found the problem is with some unusual PPM files. Maybe they are badly made?
https://www.sendspace.com/file/u8wr58

I checked you attached PPM file. With the test tool charls-image-test, compiled with Visual Studio 2022 Preview I can encode and decode the PPM image without any problems.
I can see however that your attached jpegLS.exe creates a 0 byte file.

Latest version of GCC is 11.2 Do you have a link to the compiler you used to build jpegLS.exe (I am assuming it is just CharLSTest.exe renamed).

I add link to the compiler and my modification of std: thread and std::mutex under gcc 12.0.0
http://msystem.waw.pl/x265/mingw-gcc1200-20210722.7z
https://github.com/Jamaika1/mingw_std_threads

New update cb44fab
GCC 11.2.0 http://msystem.waw.pl/x265/mingw-gcc112-20210729.7z
GCC 12.0.0 http://www.equation.com/ftpdir/gcc/gcc-12-20210926-64.exe
jpegLS.exe -encodepnm image_21448_24bit.ppm image_21448_24bit.jls

Failed to encode image_21448_24bit.ppm to image_21448_24bit.jls, reason: basic_ios::clear: iostream error

thanks for the additional info

New upadte bea1c00
Codec works in Windows 10 only as administrator. I don't know if this is correct.

I have tried to reproduce your reported problem with
GCC 11.2 (MinGW version on Windows) and GCC 12 (20211217) on Ubuntu 22.04.
I am however not able to reproduce the problem.
Running "charlstest.exe -encodepnm image_21447_24bit.ppm output.jls" on Windows or Ubuntu works fine.

Could it be that your jpegls.exe application has a problem? It reports an iostream error, but CharLS doesn't interact with IO streams.

Note: Your remark about codec works only in Windows 10 as administrator is not clear to me. CharLS doesn't anything that would require administrator privileges on Windows.

Hi charls
I don't want to upset anyone. If you think the codec is ok then just close the thread.

This is simple codec. I don't know where the codec creates the jpegls file by default. Why does the codec need administrator option?

echo off
set PATH=C:\MSYS1200\bin;%PATH%
rem echo %PATH%
rem cd "C:\MSYS1200\bin"
for %%f in ("%~dp1*.cpp") do g++.exe -std=gnu++14 -ftree-vectorize -g0 -O3 -fPIC -D_DEBUG -DCHARLS_STATIC -c %%f -o %%~nf.o
g++.exe -std=gnu++14 -Wall -Wextra -ftree-vectorize -g0 -O3 -fPIC bitstreamdamage.o charls_jpegls_decoder.o charls_jpegls_encoder.o compliance.o dicomsamples.o jpegls.o jpegls_error.o jpeg_stream_reader.o jpeg_stream_writer.o legacy.o main.o performance.o util.o -o jpegLS.exe
pause

I would be grateful for information whether my created codec works for you in Windows 10 as user. 952310a
https://www.sendspace.com/file/izk35r

jpegLS.exe -encodepnm image_21448_24bit.ppm image_21448_24bit.jls

It seems your jpegLS.exe is just charlstest.
If you don't provide an absolute path as name for the output file it will try to open that file based on the current working directory.

Calling jpegLS -encodepnm c:\users\YourName\image.ppm c:\users\YourName\image.jls will ensure that the output is created in a location you should have write rights.
Or jpegLS -encodepnm /home/YourName/image.ppm /home/YourName/image.jls on Linux

Note: there is also a CMake file that will build the codec and charlstest for you (instructions are on the wiki).

Thanks for suggestions
Codec works. However I believe that the complete path record is burdensome for the person who owns his domain.
This information isn't available in help.
jpegLS.exe -encodepnm "\users\...\Downloads\hevc\image3\image_21447_24bit.ppm" "\users\...\Downloads\hevc\image3\image.jls"

If you change the current working directory, then just the short file names should also work.
/usr/bin/jpegLS -encodepnm "image.ppm" "image.jls"

charlstest is just a simple test application to demonstrate how to use the actual codec.
There is a request (#89) to provide a more powerful command line application.