/usr/include/rem/rem_g711.h is in librem-dev 0.5.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | /**
* @file rem_g711.h Interface to G.711 codec
*
* Copyright (C) 2010 Creytiv.com
*/
extern const uint8_t g711_l2u[4096];
extern const uint8_t g711_l2A[2048];
extern const int16_t g711_u2l[256];
extern const int16_t g711_A2l[256];
/**
* Encode one 16-bit PCM sample to U-law format
*
* @param l Signed PCM sample
*
* @return U-law byte
*/
static inline uint8_t g711_pcm2ulaw(int16_t l)
{
const uint8_t mask = (l < 0) ? 0x7f : 0xff;
if (l < 0)
l = -l;
if (l < 4)
return 0xff & mask;
l -= 4;
l >>= 3;
return g711_l2u[l] & mask;
}
/**
* Encode one 16-bit PCM sample to A-law format
*
* @param l Signed PCM sample
*
* @return A-law byte
*/
static inline uint8_t g711_pcm2alaw(int16_t l)
{
const uint8_t mask = (l < 0) ? 0x7f : 0xff;
if (l < 0)
l = -l;
l >>= 4;
return g711_l2A[l] & mask;
}
/**
* Decode one U-law sample to 16-bit PCM sample
*
* @param u U-law byte
*
* @return Signed PCM sample
*/
static inline int16_t g711_ulaw2pcm(uint8_t u)
{
return g711_u2l[u];
}
/**
* Decode one A-law sample to 16-bit PCM sample
*
* @param A A-law byte
*
* @return Signed PCM sample
*/
static inline int16_t g711_alaw2pcm(uint8_t a)
{
return g711_A2l[a];
}
|