misc/libtremor/tremor/mapping0.c
author koda
Tue, 02 Apr 2013 23:02:06 +0200
changeset 8832 4e9728dcebeb
parent 7849 a12155461b34
permissions -rw-r--r--
fix osx build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     1
/********************************************************************
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     2
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     3
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     4
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     5
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     6
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     7
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     8
 *                                                                  *
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
     9
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    10
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    11
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    12
 ********************************************************************
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    13
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    14
 function: channel mapping 0 implementation
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    15
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    16
 ********************************************************************/
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    17
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    18
#include <stdlib.h>
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    19
#include <stdio.h>
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    20
#include <string.h>
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    21
#include <math.h>
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    22
#include "ogg.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    23
#include "ivorbiscodec.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    24
#include "mdct.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    25
#include "codec_internal.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    26
#include "codebook.h"
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    27
#include "window.h"
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    28
#include "registry.h"
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    29
#include "misc.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    30
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    31
/* simplistic, wasteful way of doing this (unique lookup for each
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    32
   mode/submapping); there should be a central repository for
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    33
   identical lookups.  That will require minor work, so I'm putting it
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    34
   off as low priority.
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    35
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    36
   Why a lookup for each backend in a given mode?  Because the
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    37
   blocksize is set by the mode, and low backend lookups may require
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    38
   parameters from other areas of the mode/mapping */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    39
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    40
typedef struct {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    41
  vorbis_info_mode *mode;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    42
  vorbis_info_mapping0 *map;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    43
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    44
  vorbis_look_floor **floor_look;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    45
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    46
  vorbis_look_residue **residue_look;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    47
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    48
  vorbis_func_floor **floor_func;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    49
  vorbis_func_residue **residue_func;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    50
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    51
  int ch;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    52
  long lastframe; /* if a different mode is called, we need to 
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    53
		     invalidate decay */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    54
} vorbis_look_mapping0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    55
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    56
static void mapping0_free_info(vorbis_info_mapping *i){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    57
  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    58
  if(info){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    59
    memset(info,0,sizeof(*info));
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    60
    _ogg_free(info);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    61
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    62
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    63
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    64
static void mapping0_free_look(vorbis_look_mapping *look){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    65
  int i;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    66
  vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    67
  if(l){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    68
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    69
    for(i=0;i<l->map->submaps;i++){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    70
      l->floor_func[i]->free_look(l->floor_look[i]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    71
      l->residue_func[i]->free_look(l->residue_look[i]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    72
    }
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    73
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    74
    _ogg_free(l->floor_func);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    75
    _ogg_free(l->residue_func);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    76
    _ogg_free(l->floor_look);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    77
    _ogg_free(l->residue_look);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    78
    memset(l,0,sizeof(*l));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    79
    _ogg_free(l);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    80
  }
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    81
}
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    82
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    83
static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    84
			  vorbis_info_mapping *m){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    85
  int i;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    86
  vorbis_info          *vi=vd->vi;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    87
  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    88
  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    89
  vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    90
  look->mode=vm;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    91
  
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    92
  look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    93
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    94
  look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    95
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    96
  look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    97
  look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    98
  
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    99
  for(i=0;i<info->submaps;i++){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   100
    int floornum=info->floorsubmap[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   101
    int resnum=info->residuesubmap[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   102
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   103
    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   104
    look->floor_look[i]=look->floor_func[i]->
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   105
      look(vd,vm,ci->floor_param[floornum]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   106
    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   107
    look->residue_look[i]=look->residue_func[i]->
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   108
      look(vd,vm,ci->residue_param[resnum]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   109
    
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   110
  }
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   111
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   112
  look->ch=vi->channels;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   113
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   114
  return(look);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   115
}
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   116
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   117
static int ilog(unsigned int v){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   118
  int ret=0;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   119
  if(v)--v;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   120
  while(v){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   121
    ret++;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   122
    v>>=1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   123
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   124
  return(ret);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   125
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   126
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   127
/* also responsible for range checking */
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   128
static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   129
  int i;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   130
  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   131
  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   132
  memset(info,0,sizeof(*info));
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   133
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   134
  if(oggpack_read(opb,1))
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   135
    info->submaps=oggpack_read(opb,4)+1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   136
  else
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   137
    info->submaps=1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   138
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   139
  if(oggpack_read(opb,1)){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   140
    info->coupling_steps=oggpack_read(opb,8)+1;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   141
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   142
    for(i=0;i<info->coupling_steps;i++){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   143
      int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   144
      int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   145
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   146
      if(testM<0 || 
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   147
	 testA<0 || 
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   148
	 testM==testA || 
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   149
	 testM>=vi->channels ||
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   150
	 testA>=vi->channels) goto err_out;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   151
    }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   152
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   153
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   154
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   155
  if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   156
    
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   157
  if(info->submaps>1){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   158
    for(i=0;i<vi->channels;i++){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   159
      info->chmuxlist[i]=oggpack_read(opb,4);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   160
      if(info->chmuxlist[i]>=info->submaps)goto err_out;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   161
    }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   162
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   163
  for(i=0;i<info->submaps;i++){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   164
    int temp=oggpack_read(opb,8);
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   165
    if(temp>=ci->times)goto err_out;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   166
    info->floorsubmap[i]=oggpack_read(opb,8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   167
    if(info->floorsubmap[i]>=ci->floors)goto err_out;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   168
    info->residuesubmap[i]=oggpack_read(opb,8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   169
    if(info->residuesubmap[i]>=ci->residues)goto err_out;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   170
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   171
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   172
  return info;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   173
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   174
 err_out:
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   175
  mapping0_free_info(info);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   176
  return(NULL);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   177
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   178
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   179
static int seq=0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   180
static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   181
  vorbis_dsp_state     *vd=vb->vd;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   182
  vorbis_info          *vi=vd->vi;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   183
  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   184
  private_state        *b=(private_state *)vd->backend_state;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   185
  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   186
  vorbis_info_mapping0 *info=look->map;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   187
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   188
  int                   i,j;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   189
  long                  n=vb->pcmend=ci->blocksizes[vb->W];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   190
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   191
  ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   192
  int    *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   193
  
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   194
  int   *nonzero  =(int *)alloca(sizeof(*nonzero)*vi->channels);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   195
  void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   196
  
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   197
  /* time domain information decode (note that applying the
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   198
     information would have to happen later; we'll probably add a
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   199
     function entry to the harness for that later */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   200
  /* NOT IMPLEMENTED */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   201
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   202
  /* recover the spectral envelope; store it in the PCM vector for now */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   203
  for(i=0;i<vi->channels;i++){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   204
    int submap=info->chmuxlist[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   205
    floormemo[i]=look->floor_func[submap]->
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   206
      inverse1(vb,look->floor_look[submap]);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   207
    if(floormemo[i])
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   208
      nonzero[i]=1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   209
    else
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   210
      nonzero[i]=0;      
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   211
    memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   212
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   213
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   214
  /* channel coupling can 'dirty' the nonzero listing */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   215
  for(i=0;i<info->coupling_steps;i++){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   216
    if(nonzero[info->coupling_mag[i]] ||
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   217
       nonzero[info->coupling_ang[i]]){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   218
      nonzero[info->coupling_mag[i]]=1; 
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   219
      nonzero[info->coupling_ang[i]]=1; 
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   220
    }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   221
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   222
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   223
  /* recover the residue into our working vectors */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   224
  for(i=0;i<info->submaps;i++){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   225
    int ch_in_bundle=0;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   226
    for(j=0;j<vi->channels;j++){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   227
      if(info->chmuxlist[j]==i){
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   228
	if(nonzero[j])
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   229
	  zerobundle[ch_in_bundle]=1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   230
	else
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   231
	  zerobundle[ch_in_bundle]=0;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   232
	pcmbundle[ch_in_bundle++]=vb->pcm[j];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   233
      }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   234
    }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   235
    
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   236
    look->residue_func[i]->inverse(vb,look->residue_look[i],
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   237
				   pcmbundle,zerobundle,ch_in_bundle);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   238
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   239
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   240
  //for(j=0;j<vi->channels;j++)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   241
  //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   242
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   243
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   244
  /* channel coupling */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   245
  for(i=info->coupling_steps-1;i>=0;i--){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   246
    ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   247
    ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   248
    
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   249
    for(j=0;j<n/2;j++){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   250
      ogg_int32_t mag=pcmM[j];
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   251
      ogg_int32_t ang=pcmA[j];
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   252
      
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   253
      if(mag>0)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   254
	if(ang>0){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   255
	  pcmM[j]=mag;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   256
	  pcmA[j]=mag-ang;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   257
	}else{
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   258
	  pcmA[j]=mag;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   259
	  pcmM[j]=mag+ang;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   260
	}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   261
      else
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   262
	if(ang>0){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   263
	  pcmM[j]=mag;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   264
	  pcmA[j]=mag+ang;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   265
	}else{
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   266
	  pcmA[j]=mag;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   267
	  pcmM[j]=mag-ang;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   268
	}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   269
    }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   270
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   271
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   272
  //for(j=0;j<vi->channels;j++)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   273
  //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   274
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   275
  /* compute and apply spectral envelope */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   276
  for(i=0;i<vi->channels;i++){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   277
    ogg_int32_t *pcm=vb->pcm[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   278
    int submap=info->chmuxlist[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   279
    look->floor_func[submap]->
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   280
      inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   281
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   282
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   283
  //for(j=0;j<vi->channels;j++)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   284
  //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   285
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   286
  /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   287
  /* only MDCT right now.... */
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   288
  for(i=0;i<vi->channels;i++){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   289
    ogg_int32_t *pcm=vb->pcm[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   290
    mdct_backward(n,pcm,pcm);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   291
  }
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   292
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   293
  //for(j=0;j<vi->channels;j++)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   294
  //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   295
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   296
  /* window the data */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   297
  for(i=0;i<vi->channels;i++){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   298
    ogg_int32_t *pcm=vb->pcm[i];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   299
    if(nonzero[i])
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   300
      _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   301
    else
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   302
      for(j=0;j<n;j++)
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   303
	pcm[j]=0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   304
    
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   305
  }
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   306
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   307
  //for(j=0;j<vi->channels;j++)
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   308
  //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   309
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   310
  seq+=vi->channels;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   311
  /* all done! */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   312
  return(0);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   313
}
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   314
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   315
/* export hooks */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   316
vorbis_func_mapping mapping0_exportbundle={
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   317
  &mapping0_unpack,
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   318
  &mapping0_look,
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   319
  &mapping0_free_info,
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   320
  &mapping0_free_look,
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   321
  &mapping0_inverse
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   322
};