45 for (
int i = 0;
i <
len;
i++) {
46 for (
int j = 0; j < 8; j++) {
49 int v = *(inbuf++) - 128;
51 int t = (v >
state->q || (v ==
state->q && v == 127) ? 127 : -128);
58 if(nq ==
state->q && nq != t)
59 nq += (t == 127 ? 1 : -1);
63 st = (t !=
state->lt ? 0 : 1023);
66 ns += (st != 0 ? 1 : -1);
86 ctx->bits_per_coded_sample = 1;
88 ctx->internal->pad_samples = (
const uint8_t[]){ 1, 8, 4, 8, 2, 8, 4, 8 }[
ctx->ch_layout.nb_channels & 7];
89 if (
ctx->frame_size <= 0 ||
ctx->frame_size *
ctx->ch_layout.nb_channels % 8U)
90 ctx->frame_size = 4096;
const FFCodec ff_dfpwm_encoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
static int dfpwm_enc_frame(struct AVCodecContext *ctx, struct AVPacket *packet, const struct AVFrame *frame, int *got_packet)
static av_cold int dfpwm_enc_init(struct AVCodecContext *ctx)
static void au_compress(DFPWMState *state, int len, uint8_t *outbuf, const uint8_t *inbuf)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
static struct @346255127015250356166251341105367306144006377143 state
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
common internal api header.
main external API structure.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
static AVFormatContext * ctx