~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpeglib/lib/splay/synthesis.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  header for synthesis
 
3
  Copyright (C) 2001  Martin Vogt
 
4
 
 
5
  This program is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU Library General Public License as published by
 
7
  the Free Software Foundation.
 
8
 
 
9
  For more information look at the file COPYRIGHT in this package
 
10
 
 
11
 */
 
12
 
 
13
 
 
14
 
 
15
#ifndef __SYNTHESIS_H
 
16
#define __SYNTHESIS_H
 
17
 
 
18
#include "common.h"
 
19
#include "dct.h"
 
20
 
 
21
#define CALCBUFFERSIZE     512
 
22
#define FRAMESIZE         (2*2*2*32*18)
 
23
 
 
24
 
 
25
class Synthesis {
 
26
 
 
27
  //
 
28
  // Subbandsynthesis two calcbuffers for every channel, and two channels.
 
29
  // calcbufferL[0]=calcbuffer[0]
 
30
  // calcbufferL[1]=calcbuffer[1]
 
31
  // calcbufferR[0]=calcbuffer[2]
 
32
  // calcbufferR[1]=calcbuffer[3]
 
33
  ATTR_ALIGN(64) REAL calcbuffer[2][2][CALCBUFFERSIZE];
 
34
  ATTR_ALIGN(64) int  currentcalcbuffer,calcbufferoffset;
 
35
  ATTR_ALIGN(64) static const REAL filter[512];
 
36
  ATTR_ALIGN(64) REAL out[FRAMESIZE];
 
37
  int outpos;
 
38
 
 
39
 public:
 
40
  Synthesis();
 
41
  ~Synthesis();
 
42
  
 
43
  // mpeg1,2
 
44
  void doSynth(int lDownSample,int lOutputStereo,
 
45
               REAL *fractionL,REAL *fractionR);
 
46
 
 
47
  void doMP3Synth(int lDownSample,int lOutputStereo,
 
48
                  REAL in[2][SSLIMIT][SBLIMIT]);
 
49
 
 
50
  // put mpeg to raw
 
51
  inline void putraw(REAL val) {
 
52
    out[outpos++]=val;
 
53
  }
 
54
 
 
55
  inline REAL* getOutputData() { return out; }
 
56
  inline void clearrawdata() { outpos=0; }
 
57
  inline int getLen() { return outpos; }
 
58
  
 
59
 
 
60
 private:
 
61
  void synth_Down(int lOutputStereo,REAL *fractionL,REAL *fractionR);
 
62
  void synth_Std(int lOutputStereo,REAL *fractionL,REAL *fractionR);
 
63
  
 
64
  void synthMP3_Down(int lOutputStereo,REAL hout [2][SSLIMIT][SBLIMIT]);
 
65
  void synthMP3_Std(int lOutputStereo,REAL hout [2][SSLIMIT][SBLIMIT]);
 
66
 
 
67
  inline void nextOffset() {
 
68
    calcbufferoffset++;
 
69
    calcbufferoffset&=0xf;
 
70
    /*
 
71
    if (calcbufferoffset<15) {
 
72
      calcbufferoffset++;
 
73
    } else {
 
74
      calcbufferoffset=0;
 
75
    }
 
76
    */
 
77
    currentcalcbuffer^=1;
 
78
  }
 
79
 
 
80
  
 
81
  void computebuffer_Std(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]);
 
82
  void generate_Std(void);
 
83
  void generatesingle_Std(void);
 
84
  
 
85
  void computebuffer_Down(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]);
 
86
  void generate_Down(void);
 
87
  void generatesingle_Down(void);
 
88
  
 
89
 
 
90
};
 
91
 
 
92
#endif