pcm/Dsd2Pcm: use uint8_t instead of unsigned char

This commit is contained in:
Max Kellermann 2020-01-14 22:36:50 +01:00
parent 6bfbc5d320
commit 1708ae3e3c
2 changed files with 5 additions and 4 deletions

View File

@ -175,7 +175,7 @@ Dsd2Pcm::CalcOutputSample(unsigned ffp) const noexcept
void void
Dsd2Pcm::Translate(size_t samples, Dsd2Pcm::Translate(size_t samples,
const unsigned char *src, ptrdiff_t src_stride, const uint8_t *src, ptrdiff_t src_stride,
bool lsbf, bool lsbf,
float *dst, ptrdiff_t dst_stride) noexcept float *dst, ptrdiff_t dst_stride) noexcept
{ {
@ -184,7 +184,7 @@ Dsd2Pcm::Translate(size_t samples,
unsigned bite1 = *src & 0xFFu; unsigned bite1 = *src & 0xFFu;
if (lsbf) bite1 = bit_reverse(bite1); if (lsbf) bite1 = bit_reverse(bite1);
fifo[ffp] = bite1; src += src_stride; fifo[ffp] = bite1; src += src_stride;
unsigned char *p = fifo + ((ffp-CTABLES) & FIFOMASK); uint8_t *p = fifo + ((ffp-CTABLES) & FIFOMASK);
*p = bit_reverse(*p); *p = bit_reverse(*p);
*dst = CalcOutputSample(ffp); *dst = CalcOutputSample(ffp);
dst += dst_stride; dst += dst_stride;

View File

@ -32,6 +32,7 @@ or implied, of Sebastian Gesemann.
#define DSD2PCM_H_INCLUDED #define DSD2PCM_H_INCLUDED
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
/** /**
* A "dsd2pcm engine" for one channel. * A "dsd2pcm engine" for one channel.
@ -45,7 +46,7 @@ private:
/** bit mask for FIFO offsets */ /** bit mask for FIFO offsets */
static constexpr size_t FIFOMASK = FIFOSIZE - 1; static constexpr size_t FIFOMASK = FIFOSIZE - 1;
unsigned char fifo[FIFOSIZE]; uint8_t fifo[FIFOSIZE];
unsigned fifopos; unsigned fifopos;
public: public:
@ -70,7 +71,7 @@ public:
* @param dst_stride -- dst pointer increment * @param dst_stride -- dst pointer increment
*/ */
void Translate(size_t samples, void Translate(size_t samples,
const unsigned char *src, ptrdiff_t src_stride, const uint8_t *src, ptrdiff_t src_stride,
bool lsbitfirst, bool lsbitfirst,
float *dst, ptrdiff_t dst_stride) noexcept; float *dst, ptrdiff_t dst_stride) noexcept;