Cyan4973 / FiniteStateEntropy

New generation entropy codecs : Finite State Entropy and Huff0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FSEU16_MAX_MEMORY_USAGE is defined at fseU16.c not a fseU16.h

Chemical118 opened this issue · comments

When I test the FSE-16bit version, I found some issue about the FSE_MAX_MEMORY_USAGE.
This is the code I tested.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "fseU16.h"

int main() {
    // Change the FSEU16_MAX_SYMBOL_VALUE to 4095
    int n = 10000, max = 4095;
    uint16_t *ip = malloc(sizeof(uint16_t) * n);
    uint8_t *op = malloc(sizeof(uint8_t) * 2 * n);

    for (int i=0; i<n; i++){
        ip[i] = i % max;
    }

    size_t compress = FSE_compressU16(op, 2 * n, ip, n, max, 0);
    printf("Code : %zd\n", compress);

    free(ip);
    free(op);
}

I include fseU16.h to use 16bit version, so I expected FSE_MAX_MEMORY_USAGE is 15.
However, FSEU16_MAX_MEMORY_USAGE is defined on this line at fseU16.c, so at this code FSE_MAX_MEMORY_USAGE is 14 by fse.h.

Before I make PR about this, I would like to ask if this is intended.