Changeset e4f4f59ee368c4dc1c7ed6e344945fae36e63ef2
- Timestamp:
- 07/03/05 14:05:06 (4 years ago)
- git-parent:
- Files:
-
- configure.ac (modified) (1 diff)
- modules/codec/adpcm.c (modified) (10 diffs)
- modules/demux/Modules.am (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
configure.ac
r509b4b9 re4f4f59 984 984 VLC_ADD_PLUGINS([id3 playlist export sgimb m3u xtag]) 985 985 VLC_ADD_PLUGINS([i420_rgb rawvideo blend scale image logo]) 986 VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au ])986 VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au xa]) 987 987 VLC_ADD_PLUGINS([access_directory access_file access_udp access_tcp]) 988 988 VLC_ADD_PLUGINS([access_http access_mms access_ftp ipv4]) modules/codec/adpcm.c
ra90a19a re4f4f59 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 8 * Remi Denis-Courmont <courmisch # via.ecp.fr> 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify … … 55 56 ADPCM_MS, 56 57 ADPCM_DK3, 57 ADPCM_DK4 58 ADPCM_DK4, 59 ADPCM_EA 58 60 }; 59 61 … … 73 75 static void DecodeAdpcmDk4 ( decoder_t *, int16_t *, uint8_t * ); 74 76 static void DecodeAdpcmDk3 ( decoder_t *, int16_t *, uint8_t * ); 77 static void DecodeAdpcmEA ( decoder_t *, int16_t *, uint8_t * ); 75 78 76 79 static int pi_channels_maps[6] = … … 136 139 case VLC_FOURCC('m','s',0x00,0x61): /* Duck DK4 ADPCM */ 137 140 case VLC_FOURCC('m','s',0x00,0x62): /* Duck DK3 ADPCM */ 141 case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */ 138 142 break; 139 143 default: 140 144 return VLC_EGENERIC; 145 } 146 147 if( p_dec->fmt_in.audio.i_channels <= 0 || 148 p_dec->fmt_in.audio.i_channels > 5 ) 149 { 150 msg_Err( p_dec, "bad channels count(1-5)" ); 151 return VLC_EGENERIC; 152 } 153 154 if( p_dec->fmt_in.audio.i_rate <= 0 ) 155 { 156 msg_Err( p_dec, "bad samplerate" ); 157 return VLC_EGENERIC; 141 158 } 142 159 … … 146 163 { 147 164 msg_Err( p_dec, "out of memory" ); 148 return VLC_EGENERIC; 149 } 150 151 if( p_dec->fmt_in.audio.i_channels <= 0 || 152 p_dec->fmt_in.audio.i_channels > 5 ) 153 { 154 msg_Err( p_dec, "bad channels count(1-5)" ); 155 return VLC_EGENERIC; 156 } 157 158 if( p_dec->fmt_in.audio.i_rate <= 0 ) 159 { 160 msg_Err( p_dec, "bad samplerate" ); 161 return VLC_EGENERIC; 165 return VLC_ENOMEM; 162 166 } 163 167 … … 178 182 case VLC_FOURCC('m','s',0x00,0x62): /* Duck DK3 ADPCM */ 179 183 p_sys->codec = ADPCM_DK3; 184 break; 185 case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */ 186 p_sys->codec = ADPCM_EA; 187 p_dec->fmt_in.p_extra = calloc( 2 * p_dec->fmt_in.audio.i_channels, 188 sizeof( int16_t ) ); 189 if( p_dec->fmt_in.p_extra == NULL ) 190 { 191 free( p_sys ); 192 return VLC_ENOMEM; 193 } 180 194 break; 181 195 } … … 217 231 p_sys->i_samplesperblock = ( 4 * ( p_sys->i_block - 16 ) + 2 )/ 3; 218 232 break; 233 case ADPCM_EA: 234 p_sys->i_samplesperblock = 235 2 * (p_sys->i_block - p_dec->fmt_in.audio.i_channels) / 236 p_dec->fmt_in.audio.i_channels; 219 237 } 220 238 … … 304 322 p_block->p_buffer ); 305 323 break; 324 case ADPCM_EA: 325 DecodeAdpcmEA( p_dec, (int16_t*)p_out->p_buffer, 326 p_block->p_buffer ); 306 327 default: 307 328 break; … … 325 346 decoder_sys_t *p_sys = p_dec->p_sys; 326 347 348 if( p_sys->codec == ADPCM_EA ) 349 free( p_dec->fmt_in.p_extra ); 327 350 free( p_sys ); 328 351 } … … 694 717 } 695 718 } 719 720 721 /* 722 * EA ADPCM 723 */ 724 #define MAX_CHAN 5 725 static void DecodeAdpcmEA( decoder_t *p_dec, int16_t *p_sample, 726 uint8_t *p_buffer ) 727 { 728 static const uint32_t EATable[]= 729 { 730 0x00000000, 0x000000F0, 0x000001CC, 0x00000188, 731 0x00000000, 0x00000000, 0xFFFFFF30, 0xFFFFFF24, 732 0x00000000, 0x00000001, 0x00000003, 0x00000004, 733 0x00000007, 0x00000008, 0x0000000A, 0x0000000B, 734 0x00000000, 0xFFFFFFFF, 0xFFFFFFFD, 0xFFFFFFFC 735 }; 736 decoder_sys_t *p_sys = p_dec->p_sys; 737 uint8_t *p_end; 738 unsigned i_channels, c; 739 int16_t *prev, *cur; 740 int32_t c1[MAX_CHAN], c2[MAX_CHAN]; 741 int8_t d[MAX_CHAN]; 742 743 i_channels = p_dec->fmt_in.audio.i_channels; 744 p_end = &p_buffer[p_sys->i_block]; 745 746 prev = (int16_t *)p_dec->fmt_in.p_extra; 747 cur = prev + i_channels; 748 749 for (c = 0; c < i_channels; c++) 750 { 751 uint8_t input; 752 753 input = p_buffer[c]; 754 c1[c] = EATable[input >> 4]; 755 c2[c] = EATable[(input >> 4) + 4]; 756 d[c] = (input & 0xf) + 8; 757 } 758 759 for( p_buffer += i_channels; p_buffer < p_end ; p_buffer += i_channels) 760 { 761 for (c = 0; c < i_channels; c++) 762 { 763 int32_t spl; 764 765 spl = (p_buffer[c] >> 4) & 0xf; 766 spl = (spl << 0x1c) >> d[c]; 767 spl = (spl + cur[c] * c1[c] + prev[c] * c2[c] + 0x80) >> 8; 768 CLAMP( spl, -32768, 32767 ); 769 prev[c] = cur[c]; 770 cur[c] = spl; 771 772 *(p_sample++) = spl; 773 } 774 775 for (c = 0; c < i_channels; c++) 776 { 777 int32_t spl; 778 779 spl = p_buffer[c] & 0xf; 780 spl = (spl << 0x1c) >> d[c]; 781 spl = (spl + cur[c] * c1[c] + prev[c] * c2[c] + 0x80) >> 8; 782 CLAMP( spl, -32768, 32767 ); 783 prev[c] = cur[c]; 784 cur[c] = spl; 785 786 *(p_sample++) = spl; 787 } 788 } 789 } modules/demux/Modules.am
r0acb799 re4f4f59 22 22 SOURCES_subtitle = subtitle.c 23 23 SOURCES_vobsub = vobsub.c 24 SOURCES_xa = xa.c
