/* Retunes the index of a suitable lookup table for a given delta  */
static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status, unsigned int delta)
/* Retunes the index of a suitable lookup table for a given delta  */
static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status, unsigned int delta)
{
    unsigned int i = av_clip(delta, 0, LUT_BUFF - 1);
    lut += (i * LUT_SIZE) << 4;
    if (lut_status[i] != delta)
        bgmc_lut_fillp(lut, &lut_status[i], delta);
    return lut;
}