FFmpeg  4.4.9
wmaenc.c
Go to the documentation of this file.
1 /*
2  * WMA compatible encoder
3  * Copyright (c) 2007 Michael Niedermayer
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/ffmath.h"
24 
25 #include "avcodec.h"
26 #include "internal.h"
27 #include "wma.h"
28 #include "libavutil/avassert.h"
29 
30 
32 {
33  WMACodecContext *s = avctx->priv_data;
34  int i, flags1, flags2, block_align;
35  uint8_t *extradata;
36  int ret;
37 
38  s->avctx = avctx;
39 
40  if (avctx->channels > MAX_CHANNELS) {
41  av_log(avctx, AV_LOG_ERROR,
42  "too many channels: got %i, need %i or fewer\n",
43  avctx->channels, MAX_CHANNELS);
44  return AVERROR(EINVAL);
45  }
46 
47  if (avctx->sample_rate > 48000) {
48  av_log(avctx, AV_LOG_ERROR, "sample rate is too high: %d > 48kHz\n",
49  avctx->sample_rate);
50  return AVERROR(EINVAL);
51  }
52 
53  if (avctx->bit_rate < 24 * 1000) {
54  av_log(avctx, AV_LOG_ERROR,
55  "bitrate too low: got %"PRId64", need 24000 or higher\n",
56  avctx->bit_rate);
57  return AVERROR(EINVAL);
58  }
59 
60  /* extract flag info */
61  flags1 = 0;
62  flags2 = 1;
63  if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
65  if (!extradata)
66  return AVERROR(ENOMEM);
67  avctx->extradata_size = 4;
68  AV_WL16(extradata, flags1);
69  AV_WL16(extradata + 2, flags2);
70  } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
71  extradata = av_mallocz(10 + AV_INPUT_BUFFER_PADDING_SIZE);
72  if (!extradata)
73  return AVERROR(ENOMEM);
74  avctx->extradata_size = 10;
75  AV_WL32(extradata, flags1);
76  AV_WL16(extradata + 4, flags2);
77  } else {
78  av_assert0(0);
79  }
80  avctx->extradata = extradata;
81  s->use_exp_vlc = flags2 & 0x0001;
82  s->use_bit_reservoir = flags2 & 0x0002;
83  s->use_variable_block_len = flags2 & 0x0004;
84  if (avctx->channels == 2)
85  s->ms_stereo = 1;
86 
87  if ((ret = ff_wma_init(avctx, flags2)) < 0)
88  return ret;
89 
90  /* init MDCT */
91  for (i = 0; i < s->nb_block_sizes; i++) {
92  ret = ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
93  if (ret < 0)
94  return ret;
95  }
96 
97  block_align = avctx->bit_rate * (int64_t) s->frame_len /
98  (avctx->sample_rate * 8);
99  block_align = FFMIN(block_align, MAX_CODED_SUPERFRAME_SIZE);
100  avctx->block_align = block_align;
101  avctx->frame_size = avctx->initial_padding = s->frame_len;
102 
103  return 0;
104 }
105 
107 {
108  WMACodecContext *s = avctx->priv_data;
109  float **audio = (float **) frame->extended_data;
110  int len = frame->nb_samples;
111  int window_index = s->frame_len_bits - s->block_len_bits;
112  FFTContext *mdct = &s->mdct_ctx[window_index];
113  int ch;
114  const float *win = s->windows[window_index];
115  int window_len = 1 << s->block_len_bits;
116  float n = 2.0 * 32768.0 / window_len;
117 
118  for (ch = 0; ch < avctx->channels; ch++) {
119  memcpy(s->output, s->frame_out[ch], window_len * sizeof(*s->output));
120  s->fdsp->vector_fmul_scalar(s->frame_out[ch], audio[ch], n, len);
121  s->fdsp->vector_fmul_reverse(&s->output[window_len], s->frame_out[ch],
122  win, len);
123  s->fdsp->vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
124  mdct->mdct_calc(mdct, s->coefs[ch], s->output);
125  if (!isfinite(s->coefs[ch][0])) {
126  av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
127  return AVERROR(EINVAL);
128  }
129  }
130 
131  return 0;
132 }
133 
134 // FIXME use for decoding too
135 static void init_exp(WMACodecContext *s, int ch, const int *exp_param)
136 {
137  int n;
138  const uint16_t *ptr;
139  float v, *q, max_scale, *q_end;
140 
141  ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
142  q = s->exponents[ch];
143  q_end = q + s->block_len;
144  max_scale = 0;
145  while (q < q_end) {
146  /* XXX: use a table */
147  v = ff_exp10(*exp_param++ *(1.0 / 16.0));
148  max_scale = FFMAX(max_scale, v);
149  n = *ptr++;
150  do {
151  *q++ = v;
152  } while (--n);
153  }
154  s->max_exponent[ch] = max_scale;
155 }
156 
157 static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param)
158 {
159  int last_exp;
160  const uint16_t *ptr;
161  float *q, *q_end;
162 
163  ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
164  q = s->exponents[ch];
165  q_end = q + s->block_len;
166  if (s->version == 1) {
167  last_exp = *exp_param++;
168  av_assert0(last_exp - 10 >= 0 && last_exp - 10 < 32);
169  put_bits(&s->pb, 5, last_exp - 10);
170  q += *ptr++;
171  } else
172  last_exp = 36;
173  while (q < q_end) {
174  int exp = *exp_param++;
175  int code = exp - last_exp + 60;
176  av_assert1(code >= 0 && code < 120);
179  /* XXX: use a table */
180  q += *ptr++;
181  last_exp = exp;
182  }
183 }
184 
185 static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
186  int total_gain)
187 {
188  int v, bsize, ch, coef_nb_bits, parse_exponents;
189  float mdct_norm;
190  int nb_coefs[MAX_CHANNELS];
191  static const int fixed_exp[25] = {
192  20, 20, 20, 20, 20,
193  20, 20, 20, 20, 20,
194  20, 20, 20, 20, 20,
195  20, 20, 20, 20, 20,
196  20, 20, 20, 20, 20
197  };
198 
199  // FIXME remove duplication relative to decoder
200  if (s->use_variable_block_len) {
201  av_assert0(0); // FIXME not implemented
202  } else {
203  /* fixed block len */
204  s->next_block_len_bits = s->frame_len_bits;
205  s->prev_block_len_bits = s->frame_len_bits;
206  s->block_len_bits = s->frame_len_bits;
207  }
208 
209  s->block_len = 1 << s->block_len_bits;
210 // av_assert0((s->block_pos + s->block_len) <= s->frame_len);
211  bsize = s->frame_len_bits - s->block_len_bits;
212 
213  // FIXME factor
214  v = s->coefs_end[bsize] - s->coefs_start;
215  for (ch = 0; ch < s->avctx->channels; ch++)
216  nb_coefs[ch] = v;
217  {
218  int n4 = s->block_len / 2;
219  mdct_norm = 1.0 / (float) n4;
220  if (s->version == 1)
221  mdct_norm *= sqrt(n4);
222  }
223 
224  if (s->avctx->channels == 2)
225  put_bits(&s->pb, 1, !!s->ms_stereo);
226 
227  for (ch = 0; ch < s->avctx->channels; ch++) {
228  // FIXME only set channel_coded when needed, instead of always
229  s->channel_coded[ch] = 1;
230  if (s->channel_coded[ch])
231  init_exp(s, ch, fixed_exp);
232  }
233 
234  for (ch = 0; ch < s->avctx->channels; ch++) {
235  if (s->channel_coded[ch]) {
236  WMACoef *coefs1;
237  float *coefs, *exponents, mult;
238  int i, n;
239 
240  coefs1 = s->coefs1[ch];
241  exponents = s->exponents[ch];
242  mult = ff_exp10(total_gain * 0.05) / s->max_exponent[ch];
243  mult *= mdct_norm;
244  coefs = src_coefs[ch];
245  if (s->use_noise_coding && 0) {
246  av_assert0(0); // FIXME not implemented
247  } else {
248  coefs += s->coefs_start;
249  n = nb_coefs[ch];
250  for (i = 0; i < n; i++) {
251  double t = *coefs++ / (exponents[i] * mult);
252  if (t < -32768 || t > 32767)
253  return -1;
254 
255  coefs1[i] = lrint(t);
256  }
257  }
258  }
259  }
260 
261  v = 0;
262  for (ch = 0; ch < s->avctx->channels; ch++) {
263  int a = s->channel_coded[ch];
264  put_bits(&s->pb, 1, a);
265  v |= a;
266  }
267 
268  if (!v)
269  return 1;
270 
271  for (v = total_gain - 1; v >= 127; v -= 127)
272  put_bits(&s->pb, 7, 127);
273  put_bits(&s->pb, 7, v);
274 
275  coef_nb_bits = ff_wma_total_gain_to_bits(total_gain);
276 
277  if (s->use_noise_coding) {
278  for (ch = 0; ch < s->avctx->channels; ch++) {
279  if (s->channel_coded[ch]) {
280  int i, n;
281  n = s->exponent_high_sizes[bsize];
282  for (i = 0; i < n; i++) {
283  put_bits(&s->pb, 1, s->high_band_coded[ch][i] = 0);
284  if (0)
285  nb_coefs[ch] -= s->exponent_high_bands[bsize][i];
286  }
287  }
288  }
289  }
290 
291  parse_exponents = 1;
292  if (s->block_len_bits != s->frame_len_bits)
293  put_bits(&s->pb, 1, parse_exponents);
294 
295  if (parse_exponents) {
296  for (ch = 0; ch < s->avctx->channels; ch++) {
297  if (s->channel_coded[ch]) {
298  if (s->use_exp_vlc) {
299  encode_exp_vlc(s, ch, fixed_exp);
300  } else {
301  av_assert0(0); // FIXME not implemented
302 // encode_exp_lsp(s, ch);
303  }
304  }
305  }
306  } else
307  av_assert0(0); // FIXME not implemented
308 
309  for (ch = 0; ch < s->avctx->channels; ch++) {
310  if (s->channel_coded[ch]) {
311  int run, tindex;
312  WMACoef *ptr, *eptr;
313  tindex = (ch == 1 && s->ms_stereo);
314  ptr = &s->coefs1[ch][0];
315  eptr = ptr + nb_coefs[ch];
316 
317  run = 0;
318  for (; ptr < eptr; ptr++) {
319  if (*ptr) {
320  int level = *ptr;
321  int abs_level = FFABS(level);
322  int code = 0;
323  if (abs_level <= s->coef_vlcs[tindex]->max_level)
324  if (run < s->coef_vlcs[tindex]->levels[abs_level - 1])
325  code = run + s->int_table[tindex][abs_level - 1];
326 
327  av_assert2(code < s->coef_vlcs[tindex]->n);
328  put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[code],
329  s->coef_vlcs[tindex]->huffcodes[code]);
330 
331  if (code == 0) {
332  if (1 << coef_nb_bits <= abs_level)
333  return -1;
334 
335  put_bits(&s->pb, coef_nb_bits, abs_level);
336  put_bits(&s->pb, s->frame_len_bits, run);
337  }
338  // FIXME the sign is flipped somewhere
339  put_bits(&s->pb, 1, level < 0);
340  run = 0;
341  } else
342  run++;
343  }
344  if (run)
345  put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1],
346  s->coef_vlcs[tindex]->huffcodes[1]);
347  }
348  if (s->version == 1 && s->avctx->channels >= 2)
349  align_put_bits(&s->pb);
350  }
351  return 0;
352 }
353 
354 static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
355  uint8_t *buf, int buf_size, int total_gain)
356 {
357  init_put_bits(&s->pb, buf, buf_size);
358 
359  if (s->use_bit_reservoir)
360  av_assert0(0); // FIXME not implemented
361  else if (encode_block(s, src_coefs, total_gain) < 0)
362  return INT_MAX;
363 
364  align_put_bits(&s->pb);
365 
366  return put_bits_count(&s->pb) / 8 - s->avctx->block_align;
367 }
368 
369 static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
370  const AVFrame *frame, int *got_packet_ptr)
371 {
372  WMACodecContext *s = avctx->priv_data;
373  int i, total_gain, ret, error;
374 
375  s->block_len_bits = s->frame_len_bits; // required by non variable block len
376  s->block_len = 1 << s->block_len_bits;
377 
378  ret = apply_window_and_mdct(avctx, frame);
379 
380  if (ret < 0)
381  return ret;
382 
383  if (s->ms_stereo) {
384  float a, b;
385  int i;
386 
387  for (i = 0; i < s->block_len; i++) {
388  a = s->coefs[0][i] * 0.5;
389  b = s->coefs[1][i] * 0.5;
390  s->coefs[0][i] = a + b;
391  s->coefs[1][i] = a - b;
392  }
393  }
394 
395  if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE, 0)) < 0)
396  return ret;
397 
398  total_gain = 128;
399  for (i = 64; i; i >>= 1) {
400  error = encode_frame(s, s->coefs, avpkt->data, avpkt->size,
401  total_gain - i);
402  if (error <= 0)
403  total_gain -= i;
404  }
405 
406  while(total_gain <= 128 && error > 0)
407  error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain++);
408  if (error > 0) {
409  av_log(avctx, AV_LOG_ERROR, "Invalid input data or requested bitrate too low, cannot encode\n");
410  avpkt->size = 0;
411  return AVERROR(EINVAL);
412  }
413  av_assert0((put_bits_count(&s->pb) & 7) == 0);
414  i= avctx->block_align - (put_bits_count(&s->pb)+7)/8;
415  av_assert0(i>=0);
416  while(i--)
417  put_bits(&s->pb, 8, 'N');
418 
419  flush_put_bits(&s->pb);
420  av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align);
421 
422  if (frame->pts != AV_NOPTS_VALUE)
423  avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
424 
425  avpkt->size = avctx->block_align;
426  *got_packet_ptr = 1;
427  return 0;
428 }
429 
430 #if CONFIG_WMAV1_ENCODER
432  .name = "wmav1",
433  .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
434  .type = AVMEDIA_TYPE_AUDIO,
435  .id = AV_CODEC_ID_WMAV1,
436  .priv_data_size = sizeof(WMACodecContext),
437  .init = encode_init,
438  .encode2 = encode_superframe,
439  .close = ff_wma_end,
440  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
442  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
443 };
444 #endif
445 #if CONFIG_WMAV2_ENCODER
447  .name = "wmav2",
448  .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
449  .type = AVMEDIA_TYPE_AUDIO,
450  .id = AV_CODEC_ID_WMAV2,
451  .priv_data_size = sizeof(WMACodecContext),
452  .init = encode_init,
453  .encode2 = encode_superframe,
454  .close = ff_wma_end,
455  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
457  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
458 };
459 #endif
#define MAX_CHANNELS
Definition: aac.h:48
static int fixed_exp(int x)
Definition: aacsbr_fixed.c:111
const uint32_t ff_aac_scalefactor_code[121]
Definition: aactab.c:92
const uint8_t ff_aac_scalefactor_bits[121]
Definition: aactab.c:111
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:925
static float win(SuperEqualizerContext *s, float n, int N)
AVCodec ff_wmav2_encoder
AVCodec ff_wmav1_encoder
Macro definitions for various function/variable attributes.
#define av_cold
Definition: attributes.h:88
uint8_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
#define s(width, name)
Definition: cbs_vp9.c:257
#define FFMIN(a, b)
Definition: common.h:105
#define FFMAX(a, b)
Definition: common.h:103
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
long long int64_t
Definition: coverity.c:34
static AVFrame * frame
static int parse_exponents(DBEContext *s, DBEChannel *c)
Definition: dolby_e.c:653
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
Definition: encode.c:34
int8_t exp
Definition: eval.c:74
internal math functions header
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
Definition: ffmath.h:42
#define ff_mdct_init
Definition: fft.h:161
@ AV_CODEC_ID_WMAV1
Definition: codec_id.h:431
@ AV_CODEC_ID_WMAV2
Definition: codec_id.h:432
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition: avcodec.h:215
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
for(j=16;j >0;--j)
int i
Definition: input.c:407
#define AV_WL32(p, v)
Definition: intreadwrite.h:426
#define AV_WL16(p, v)
Definition: intreadwrite.h:412
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:218
static int16_t mult(Float11 *f1, Float11 *f2)
Definition: g726.c:55
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
Definition: internal.h:277
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:49
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
#define isfinite(x)
Definition: libm.h:359
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:57
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
Definition: put_bits.h:342
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:76
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:110
static void align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
Definition: put_bits.h:386
const uint8_t * code
Definition: spdifenc.c:413
main external API structure.
Definition: avcodec.h:536
int64_t bit_rate
the average bitrate
Definition: avcodec.h:586
const struct AVCodec * codec
Definition: avcodec.h:545
int initial_padding
Audio only.
Definition: avcodec.h:2066
int sample_rate
samples per second
Definition: avcodec.h:1196
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:637
int channels
number of audio channels
Definition: avcodec.h:1197
int extradata_size
Definition: avcodec.h:638
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition: avcodec.h:1233
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1216
void * priv_data
Definition: avcodec.h:563
AVCodec.
Definition: codec.h:197
enum AVCodecID id
Definition: codec.h:211
const char * name
Name of the codec implementation.
Definition: codec.h:204
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:384
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:411
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:365
This structure stores compressed data.
Definition: packet.h:346
int size
Definition: packet.h:370
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:362
uint8_t * data
Definition: packet.h:369
Definition: fft.h:83
uint8_t run
Definition: svq3.c:205
uint8_t level
Definition: svq3.c:206
#define lrint
Definition: tablegen.h:53
#define av_log(a,...)
static void error(const char *err)
const char * b
Definition: vf_curves.c:119
int len
int ff_wma_total_gain_to_bits(int total_gain)
Definition: wma.c:352
av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
Definition: wma.c:79
int ff_wma_end(AVCodecContext *avctx)
Definition: wma.c:366
#define MAX_CODED_SUPERFRAME_SIZE
Definition: wma.h:46
#define BLOCK_MAX_SIZE
Definition: wma.h:36
float WMACoef
type for decoded coefficients, int16_t would be enough for wma 1/2
Definition: wma.h:58
static const CoefVLCTable coef_vlcs[6]
Definition: wmadata.h:1371
static void init_exp(WMACodecContext *s, int ch, const int *exp_param)
Definition: wmaenc.c:135
static int encode_block(WMACodecContext *s, float(*src_coefs)[BLOCK_MAX_SIZE], int total_gain)
Definition: wmaenc.c:185
static av_cold int encode_init(AVCodecContext *avctx)
Definition: wmaenc.c:31
static int encode_frame(WMACodecContext *s, float(*src_coefs)[BLOCK_MAX_SIZE], uint8_t *buf, int buf_size, int total_gain)
Definition: wmaenc.c:354
static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: wmaenc.c:369
static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param)
Definition: wmaenc.c:157
static int apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
Definition: wmaenc.c:106