FFmpeg
Loading...
Searching...
No Matches
dsd2pcm.h
Go to the documentation of this file.
1/*
2 * DSD to PCM conversion
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 SWRESAMPLE_DSD2PCM_H
25#define SWRESAMPLE_DSD2PCM_H
26
27#include <stddef.h>
28#include <stdint.h>
29
30#define DSD_HTAPS 48 /** number of FIR constants */
31#define DSD_FIFOSIZE 16 /** must be a power of two */
32#define DSD_FIFOMASK (DSD_FIFOSIZE - 1) /** bit mask for FIFO offsets */
33
34#if DSD_FIFOSIZE * 8 < DSD_HTAPS * 2
35#error "DSD_FIFOSIZE too small"
36#endif
37
38/**
39 * Per-channel buffer
40 */
41typedef struct DSDContext {
42 uint8_t buf[DSD_FIFOSIZE];
43 unsigned pos;
45
46void swri_dsd2pcm_init(void);
47
48/**
49 * Convert one channel of MSB-first DSD data (one byte = 8 samples) to
50 * float PCM at 1/8th of the DSD bit rate. Strides are in elements.
51 */
52void swri_dsd2pcm_translate(DSDContext *s, size_t samples,
53 const uint8_t *src, ptrdiff_t src_stride,
54 float *dst, ptrdiff_t dst_stride);
55
56#endif /* SWRESAMPLE_DSD2PCM_H */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define s(width, name)
Definition cbs_vp9.c:198
void swri_dsd2pcm_init(void)
Definition dsd2pcm.c:89
#define DSD_FIFOSIZE
Definition dsd2pcm.h:31
void swri_dsd2pcm_translate(DSDContext *s, size_t samples, const uint8_t *src, ptrdiff_t src_stride, float *dst, ptrdiff_t dst_stride)
Convert one channel of MSB-first DSD data (one byte = 8 samples) to float PCM at 1/8th of the DSD bit...
Definition dsd2pcm.c:95
Per-channel buffer.
Definition dsd2pcm.h:41
uint8_t buf[DSD_FIFOSIZE]
Definition dsd2pcm.h:42
unsigned pos
Definition dsd2pcm.h:43
#define src
Definition vp8dsp.c:248