ilyakurdyukov / jpeg-quantsmooth

JPEG artifacts removal based on quantization coefficients.
GNU Lesser General Public License v2.1
254 stars 21 forks source link

Current Windows builds don't seem to output any images (wrong CPU features detection) #16

Closed Sauerstoffdioxid closed 4 years ago

Sauerstoffdioxid commented 4 years ago

Just stumbled across this today, and it looks like a really neat program. However, I can't get the current Windows builds to produce any output file. The latest working version seems to be 2020-03-06 afaict. I'm on Windows 10 64bit, version 10.0.19041.264, if that matters. Here's the full console out put if that helps

jpegqs64.exe --verbose 1 -q 4 0008.jpg 0008_o.jpg

Compiled with libjpeg version 62
Version string: 6b  27-Mar-1998
Copyright (C) 1998, Thomas G. Lane

component[0] : table 0, samp 1x1
component[1] : table 1, samp 1x1
component[2] : table 1, samp 1x1
quant[0]:
0003 0003 0003 0004 0005 0007 000b 0011
0003 0003 0004 0005 0007 0008 000b 000f
0003 0004 0005 0006 0009 000c 0012 001b
0004 0005 0006 0008 000b 000f 0015 001f
0005 0007 0009 000b 000e 0013 001a 0026
0007 0008 000c 000f 0013 0019 0022 0030
000b 000b 0012 0015 001a 0022 002d 003e
0011 000f 001b 001f 0026 0030 003e 0054
quant[1]:
0003 0003 0003 0004 0005 0007 000b 0011
0003 0003 0004 0005 0007 0008 000b 000f
0003 0004 0005 0006 0009 000c 0012 001b
0004 0005 0006 0008 000b 000f 0015 001f
0005 0007 0009 000b 000e 0013 001a 0026
0007 0008 000c 000f 0013 0019 0022 0030
000b 000b 0012 0015 001a 0022 002d 003e
0011 000f 001b 001f 0026 0030 003e 0054
ilyakurdyukov commented 4 years ago

On how CPU did you run it? It looks like I added support for AVX512 after 2020-03-06, but this is only tested on an emulator under linux (Intel SDE).

Try the "--info 16" option, If you see the message "SIMD type: 4" - then this is running with AVX512 vectorization. You can specify the "--cpu 3" option (curently undocumented) to force the use of AVX2.

zvezdochiot commented 4 years ago

:information_source: This is the conclusion of the quantization tables; the process of dequantization itself does not even begin. Indication of the process itself:

...
0011 000f 001b 001f 0026 0030 003e 0054
component[0] : size W0xH0
component[1] : size W1xH1
component[2] : size W2xH2
quantsmooth = XXXX.XXXms
Sauerstoffdioxid commented 4 years ago

It says SIMD type: 3 when run with --info 16. So I guess it uses AVX2? In any case, I'm fairly certain my CPU doesn't support that either (older Intel Core). However, trying with --cpu 2 it does work.

Thank you for the quick response 👍

ilyakurdyukov commented 4 years ago

This is interesting, it looks like my CPU features detection code is not working correctly for your CPU (or you have some early or development model). "--cpu 2" forces to use SSE2. Changes from 2020-03-06 in the detection code are that FMA detection is disabled. This is because I thought AVX2 processors always come with FMA support. Also due to a VirtualBox bug, it clears the FMA flag for the VM, even if the host processor has this flag.

ilyakurdyukov commented 4 years ago

It would be helpful if you sent me a screenshot of what the CPU-Z tool tells about your CPU.

And about VirtualBox... VirtualBox developers have ignored this problem for years.

https://www.virtualbox.org/ticket/15471 https://forums.virtualbox.org/viewtopic.php?f=6&t=84213

I'm testing windows version in a VirtualBox VM, and need to deal with this.

Sauerstoffdioxid commented 4 years ago

screenshot

ilyakurdyukov commented 4 years ago

Thanks, the FMA bit is not needed here because there is no AVX2 support, I don't understand why my code works incorrectly for this case.

ilyakurdyukov commented 4 years ago

Found a bug, so I will make a new release with a fix and document that --cpu switch.

Sauerstoffdioxid commented 4 years ago

Thank you for the quick fix! The new version fixed the issue.