mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-27 18:02:11 +00:00
5f47c85e5c
This marks the first time anyone has written an Opus encoder without using any libopus code. The aim of the encoder is to prove how far the format can go by writing the craziest encoder for it. Right now the encoder's basic, it only supports CBR encoding, however internally every single feature the CELT layer has is implemented (except the pitch pre-filter which needs to work well with the rest of whatever gets implemented). Psychoacoustic and rate control systems are under development. The encoder takes in frames of 120 samples and depending on the value of opus_delay the plan is to use the extra buffered frames as lookahead. Right now the encoder will pick the nearest largest legal frame size and won't use the lookahead, but that'll change once there's a psychoacoustic system. Even though its a pretty basic encoder its already outperforming any other native encoder FFmpeg has by a huge amount. The PVQ search algorithm is faster and more accurate than libopus's algorithm so the encoder's performance is close to that of libopus at zero complexity (libopus has more SIMD). The algorithm might be ported to libopus or other codecs using PVQ in the future. The encoder still has a few minor bugs, like desyncs at ultra low bitrates (below 9kbps with 20ms frames). Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
42 lines
1.7 KiB
C
42 lines
1.7 KiB
C
/*
|
|
* Copyright (c) 2012 Andrew D'Addesio
|
|
* Copyright (c) 2013-2014 Mozilla Corporation
|
|
* Copyright (c) 2016 Rostislav Pehlivanov <atomnuker@gmail.com>
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
#ifndef AVCODEC_OPUS_PVQ_H
|
|
#define AVCODEC_OPUS_PVQ_H
|
|
|
|
#include "opus.h"
|
|
#include "opus_celt.h"
|
|
|
|
/* Decodes a band using PVQ */
|
|
uint32_t ff_celt_decode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
|
|
float *X, float *Y, int N, int b, uint32_t blocks,
|
|
float *lowband, int duration, float *lowband_out, int level,
|
|
float gain, float *lowband_scratch, int fill);
|
|
|
|
/* Encodes a band using PVQ */
|
|
uint32_t ff_celt_encode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
|
|
float *X, float *Y, int N, int b, uint32_t blocks,
|
|
float *lowband, int duration, float *lowband_out, int level,
|
|
float gain, float *lowband_scratch, int fill);
|
|
|
|
#endif /* AVCODEC_OPUS_PVQ_H */
|