1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * Direct Stream Digital (DSD) decoder
3cabdff1aSopenharmony_ci * based on BSD licensed dsd2pcm by Sebastian Gesemann
4cabdff1aSopenharmony_ci * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved.
5cabdff1aSopenharmony_ci * Copyright (c) 2014 Peter Ross
6cabdff1aSopenharmony_ci *
7cabdff1aSopenharmony_ci * This file is part of FFmpeg.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
10cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
11cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
12cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
15cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
16cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17cabdff1aSopenharmony_ci * Lesser General Public License for more details.
18cabdff1aSopenharmony_ci *
19cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
20cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
21cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22cabdff1aSopenharmony_ci */
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#ifndef AVCODEC_DSD_H
25cabdff1aSopenharmony_ci#define AVCODEC_DSD_H
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_ci#include <stddef.h>
28cabdff1aSopenharmony_ci#include <stdint.h>
29cabdff1aSopenharmony_ci
30cabdff1aSopenharmony_ci#define HTAPS   48               /** number of FIR constants */
31cabdff1aSopenharmony_ci#define FIFOSIZE 16              /** must be a power of two */
32cabdff1aSopenharmony_ci#define FIFOMASK (FIFOSIZE - 1)  /** bit mask for FIFO offsets */
33cabdff1aSopenharmony_ci
34cabdff1aSopenharmony_ci#if FIFOSIZE * 8 < HTAPS * 2
35cabdff1aSopenharmony_ci#error "FIFOSIZE too small"
36cabdff1aSopenharmony_ci#endif
37cabdff1aSopenharmony_ci
38cabdff1aSopenharmony_ci/**
39cabdff1aSopenharmony_ci * Per-channel buffer
40cabdff1aSopenharmony_ci */
41cabdff1aSopenharmony_citypedef struct DSDContext {
42cabdff1aSopenharmony_ci    uint8_t buf[FIFOSIZE];
43cabdff1aSopenharmony_ci    unsigned pos;
44cabdff1aSopenharmony_ci} DSDContext;
45cabdff1aSopenharmony_ci
46cabdff1aSopenharmony_civoid ff_init_dsd_data(void);
47cabdff1aSopenharmony_ci
48cabdff1aSopenharmony_civoid ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf,
49cabdff1aSopenharmony_ci                          const uint8_t *src, ptrdiff_t src_stride,
50cabdff1aSopenharmony_ci                          float *dst, ptrdiff_t dst_stride);
51cabdff1aSopenharmony_ci#endif /* AVCODEC_DSD_H */
52