You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3KB

  1. /*
  2. * SIPR / ACELP.NET decoder
  3. *
  4. * Copyright (c) 2008 Vladimir Voroshilov
  5. * Copyright (c) 2009 Vitor Sessak
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVCODEC_SIPR_H
  24. #define AVCODEC_SIPR_H
  25. #include "avcodec.h"
  26. #include "dsputil.h"
  27. #include "acelp_pitch_delay.h"
  28. #define LSFQ_DIFF_MIN (0.0125 * M_PI)
  29. #define LP_FILTER_ORDER 10
  30. /** Number of past samples needed for excitation interpolation */
  31. #define L_INTERPOL (LP_FILTER_ORDER + 1)
  32. /** Subframe size for all modes except 16k */
  33. #define SUBFR_SIZE 48
  34. typedef enum {
  35. MODE_16k,
  36. MODE_8k5,
  37. MODE_6k5,
  38. MODE_5k0,
  39. MODE_COUNT
  40. } SiprMode;
  41. typedef struct {
  42. AVCodecContext *avctx;
  43. DSPContext dsp;
  44. SiprMode mode;
  45. float past_pitch_gain;
  46. float lsf_history[LP_FILTER_ORDER];
  47. float excitation[L_INTERPOL + PITCH_DELAY_MAX + 5*SUBFR_SIZE];
  48. DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]);
  49. float lsp_history[LP_FILTER_ORDER];
  50. float gain_mem;
  51. float energy_history[4];
  52. float highpass_filt_mem[2];
  53. float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
  54. /* 5k0 */
  55. float tilt_mem;
  56. float postfilter_agc;
  57. float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
  58. float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
  59. } SiprContext;
  60. typedef struct {
  61. int vq_indexes[5];
  62. int pitch_delay[5]; ///< pitch delay
  63. int gp_index[5]; ///< adaptive-codebook gain indexes
  64. int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
  65. int gc_index[5]; ///< fixed-codebook gain indexes
  66. } SiprParameters;
  67. #endif /* AVCODEC_SIPR_H */