37 -9, -8, -6, -5, -4, -3, -2, -1,
38 0, 1, 2, 3, 4, 5, 6, 8
66 const uint8_t *buf = avpkt->
data;
67 int buf_size = avpkt->
size;
69 int in_size, out_size, ret;
86 if (in_size > buf_size) {
98 samples_end = samples + out_size;
100 if (in_size == out_size) {
101 memcpy(samples, buf, out_size);
107 while (samples < samples_end && buf - avpkt->data < buf_size) {
116 case 0: smp = 4*(count+1);
break;
117 case 1: smp = 2*(count+1);
break;
118 case 2: smp = (count & 0x20) ? 1 : count + 1;
break;
119 default: smp = count + 1;
break;
121 if (samples_end - samples < smp)
125 size = ((code == 2 && (count & 0x20)) || code == 3) ? 0 : count + 1;
126 if ((buf - avpkt->
data) + size > buf_size)
131 for (count++; count > 0; count--) {
133 sample += ( code & 0x3) - 2;
134 sample = av_clip_uint8(sample);
136 sample += ((code >> 2) & 0x3) - 2;
137 sample = av_clip_uint8(sample);
139 sample += ((code >> 4) & 0x3) - 2;
140 sample = av_clip_uint8(sample);
142 sample += (code >> 6) - 2;
143 sample = av_clip_uint8(sample);
148 for (count++; count > 0; count--) {
151 sample = av_clip_uint8(sample);
154 sample = av_clip_uint8(sample);
164 sample = av_clip_uint8(sample);
167 memcpy(samples, buf, smp);
174 memset(samples, sample, smp);
AVFrame * coded_frame
the picture in the bitstream
static av_cold int ws_snd_decode_init(AVCodecContext *avctx)
AVCodec ff_ws_snd1_decoder
struct WSSndContext WSSndContext
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum AVSampleFormat sample_fmt
audio sample format
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int8_t ws_adpcm_4bit[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
int channels
number of audio channels
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
static int ws_snd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
int nb_samples
number of audio samples (per channel) described by this frame