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