50 for (
i = 0, j = 0; j < 32;
i +=
channels, j++) {
52 d = s0 + ((-
c->coeff[0] * s1 -
c->coeff[1] * s2) >>
COEFF_BITS);
61 if (
max == 0 &&
min == 0) {
82 for (
i = 0, j = 0; j < 32;
i +=
channels, j++) {
83 d = wav[
i] + ((-
c->coeff[0] * s1 -
c->coeff[1] * s2) >>
COEFF_BITS);
105 bytestream_put_be16(&buf, 0x8000);
107 bytestream_put_byte(&buf, 3);
109 bytestream_put_byte(&buf, 4);
112 bytestream_put_be32(&buf, 0);
113 bytestream_put_be16(&buf,
c->cutoff);
114 bytestream_put_byte(&buf, 3);
115 bytestream_put_byte(&buf, 0);
116 bytestream_put_be32(&buf, 0);
117 bytestream_put_be32(&buf, 0);
118 bytestream_put_be16(&buf, 0);
145 const int16_t *samples =
frame ? (
const int16_t *)
frame->data[0] :
NULL;
157 bytestream_put_be16(&
dst, 0x8001);
158 bytestream_put_be16(&
dst, 0x000E);
159 bytestream_put_be64(&
dst, 0x0);
160 bytestream_put_be32(&
dst, 0x0);
161 bytestream_put_be16(&
dst, 0x0);
171 if (!
c->header_parsed) {
178 c->header_parsed = 1;
191 .p.name =
"adpcm_adx",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff)
Calculate LPC coefficients based on cutoff frequency and sample rate.
static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize)
static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav, ADXChannelState *prev, int channels)
const FFCodec ff_adpcm_adx_encoder
static av_cold int adx_encode_init(AVCodecContext *avctx)
static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Libavcodec external API header.
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define i(width, name, range_min, range_max)
#define FF_CODEC_CAP_EOF_FLUSH
The encoder has AV_CODEC_CAP_DELAY set, but does not actually have delay - it only wants to be flushe...
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
#define ROUNDED_DIV(a, b)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#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_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S16
signed 16 bits
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int sample_rate
samples per second
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.