Top > zlib

Compression

実装比較

compress / uncompress

compress

compsize = ~; // 圧縮後のサイズより大きな値
compbuff = malloc(compsize);
int result = compress(compbuff, &compsize, origbuff, origsize);
if (result != Z_OK) {
    if (result == Z_MEM_ERROR) {
        fprintf(stderr, "compress: Z_MEM_ERROR: can't malloc\n");
    } else if (result == Z_BUF_ERROR) {
        fprintf(stderr, "compress: Z_BUF_ERROR: not enough buff size\n");
    }
    return 1; // FAILURE
}

uncompress

origsize = ~;  // 伸張後のサイズより大きな値
origbuff = malloc(origsize);
int result = uncompress(origbuff, &origsize, compbuff, compsize);
if (result != Z_OK) {
    if (result == Z_MEM_ERROR) {
        fprintf(stderr, "uncompress: Z_MEM_ERROR: can't malloc\n");
    } else if (result == Z_BUF_ERROR) {
        fprintf(stderr, "uncompress: Z_BUF_ERROR: not enough buff size\n");
    }
    return 1; // FAILURE
}

inflate / defrate

(予定)

発表スライド

未圧縮形式と固定ハフマン

参考

関連

  • LZFSE (Apple の圧縮技術)

Reload   Diff   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes
Last-modified: Fri, 14 Apr 2023 22:49:07 JST (378d)