42 uint8_t *outbuf,
const uint8_t *inbuf)
45 for (
int i = 0;
i <
len;
i++) {
48 for (
int j = 0; j < 8; j++) {
49 int nq, lq, st, ns, ov;
51 int t = ((d&1) ? 127 : -128);
56 if(nq ==
state->q && nq != t)
57 nq += (t == 127 ? 1 : -1);
62 st = (t !=
state->lt ? 0 : 1023);
65 ns += (st != 0 ? 1 : -1);
70 ov = (t !=
state->lt ? (nq+lq+1)>>1 : nq);
77 *(outbuf++) = ov + 128;
94 ctx->bits_per_raw_sample = 8;
100 int *got_frame,
struct AVPacket *packet)
104 uint64_t nb_samples = packet->
size * 8LL /
ctx->ch_layout.nb_channels;
106 if (packet->
size * 8LL %
ctx->ch_layout.nb_channels)
109 if (nb_samples > INT_MAX || !nb_samples) {
113 frame->nb_samples = nb_samples;
const FFCodec ff_dfpwm_decoder
static AVFormatContext * ctx
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define fs(width, name, subs,...)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static struct @346255127015250356166251341105367306144006377143 state
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
static int dfpwm_dec_frame(struct AVCodecContext *ctx, AVFrame *frame, int *got_frame, struct AVPacket *packet)
static av_cold int dfpwm_dec_init(struct AVCodecContext *ctx)
static void au_decompress(DFPWMState *state, int fs, int len, uint8_t *outbuf, const uint8_t *inbuf)
common internal API header
main external API structure.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.