"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/AV/SampleCast.h" between
ssr-0.4.1.tar.gz and ssr-0.4.2.tar.gz

About: SimpleScreenRecorder is a screen (video-audio) recorder for Linux.

SampleCast.h  (ssr-0.4.1):SampleCast.h  (ssr-0.4.2)
skipping to change at line 25 skipping to change at line 25
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with SimpleScreenRecorder. If not, see <http://www.gnu.org/licenses/>. along with SimpleScreenRecorder. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include "Global.h" #include "Global.h"
template<typename IN, typename OUT> OUT SampleCast(IN x); template<typename IN, typename OUT> OUT SampleCast(IN x);
template<> inline int16_t SampleCast<int16_t, int16_t>(int16_t x) { return x; } template<> inline int16_t SampleCast<int16_t, int16_t>(int16_t x) { return x; }
template<> inline int16_t SampleCast<int32_t, int16_t>(int32_t x) { return (x + (1 << 15)) >> 16; }
template<> inline int16_t SampleCast<float , int16_t>(float x) { return lrint (fmin(fmax(x * 32768.0f, -32768.0f), 32767.0f)); } template<> inline int16_t SampleCast<float , int16_t>(float x) { return lrint (fmin(fmax(x * 32768.0f, -32768.0f), 32767.0f)); }
template<> inline float SampleCast<int16_t, float >(int16_t x) { return (floa t) x * (1.0f / 32768.0f); } template<> inline float SampleCast<int16_t, float >(int16_t x) { return (floa t) x * (1.0f / 32768.0f); }
template<> inline float SampleCast<int32_t, float >(int32_t x) { return (floa t) x * (1.0f / 2147483648.0f); }
template<> inline float SampleCast<float , float >(float x) { return x; } template<> inline float SampleCast<float , float >(float x) { return x; }
template<typename IN> IN SampleMix(IN a, IN b); template<typename IN> IN SampleMix(IN a, IN b);
template<> inline int16_t SampleMix<int16_t>(int16_t a, int16_t b) { return (a + b) >> 1; } template<> inline int16_t SampleMix<int16_t>(int16_t a, int16_t b) { return (a + b) >> 1; }
template<> inline float SampleMix<float >(float a, float b) { return (a + b) * 0.5f; } template<> inline float SampleMix<float >(float a, float b) { return (a + b) * 0.5f; }
// Simple sample format conversion. // Simple sample format conversion.
// The in_step and out_step parameters are useful for converting between planar and interleaved audio. // The in_step and out_step parameters are useful for converting between planar and interleaved audio.
template<typename IN, typename OUT> template<typename IN, typename OUT>
inline void SampleCopy(unsigned int sample_count, const IN* in_data, int in_step , OUT* out_data, int out_step) { inline void SampleCopy(unsigned int sample_count, const IN* in_data, int in_step , OUT* out_data, int out_step) {
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)