Unified · Split
| @@ -42,7 +42,7 @@ RSC=rc.exe · 41 unmodified lines | ||
| 42 | 42 | # PROP Target_Dir "" |
| 43 | 43 | MTL=midl.exe |
| 44 | 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c |
| 45 | −# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_FILE_CALLBACKS" /YX /FD /c | |
| 45 | +# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_FILE_CALLBACKS" /YX /FD /c | |
| 46 | 46 | # ADD BASE RSC /l 0x413 /d "NDEBUG" |
| 47 | 47 | # ADD RSC /l 0x413 /d "NDEBUG" |
| 48 | 48 | BSC32=bscmake.exe |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: main.c,v 1.29 2003/03/05 14:24:50 menno Exp $ | |
| 19 | +** $Id: main.c,v 1.30 2003/04/02 20:07:44 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #ifdef _WIN32 |
| @@ -135,10 +135,11 @@ void usage(void) · 112 unmodified lines | ||
| 135 | 135 | fprintf(stderr, " 2: 24 bit PCM data.\n"); |
| 136 | 136 | fprintf(stderr, " 3: 32 bit PCM data.\n"); |
| 137 | 137 | fprintf(stderr, " 4: 32 bit floating point data.\n"); |
| 138 | − fprintf(stderr, " 5: 16 bit PCM data (dithered).\n"); | |
| 139 | − fprintf(stderr, " 6: 16 bit PCM data (dithered with LIGHT noise shaping).\n"); | |
| 140 | − fprintf(stderr, " 7: 16 bit PCM data (dithered with MEDIUM noise shaping).\n"); | |
| 141 | − fprintf(stderr, " 8: 16 bit PCM data (dithered with HEAVY noise shaping).\n"); | |
| 138 | + fprintf(stderr, " 5: 64 bit floating point data.\n"); | |
| 139 | + fprintf(stderr, " 6: 16 bit PCM data (dithered).\n"); | |
| 140 | + fprintf(stderr, " 7: 16 bit PCM data (dithered with LIGHT noise shaping).\n"); | |
| 141 | + fprintf(stderr, " 8: 16 bit PCM data (dithered with MEDIUM noise shaping).\n"); | |
| 142 | + fprintf(stderr, " 9: 16 bit PCM data (dithered with HEAVY noise shaping).\n"); | |
| 142 | 143 | fprintf(stderr, " -s X Force the samplerate to X (for RAW files).\n"); |
| 143 | 144 | fprintf(stderr, " -l X Set object type. Supported object types:\n"); |
| 144 | 145 | fprintf(stderr, " 0: Main object type.\n"); |
| @@ -583,7 +584,7 @@ int main(int argc, char *argv[]) · 438 unmodified lines | ||
| 583 | 584 | outputFormat = FAAD_FMT_16BIT; /* just use default */ |
| 584 | 585 | } else { |
| 585 | 586 | outputFormat = atoi(dr); |
| 586 | − if ((outputFormat < 1) || (outputFormat > 8)) | |
| 587 | + if ((outputFormat < 1) || (outputFormat > 9)) | |
| 587 | 588 | showHelp = 1; |
| 588 | 589 | } |
| 589 | 590 | } |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: faad.h,v 1.20 2003/03/05 14:24:52 menno Exp $ | |
| 19 | +** $Id: faad.h,v 1.21 2003/04/02 20:07:45 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #ifndef __AACDEC_H__ |
| @@ -55,15 +55,16 @@ extern "C" { · 32 unmodified lines | ||
| 55 | 55 | #define ADTS 2 |
| 56 | 56 | |
| 57 | 57 | /* library output formats */ |
| 58 | −#define FAAD_FMT_16BIT 1 | |
| 59 | −#define FAAD_FMT_24BIT 2 | |
| 60 | −#define FAAD_FMT_32BIT 3 | |
| 61 | −#define FAAD_FMT_FLOAT 4 | |
| 62 | −#define FAAD_FMT_16BIT_DITHER 5 | |
| 63 | −#define FAAD_FMT_16BIT_L_SHAPE 6 | |
| 64 | −#define FAAD_FMT_16BIT_M_SHAPE 7 | |
| 65 | −#define FAAD_FMT_16BIT_H_SHAPE 8 | |
| 66 | − | |
| 58 | +#define FAAD_FMT_16BIT 1 | |
| 59 | +#define FAAD_FMT_24BIT 2 | |
| 60 | +#define FAAD_FMT_32BIT 3 | |
| 61 | +#define FAAD_FMT_FLOAT 4 | |
| 62 | +#define FAAD_FMT_DOUBLE 5 | |
| 63 | +#define FAAD_FMT_16BIT_DITHER 6 | |
| 64 | +#define FAAD_FMT_16BIT_L_SHAPE 7 | |
| 65 | +#define FAAD_FMT_16BIT_M_SHAPE 8 | |
| 66 | +#define FAAD_FMT_16BIT_H_SHAPE 9 | |
| 67 | + | |
| 67 | 68 | /* Capabilities */ |
| 68 | 69 | #define LC_DEC_CAP (1<<0) |
| 69 | 70 | #define MAIN_DEC_CAP (1<<1) |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: decoder.c,v 1.53 2003/03/05 14:24:53 menno Exp $ | |
| 19 | +** $Id: decoder.c,v 1.54 2003/04/02 20:07:45 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #include "common.h" |
| @@ -225,8 +225,8 @@ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer, · 202 unmodified lines | ||
| 225 | 225 | return -1; |
| 226 | 226 | |
| 227 | 227 | #ifndef FIXED_POINT |
| 228 | − if (hDecoder->config.outputFormat >= 5) | |
| 229 | − Init_Dither(16, hDecoder->config.outputFormat - 5); | |
| 228 | + if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST) | |
| 229 | + Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST); | |
| 230 | 230 | #endif |
| 231 | 231 | |
| 232 | 232 | return bits; |
| @@ -288,8 +288,8 @@ int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer, · 55 unmodified lines | ||
| 288 | 288 | #endif |
| 289 | 289 | |
| 290 | 290 | #ifndef FIXED_POINT |
| 291 | − if (hDecoder->config.outputFormat >= 5) | |
| 292 | − Init_Dither(16, hDecoder->config.outputFormat - 5); | |
| 291 | + if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST) | |
| 292 | + Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST); | |
| 293 | 293 | #endif |
| 294 | 294 | |
| 295 | 295 | return 0; |
| @@ -314,8 +314,8 @@ int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate, · 18 unmodified lines | ||
| 314 | 314 | hDecoder->fb = filter_bank_init(hDecoder->frameLength); |
| 315 | 315 | |
| 316 | 316 | #ifndef FIXED_POINT |
| 317 | − if (hDecoder->config.outputFormat >= 5) | |
| 318 | − Init_Dither(16, hDecoder->config.outputFormat - 5); | |
| 317 | + if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST) | |
| 318 | + Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST); | |
| 319 | 319 | #endif |
| 320 | 320 | |
| 321 | 321 | return 0; |
| @@ -481,7 +481,12 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, · 159 unmodified lines | ||
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | if (hDecoder->sample_buffer == NULL) |
| 484 | − hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(real_t)); | |
| 484 | + { | |
| 485 | + if (hDecoder->config.outputFormat == FAAD_FMT_DOUBLE) | |
| 486 | + hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(double)); | |
| 487 | + else | |
| 488 | + hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(real_t)); | |
| 489 | + } | |
| 485 | 490 | |
| 486 | 491 | sample_buffer = hDecoder->sample_buffer; |
| 487 | 492 | |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: decoder.h,v 1.21 2003/03/05 14:24:55 menno Exp $ | |
| 19 | +** $Id: decoder.h,v 1.22 2003/04/02 20:07:46 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #ifndef __DECODER_H__ |
| @@ -45,14 +45,18 @@ extern "C" { · 22 unmodified lines | ||
| 45 | 45 | #include "ic_predict.h" |
| 46 | 46 | |
| 47 | 47 | |
| 48 | −#define FAAD_FMT_16BIT 1 | |
| 49 | −#define FAAD_FMT_24BIT 2 | |
| 50 | −#define FAAD_FMT_32BIT 3 | |
| 51 | −#define FAAD_FMT_FLOAT 4 | |
| 52 | −#define FAAD_FMT_16BIT_DITHER 5 | |
| 53 | −#define FAAD_FMT_16BIT_L_SHAPE 6 | |
| 54 | −#define FAAD_FMT_16BIT_M_SHAPE 7 | |
| 55 | −#define FAAD_FMT_16BIT_H_SHAPE 8 | |
| 48 | +/* library output formats */ | |
| 49 | +#define FAAD_FMT_16BIT 1 | |
| 50 | +#define FAAD_FMT_24BIT 2 | |
| 51 | +#define FAAD_FMT_32BIT 3 | |
| 52 | +#define FAAD_FMT_FLOAT 4 | |
| 53 | +#define FAAD_FMT_DOUBLE 5 | |
| 54 | +#define FAAD_FMT_16BIT_DITHER 6 | |
| 55 | +#define FAAD_FMT_16BIT_L_SHAPE 7 | |
| 56 | +#define FAAD_FMT_16BIT_M_SHAPE 8 | |
| 57 | +#define FAAD_FMT_16BIT_H_SHAPE 9 | |
| 58 | + | |
| 59 | +#define FAAD_FMT_DITHER_LOWEST FAAD_FMT_16BIT_DITHER | |
| 56 | 60 | |
| 57 | 61 | #define LC_DEC_CAP (1<<0) |
| 58 | 62 | #define MAIN_DEC_CAP (1<<1) |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: output.c,v 1.14 2002/11/28 18:48:30 menno Exp $ | |
| 19 | +** $Id: output.c,v 1.15 2003/04/02 20:07:46 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #include "common.h" |
| @@ -53,6 +53,7 @@ void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, · 30 unmodified lines | ||
| 53 | 53 | int16_t *short_sample_buffer = (int16_t*)sample_buffer; |
| 54 | 54 | int32_t *int_sample_buffer = (int32_t*)sample_buffer; |
| 55 | 55 | float32_t *float_sample_buffer = (float32_t*)sample_buffer; |
| 56 | + double *double_sample_buffer = (double*)sample_buffer; | |
| 56 | 57 | |
| 57 | 58 | /* Copy output to a standard PCM buffer */ |
| 58 | 59 | switch (format) |
| @@ -147,6 +148,19 @@ void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, · 88 unmodified lines | ||
| 147 | 148 | } |
| 148 | 149 | } |
| 149 | 150 | break; |
| 151 | + case FAAD_FMT_DOUBLE: | |
| 152 | + for (ch = 0; ch < channels; ch++) | |
| 153 | + { | |
| 154 | + for(i = 0; i < frame_len; i++) | |
| 155 | + { | |
| 156 | + if (input[ch][i] > (1<<15)-1) | |
| 157 | + input[ch][i] = (1<<15)-1; | |
| 158 | + else if (input[ch][i] < -(1<<15)) | |
| 159 | + input[ch][i] = -(1<<15); | |
| 160 | + double_sample_buffer[(i*channels)+ch] = (double)input[ch][i]*FLOAT_SCALE; | |
| 161 | + } | |
| 162 | + } | |
| 163 | + break; | |
| 150 | 164 | } |
| 151 | 165 | |
| 152 | 166 | return sample_buffer; |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | ** along with this program; if not, write to the Free Software |
| 17 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 18 | ** |
| 19 | −** $Id: foo_mp4.cpp,v 1.14 2003/02/09 20:42:50 menno Exp $ | |
| 19 | +** $Id: foo_mp4.cpp,v 1.15 2003/04/02 20:07:46 menno Exp $ | |
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | #include <mp4.h> |
| @@ -38,6 +38,7 @@ public: · 15 unmodified lines | ||
| 38 | 38 | unsigned __int8 *buffer; |
| 39 | 39 | unsigned __int32 buffer_size; |
| 40 | 40 | unsigned __int8 channels; |
| 41 | + unsigned __int32 samplerate; | |
| 41 | 42 | faacDecConfigurationPtr config; |
| 42 | 43 | |
| 43 | 44 | m_reader = r; |
| @@ -46,7 +47,7 @@ public: · 2 unmodified lines | ||
| 46 | 47 | if (!hDecoder) return 0; |
| 47 | 48 | |
| 48 | 49 | config = faacDecGetCurrentConfiguration(hDecoder); |
| 49 | − config->outputFormat = FAAD_FMT_FLOAT; | |
| 50 | + config->outputFormat = FAAD_FMT_DOUBLE; | |
| 50 | 51 | faacDecSetConfiguration(hDecoder, config); |
| 51 | 52 | |
| 52 | 53 | hFile = MP4ReadCb(0, open_cb, close_cb, read_cb, write_cb, |
| @@ -62,7 +63,7 @@ public: · 9 unmodified lines | ||
| 62 | 63 | if (!buffer) return 0; |
| 63 | 64 | |
| 64 | 65 | int rc = faacDecInit2(hDecoder, (unsigned char*)buffer, buffer_size, |
| 65 | − (unsigned long*)&m_samplerate, (unsigned char*)&channels); | |
| 66 | + (unsigned long*)&samplerate, (unsigned char*)&channels); | |
| 66 | 67 | if (buffer) free(buffer); |
| 67 | 68 | if (rc < 0) return 0; |
| 68 | 69 | |
| @@ -78,7 +79,7 @@ public: · 9 unmodified lines | ||
| 78 | 79 | (double)(__int64)MP4GetTrackIntegerProperty(hFile, |
| 79 | 80 | track, "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.avgBitrate")) + 0.5); |
| 80 | 81 | info->info_set_int("channels", (__int64)channels); |
| 81 | − info->info_set_int("samplerate", (__int64)m_samplerate); | |
| 82 | + info->info_set_int("samplerate", (__int64)samplerate); | |
| 82 | 83 | |
| 83 | 84 | ReadMP4Tag(info); |
| 84 | 85 | |
| @@ -127,10 +128,10 @@ public: · 42 unmodified lines | ||
| 127 | 128 | if (frameInfo.error || (sampleId > numSamples)) |
| 128 | 129 | return 0; |
| 129 | 130 | |
| 130 | − chunk->data = (float*)sample_buffer; | |
| 131 | + chunk->data = (audio_sample*)sample_buffer; | |
| 131 | 132 | chunk->samples = frameInfo.samples/frameInfo.channels; |
| 132 | 133 | chunk->nch = frameInfo.channels; |
| 133 | − chunk->srate = m_samplerate; | |
| 134 | + chunk->srate = frameInfo.samplerate; | |
| 134 | 135 | |
| 135 | 136 | return 1; |
| 136 | 137 | } |
| @@ -147,7 +148,6 @@ public: · 10 unmodified lines | ||
| 147 | 148 | if (track < 1) return 0; |
| 148 | 149 | |
| 149 | 150 | MP4TagDelete(hFile, track); |
| 150 | −// MP4TagCreate(hFile, track); | |
| 151 | 151 | |
| 152 | 152 | /* replay gain writing */ |
| 153 | 153 | const char *p = NULL; |
| @@ -204,8 +204,6 @@ private: · 50 unmodified lines | ||
| 204 | 204 | MP4SampleId sampleId, numSamples; |
| 205 | 205 | MP4TrackId track; |
| 206 | 206 | |
| 207 | − unsigned __int32 m_samplerate; | |
| 208 | − | |
| 209 | 207 | faacDecHandle hDecoder; |
| 210 | 208 | |
| 211 | 209 | int ReadMP4Tag(file_info *info) |