aacsbr.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * AAC Spectral Band Replication function declarations
  3. * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
  4. * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * AAC Spectral Band Replication function declarations
  25. * @author Robert Swain ( rob opendot cl )
  26. */
  27. #ifndef AVCODEC_AACSBR_H
  28. #define AVCODEC_AACSBR_H
  29. #include "get_bits.h"
  30. #include "aac.h"
  31. #include "sbr.h"
  32. #define ENVELOPE_ADJUSTMENT_OFFSET 2
  33. #define NOISE_FLOOR_OFFSET 6
  34. /**
  35. * SBR VLC tables
  36. */
  37. enum {
  38. T_HUFFMAN_ENV_1_5DB,
  39. F_HUFFMAN_ENV_1_5DB,
  40. T_HUFFMAN_ENV_BAL_1_5DB,
  41. F_HUFFMAN_ENV_BAL_1_5DB,
  42. T_HUFFMAN_ENV_3_0DB,
  43. F_HUFFMAN_ENV_3_0DB,
  44. T_HUFFMAN_ENV_BAL_3_0DB,
  45. F_HUFFMAN_ENV_BAL_3_0DB,
  46. T_HUFFMAN_NOISE_3_0DB,
  47. T_HUFFMAN_NOISE_BAL_3_0DB,
  48. };
  49. /**
  50. * bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98)
  51. */
  52. enum {
  53. FIXFIX,
  54. FIXVAR,
  55. VARFIX,
  56. VARVAR,
  57. };
  58. enum {
  59. EXTENSION_ID_PS = 2,
  60. };
  61. static const int8_t vlc_sbr_lav[10] =
  62. { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
  63. #define SBR_INIT_VLC_STATIC(num, size) \
  64. INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
  65. sbr_tmp[num].sbr_bits , 1, 1, \
  66. sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
  67. size)
  68. #define SBR_VLC_ROW(name) \
  69. { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
  70. /** Initialize SBR. */
  71. void AAC_RENAME(ff_aac_sbr_init)(void);
  72. /** Initialize one SBR context. */
  73. void AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac);
  74. /** Close one SBR context. */
  75. void AAC_RENAME(ff_aac_sbr_ctx_close)(SpectralBandReplication *sbr);
  76. /** Decode one SBR element. */
  77. int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
  78. GetBitContext *gb, int crc, int cnt, int id_aac);
  79. /** Apply one SBR element to one AAC element. */
  80. void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
  81. INTFLOAT* L, INTFLOAT *R);
  82. void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c);
  83. #endif /* AVCODEC_AACSBR_H */