Implemented MJPG handler.
[wine/multimedia.git] / dlls / quartz / amundoc.c
blob860f70eb76f0c2686cdf8e040d01be7510dea442
1 /*
2 * Copyright (C) Hidenori TAKESHIMA
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "config.h"
21 #include <math.h>
22 #include "windef.h"
23 #include "wine/obj_base.h"
25 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
28 #include "quartz_private.h"
30 /***********************************************************************
31 * AmpFactorToDB (QUARTZ.@)
33 * undocumented.
34 * converting from Amp to dB?
37 LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp )
39 LONG dB;
41 TRACE( "(%ld)\n", amp );
43 if ( amp <= 0 || amp > 65536 )
44 return 0;
46 dB = (LONG)(2000.0 * log10((double)amp / 65536.0) + 0.5);
47 if ( dB >= 0 ) dB = 0;
48 if ( dB < -10000 ) dB = -10000;
50 return dB;
53 /***********************************************************************
54 * DBToAmpFactor (QUARTZ.@)
56 * undocumented.
57 * converting from dB to Amp?
59 LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB )
61 LONG amp;
63 TRACE( "(%ld)\n", dB );
65 if ( dB >= 0 )
66 return 65535;
67 if ( dB < -10000 )
68 return 0;
70 amp = (LONG)(pow(10.0,dB / 2000.0) * 65536.0 + 0.5);
71 if ( amp <= 0 ) amp = 1;
72 if ( amp >= 65536 ) amp = 65535;
74 return amp;