Libav 0.7.1
|
00001 /* 00002 * Header file for hardcoded sine windows 00003 * 00004 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> 00005 * 00006 * This file is part of Libav. 00007 * 00008 * Libav is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * Libav is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with Libav; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef AVCODEC_SINEWIN_TABLEGEN_H 00024 #define AVCODEC_SINEWIN_TABLEGEN_H 00025 00026 #include <assert.h> 00027 // do not use libavutil/libm.h since this is compiled both 00028 // for the host and the target and config.h is only valid for the target 00029 #include <math.h> 00030 #include "libavutil/attributes.h" 00031 00032 #if !CONFIG_HARDCODED_TABLES 00033 SINETABLE( 32); 00034 SINETABLE( 64); 00035 SINETABLE( 128); 00036 SINETABLE( 256); 00037 SINETABLE( 512); 00038 SINETABLE(1024); 00039 SINETABLE(2048); 00040 SINETABLE(4096); 00041 #else 00042 #include "libavcodec/sinewin_tables.h" 00043 #endif 00044 00045 SINETABLE_CONST float * const ff_sine_windows[] = { 00046 NULL, NULL, NULL, NULL, NULL, // unused 00047 ff_sine_32 , ff_sine_64 , 00048 ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096 00049 }; 00050 00051 // Generate a sine window. 00052 av_cold void ff_sine_window_init(float *window, int n) { 00053 int i; 00054 for(i = 0; i < n; i++) 00055 window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); 00056 } 00057 00058 av_cold void ff_init_ff_sine_windows(int index) { 00059 assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows)); 00060 #if !CONFIG_HARDCODED_TABLES 00061 ff_sine_window_init(ff_sine_windows[index], 1 << index); 00062 #endif 00063 } 00064 00065 #endif /* AVCODEC_SINEWIN_TABLEGEN_H */