Changeset 4758:891fa8f3a5cd in roaraudio


Ignore:
Timestamp:
02/06/11 02:40:52 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

started with autlaw support, still broken

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroardsp/libroardsp.h

    r4708 r4758  
    7474int roardsp_conv_pcm162alaw (char * out, int16_t * in, size_t len); 
    7575 
     76int roardsp_conv_autlaw2pcm32 (int32_t * out, int16_t * in, size_t len); 
     77int roardsp_conv_pcm322autlaw (int16_t * out, int32_t * in, size_t len); 
     78 
    7679int roardsp_conv_mulaw2pcm16 (int16_t * out, char * in, size_t len); 
    7780int roardsp_conv_pcm162mulaw (char * out, int16_t * in, size_t len); 
  • libroardsp/alaw.c

    r4708 r4758  
    820820} 
    821821 
     822int roardsp_conv_autlaw2pcm32 (int32_t * out, int16_t * in, size_t len) { 
     823#ifdef ROAR_SUPPORT_ALAW 
     824 uint16_t inp; 
     825 register unsigned char alaw, extra; 
     826 register int bits; 
     827 uint32_t op; 
     828 int i; 
     829 
     830 for (i = len-1; i > -1; i--) { 
     831  inp = ROAR_NET2HOST16(in[i]); 
     832  alaw = (inp & 0xFF00) >> 8; 
     833  extra = inp & 0x00FF; 
     834 
     835//  printf("Balaw=%u\n", (unsigned)alaw); 
     836 
     837  bits = (alaw & 0x70) >> 4; 
     838  if ( bits == 0 ) 
     839   bits = 1; 
     840 
     841  op = _roardsp_alaw2pcm16[(int)alaw] << 16; 
     842//  out[i] |= extra << (11 + bits); 
     843  out[i]  = op; 
     844 } 
     845 
     846 return 0; 
     847#else 
     848 return -1; 
     849#endif 
     850} 
     851 
     852int roardsp_conv_pcm322autlaw (int16_t * out, int32_t * in, size_t len) { 
     853#ifdef ROAR_SUPPORT_ALAW_RW 
     854 register unsigned int i; 
     855 register uint16_t upper, r; 
     856 register unsigned char alaw; 
     857 register int bits; 
     858 
     859 for (i = 0; i < len; i++) { 
     860  upper = (uint32_t)((in[i] & 0xFFFF0000L) >> 16); 
     861  alaw = _roardsp_pcm132alaw[(upper + 32768) >> 3]; 
     862//  printf("Aalaw=%u\n", (unsigned)alaw); 
     863  bits = (alaw & 0x70) >> 4; 
     864  if ( bits == 0 ) 
     865   bits = 1; 
     866 
     867  r  = ((in[i] << (6 + bits)) & 0xFF000000) >> 24; 
     868  r |= alaw << 8; 
     869 
     870  out[i] = ROAR_HOST2NET16(r); 
     871 } 
     872 
     873 return 0; 
     874#else 
     875 return -1; 
     876#endif 
     877} 
    822878 
    823879//ll 
Note: See TracChangeset for help on using the changeset viewer.