Open optyfr opened 4 years ago
Also note that this happens the same with 16.02-2.01 and 9.20-2.00 beta
Can you try this CMD ?( show technical information) 7z l -slt archivename
the difference between the two following is setSolid, setLevel is 9 for both ultra.txt => LZMA:22 (9 blocks) solid+ultra.txt => LZMA2:48m (1 block)
the difference between the two is setSolid, setLevel is 1 for both fastest.txt => LZMA2:22 (9 blocks) solid+fastest.txt => LZMA2:24 (1 block)
private void SetOptions(final Object iout) throws SevenZipException
{
switch(format)
{
case SEVEN_ZIP:
if(iout instanceof IOutFeatureSetSolid)
{
System.out.println("Solid : "+session.getUser().getSettings().getProperty(SettingsEnum.sevenzip_solid, true));
((IOutFeatureSetSolid) iout).setSolid(session.getUser().getSettings().getProperty(SettingsEnum.sevenzip_solid, true)); //$NON-NLS-1$
}
if(iout instanceof IOutFeatureSetLevel)
{
System.out.println("Level : "+SevenZipOptions.valueOf(session.getUser().getSettings().getProperty(SettingsEnum.sevenzip_level, SevenZipOptions.NORMAL.toString())).getLevel());
((IOutFeatureSetLevel) iout).setLevel(SevenZipOptions.valueOf(session.getUser().getSettings().getProperty(SettingsEnum.sevenzip_level, SevenZipOptions.NORMAL.toString())).getLevel()); //$NON-NLS-1$
}
if(iout instanceof IOutFeatureSetMultithreading)
((IOutFeatureSetMultithreading) iout).setThreadCount(session.getUser().getSettings().getProperty(SettingsEnum.sevenzip_threads, -1)); //$NON-NLS-1$
break;
case ZIP:
if(iout instanceof IOutFeatureSetLevel)
((IOutFeatureSetLevel) iout).setLevel(ZipOptions.valueOf(session.getUser().getSettings().getProperty(SettingsEnum.zip_level, ZipOptions.NORMAL.toString())).getLevel()); //$NON-NLS-1$
if(iout instanceof IOutFeatureSetMultithreading)
((IOutFeatureSetMultithreading) iout).setThreadCount(session.getUser().getSettings().getProperty(SettingsEnum.zip_threads, -1)); //$NON-NLS-1$
default:
break;
}
}
This is the method used to set options for compression, the println showed the right settings used for tests...
btw, don't try to setThreadCount other than -1 or it won't compress to the desired level at all... even with solid mode!
also tried to tweak solid mode... and finally the only combination that take care of compression level settings is setSolid(true) without any other options from IOutFeatureSetSolid, I mean that setSolidFiles other than -1 (for example 1 or 2) with setSolid(true) will also break the compression level...
@borisbrodski This is really becoming a huge deal breaker. setThreadCount() and setSolidSize() both ENFORCE level 9 Ultra compression and disregards whatever level we set via setLevel(). Please prioritize this issue. Can help test this thoroughly on Windows and Android devices.
optyfr, were you able to use any workaround for this issue?
When archive is set to solid mode, compression level is respected... but when solid mode is not set, the compression level is not taken into account, it seems to choose a compression method according some sizing rules : whatever the level chosen, the final compression method is always the same for the same archive, but change from one archive to another for the same level, so that : On a 2M archive, il will be LZMA2:20 whatever the level On a 5M archive, il will be LZMA2:21 whatever the level On a 10M archive, it will be LZMA2:22 whatever the level On a 95M archive, it will be LZMA2:24 whatever the level