| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Nellymoser encoder | 2 * Nellymoser encoder |
| 3 * This code is developed as part of Google Summer of Code 2008 Program. | 3 * This code is developed as part of Google Summer of Code 2008 Program. |
| 4 * | 4 * |
| 5 * Copyright (c) 2008 Bartlomiej Wolowiec | 5 * Copyright (c) 2008 Bartlomiej Wolowiec |
| 6 * | 6 * |
| 7 * This file is part of FFmpeg. | 7 * This file is part of FFmpeg. |
| 8 * | 8 * |
| 9 * FFmpeg is free software; you can redistribute it and/or | 9 * FFmpeg is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * Some information also from: http://samples.mplayerhq.hu/A-codecs/Nelly_Moser/
ASAO/ASAO.zip | 31 * Some information also from: http://samples.mplayerhq.hu/A-codecs/Nelly_Moser/
ASAO/ASAO.zip |
| 32 * (Copyright Joseph Artsimovich and UAB "DKD") | 32 * (Copyright Joseph Artsimovich and UAB "DKD") |
| 33 * | 33 * |
| 34 * for more information about nellymoser format, visit: | 34 * for more information about nellymoser format, visit: |
| 35 * http://wiki.multimedia.cx/index.php?title=Nellymoser | 35 * http://wiki.multimedia.cx/index.php?title=Nellymoser |
| 36 */ | 36 */ |
| 37 | 37 |
| 38 #include "nellymoser.h" | 38 #include "nellymoser.h" |
| 39 #include "avcodec.h" | 39 #include "avcodec.h" |
| 40 #include "dsputil.h" | 40 #include "dsputil.h" |
| 41 #include "fft.h" |
| 41 | 42 |
| 42 #define BITSTREAM_WRITER_LE | 43 #define BITSTREAM_WRITER_LE |
| 43 #include "put_bits.h" | 44 #include "put_bits.h" |
| 44 | 45 |
| 45 #define POW_TABLE_SIZE (1<<11) | 46 #define POW_TABLE_SIZE (1<<11) |
| 46 #define POW_TABLE_OFFSET 3 | 47 #define POW_TABLE_OFFSET 3 |
| 47 #define OPT_SIZE ((1<<15) + 3000) | 48 #define OPT_SIZE ((1<<15) + 3000) |
| 48 | 49 |
| 49 typedef struct NellyMoserEncodeContext { | 50 typedef struct NellyMoserEncodeContext { |
| 50 AVCodecContext *avctx; | 51 AVCodecContext *avctx; |
| 51 int last_frame; | 52 int last_frame; |
| 52 int bufsel; | 53 int bufsel; |
| 53 int have_saved; | 54 int have_saved; |
| 54 DSPContext dsp; | 55 DSPContext dsp; |
| 55 FFTContext mdct_ctx; | 56 FFTContext mdct_ctx; |
| 56 DECLARE_ALIGNED_16(float, mdct_out)[NELLY_SAMPLES]; | 57 DECLARE_ALIGNED(16, float, mdct_out)[NELLY_SAMPLES]; |
| 57 DECLARE_ALIGNED_16(float, in_buff)[NELLY_SAMPLES]; | 58 DECLARE_ALIGNED(16, float, in_buff)[NELLY_SAMPLES]; |
| 58 DECLARE_ALIGNED_16(float, buf)[2][3 * NELLY_BUF_LEN]; ///< sample buffer | 59 DECLARE_ALIGNED(16, float, buf)[2][3 * NELLY_BUF_LEN]; ///< sample buffe
r |
| 59 float (*opt )[NELLY_BANDS]; | 60 float (*opt )[NELLY_BANDS]; |
| 60 uint8_t (*path)[NELLY_BANDS]; | 61 uint8_t (*path)[NELLY_BANDS]; |
| 61 } NellyMoserEncodeContext; | 62 } NellyMoserEncodeContext; |
| 62 | 63 |
| 63 static float pow_table[POW_TABLE_SIZE]; ///< -pow(2, -i / 2048.0 - 3.0); | 64 static float pow_table[POW_TABLE_SIZE]; ///< -pow(2, -i / 2048.0 - 3.0); |
| 64 | 65 |
| 65 static const uint8_t sf_lut[96] = { | 66 static const uint8_t sf_lut[96] = { |
| 66 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, | 67 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, |
| 67 5, 5, 5, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 13, 13, 14, | 68 5, 5, 5, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 13, 13, 14, |
| 68 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, | 69 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 .name = "nellymoser", | 386 .name = "nellymoser", |
| 386 .type = CODEC_TYPE_AUDIO, | 387 .type = CODEC_TYPE_AUDIO, |
| 387 .id = CODEC_ID_NELLYMOSER, | 388 .id = CODEC_ID_NELLYMOSER, |
| 388 .priv_data_size = sizeof(NellyMoserEncodeContext), | 389 .priv_data_size = sizeof(NellyMoserEncodeContext), |
| 389 .init = encode_init, | 390 .init = encode_init, |
| 390 .encode = encode_frame, | 391 .encode = encode_frame, |
| 391 .close = encode_end, | 392 .close = encode_end, |
| 392 .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, | 393 .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, |
| 393 .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), | 394 .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), |
| 394 }; | 395 }; |
| OLD | NEW |