schroutils

schroutils

Synopsis

typedef             schro_bool;
#define             SCHRO_GET                           (ptr,
                                                         offset,
                                                         type)
#define             OFFSET                              (ptr,
                                                         offset)
#define             SCHRO_INTERNAL
#define             ARRAY_SIZE                          (x)
#define             MIN                                 (a,
                                                         b)
#define             MAX                                 (a,
                                                         b)
#define             CLAMP                               (x,
                                                         a,
                                                         b)
#define             DIVIDE_ROUND_UP                     (a,
                                                         b)
#define             ROUND_UP_SHIFT                      (x,
                                                         y)
#define             ROUND_UP_POW2                       (x,
                                                         y)
#define             ROUND_UP_2                          (x)
#define             ROUND_UP_4                          (x)
#define             ROUND_UP_8                          (x)
#define             ROUND_UP_64                         (x)
#define             ROUND_SHIFT                         (x,
                                                         y)
#define             NEED_CLAMP                          (x,
                                                         y,
                                                         a,
                                                         b)
#define             schro_divide                        (a,
                                                         b)
double              schro_utils_entropy                 (double a,
                                                         double total);
int                 schro_utils_multiplier_to_quant_index
                                                        (double x);
double              schro_utils_probability_to_entropy  (double x);
void                schro_utils_reduce_fraction         (int *n,
                                                         int *d);
int                 schro_dequantise                    (int q,
                                                         int quant_factor,
                                                         int quant_offset);
int                 schro_quantise                      (int value,
                                                         int quant_factor,
                                                         int quant_offset);
void                schro_dequantise_s16                (int16_t *dest,
                                                         int16_t *src,
                                                         int quant_factor,
                                                         int quant_offset,
                                                         int n);
void                schro_quantise_s16                  (int16_t *dest,
                                                         int16_t *src,
                                                         int quant_factor,
                                                         int quant_offset,
                                                         int n);
void *              schro_malloc                        (int size);
void *              schro_malloc0                       (int size);
void *              schro_realloc                       (void *ptr,
                                                         int size);
void                schro_free                          (void *ptr);
double              schro_utils_get_time                (void);
int                 muldiv64                            (int a,
                                                         int b,
                                                         int c);

Description

Details

schro_bool

typedef unsigned int schro_bool;


SCHRO_GET()

#define SCHRO_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)) )


OFFSET()

#define OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset)))


SCHRO_INTERNAL

#define SCHRO_INTERNAL __attribute__ ((visibility ("internal")))


ARRAY_SIZE()

#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))


MIN()

#define MIN(a,b) ((a)<(b) ? (a) : (b))


MAX()

#define MAX(a,b) ((a)>(b) ? (a) : (b))


CLAMP()

#define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))


DIVIDE_ROUND_UP()

#define DIVIDE_ROUND_UP(a,b) (((a) + (b) - 1)/(b))


ROUND_UP_SHIFT()

#define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y))


ROUND_UP_POW2()

#define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y)))


ROUND_UP_2()

#define ROUND_UP_2(x) ROUND_UP_POW2(x,1)


ROUND_UP_4()

#define ROUND_UP_4(x) ROUND_UP_POW2(x,2)


ROUND_UP_8()

#define ROUND_UP_8(x) ROUND_UP_POW2(x,3)


ROUND_UP_64()

#define ROUND_UP_64(x) ROUND_UP_POW2(x,6)


ROUND_SHIFT()

#define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y))


NEED_CLAMP()

#define NEED_CLAMP(x,y,a,b) ((x) < (a) || (y) > (b))


schro_divide()

#define schro_divide(a,b) (((a)<0)?(((a) - (b) + 1)/(b)):((a)/(b)))


schro_utils_entropy ()

double              schro_utils_entropy                 (double a,
                                                         double total);


schro_utils_multiplier_to_quant_index ()

int                 schro_utils_multiplier_to_quant_index
                                                        (double x);


schro_utils_probability_to_entropy ()

double              schro_utils_probability_to_entropy  (double x);


schro_utils_reduce_fraction ()

void                schro_utils_reduce_fraction         (int *n,
                                                         int *d);


schro_dequantise ()

int                 schro_dequantise                    (int q,
                                                         int quant_factor,
                                                         int quant_offset);


schro_quantise ()

int                 schro_quantise                      (int value,
                                                         int quant_factor,
                                                         int quant_offset);


schro_dequantise_s16 ()

void                schro_dequantise_s16                (int16_t *dest,
                                                         int16_t *src,
                                                         int quant_factor,
                                                         int quant_offset,
                                                         int n);


schro_quantise_s16 ()

void                schro_quantise_s16                  (int16_t *dest,
                                                         int16_t *src,
                                                         int quant_factor,
                                                         int quant_offset,
                                                         int n);


schro_malloc ()

void *              schro_malloc                        (int size);


schro_malloc0 ()

void *              schro_malloc0                       (int size);


schro_realloc ()

void *              schro_realloc                       (void *ptr,
                                                         int size);


schro_free ()

void                schro_free                          (void *ptr);


schro_utils_get_time ()

double              schro_utils_get_time                (void);


muldiv64 ()

int                 muldiv64                            (int a,
                                                         int b,
                                                         int c);