FFmpeg
|
#include <math.h>
#include <stdint.h>
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "fft.h"
#include "internal.h"
#include "lsp.h"
#include "sinewin.h"
#include "twinvq.h"
Go to the source code of this file.
Functions | |
static float | eval_lpc_spectrum (const float *lsp, float cos_val, int order) |
Evaluate a single LPC amplitude spectrum envelope coefficient from the line spectrum pairs. More... | |
static void | eval_lpcenv (TwinVQContext *tctx, const float *cos_vals, float *lpc) |
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs. More... | |
static void | interpolate (float *out, float v1, float v2, int size) |
static float | get_cos (int idx, int part, const float *cos_tab, int size) |
static void | eval_lpcenv_or_interp (TwinVQContext *tctx, enum TwinVQFrameType ftype, float *out, const float *in, int size, int step, int part) |
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs. More... | |
static void | eval_lpcenv_2parts (TwinVQContext *tctx, enum TwinVQFrameType ftype, const float *buf, float *lpc, int size, int step) |
static void | dequant (TwinVQContext *tctx, const uint8_t *cb_bits, float *out, enum TwinVQFrameType ftype, const int16_t *cb0, const int16_t *cb1, int cb_len) |
Inverse quantization. More... | |
static void | dec_gain (TwinVQContext *tctx, enum TwinVQFrameType ftype, float *out) |
static void | rearrange_lsp (int order, float *lsp, float min_dist) |
Rearrange the LSP coefficients so that they have a minimum distance of min_dist. More... | |
static void | decode_lsp (TwinVQContext *tctx, int lpc_idx1, uint8_t *lpc_idx2, int lpc_hist_idx, float *lsp, float *hist) |
static void | dec_lpc_spectrum_inv (TwinVQContext *tctx, float *lsp, enum TwinVQFrameType ftype, float *lpc) |
static void | imdct_and_window (TwinVQContext *tctx, enum TwinVQFrameType ftype, int wtype, float *in, float *prev, int ch) |
static void | imdct_output (TwinVQContext *tctx, enum TwinVQFrameType ftype, int wtype, float **out, int offset) |
static void | read_and_decode_spectrum (TwinVQContext *tctx, float *out, enum TwinVQFrameType ftype) |
int | ff_twinvq_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) |
static av_cold int | init_mdct_win (TwinVQContext *tctx) |
Init IMDCT and windowing tables. More... | |
static void | permutate_in_line (int16_t *tab, int num_vect, int num_blocks, int block_size, const uint8_t line_len[2], int length_div, enum TwinVQFrameType ftype) |
Interpret the data as if it were a num_blocks x line_len[0] matrix and for each line do a cyclic permutation, i.e. More... | |
static void | transpose_perm (int16_t *out, int16_t *in, int num_vect, const uint8_t line_len[2], int length_div) |
Interpret the input data as in the following table: More... | |
static void | linear_perm (int16_t *out, int16_t *in, int n_blocks, int size) |
static av_cold void | construct_perm_table (TwinVQContext *tctx, enum TwinVQFrameType ftype) |
static av_cold void | init_bitstream_params (TwinVQContext *tctx) |
av_cold int | ff_twinvq_decode_close (AVCodecContext *avctx) |
av_cold int | ff_twinvq_decode_init (AVCodecContext *avctx) |
Variables | |
static const uint8_t | wtype_to_wsize [] = { 0, 0, 2, 2, 2, 1, 0, 1, 1 } |
enum TwinVQFrameType | ff_twinvq_wtype_to_ftype_table [] |
|
static |
Evaluate a single LPC amplitude spectrum envelope coefficient from the line spectrum pairs.
lsp | a vector of the cosine of the LSP values |
cos_val | cos(PI*i/N) where i is the index of the LPC amplitude |
order | the order of the LSP (and the size of the *lsp buffer). Must be a multiple of four. |
Definition at line 46 of file twinvq.c.
Referenced by eval_lpcenv(), and eval_lpcenv_or_interp().
|
static |
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs.
Definition at line 71 of file twinvq.c.
Referenced by dec_lpc_spectrum_inv().
|
static |
Definition at line 84 of file twinvq.c.
Referenced by avfilter_transform(), bayer_to_rgb24_wrapper(), bayer_to_rgb48_wrapper(), bayer_to_yv12_wrapper(), blend_frames(), deshake_transform_c(), eval_lpcenv_2parts(), eval_lpcenv_or_interp(), and process_work_frame().
Definition at line 95 of file twinvq.c.
Referenced by eval_lpcenv_or_interp().
|
inlinestatic |
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs.
Probably for speed reasons, the coefficients are evaluated as siiiibiiiisiiiibiiiisiiiibiiiisiiiibiiiis ... where s is an evaluated value, i is a value interpolated from the others and b might be either calculated or interpolated, depending on an unexplained condition.
step | the size of a block "siiiibiiii" |
in | the cosine of the LSP data |
part | is 0 for 0...PI (positive cosine values) and 1 for PI...2PI (negative cosine values) |
size | the size of the whole output |
Definition at line 115 of file twinvq.c.
Referenced by eval_lpcenv_2parts().
|
static |
Definition at line 152 of file twinvq.c.
Referenced by dec_lpc_spectrum_inv().
|
static |
Inverse quantization.
Read CB coefficients for cb1 and cb2 from the bitstream, sum the corresponding vectors and write the result to *out after permutation.
Definition at line 172 of file twinvq.c.
Referenced by read_and_decode_spectrum().
|
static |
Definition at line 214 of file twinvq.c.
Referenced by read_and_decode_spectrum().
|
static |
Rearrange the LSP coefficients so that they have a minimum distance of min_dist.
This function does it exactly as described in section of 3.2.4 of the G.729 specification (but interestingly is different from what the reference decoder actually does).
Definition at line 250 of file twinvq.c.
Referenced by decode_lsp().
|
static |
Definition at line 263 of file twinvq.c.
Referenced by read_and_decode_spectrum().
|
static |
Definition at line 303 of file twinvq.c.
Referenced by read_and_decode_spectrum().
|
static |
Definition at line 327 of file twinvq.c.
Referenced by imdct_output(), and spectral_to_sample().
|
static |
Definition at line 378 of file twinvq.c.
Referenced by ff_twinvq_decode_frame().
|
static |
Definition at line 412 of file twinvq.c.
Referenced by ff_twinvq_decode_frame().
int ff_twinvq_decode_frame | ( | AVCodecContext * | avctx, |
void * | data, | ||
int * | got_frame_ptr, | ||
AVPacket * | avpkt | ||
) |
|
static |
Init IMDCT and windowing tables.
Definition at line 533 of file twinvq.c.
Referenced by ff_twinvq_decode_init().
|
static |
Interpret the data as if it were a num_blocks x line_len[0] matrix and for each line do a cyclic permutation, i.e.
abcdefghijklm -> defghijklmabc where the amount to be shifted is evaluated depending on the column.
Definition at line 580 of file twinvq.c.
Referenced by construct_perm_table().
|
static |
Interpret the input data as in the following table:
* * abcdefgh * ijklmnop * qrstuvw * x123456 * *
and transpose it, giving the output aiqxbjr1cks2dlt3emu4fvn5gow6hp
Definition at line 620 of file twinvq.c.
Referenced by construct_perm_table(), and load_native_model().
Definition at line 631 of file twinvq.c.
Referenced by construct_perm_table().
|
static |
Definition at line 640 of file twinvq.c.
Referenced by init_bitstream_params().
|
static |
Definition at line 666 of file twinvq.c.
Referenced by ff_twinvq_decode_init().
av_cold int ff_twinvq_decode_close | ( | AVCodecContext * | avctx | ) |
Definition at line 741 of file twinvq.c.
Referenced by ff_twinvq_decode_init().
av_cold int ff_twinvq_decode_init | ( | AVCodecContext * | avctx | ) |
Definition at line 760 of file twinvq.c.
Referenced by metasound_decode_init(), and twinvq_decode_init().
|
static |
Definition at line 325 of file twinvq.c.
Referenced by imdct_and_window().
enum TwinVQFrameType ff_twinvq_wtype_to_ftype_table[] |
Definition at line 470 of file twinvq.c.
Referenced by metasound_read_bitstream(), and twinvq_read_bitstream().