misc/libtremor/tremor/window.c
author dag10 <gottlieb.drew@gmail.com>
Wed, 16 Jan 2013 18:34:43 -0500
changeset 8393 85bd6c7b2641
parent 7859 519d5bc91dd3
permissions -rw-r--r--
Can now change theme for static and mission maps. Fixed mission map descriptions that had commas which broke them. Now, you must escape commas in map descriptions. Made bgwidget repaint on animation tick to avoid buffer-not-clearing issue with widgets that change overtop the background leaving a ghost image of the widget's previous state. Generated map is now the default map in the mapconfig widget.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7859
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     1
/********************************************************************
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     2
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     3
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     4
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     5
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     6
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     7
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     8
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
     9
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    10
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    11
 *                                                                  *
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    12
 ********************************************************************
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    13
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    14
 function: window functions
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    15
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    16
 ********************************************************************/
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    17
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    18
#include <stdlib.h>
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    19
#include <math.h>
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    20
#include "misc.h"
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    21
#include "window.h"
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    22
#include "window_lookup.h"
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    23
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    24
const void *_vorbis_window(int type, int left){
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    25
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    26
  switch(type){
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    27
  case 0:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    28
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    29
    switch(left){
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    30
    case 32:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    31
      return vwin64;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    32
    case 64:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    33
      return vwin128;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    34
    case 128:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    35
      return vwin256;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    36
    case 256:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    37
      return vwin512;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    38
    case 512:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    39
      return vwin1024;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    40
    case 1024:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    41
      return vwin2048;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    42
    case 2048:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    43
      return vwin4096;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    44
    case 4096:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    45
      return vwin8192;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    46
    default:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    47
      return(0);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    48
    }
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    49
    break;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    50
  default:
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    51
    return(0);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    52
  }
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    53
}
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    54
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    55
void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    56
			  long *blocksizes,
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    57
			  int lW,int W,int nW){
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    58
  
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    59
  LOOKUP_T *window[2]={window_p[0],window_p[1]};
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    60
  long n=blocksizes[W];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    61
  long ln=blocksizes[lW];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    62
  long rn=blocksizes[nW];
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    63
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    64
  long leftbegin=n/4-ln/4;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    65
  long leftend=leftbegin+ln/2;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    66
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    67
  long rightbegin=n/2+n/4-rn/4;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    68
  long rightend=rightbegin+rn/2;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    69
  
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    70
  int i,p;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    71
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    72
  for(i=0;i<leftbegin;i++)
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    73
    d[i]=0;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    74
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    75
  for(p=0;i<leftend;i++,p++)
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    76
    d[i]=MULT31(d[i],window[lW][p]);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    77
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    78
  for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    79
    d[i]=MULT31(d[i],window[nW][p]);
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    80
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    81
  for(;i<n;i++)
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    82
    d[i]=0;
519d5bc91dd3 revert tremor back to a version before koda broke it ;p
Xeli
parents:
diff changeset
    83
}