Skip to content
Snippets Groups Projects
  • Vojtech Moravec's avatar
    bf10676a
    Pass InputData object to stream decompression. · bf10676a
    Vojtech Moravec authored
    Stream compression is in its nature compressing different data every time. That's why we shouldn't work with cached instance options which includes InputData object.
    
    This was a problem when multiple threads tried to compress different data, but were overriding each other InputData info.
    
    Because of this we changed compressVoxels() signature to access InputData.
    bf10676a
    History
    Pass InputData object to stream decompression.
    Vojtech Moravec authored
    Stream compression is in its nature compressing different data every time. That's why we shouldn't work with cached instance options which includes InputData object.
    
    This was a problem when multiple threads tried to compress different data, but were overriding each other InputData info.
    
    Because of this we changed compressVoxels() signature to access InputData.
IImageCompressor.java 1.62 KiB
package azgracompress.compression;

import azgracompress.cache.ICacheFile;
import azgracompress.compression.exception.ImageCompressionException;
import azgracompress.data.V3i;
import azgracompress.io.InputData;

import java.io.DataOutputStream;

public interface IImageCompressor extends IListenable {

    /**
     * Compress the image planes.
     *
     * @param compressStream Compressed data stream.
     * @return Size of compressed chunks.
     * @throws ImageCompressionException when compression fails.
     */
    long[] compress(DataOutputStream compressStream) throws ImageCompressionException;


    /**
     * Compress image planes in stream mode. QCMP header is not written to the stream only compressed image data without any additional
     * META information.
     *
     * @param compressStream Compressed data stream.
     * @param inputData      Chunk input data.
     * @return Size of compressed chunks.
     * @throws ImageCompressionException when compression fails
     */
    long[] compressStreamChunk(final DataOutputStream compressStream,
                               final InputData inputData) throws ImageCompressionException;

    /**
     * Train codebook from selected frames and save the learned codebook to cache file.
     *
     * @throws ImageCompressionException when training or saving fails.
     */
    void trainAndSaveCodebook() throws ImageCompressionException;

    /**
     * Preload compressor codebook and Huffman tree for stream compressor from provided cache file.
     *
     * @param codebookCacheFile Codebook cache file.
     */
    void preloadGlobalCodebook(final ICacheFile codebookCacheFile);
}