FFmpeg
Loading...
Searching...
No Matches
enc_psy.h
Go to the documentation of this file.
1/*
2 * Opus encoder
3 * Copyright (c) 2017 Rostislav Pehlivanov <atomnuker@gmail.com>
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#ifndef AVCODEC_OPUS_ENC_PSY_H
23#define AVCODEC_OPUS_ENC_PSY_H
24
25#include "libavutil/tx.h"
27
28#include "enc.h"
29#include "celt.h"
30#include "enc_utils.h"
31
32/* Each step is 2.5ms */
33typedef struct OpusPsyStep {
34 int index; /* Current index */
36 float energy[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]; /* Masking effects included */
37 float tone[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]; /* Tonality */
38 float stereo[CELT_MAX_BANDS]; /* IS/MS compatibility */
39 float change_amp[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]; /* Jump over last frame */
40 float total_change; /* Total change */
41
45
51
86
91
93 struct FFBufQueue *bufqueue, OpusEncOptions *options);
96
97#endif /* AVCODEC_OPUS_ENC_PSY_H */
#define FF_BUFQUEUE_SIZE
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
#define CELT_MAX_BANDS
Definition celt.h:43
@ CELT_BLOCK_NB
Definition celt.h:68
@ CELT_BLOCK_960
Definition celt.h:66
long long int64_t
Definition coverity.c:34
#define OPUS_MAX_CHANNELS
Definition enc.h:34
#define OPUS_BLOCK_SIZE(x)
Definition enc.h:39
int ff_opus_psy_init(OpusPsyContext *s, AVCodecContext *avctx, struct FFBufQueue *bufqueue, OpusEncOptions *options)
Definition enc_psy.c:561
void ff_opus_psy_postencode_update(OpusPsyContext *s, CeltFrame *f)
Definition enc_psy.c:524
int ff_opus_psy_end(OpusPsyContext *s)
Definition enc_psy.c:642
int ff_opus_psy_celt_frame_process(OpusPsyContext *s, CeltFrame *f, int index)
Definition enc_psy.c:502
int ff_opus_psy_process(OpusPsyContext *s, OpusPacketInfo *p)
Definition enc_psy.c:254
void ff_opus_psy_signal_eof(OpusPsyContext *s)
Definition enc_psy.c:637
void ff_opus_psy_celt_frame_init(OpusPsyContext *s, CeltFrame *f, int index)
Definition enc_psy.c:288
int index
Definition gxfenc.c:90
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
main external API structure.
Definition avcodec.h:443
Structure holding the queue.
Definition bufferqueue.h:49
float excitation_dist
Definition enc_psy.h:48
float excitation_init
Definition enc_psy.h:49
int bsize_analysis
Definition enc_psy.h:68
int * inflection_points
Definition enc_psy.h:83
int64_t dual_stereo_used
Definition enc_psy.h:74
float scratch[2048]
Definition enc_psy.h:70
OpusPacketInfo p
Definition enc_psy.h:78
OpusEncOptions * options
Definition enc_psy.h:56
int buffered_steps
Definition enc_psy.h:79
int steps_to_process
Definition enc_psy.h:80
FFBesselFilter bfilter_lo[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:59
float avg_is_band
Definition enc_psy.h:73
float * window[CELT_BLOCK_NB]
Definition enc_psy.h:65
AVCodecContext * avctx
Definition enc_psy.h:53
OpusBandExcitation ex[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:58
FFBesselFilter bfilter_hi[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:60
float lambda
Definition enc_psy.h:82
int64_t total_packets_out
Definition enc_psy.h:75
AVTXContext * mdct[CELT_BLOCK_NB]
Definition enc_psy.h:66
struct FFBufQueue * bufqueue
Definition enc_psy.h:55
OpusPsyStep * steps[FF_BUFQUEUE_SIZE+1]
Definition enc_psy.h:62
AVFloatDSPContext * dsp
Definition enc_psy.h:54
int inflection_points_count
Definition enc_psy.h:84
av_tx_fn mdct_fn[CELT_BLOCK_NB]
Definition enc_psy.h:67
float coeffs[OPUS_MAX_CHANNELS][OPUS_BLOCK_SIZE(CELT_BLOCK_960)]
Definition enc_psy.h:43
float tone[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:37
int index
Definition enc_psy.h:34
float stereo[CELT_MAX_BANDS]
Definition enc_psy.h:38
float change_amp[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:39
int silence
Definition enc_psy.h:35
float * bands[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:42
float energy[OPUS_MAX_CHANNELS][CELT_MAX_BANDS]
Definition enc_psy.h:36
float total_change
Definition enc_psy.h:40
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition tx.h:151