Files
oot/tools/audio/sampleconv/src/codec/vadpcm.h
T
Tharo ef329e633a [Audio 2/?] Extract audio samples to wav (#2020)
* [Audio 2/?] Extract audio samples to wav

Co-authored-by: zelda2774 <69368340+zelda2774@users.noreply.github.com>

* How

* Hopefully fix warning I don't get locally

* Pad default sample filenames, comment on the vadpcm frame encoder functions, other suggested changes

* Small tweaks to above

* Remove some obsolete code

---------

Co-authored-by: zelda2774 <69368340+zelda2774@users.noreply.github.com>
2024-08-08 22:39:18 -04:00

51 lines
1.2 KiB
C

/**
* SPDX-FileCopyrightText: Copyright (C) 2024 ZeldaRET
* SPDX-License-Identifier: CC0-1.0
*/
#ifndef CODEC_VADPCM_H
#define CODEC_VADPCM_H
#include <stdbool.h>
#include <stdint.h>
#define VADPCM_BOOK_SIZE(order, npredictors) (8 * (order) * (npredictors))
#define VADPCM_BOOK_SIZE_BYTES(order, npredictors) (sizeof(int16_t) * VADPCM_BOOK_SIZE(order, npredictors))
typedef struct {
int16_t order;
int16_t npredictors;
} ALADPCMbookhead;
typedef int16_t ALADPCMbookstate[];
typedef struct {
uint32_t start;
uint32_t end;
uint32_t count;
int16_t state[16];
} ALADPCMloop;
typedef struct {
unsigned int order;
unsigned int bits;
unsigned int refine_iters;
double thresh;
unsigned int frame_size;
} table_design_spec;
int
tabledesign_run(int16_t *order_out, int16_t *npredictors_out, int16_t **book_data_out, void *sample_data,
size_t num_samples, const table_design_spec *design);
struct container_data;
struct codec_spec;
struct enc_dec_opts;
int
vadpcm_enc(struct container_data *ctnr, const struct codec_spec *codec, const struct enc_dec_opts *opts);
int
vadpcm_dec(struct container_data *ctnr, const struct codec_spec *codec, const struct enc_dec_opts *opts);
#endif