Revision c7d89948

View differences:

libavcodec/g726.c
334 334
    if (avctx->codec->decode)
335 335
        avctx->sample_fmt = SAMPLE_FMT_S16;
336 336

  
337
    /* select a frame size that will end on a byte boundary and have a size of
338
       approximately 1024 bytes */
339
    if (avctx->codec->encode)
340
        avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[index];
341

  
337 342
    return 0;
338 343
}
339 344

  
......
350 355
    G726Context *c = avctx->priv_data;
351 356
    const short *samples = data;
352 357
    PutBitContext pb;
358
    int i;
353 359

  
354 360
    init_put_bits(&pb, dst, 1024*1024);
355 361

  
356
    for (; buf_size; buf_size--)
362
    for (i = 0; i < avctx->frame_size; i++)
357 363
        put_bits(&pb, c->code_size, g726_encode(c, *samples++));
358 364

  
359 365
    flush_put_bits(&pb);
......
394 400
    g726_encode_frame,
395 401
    g726_close,
396 402
    NULL,
403
    .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
397 404
    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
398 405
    .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
399 406
};
tests/ref/acodec/g726
1
5d8cce28f83dd33c3c7eaf43a5db5294 *./tests/data/acodec/g726.wav
2
24082 ./tests/data/acodec/g726.wav
3
4f1ba1af75dee64625a1c852e6cd01d3 *./tests/data/g726.acodec.out.wav
4
stddev: 8504.69 PSNR: 17.74 MAXDIFF:31645 bytes:    96104/  1058400
1
fd090ddf05cc3401cc75c4a5ace1d05a *./tests/data/acodec/g726.wav
2
24052 ./tests/data/acodec/g726.wav
3
74abea06027375111eeac1b2f8c7d3af *./tests/data/g726.acodec.out.wav
4
stddev: 8554.55 PSNR: 17.69 MAXDIFF:29353 bytes:    95984/  1058400

Also available in: Unified diff