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.

79 lines
2.2KB

  1. /*
  2. * Musepack decoder
  3. * Copyright (c) 2006 Konstantin Shishkov
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * Musepack decoder
  24. * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
  25. * divided into 32 subbands.
  26. */
  27. #ifndef AVCODEC_MPC_H
  28. #define AVCODEC_MPC_H
  29. #include "libavutil/lfg.h"
  30. #include "avcodec.h"
  31. #include "get_bits.h"
  32. #include "dsputil.h"
  33. #include "mpegaudio.h"
  34. #include "mpegaudiodsp.h"
  35. #define BANDS 32
  36. #define SAMPLES_PER_BAND 36
  37. #define MPC_FRAME_SIZE (BANDS * SAMPLES_PER_BAND)
  38. /** Subband structure - hold all variables for each subband */
  39. typedef struct {
  40. int msf; ///< mid-stereo flag
  41. int res[2];
  42. int scfi[2];
  43. int scf_idx[2][3];
  44. int Q[2];
  45. }Band;
  46. typedef struct {
  47. AVFrame frame;
  48. DSPContext dsp;
  49. MPADSPContext mpadsp;
  50. GetBitContext gb;
  51. int IS, MSS, gapless;
  52. int lastframelen;
  53. int maxbands, last_max_band;
  54. int last_bits_used;
  55. int oldDSCF[2][BANDS];
  56. Band bands[BANDS];
  57. int Q[2][MPC_FRAME_SIZE];
  58. int cur_frame, frames;
  59. uint8_t *bits;
  60. int buf_size;
  61. AVLFG rnd;
  62. int frames_to_skip;
  63. /* for synthesis */
  64. DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2];
  65. int synth_buf_offset[MPA_MAX_CHANNELS];
  66. DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT];
  67. } MPCContext;
  68. void ff_mpc_init(void);
  69. void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst, int channels);
  70. #endif /* AVCODEC_MPC_H */