[FFmpeg-devel] [PATCH]Split G.726 encoder and decoder
Carl Eugen Hoyos
cehoyos at ag.or.at
Thu Jun 6 12:59:12 CEST 2013
Hi!
Attached patch splits the G.726 encoder and decoder from the common code.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 1aeea28..2c8c50b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -583,8 +583,8 @@ OBJS-$(CONFIG_ADPCM_EA_R3_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_EA_XAS_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_G722_DECODER) += g722.o g722dec.o
OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o g722enc.o
-OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o
-OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
+OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o g726dec.o
+OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o g726enc.o
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 58d0468..4b2a1eb 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <limits.h>
+#include "g726.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
@@ -31,18 +32,6 @@
#include "get_bits.h"
#include "put_bits.h"
-/**
- * G.726 11bit float.
- * G.726 Standard uses rather odd 11bit floating point arithmentic for
- * numerous occasions. It's a mystery to me why they did it this way
- * instead of simply using 32bit integer arithmetic.
- */
-typedef struct Float11 {
- uint8_t sign; /**< 1bit sign */
- uint8_t exp; /**< 4bit exponent */
- uint8_t mant; /**< 6bit mantissa */
-} Float11;
-
static inline Float11* i2f(int i, Float11* f)
{
f->sign = (i < 0);
@@ -68,36 +57,6 @@ static inline int sgn(int value)
return (value < 0) ? -1 : 1;
}
-typedef struct G726Tables {
- const int* quant; /**< quantization table */
- const int16_t* iquant; /**< inverse quantization table */
- const int16_t* W; /**< special table #1 ;-) */
- const uint8_t* F; /**< special table #2 */
-} G726Tables;
-
-typedef struct G726Context {
- AVClass *class;
- G726Tables tbls; /**< static tables needed for computation */
-
- Float11 sr[2]; /**< prev. reconstructed samples */
- Float11 dq[6]; /**< prev. difference */
- int a[2]; /**< second order predictor coeffs */
- int b[6]; /**< sixth order predictor coeffs */
- int pk[2]; /**< signs of prev. 2 sez + dq */
-
- int ap; /**< scale factor control */
- int yu; /**< fast scale factor */
- int yl; /**< slow scale factor */
- int dms; /**< short average magnitude of F[i] */
- int dml; /**< long average magnitude of F[i] */
- int td; /**< tone detect */
-
- int se; /**< estimated signal for the next iteration */
- int sez; /**< estimated second order prediction */
- int y; /**< quantizer scaling factor for the next iteration */
- int code_size;
-} G726Context;
-
static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */
{ 260, INT_MAX };
static const int16_t iquant_tbl16[] =
@@ -152,32 +111,6 @@ static const G726Tables G726Tables_pool[] =
/**
- * Para 4.2.2 page 18: Adaptive quantizer.
- */
-static inline uint8_t quant(G726Context* c, int d)
-{
- int sign, exp, i, dln;
-
- sign = i = 0;
- if (d < 0) {
- sign = 1;
- d = -d;
- }
- exp = av_log2_16bit(d);
- dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2);
-
- while (c->tbls.quant[i] < INT_MAX && c->tbls.quant[i] < dln)
- ++i;
-
- if (sign)
- i = ~i;
- if (c->code_size != 2 && i == 0) /* I'm not sure this is a good idea */
- i = 0xff;
-
- return i;
-}
-
-/**
* Para 4.2.3 page 22: Inverse adaptive quantizer.
*/
static inline int16_t inverse_quant(G726Context* c, int i)
@@ -190,7 +123,7 @@ static inline int16_t inverse_quant(G726Context* c, int i)
return (dql < 0) ? 0 : ((dqt<<dex) >> 7);
}
-static int16_t g726_decode(G726Context* c, int I)
+int16_t ff_g726_decode(G726Context* c, int I)
{
int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;
Float11 f;
@@ -272,7 +205,7 @@ static int16_t g726_decode(G726Context* c, int I)
return av_clip(re_signal << 2, -0xffff, 0xffff);
}
-static av_cold int g726_reset(G726Context *c)
+int ff_g726_reset(G726Context *c)
{
int i;
@@ -291,178 +224,3 @@ static av_cold int g726_reset(G726Context *c)
return 0;
}
-
-#if CONFIG_ADPCM_G726_ENCODER
-static int16_t g726_encode(G726Context* c, int16_t sig)
-{
- uint8_t i;
-
- i = quant(c, sig/4 - c->se) & ((1<<c->code_size) - 1);
- g726_decode(c, i);
- return i;
-}
-
-/* Interfacing to the libavcodec */
-
-static av_cold int g726_encode_init(AVCodecContext *avctx)
-{
- G726Context* c = avctx->priv_data;
-
- if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL &&
- avctx->sample_rate != 8000) {
- av_log(avctx, AV_LOG_ERROR, "Sample rates other than 8kHz are not "
- "allowed when the compliance level is higher than unofficial. "
- "Resample or reduce the compliance level.\n");
- return AVERROR(EINVAL);
- }
- av_assert0(avctx->sample_rate > 0);
-
- if(avctx->channels != 1){
- av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
- return AVERROR(EINVAL);
- }
-
- if (avctx->bit_rate)
- c->code_size = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate;
-
- c->code_size = av_clip(c->code_size, 2, 5);
- avctx->bit_rate = c->code_size * avctx->sample_rate;
- avctx->bits_per_coded_sample = c->code_size;
-
- g726_reset(c);
-
- /* select a frame size that will end on a byte boundary and have a size of
- approximately 1024 bytes */
- avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[c->code_size - 2];
-
- return 0;
-}
-
-static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
- const AVFrame *frame, int *got_packet_ptr)
-{
- G726Context *c = avctx->priv_data;
- const int16_t *samples = (const int16_t *)frame->data[0];
- PutBitContext pb;
- int i, ret, out_size;
-
- out_size = (frame->nb_samples * c->code_size + 7) / 8;
- if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0)
- return ret;
- init_put_bits(&pb, avpkt->data, avpkt->size);
-
- for (i = 0; i < frame->nb_samples; i++)
- put_bits(&pb, c->code_size, g726_encode(c, *samples++));
-
- flush_put_bits(&pb);
-
- avpkt->size = out_size;
- *got_packet_ptr = 1;
- return 0;
-}
-
-#define OFFSET(x) offsetof(G726Context, x)
-#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-static const AVOption options[] = {
- { "code_size", "Bits per code", OFFSET(code_size), AV_OPT_TYPE_INT, { .i64 = 4 }, 2, 5, AE },
- { NULL },
-};
-
-static const AVClass class = {
- .class_name = "g726",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-static const AVCodecDefault defaults[] = {
- { "b", "0" },
- { NULL },
-};
-
-AVCodec ff_adpcm_g726_encoder = {
- .name = "g726",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = AV_CODEC_ID_ADPCM_G726,
- .priv_data_size = sizeof(G726Context),
- .init = g726_encode_init,
- .encode2 = g726_encode_frame,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
- .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
- AV_SAMPLE_FMT_NONE },
- .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
- .priv_class = &class,
- .defaults = defaults,
-};
-#endif
-
-#if CONFIG_ADPCM_G726_DECODER
-static av_cold int g726_decode_init(AVCodecContext *avctx)
-{
- G726Context* c = avctx->priv_data;
-
- avctx->channels = 1;
- avctx->channel_layout = AV_CH_LAYOUT_MONO;
-
- c->code_size = avctx->bits_per_coded_sample;
- if (c->code_size < 2 || c->code_size > 5) {
- av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size);
- return AVERROR(EINVAL);
- }
- g726_reset(c);
-
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-
- return 0;
-}
-
-static int g726_decode_frame(AVCodecContext *avctx, void *data,
- int *got_frame_ptr, AVPacket *avpkt)
-{
- AVFrame *frame = data;
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- G726Context *c = avctx->priv_data;
- int16_t *samples;
- GetBitContext gb;
- int out_samples, ret;
-
- out_samples = buf_size * 8 / c->code_size;
-
- /* get output buffer */
- frame->nb_samples = out_samples;
- if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
- return ret;
- samples = (int16_t *)frame->data[0];
-
- init_get_bits(&gb, buf, buf_size * 8);
-
- while (out_samples--)
- *samples++ = g726_decode(c, get_bits(&gb, c->code_size));
-
- if (get_bits_left(&gb) > 0)
- av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
-
- *got_frame_ptr = 1;
-
- return buf_size;
-}
-
-static void g726_decode_flush(AVCodecContext *avctx)
-{
- G726Context *c = avctx->priv_data;
- g726_reset(c);
-}
-
-AVCodec ff_adpcm_g726_decoder = {
- .name = "g726",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = AV_CODEC_ID_ADPCM_G726,
- .priv_data_size = sizeof(G726Context),
- .init = g726_decode_init,
- .decode = g726_decode_frame,
- .flush = g726_decode_flush,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
-};
-#endif
diff --git a/libavcodec/g726.h b/libavcodec/g726.h
new file mode 100644
index 0000000..1292faf
--- /dev/null
+++ b/libavcodec/g726.h
@@ -0,0 +1,77 @@
+/*
+ * G.726 ADPCM audio codec
+ * Copyright (c) 2004 Roman Shaposhnik
+ *
+ * This is a very straightforward rendition of the G.726
+ * Section 4 "Computational Details".
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <limits.h>
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+
+/**
+ * G.726 11bit float.
+ * G.726 Standard uses rather odd 11bit floating point arithmentic for
+ * numerous occasions. It's a mystery to me why they did it this way
+ * instead of simply using 32bit integer arithmetic.
+ */
+typedef struct Float11 {
+ uint8_t sign; /**< 1bit sign */
+ uint8_t exp; /**< 4bit exponent */
+ uint8_t mant; /**< 6bit mantissa */
+} Float11;
+
+typedef struct G726Tables {
+ const int* quant; /**< quantization table */
+ const int16_t* iquant; /**< inverse quantization table */
+ const int16_t* W; /**< special table #1 ;-) */
+ const uint8_t* F; /**< special table #2 */
+} G726Tables;
+
+typedef struct G726Context {
+ AVClass *class;
+ G726Tables tbls; /**< static tables needed for computation */
+
+ Float11 sr[2]; /**< prev. reconstructed samples */
+ Float11 dq[6]; /**< prev. difference */
+ int a[2]; /**< second order predictor coeffs */
+ int b[6]; /**< sixth order predictor coeffs */
+ int pk[2]; /**< signs of prev. 2 sez + dq */
+
+ int ap; /**< scale factor control */
+ int yu; /**< fast scale factor */
+ int yl; /**< slow scale factor */
+ int dms; /**< short average magnitude of F[i] */
+ int dml; /**< long average magnitude of F[i] */
+ int td; /**< tone detect */
+
+ int se; /**< estimated signal for the next iteration */
+ int sez; /**< estimated second order prediction */
+ int y; /**< quantizer scaling factor for the next iteration */
+ int code_size;
+} G726Context;
+
+int16_t ff_g726_decode(G726Context* c, int I);
+int ff_g726_reset(G726Context *c);
diff --git a/libavcodec/g726dec.c b/libavcodec/g726dec.c
new file mode 100644
index 0000000..dd6e2b1
--- /dev/null
+++ b/libavcodec/g726dec.c
@@ -0,0 +1,102 @@
+/*
+ * G.726 ADPCM audio codec
+ * Copyright (c) 2004 Roman Shaposhnik
+ *
+ * This is a very straightforward rendition of the G.726
+ * Section 4 "Computational Details".
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <limits.h>
+#include "g726.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+
+static av_cold int g726_decode_init(AVCodecContext *avctx)
+{
+ G726Context* c = avctx->priv_data;
+
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+
+ c->code_size = avctx->bits_per_coded_sample;
+ if (c->code_size < 2 || c->code_size > 5) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size);
+ return AVERROR(EINVAL);
+ }
+ ff_g726_reset(c);
+
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+
+ return 0;
+}
+
+static int g726_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ AVFrame *frame = data;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ G726Context *c = avctx->priv_data;
+ int16_t *samples;
+ GetBitContext gb;
+ int out_samples, ret;
+
+ out_samples = buf_size * 8 / c->code_size;
+
+ /* get output buffer */
+ frame->nb_samples = out_samples;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+ return ret;
+ samples = (int16_t *)frame->data[0];
+
+ init_get_bits(&gb, buf, buf_size * 8);
+
+ while (out_samples--)
+ *samples++ = ff_g726_decode(c, get_bits(&gb, c->code_size));
+
+ if (get_bits_left(&gb) > 0)
+ av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
+
+ *got_frame_ptr = 1;
+
+ return buf_size;
+}
+
+static void g726_decode_flush(AVCodecContext *avctx)
+{
+ G726Context *c = avctx->priv_data;
+ ff_g726_reset(c);
+}
+
+AVCodec ff_adpcm_g726_decoder = {
+ .name = "g726",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ADPCM_G726,
+ .priv_data_size = sizeof(G726Context),
+ .init = g726_decode_init,
+ .decode = g726_decode_frame,
+ .flush = g726_decode_flush,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
+};
diff --git a/libavcodec/g726enc.c b/libavcodec/g726enc.c
new file mode 100644
index 0000000..1925f3c
--- /dev/null
+++ b/libavcodec/g726enc.c
@@ -0,0 +1,161 @@
+/*
+ * G.726 ADPCM audio codec
+ * Copyright (c) 2004 Roman Shaposhnik
+ *
+ * This is a very straightforward rendition of the G.726
+ * Section 4 "Computational Details".
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <limits.h>
+#include "g726.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+
+/**
+ * Para 4.2.2 page 18: Adaptive quantizer.
+ */
+static inline uint8_t quant(G726Context* c, int d)
+{
+ int sign, exp, i, dln;
+
+ sign = i = 0;
+ if (d < 0) {
+ sign = 1;
+ d = -d;
+ }
+ exp = av_log2_16bit(d);
+ dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2);
+
+ while (c->tbls.quant[i] < INT_MAX && c->tbls.quant[i] < dln)
+ ++i;
+
+ if (sign)
+ i = ~i;
+ if (c->code_size != 2 && i == 0) /* I'm not sure this is a good idea */
+ i = 0xff;
+
+ return i;
+}
+
+static int16_t g726_encode(G726Context* c, int16_t sig)
+{
+ uint8_t i;
+
+ i = quant(c, sig/4 - c->se) & ((1<<c->code_size) - 1);
+ ff_g726_decode(c, i);
+ return i;
+}
+
+/* Interfacing to the libavcodec */
+
+static av_cold int g726_encode_init(AVCodecContext *avctx)
+{
+ G726Context* c = avctx->priv_data;
+
+ if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL &&
+ avctx->sample_rate != 8000) {
+ av_log(avctx, AV_LOG_ERROR, "Sample rates other than 8kHz are not "
+ "allowed when the compliance level is higher than unofficial. "
+ "Resample or reduce the compliance level.\n");
+ return AVERROR(EINVAL);
+ }
+ av_assert0(avctx->sample_rate > 0);
+
+ if(avctx->channels != 1){
+ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (avctx->bit_rate)
+ c->code_size = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate;
+
+ c->code_size = av_clip(c->code_size, 2, 5);
+ avctx->bit_rate = c->code_size * avctx->sample_rate;
+ avctx->bits_per_coded_sample = c->code_size;
+
+ ff_g726_reset(c);
+
+ /* select a frame size that will end on a byte boundary and have a size of
+ approximately 1024 bytes */
+ avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[c->code_size - 2];
+
+ return 0;
+}
+
+static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ G726Context *c = avctx->priv_data;
+ const int16_t *samples = (const int16_t *)frame->data[0];
+ PutBitContext pb;
+ int i, ret, out_size;
+
+ out_size = (frame->nb_samples * c->code_size + 7) / 8;
+ if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0)
+ return ret;
+ init_put_bits(&pb, avpkt->data, avpkt->size);
+
+ for (i = 0; i < frame->nb_samples; i++)
+ put_bits(&pb, c->code_size, g726_encode(c, *samples++));
+
+ flush_put_bits(&pb);
+
+ avpkt->size = out_size;
+ *got_packet_ptr = 1;
+ return 0;
+}
+
+#define OFFSET(x) offsetof(G726Context, x)
+#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "code_size", "Bits per code", OFFSET(code_size), AV_OPT_TYPE_INT, { .i64 = 4 }, 2, 5, AE },
+ { NULL },
+};
+
+static const AVClass class = {
+ .class_name = "g726",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static const AVCodecDefault defaults[] = {
+ { "b", "0" },
+ { NULL },
+};
+
+AVCodec ff_adpcm_g726_encoder = {
+ .name = "g726",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ADPCM_G726,
+ .priv_data_size = sizeof(G726Context),
+ .init = g726_encode_init,
+ .encode2 = g726_encode_frame,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
+ .priv_class = &class,
+ .defaults = defaults,
+};
More information about the ffmpeg-devel
mailing list