59 if (!p->samples32 || !p->ref_coef)
72 const int16_t *samples = (
const int16_t*)
frame->data[0];
79 for (
i = 0;
i <
frame->nb_samples;
i++) {
80 p->samples32[
i] = samples[
i];
81 energy += samples[
i] * samples[
i];
83 energy /=
frame->nb_samples;
85 double dbov = 10 * log10(energy / 1081109975);
91 avpkt->
data[0] = qdbov;
92 for (
i = 0;
i < p->order;
i++)
93 avpkt->
data[1 +
i] = p->ref_coef[
i] * 127 + 127;
102 .p.name =
"comfortnoise",
const FFCodec ff_comfortnoise_encoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
static av_cold int cng_encode_init(AVCodecContext *avctx)
static int cng_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_cold int cng_encode_close(AVCodecContext *avctx)
#define CODEC_CH_LAYOUTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define CODEC_SAMPLEFMTS(...)
common internal and external API header
static __device__ float floor(float a)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
@ AV_CODEC_ID_COMFORT_NOISE
#define AV_CHANNEL_LAYOUT_MONO
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S16
signed 16 bits
av_cold void ff_lpc_end(LPCContext *s)
Uninitialize LPCContext.
int ff_lpc_calc_ref_coefs(LPCContext *s, const int32_t *samples, int order, double *ref)
av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, enum FFLPCType lpc_type)
Initialize LPCContext.
@ FF_LPC_TYPE_LEVINSON
Levinson-Durbin recursion.
Memory handling functions.
main external API structure.
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
#define av_malloc_array(a, b)