⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dvb_math.c

📁 V4l driver for DVB HD
💻 C
字号:
/* *    dvb_math.c - Integer math functions suitable for DVB driver use * *    Copyright (C) 2006 Rusty Scott <rustys@ieee.org> * *    Taken from or51134 and or51211 front end modules which are *    Copyright (C) 2005 Kirk Lapray <kirk_lapray@bigfoot.com> * *    which lifted the integer logarithm code, without modification, directly *    from pcHDTV code which is *    Copyright (C) 2002 pcHDTV,Inc. & Jack Kelliher <jkelliher@xmission.com> * *    All of which was published under the GNU GPL. * *    Permission has been granted by the original copyright holder to *    distribute this code in the dvb_core library under the GNU Lesser *    General Public license which is hereafter referenced: * *    This program is free software; you can redistribute it and/or modify *    it under the terms of the GNU Lesser General Public License as *    published by the Free Software Foundation; either version 2.1 of the *    License, or (at your option) any later version. * *    This program is distributed in the hope that it will be useful, *    but WITHOUT ANY WARRANTY; without even the implied warranty of *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *    GNU Lesser General Public License for more details. * *    You should have received a copy of the GNU Lesser General Public *    License along with this program; if not, write to the Free Software *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 *    USA * *//* *    Notes: *    There are several frontends in the DVB set that attempt to give a *    real value for the SNR in dB.  This module pulls that code into a single *    place for maintenance and fixes the algorithmic problems of the code *    found in the OR51132 and 51211 frontends. * */#include <linux/kernel.h>#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/string.h>#include <linux/slab.h>#include <asm/byteorder.h>#include "dvb_math.h"/* log10-1 table at .5 increments from 1 to 100.5 */static unsigned int i100x20log10[] = {0, 0,     0,  352,  602,  795,  954, 1088, 1204, 1306, 1397, 1480,  1556, 1625, 1690, 1750, 1806, 1858, 1908, 1955, 2000, 2042,  2082, 2121, 2158, 2193, 2227, 2260, 2292, 2322, 2352, 2380,  2408, 2434, 2460, 2486, 2510, 2534, 2557, 2580, 2602, 2623,  2644, 2664, 2684, 2704, 2723, 2742, 2760, 2778, 2795, 2813,  2829, 2846, 2862, 2878, 2894, 2909, 2924, 2939, 2954, 2968,  2982, 2996, 3010, 3023, 3037, 3050, 3062, 3075, 3088, 3100,  3112, 3124, 3136, 3148, 3159, 3170, 3182, 3193, 3204, 3214,  3225, 3236, 3246, 3256, 3266, 3276, 3286, 3296, 3306, 3316,  3325, 3334, 3344, 3353, 3362, 3371, 3380, 3389, 3397, 3406,  3415, 3423, 3432, 3440, 3448, 3456, 3464, 3472, 3480, 3488,  3496, 3504, 3511, 3519, 3526, 3534, 3541, 3549, 3556, 3563,  3570, 3577, 3584, 3591, 3598, 3605, 3612, 3619, 3625, 3632,  3639, 3645, 3652, 3658, 3665, 3671, 3677, 3683, 3690, 3696,  3702, 3708, 3714, 3720, 3726, 3732, 3738, 3744, 3750, 3755,  3761, 3767, 3772, 3778, 3784, 3789, 3795, 3800, 3806, 3811,  3816, 3822, 3827, 3832, 3838, 3843, 3848, 3853, 3858, 3863,  3868, 3874, 3879, 3884, 3888, 3893, 3898, 3903, 3908, 3913,  3918, 3922, 3927, 3932, 3936, 3941, 3946, 3950, 3955, 3960,  3964, 3969, 3973, 3978, 3982, 3986, 3991, 3995, 4000, 4004,};static unsigned int denom[] = {1,10,100,1000,10000,100000,1000000,10000000,100000000};unsigned int i10Log10(u32 val){	unsigned int rntval = 0;	u32 tmp = val;	unsigned int exp = 0;	while(tmp > 100) {tmp /= 10; exp++;}	val = (2 * val)/denom[exp];	rntval = 1000*exp;	rntval += i100x20log10[val]/2;	return rntval;}EXPORT_SYMBOL(i10Log10);unsigned int i20Log10(u32 val){	return 2*i10Log10(val);}EXPORT_SYMBOL(i20Log10);/* * Local variables: * c-basic-offset: 8 * End: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -