zenilib: zenilib/jni/external/libvorbis/lib/psy.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
psy.c File Reference
`#include <stdlib.h>`
`#include <math.h>`
`#include <string.h>`
`#include "vorbis/codec.h"`
`#include "codec_internal.h"`
`#include "masking.h"`
`#include "psy.h"`
`#include "os.h"`
`#include "lpc.h"`
`#include "smallft.h"`
`#include "scales.h"`
`#include "misc.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | NEGINF -9999.f

## Functions

void | _vi_gpsy_free (vorbis_info_psy_global *i)
void | _vi_psy_free (vorbis_info_psy *i)
float | _vp_ampmax_decay (float amp, vorbis_dsp_state *vd)
void | _vp_couple_quantize_normalize (int blobno, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct, int **iwork, int *nonzero, int sliding_lowpass, int ch)
void | _vp_global_free (vorbis_look_psy_global *look)
vorbis_look_psy_global * | _vp_global_look (vorbis_info *vi)
void | _vp_noisemask (vorbis_look_psy *p, float *logmdct, float *logmask)
void | _vp_offset_and_mix (vorbis_look_psy *p, float *noise, float *tone, int offset_select, float *logmask, float *mdct, float *logmdct)
void | _vp_psy_clear (vorbis_look_psy *p)
void | _vp_psy_init (vorbis_look_psy *p, vorbis_info_psy *vi, vorbis_info_psy_global *gi, int n, long rate)
void | _vp_tonemask (vorbis_look_psy *p, float *logfft, float *logmask, float global_specmax, float local_specmax)
static int | apsort (const void *a, const void *b)
static void | attenuate_curve (float *c, float att)
static void | bark_noise_hybridmp (int n, const long *b, const float *f, float *noise, const float offset, const int fixed)
static void | flag_lossless (int limit, float prepoint, float postpoint, float *mdct, float *floor, int *flag, int i, int jn)
static void | max_curve (float *c, float *c2)
static void | max_seeds (vorbis_look_psy *p, float *seed, float *flr)
static void | min_curve (float *c, float *c2)
static float | noise_normalize (vorbis_look_psy *p, int limit, float *r, float *q, float *f, int *flags, float acc, int i, int n, int *out)
static void | seed_chase (float *seeds, int linesper, long n)
static void | seed_curve (float *seed, const float **curves, float amp, int oc, int n, int linesper, float dBoffset)
static void | seed_loop (vorbis_look_psy *p, const float ***curves, const float *f, const float *flr, float *seed, float specmax)
static float *** | setup_tone_curves (float curveatt_dB[P_BANDS], float binHz, int n, float center_boost, float center_decay_rate)

## Variables

static float | FLOOR1_fromdB_LOOKUP [256]
static const double | stereo_threshholds [] ={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}
static const double | stereo_threshholds_limited [] ={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}

## Macro Definition Documentation

#define NEGINF -9999.f

Definition at line 32 of file psy.c.

Referenced by _vp_tonemask(), and max_seeds().

## Function Documentation

void _vi_gpsy_free | ( | vorbis_info_psy_global * | i | ) |

Definition at line 55 of file psy.c.

References _ogg_free, and memset.

void _vi_psy_free | ( | vorbis_info_psy * | i | ) |

Definition at line 62 of file psy.c.

References _ogg_free, and memset.

Referenced by vorbis_info_clear().

float _vp_ampmax_decay | ( | float | amp,
|  | vorbis_dsp_state * | vd
| ) |  |

Definition at line 830 of file psy.c.

References vorbis_info_psy_global::ampmax_att_per_sec, codec_setup_info::blocksizes, vorbis_info::codec_setup, codec_setup_info::psy_g_param, vorbis_info::rate, vorbis_dsp_state::vi, vi, and vorbis_dsp_state::W.

Referenced by vorbis_analysis_blockout().

void _vp_couple_quantize_normalize | ( | int | blobno,
|  | vorbis_info_psy_global * | g,
|  | vorbis_look_psy * | p,
|  | vorbis_info_mapping0 * | vi,
|  | float ** | mdct,
|  | int ** | iwork,
|  | int * | nonzero,
|  | int | sliding_lowpass,
|  | int | ch
| ) |  |

@ M2 ** The boost problem by the combination of noise normalization and point stereo is eased. However, this is a temporary patch. by Aoyumi @ 2004/04/18

Definition at line 1007 of file psy.c.

References vorbis_info_psy::blockflag, vorbis_info_mapping0::coupling_ang, vorbis_info_mapping0::coupling_mag, vorbis_info_psy_global::coupling_pointlimit, vorbis_info_psy_global::coupling_postpointamp, vorbis_info_psy_global::coupling_prepointamp, vorbis_info_mapping0::coupling_steps, e, fabs(), flag_lossless(), floor(), FLOOR1_fromdB_LOOKUP, i, j, k, vorbis_look_psy::m_val, memcpy, memset, vorbis_look_psy::n, noise_normalize(), vorbis_info_psy::normal_p, vorbis_info_psy::normal_partition, NULL, stereo_threshholds, stereo_threshholds_limited, and vorbis_look_psy::vi.

Referenced by mapping0_forward().

void _vp_global_free | ( | vorbis_look_psy_global * | look | ) |

Definition at line 48 of file psy.c.

References _ogg_free, and memset.

Referenced by vorbis_dsp_clear().

vorbis_look_psy_global* _vp_global_look | ( | vorbis_info * | vi | ) |

Definition at line 36 of file psy.c.

References _ogg_calloc, vorbis_look_psy_global::ampmax, vorbis_info::channels, vorbis_look_psy_global::channels, vorbis_info::codec_setup, vorbis_look_psy_global::gi, and codec_setup_info::psy_g_param.

Referenced by main(), and vorbis_analysis_init().

void _vp_noisemask | ( | vorbis_look_psy * | p,
|  | float * | logmdct,
|  | float * | logmask
| ) |  |

Definition at line 699 of file psy.c.

References vorbis_look_psy::bark, bark_noise_hybridmp(), i, vorbis_look_psy::n, NOISE_COMPAND_LEVELS, vorbis_info_psy::noisecompand, vorbis_info_psy::noisewindowfixed, and vorbis_look_psy::vi.

Referenced by mapping0_forward().

void _vp_offset_and_mix | ( | vorbis_look_psy * | p,
|  | float * | noise,
|  | float * | tone,
|  | int | offset_select,
|  | float * | logmask,
|  | float * | mdct,
|  | float * | logmdct
| ) |  |

@ M1 ** The following codes improve a noise problem. A fundamental idea uses the value of masking and carries out the relative compensation of the MDCT. However, this code is not perfect and all noise problems cannot be solved. by Aoyumi @ 2004/04/18

Definition at line 772 of file psy.c.

References i, vorbis_look_psy::m_val, max, vorbis_look_psy::n, vorbis_info_psy::noisemaxsupp, vorbis_look_psy::noiseoffset, vorbis_info_psy::tone_masteratt, and vorbis_look_psy::vi.

Referenced by mapping0_forward().

void _vp_psy_clear | ( | vorbis_look_psy * | p | ) |

Definition at line 361 of file psy.c.

References _ogg_free, vorbis_look_psy::ath, vorbis_look_psy::bark, i, j, memset, vorbis_look_psy::noiseoffset, vorbis_look_psy::octave, P_BANDS, P_LEVELS, P_NOISECURVES, and vorbis_look_psy::tonecurves.

Referenced by vorbis_dsp_clear().

void _vp_psy_init | ( | vorbis_look_psy * | p,
|  | vorbis_info_psy * | vi,
|  | vorbis_info_psy_global * | gi,
|  | int | n,
|  | long | rate
| ) |  |

Definition at line 267 of file psy.c.

References _ogg_malloc, ATH, vorbis_look_psy::ath, vorbis_look_psy::bark, vorbis_info_psy_global::eighth_octave_lines, vorbis_look_psy::eighth_octave_lines, vorbis_look_psy::firstoc, fromOC, cordic::hi, i, int, j, cordic::lo, vorbis_look_psy::m_val, MAX_ATH, memset, vorbis_look_psy::n, vorbis_info_psy::noiseoff, vorbis_look_psy::noiseoffset, vorbis_info_psy::noisewindowhi, vorbis_info_psy::noisewindowhimin, vorbis_info_psy::noisewindowlo, vorbis_info_psy::noisewindowlomin, vorbis_look_psy::octave, P_BANDS, P_NOISECURVES, vorbis_look_psy::rate, setup_tone_curves(), vorbis_look_psy::shiftoc, toBARK, vorbis_info_psy::tone_centerboost, vorbis_info_psy::tone_decay, vorbis_info_psy::toneatt, vorbis_look_psy::tonecurves, toOC, vorbis_look_psy::total_octave_lines, vorbis_look_psy::vi, and vi.

Referenced by _vds_shared_init(), and main().

void _vp_tonemask | ( | vorbis_look_psy * | p,
|  | float * | logfft,
|  | float * | logmask,
|  | float | global_specmax,
|  | float | local_specmax
| ) |  |

Definition at line 747 of file psy.c.

References vorbis_look_psy::ath, vorbis_info_psy::ath_adjatt, vorbis_info_psy::ath_maxatt, i, max_seeds(), vorbis_look_psy::n, NEGINF, seed_loop(), vorbis_look_psy::tonecurves, vorbis_look_psy::total_octave_lines, vorbis_look_psy::vi, and vi.

Referenced by mapping0_forward().

static int apsort | ( | const void * | a,
|  | const void * | b
| ) |  |

static

Definition at line 911 of file psy.c.

Referenced by noise_normalize().

static void attenuate_curve | ( | float * | c,
|  | float | att
| ) |  |

static

Definition at line 80 of file psy.c.

References EHMER_MAX, and i.

Referenced by setup_tone_curves().

static void bark_noise_hybridmp | ( | int | n,
|  | const long * | b,
|  | const float * | f,
|  | float * | noise,
|  | const float | offset,
|  | const int | fixed
| ) |  |

static

Definition at line 544 of file psy.c.

References cordic::hi, i, cordic::lo, R, and XX.

Referenced by _vp_noisemask().

static void flag_lossless | ( | int | limit,
|  | float | prepoint,
|  | float | postpoint,
|  | float * | mdct,
|  | float * | floor,
|  | int * | flag,
|  | int | i,
|  | int | jn
| ) |  |

static

Definition at line 917 of file psy.c.

References fabs(), and j.

Referenced by _vp_couple_quantize_normalize().

static void max_curve | ( | float * | c,
|  | float * | c2
| ) |  |

static

Definition at line 74 of file psy.c.

References i.

Referenced by setup_tone_curves().

static void max_seeds | ( | vorbis_look_psy * | p,
|  | float * | seed,
|  | float * | flr
| ) |  |

static

Definition at line 509 of file psy.c.

References vorbis_look_psy::eighth_octave_lines, vorbis_look_psy::firstoc, vorbis_look_psy::n, NEGINF, vorbis_look_psy::octave, seed_chase(), vorbis_info_psy::tone_abs_limit, vorbis_look_psy::total_octave_lines, and vorbis_look_psy::vi.

Referenced by _vp_tonemask().

static void min_curve | ( | float * | c,
|  | float * | c2
| ) |  |

static

Definition at line 69 of file psy.c.

References EHMER_MAX, and i.

Referenced by setup_tone_curves().

static float noise_normalize | ( | vorbis_look_psy * | p,
|  | int | limit,
|  | float * | r,
|  | float * | q,
|  | float * | f,
|  | int * | flags,
|  | float | acc,
|  | int | i,
|  | int | n,
|  | int * | out
| ) |  |

static

Definition at line 934 of file psy.c.

References apsort(), j, k, vorbis_info_psy::normal_p, vorbis_info_psy::normal_start, vorbis_info_psy::normal_thresh, qsort(), unitnorm(), vorbis_look_psy::vi, and vi.

Referenced by _vp_couple_quantize_normalize().

static void seed_chase | ( | float * | seeds,
|  | int | linesper,
|  | long | n
| ) |  |

static

Definition at line 451 of file psy.c.

References i.

Referenced by max_seeds().

static void seed_curve | ( | float * | seed,
|  | const float ** | curves,
|  | float | amp,
|  | int | oc,
|  | int | n,
|  | int | linesper,
|  | float | dBoffset
| ) |  |

static

Definition at line 387 of file psy.c.

References EHMER_OFFSET, i, int, max, min, P_LEVEL_0, and P_LEVELS.

Referenced by seed_loop().

static void seed_loop | ( | vorbis_look_psy * | p,
|  | const float *** | curves,
|  | const float * | f,
|  | const float * | flr,
|  | float * | seed,
|  | float | specmax
| ) |  |

static

Definition at line 414 of file psy.c.

References vorbis_look_psy::eighth_octave_lines, vorbis_look_psy::firstoc, i, max, vorbis_info_psy::max_curve_dB, vorbis_look_psy::n, vorbis_look_psy::octave, P_BANDS, seed_curve(), vorbis_look_psy::shiftoc, vorbis_look_psy::total_octave_lines, vorbis_look_psy::vi, and vi.

Referenced by _vp_tonemask().

static float*** setup_tone_curves | ( | float | curveatt_dB[P_BANDS],
|  | float | binHz,
|  | int | n,
|  | float | center_boost,
|  | float | center_decay_rate
| ) |  |

static

Definition at line 86 of file psy.c.

References _ogg_malloc, ATH, attenuate_curve(), EHMER_MAX, EHMER_OFFSET, floor(), fromOC, i, j, k, m, MAX_ATH, max_curve(), memcpy, memset, min, min_curve(), P_BANDS, P_LEVEL_0, P_LEVELS, ret, tonemasks, and toOC.

Referenced by _vp_psy_init().

## Variable Documentation

float FLOOR1_fromdB_LOOKUP[256]

static

Definition at line 843 of file psy.c.

Referenced by _vp_couple_quantize_normalize().

const double stereo_threshholds[] ={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}

static

Definition at line 33 of file psy.c.

Referenced by _vp_couple_quantize_normalize().

const double stereo_threshholds_limited[] ={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}

static

Definition at line 34 of file psy.c.

Referenced by _vp_couple_quantize_normalize().