#ifndef dm_sample_H #define dm_sample_H /* Encoded of numerical signal samples */ /* Last edited on 2006-12-24 22:43:58 by stolfi */ #define dm_sample_H_COPYRIGHT \ "Copyright © 2006 by the State University of Campinas (UNICAMP)" #include #include /* This interface defines the type {dm_sample_t}, an encoded sample from a real-valued signal. The numbers are encoded as signed bytes in the range {-127..+127}, using a non-linear encoding. The encoding is designed to map a normal-distributed variable to a uniformly distributed code in that range. */ typedef signed char dm_sample_t; /* One coordinate of a sample, packed as a character. */ #define dm_sample_VALID_MIN (-127) #define dm_sample_VALID_MAX (+127) /* Minimum and maximum valid values of a {dm_sample_t}. */ double dm_sample_decode(dm_sample_t ev); dm_sample_t dm_sample_encode(double dv); /* Converts between unpacked ({double}) and packed ({dm_sample_t}) representations of sample values. */ double dm_sample_diffsq(dm_sample_t xs, dm_sample_t ys); /* Returns the abs difference squared between the samples, defined as {(dm_sample_decode(xs) - dm_sample_decode(ys))^2}. */ vec_typedef(dm_sample_vec_t,dm_sample_vec,dm_sample_t); /* Vector of {dm_sample_t}. */ #endif