#include <math.h>
#include <stdint.h>
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "twinvq.h"
#include "twinvq_data.h"
Go to the source code of this file.
|
| static int | very_broken_op (int a, int b) |
| | Evaluate a * b / 400 rounded to the nearest integer.
|
| |
| static void | add_peak (int period, int width, const float *shape, float ppc_gain, float *speech, int len) |
| | Sum to data a periodic peak of a given period, width and shape.
|
| |
| static void | decode_ppc (TwinVQContext *tctx, int period_coef, int g_coef, const float *shape, float *speech) |
| |
| static void | dec_bark_env (TwinVQContext *tctx, const uint8_t *in, int use_hist, int ch, float *out, float gain, enum TwinVQFrameType ftype) |
| |
| static void | read_cb_data (TwinVQContext *tctx, GetBitContext *gb, uint8_t *dst, enum TwinVQFrameType ftype) |
| |
| static int | twinvq_read_bitstream (AVCodecContext *avctx, TwinVQContext *tctx, const uint8_t *buf, int buf_size) |
| |
| static av_cold int | twinvq_decode_init (AVCodecContext *avctx) |
| |
◆ very_broken_op()
| static int very_broken_op |
( |
int | a, |
|
|
int | b ) |
|
static |
Evaluate a * b / 400 rounded to the nearest integer.
When, for example, a * b == 200 and the nearest integer is ill-defined, use a table to emulate the following broken float-based implementation used by the binary decoder:
{
}
static int very_broken_op(int a, int b)
Evaluate a * b / 400 rounded to the nearest integer.
- Note
- if this function is replaced by just ROUNDED_DIV(a * b, 400.0), the stddev between the original file (before encoding with Yamaha encoder) and the decoded output increases, which leads one to believe that the encoder expects exactly this broken calculation.
Definition at line 133 of file twinvqdec.c.
Referenced by add_peak().
◆ add_peak()
| static void add_peak |
( |
int | period, |
|
|
int | width, |
|
|
const float * | shape, |
|
|
float | ppc_gain, |
|
|
float * | speech, |
|
|
int | len ) |
|
static |
Sum to data a periodic peak of a given period, width and shape.
- Parameters
-
| period | the period of the peak divided by 400.0 |
Definition at line 154 of file twinvqdec.c.
Referenced by decode_ppc().
◆ decode_ppc()
◆ dec_bark_env()
◆ read_cb_data()
◆ twinvq_read_bitstream()
◆ twinvq_decode_init()
◆ mode_08_08
Initial value:= {
{
},
512, 12,
ff_metasound_lsp8, 1, 5, 3, 3,
tab.
shape08, 8, 28, 20, 6, 40
}
static const uint16_t bark_tab_s08_64[]
static const struct twinvq_data tab
static const uint16_t bark_tab_m08_256[]
static const uint16_t bark_tab_l08_512[]
Definition at line 32 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_11_08
Initial value:= {
{
},
512, 16,
ff_metasound_lsp11, 1, 6, 4, 3,
tab.
shape11, 9, 36, 30, 7, 90
}
Definition at line 41 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_11_10
Initial value:= {
{
},
512, 16,
ff_metasound_lsp11, 1, 6, 4, 3,
tab.
shape11, 9, 36, 30, 7, 90
}
Definition at line 50 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_16_16
Initial value:= {
{
},
1024, 16,
ff_metasound_lsp16, 1, 6, 4, 3,
tab.
shape16, 9, 56, 60, 7, 180
}
Definition at line 59 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_22_20
Initial value:= {
{
},
1024, 16,
ff_metasound_lsp22, 1, 6, 4, 3,
tab.
shape22_1, 9, 56, 36, 7, 144
}
Definition at line 68 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_22_24
Initial value:= {
{
},
1024, 16,
ff_metasound_lsp22, 1, 6, 4, 3,
tab.
shape22_1, 9, 56, 36, 7, 144
}
Definition at line 77 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_22_32
Initial value:= {
{
},
512, 16,
tab.
lsp22_2, 1, 6, 4, 4,
tab.
shape22_2, 9, 56, 36, 7, 72
}
static const uint16_t bark_tab_l22_512[]
static const uint16_t bark_tab_m22_256[]
Definition at line 86 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_44_40
Initial value:= {
{
},
2048, 20,
ff_metasound_lsp44, 1, 6, 4, 4,
tab.
shape44, 9, 84, 54, 7, 432
}
Definition at line 95 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ mode_44_48
Initial value:= {
{
},
2048, 20,
ff_metasound_lsp44, 1, 6, 4, 4,
tab.
shape44, 9, 84, 54, 7, 432
}
Definition at line 104 of file twinvqdec.c.
Referenced by twinvq_decode_init().
◆ ff_twinvq_decoder
Initial value:= {
.p.name = "twinvq",
}
static av_cold void close(AVCodecParserContext *s)
#define FF_CODEC_DECODE_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...
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_twinvq_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
av_cold int ff_twinvq_decode_close(AVCodecContext *avctx)
static av_cold int twinvq_decode_init(AVCodecContext *avctx)
Definition at line 416 of file twinvqdec.c.