dsd.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Direct Stream Digital (DSD) decoder
  3. * based on BSD licensed dsd2pcm by Sebastian Gesemann
  4. * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved.
  5. * Copyright (c) 2014 Peter Ross
  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_DSD_H
  24. #define AVCODEC_DSD_H
  25. #include "libavcodec/internal.h"
  26. #include "libavcodec/mathops.h"
  27. #include "avcodec.h"
  28. #define HTAPS 48 /** number of FIR constants */
  29. #define FIFOSIZE 16 /** must be a power of two */
  30. #define FIFOMASK (FIFOSIZE - 1) /** bit mask for FIFO offsets */
  31. #if FIFOSIZE * 8 < HTAPS * 2
  32. #error "FIFOSIZE too small"
  33. #endif
  34. /**
  35. * Per-channel buffer
  36. */
  37. typedef struct DSDContext {
  38. uint8_t buf[FIFOSIZE];
  39. unsigned pos;
  40. } DSDContext;
  41. void ff_init_dsd_data(void);
  42. void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf,
  43. const uint8_t *src, ptrdiff_t src_stride,
  44. float *dst, ptrdiff_t dst_stride);
  45. #endif /* AVCODEC_DSD_H */