49 for (i = 0, j = 0; j < 32; i += channels, j++) {
60 if (max == 0 && min == 0) {
67 if (max / 7 > -min / 8)
81 for (i = 0, j = 0; j < 32; i += channels, j++) {
98 #define HEADER_SIZE 36
104 bytestream_put_be16(&buf, 0x8000);
106 bytestream_put_byte(&buf, 3);
108 bytestream_put_byte(&buf, 4);
109 bytestream_put_byte(&buf, avctx->
channels);
111 bytestream_put_be32(&buf, 0);
112 bytestream_put_be16(&buf, c->
cutoff);
113 bytestream_put_byte(&buf, 3);
114 bytestream_put_byte(&buf, 0);
115 bytestream_put_be32(&buf, 0);
116 bytestream_put_be32(&buf, 0);
117 bytestream_put_be16(&buf, 0);
144 const int16_t *samples = (
const int16_t *)frame->
data[0];
146 int ch, out_size,
ret;
163 for (ch = 0; ch < avctx->
channels; ch++) {
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
This structure describes decoded (raw) audio or video data.
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static av_cold int init(AVCodecContext *avctx)
static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav, ADXChannelState *prev, int channels)
void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff)
Calculate LPC coefficients based on cutoff frequency and sample rate.
#define ROUNDED_DIV(a, b)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
Libavcodec external API header.
AVCodec ff_adpcm_adx_encoder
int frame_size
Number of samples per channel in an audio frame.
AVSampleFormat
Audio sample formats.
int sample_rate
samples per second
main external API structure.
static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static av_cold int adx_encode_init(AVCodecContext *avctx)
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize)
int channels
number of audio channels
static enum AVSampleFormat sample_fmts[]
This structure stores compressed data.