Go to the documentation of this file.
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);
87 ctx->bits_per_coded_sample = 1;
96 int size =
frame->nb_samples *
frame->ch_layout.nb_channels / 8 + (
frame->nb_samples % 8 > 0 ? 1 : 0);
This structure describes decoded (raw) audio or video data.
static void au_compress(DFPWMState *state, int len, uint8_t *outbuf, const uint8_t *inbuf)
AVCodec p
The public AVCodec.
static int dfpwm_enc_frame(struct AVCodecContext *ctx, struct AVPacket *packet, const struct AVFrame *frame, int *got_packet)
#define FF_CODEC_ENCODE_CB(func)
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define CODEC_LONG_NAME(str)
static av_cold int dfpwm_enc_init(struct AVCodecContext *ctx)
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define ns(max_value, name, subs,...)
#define i(width, name, range_min, range_max)
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
AVSampleFormat
Audio sample formats.
const char * name
Name of the codec implementation.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
const FFCodec ff_dfpwm_encoder
This structure stores compressed data.
void * priv_data
Format private data.