xref: /third_party/ffmpeg/libavcodec/dsd.h (revision cabdff1a)
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
24#ifndef AVCODEC_DSD_H
25#define AVCODEC_DSD_H
26
27#include <stddef.h>
28#include <stdint.h>
29
30#define HTAPS   48               /** number of FIR constants */
31#define FIFOSIZE 16              /** must be a power of two */
32#define FIFOMASK (FIFOSIZE - 1)  /** bit mask for FIFO offsets */
33
34#if FIFOSIZE * 8 < HTAPS * 2
35#error "FIFOSIZE too small"
36#endif
37
38/**
39 * Per-channel buffer
40 */
41typedef struct DSDContext {
42    uint8_t buf[FIFOSIZE];
43    unsigned pos;
44} DSDContext;
45
46void ff_init_dsd_data(void);
47
48void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf,
49                          const uint8_t *src, ptrdiff_t src_stride,
50                          float *dst, ptrdiff_t dst_stride);
51#endif /* AVCODEC_DSD_H */
52