Libav
|
00001 /* 00002 * Header file for hardcoded MDCT tables 00003 * 00004 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg 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 * FFmpeg 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 FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #include <assert.h> 00024 // do not use libavutil/mathematics.h since this is compiled both 00025 // for the host and the target and config.h is only valid for the target 00026 #include <math.h> 00027 #include "../libavutil/attributes.h" 00028 00029 #if !CONFIG_HARDCODED_TABLES 00030 SINETABLE( 32); 00031 SINETABLE( 64); 00032 SINETABLE( 128); 00033 SINETABLE( 256); 00034 SINETABLE( 512); 00035 SINETABLE(1024); 00036 SINETABLE(2048); 00037 SINETABLE(4096); 00038 #else 00039 #include "libavcodec/mdct_tables.h" 00040 #endif 00041 00042 SINETABLE_CONST float * const ff_sine_windows[] = { 00043 NULL, NULL, NULL, NULL, NULL, // unused 00044 ff_sine_32 , ff_sine_64 , 00045 ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096 00046 }; 00047 00048 // Generate a sine window. 00049 av_cold void ff_sine_window_init(float *window, int n) { 00050 int i; 00051 for(i = 0; i < n; i++) 00052 window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); 00053 } 00054 00055 av_cold void ff_init_ff_sine_windows(int index) { 00056 assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows)); 00057 #if !CONFIG_HARDCODED_TABLES 00058 ff_sine_window_init(ff_sine_windows[index], 1 << index); 00059 #endif 00060 }