Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

resample.h

Go to the documentation of this file.
00001 #ifndef RESAMPLE_H
00002 #define RESAMPLE_H
00003 
00004 #define BPC 160
00005 #define BLACKSIZE 25
00006 
00007 #include "file.inc"
00008 
00009 class Resample
00010 {
00011 public:
00012         Resample(File *file, int channels);
00013         ~Resample();
00014 
00015 // Reset after seeking
00016         void reset(int channel = -1);
00017         double blackman(int i, double offset, double fcn, int l);
00018 // Query output temp
00019         int get_output_size(int channel);
00020         void read_output(double *output, int channel, int size);
00021 // Resamples input and dumps it to output_temp
00022         void resample_chunk(double *input,
00023                 long in_len,
00024                 int in_rate,
00025                 int out_rate,
00026                 int channel);
00027 // Resample from the file handler and store in *output.
00028 // Returns the total samples read from the file handler.
00029         int resample(double *output, 
00030                 long out_len,
00031                 int in_rate,
00032                 int out_rate,
00033                 int channel,
00034                 long in_position,      // Starting sample in input samplerate
00035                 long out_position);      // Starting sample in output samplerate
00036         virtual void read_chunk(double *input, 
00037                 long len, 
00038                 int &reseek, 
00039                 int iteration);   // True once for every resample call
00040 
00041 // History buffer for resampling.
00042         double **old;
00043         double *itime;
00044 
00045 
00046 
00047 // Unaligned resampled output
00048         double **output_temp;
00049 
00050 
00051 // Total samples in unaligned output
00052 // Tied to each channel independantly
00053         long *output_size;
00054 
00055 
00056 // Sample start of output_temp in the resampled domain.
00057         long *output_temp_start;
00058 // Allocation of unaligned output
00059         long output_allocation;
00060 // input chunk
00061         double *input;
00062 // Sample end of input chunks in the input domain.
00063         long *input_chunk_end;
00064         long input_size;
00065         int channels;
00066         int *resample_init;
00067 // Last sample ratio configured to
00068         double last_ratio;
00069         double blackfilt[2 * BPC + 1][BLACKSIZE];
00070         File *file;
00071 // Determine whether to reset after a seek
00072 // Sample end of last buffer read for each channel
00073         long *last_out_end;
00074 };
00075 
00076 class Resample_float
00077 {
00078 public:
00079         Resample_float(File *file, int channels);
00080         ~Resample_float();
00081 
00082 // Reset after seeking
00083         void reset(int channel = -1);
00084         float blackman(int i, float offset, float fcn, int l);
00085 // Query output temp
00086         int get_output_size(int channel);
00087         void read_output(double *output, int channel, int size);
00088 // Resamples input and dumps it to output_temp
00089         void resample_chunk(float *input,
00090                 long in_len,
00091                 int in_rate,
00092                 int out_rate,
00093                 int channel);
00094 // Resample from the file handler and store in *output.
00095 // Returns the total samples read from the file handler.
00096         int resample(double *output, 
00097                 long out_len,
00098                 int in_rate,
00099                 int out_rate,
00100                 int channel,
00101                 long in_position,      // Starting sample in input samplerate
00102                 long out_position);      // Starting sample in output samplerate
00103         virtual void read_chunk(float *input, 
00104                 long len, 
00105                 int &reseek, 
00106                 int iteration);   // True once for every resample call
00107 
00108 // History buffer for resampling.
00109         float **old;
00110         float *itime;
00111 
00112 
00113 
00114 // Unaligned resampled output
00115         double **output_temp;
00116 
00117 
00118 // Total samples in unaligned output
00119 // Tied to each channel independantly
00120         long *output_size;
00121 
00122 
00123 // Sample start of output_temp in the resampled domain.
00124         long *output_temp_start;
00125 // Allocation of unaligned output
00126         long output_allocation;
00127 // input chunk
00128         float *input;
00129 // Sample end of input chunks in the input domain.
00130         long *input_chunk_end;
00131         long input_size;
00132         int channels;
00133         int *resample_init;
00134 // Last sample ratio configured to
00135         float last_ratio;
00136         float blackfilt[2 * BPC + 1][BLACKSIZE];
00137         File *file;
00138 // Determine whether to reset after a seek
00139 // Sample end of last buffer read for each channel
00140         long *last_out_end;
00141 };
00142 
00143 #endif

Generated on Sun Jan 8 13:39:00 2006 for Cinelerra-svn by  doxygen 1.4.4