summaryrefslogtreecommitdiff
path: root/apps/codecs/libmusepack
ModeNameSize
-rw-r--r--AUTHORS284logplain
-rw-r--r--COPYING1563logplain
-rw-r--r--ChangeLog295logplain
-rw-r--r--Makefile1402logplain
-rw-r--r--README161logplain
-rw-r--r--README.rockbox925logplain
-rw-r--r--SOURCES128logplain
-rw-r--r--config-mpc.h2951logplain
-rw-r--r--config_types.h2008logplain
-rw-r--r--decoder.h5150logplain
-rw-r--r--huffman.h1995logplain
-rw-r--r--huffsv46.c5994logplain
-rw-r--r--huffsv7.c9913logplain
-rw-r--r--idtag.c2870logplain
-rw-r--r--internal.h2725logplain
-rw-r--r--mainpage.h1876logplain
-rw-r--r--math.h9479logplain
-rwxr-xr-xmpc_config.h1741logplain
-rw-r--r--mpc_decoder.c63412logplain
-rw-r--r--musepack.h5693logplain
-rw-r--r--reader.h3069logplain
-rw-r--r--requant.c5742logplain
-rw-r--r--requant.h2486logplain
-rw-r--r--streaminfo.c9475logplain
-rw-r--r--streaminfo.h3994logplain
-rw-r--r--synth_filter.c32237logplain
-rwxr-xr-xsynth_filter_arm.S13625logplain
02' href='#n402'>402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
/********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
 *                                                                  *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
 *                                                                  *
 ********************************************************************

 function: floor backend 0 implementation

 ********************************************************************/

#include "config-tremor.h"
#include <string.h>
#include <math.h>
#include "ogg.h"
#include "ivorbiscodec.h"
#include "codec_internal.h"
#include "registry.h"
#include "codebook.h"
#include "misc.h"
#include "os.h"

#define LSP_FRACBITS 14

typedef struct {
  long n;
  int ln;
  int  m;
  int *linearmap;

  vorbis_info_floor0 *vi;
  ogg_int32_t *lsp_look;

} vorbis_look_floor0;

/*************** LSP decode ********************/

#include "lsp_lookup.h"

/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
   16.16 format 
   returns in m.8 format */

static const long ADJUST_SQRT2[2] ICONST_ATTR ={8192,5792};
static inline ogg_int32_t vorbis_invsqlook_i(long a,long e){
  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); 
  long d=a&INVSQ_LOOKUP_I_MASK;                              /*  0.10 */
  long val=INVSQ_LOOKUP_I[i]-                                /*  1.16 */
    ((INVSQ_LOOKUP_IDel[i]*d)>>INVSQ_LOOKUP_I_SHIFT);        /* result 1.16 */
  val*=ADJUST_SQRT2[e&1];
  e=(e>>1)+21;
  return(val>>e);
}

/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
/* a is in n.12 format */
static inline ogg_int32_t vorbis_fromdBlook_i(long a){
  int i=(-a)>>(12-FROMdB2_SHIFT);
  if(i<0) return 0x7fffffff;
  if(i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))return 0;
  
  return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
}

/* interpolated lookup based cos function, domain 0 to PI only */
/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
static inline ogg_int32_t vorbis_coslook_i(long a){
  int i=a>>COS_LOOKUP_I_SHIFT;
  int d=a&COS_LOOKUP_I_MASK;
  return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
			   COS_LOOKUP_I_SHIFT);
}

/* interpolated lookup based cos function */
/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */
static inline ogg_int32_t vorbis_coslook2_i(long a){
  a=a&0x1ffff;

  if(a>0x10000)a=0x20000-a;
  {               
    int i=a>>COS_LOOKUP_I_SHIFT;
    int d=a&COS_LOOKUP_I_MASK;
    a=((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
       d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
      (COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
  }
  
  return(a);
}

static const int barklook[28] IDATA_ATTR ={
  0,100,200,301,          405,516,635,766,
  912,1077,1263,1476,     1720,2003,2333,2721,
  3184,3742,4428,5285,    6376,7791,9662,12181,
  15624,20397,27087,36554
};