 frontend/audio.c           | 11 +++++-
 frontend/faad.sln          | 16 ++++----
 frontend/main.c            | 89 ++++++++++++++++++++++++++++++++---------
 frontend/unicode_support.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++
 frontend/unicode_support.h | 21 ++++++++++
 include/neaacdec.h         |  6 +--
 libfaad/common.h           |  4 +-
 libfaad/decoder.c          |  6 +--
 libfaad/lt_predict.c       |  2 +-
 libfaad/output.c           | 36 ++++++++---------
 10 files changed, 233 insertions(+), 56 deletions(-)

diff --git a/frontend/audio.c b/frontend/audio.c
index 9ab7a2a..20f92a2 100644
--- a/frontend/audio.c
+++ b/frontend/audio.c
@@ -39,11 +39,14 @@
 #include <stdint.h>
 
 #include "audio.h"
+#include "unicode_support.h"
 
 
 audio_file *open_audio_file(char *infile, int samplerate, int channels,
                             int outputFormat, int fileType, long channelMask)
 {
+    wchar_t *fileNameW;
+
     audio_file *aufile = malloc(sizeof(audio_file));
 
     aufile->outputFormat = outputFormat;
@@ -80,7 +83,13 @@ audio_file *open_audio_file(char *infile, int samplerate, int channels,
         aufile->toStdio = 1;
     } else {
         aufile->toStdio = 0;
-        aufile->sndfile = fopen(infile, "wb");
+        aufile->sndfile = NULL;
+        fileNameW = utf8_to_utf16(infile);
+        if(fileNameW)
+        {
+            aufile->sndfile = _wfopen(fileNameW, L"wb");
+            free(fileNameW);
+        }
     }
 
     if (aufile->sndfile == NULL)
diff --git a/frontend/faad.sln b/frontend/faad.sln
index a47200b..ddbea6d 100644
--- a/frontend/faad.sln
+++ b/frontend/faad.sln
@@ -1,15 +1,13 @@
 ﻿
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
-	ProjectSection(ProjectDependencies) = postProject
-		{F470BB4A-7675-4D6A-B310-41F33AC6F987} = {F470BB4A-7675-4D6A-B310-41F33AC6F987}
-		{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114} = {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}
-	EndProjectSection
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcxproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcxproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcxproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/frontend/main.c b/frontend/main.c
index f943d9d..e4294d0 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -44,11 +44,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <getopt.h>
+#include <io.h>
 
 #include <neaacdec.h>
 #include <mp4ff.h>
 
 #include "audio.h"
+#include "unicode_support.h"
 
 #ifndef min
 #define min(a,b) ( (a) < (b) ? (a) : (b) )
@@ -71,6 +73,8 @@ static void faad_fprintf(FILE *stream, const char *fmt, ...)
         vfprintf(stream, fmt, ap);
 
         va_end(ap);
+
+        fflush(stream);
     }
 }
 
@@ -450,7 +454,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
     NeAACDecFrameInfo frameInfo;
     NeAACDecConfigurationPtr config;
 
-    char percents[200];
+    char percents[300];
     int percent, old_percent = -1;
     int bread, fileread;
     int header_type = 0;
@@ -463,11 +467,19 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
 
     aac_buffer b;
 
+    wchar_t *fileNameW;
+
     memset(&b, 0, sizeof(aac_buffer));
 
     if (adts_out)
     {
-        adtsFile = fopen(adts_fn, "wb");
+        adtsFile = NULL;
+        fileNameW = utf8_to_utf16(adts_fn);
+        if(fileNameW)
+        {
+            adtsFile = _wfopen(fileNameW, L"wb");
+            free(fileNameW);
+        }
         if (adtsFile == NULL)
         {
             faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
@@ -477,20 +489,26 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
 
     if (0 == strcmp(aacfile, "-"))
     {
-	b.infile = stdin;
+        b.infile = stdin;
 #ifdef _WIN32
         setmode(fileno(stdin), O_BINARY);
 #endif
-
-    } else
+    }
+    else
     {
-    	b.infile = fopen(aacfile, "rb");
-    	if (b.infile == NULL)
-    	{
-    	    /* unable to open file */
-    	    faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
-    	    return 1;
-    	}
+        b.infile = NULL;
+        fileNameW = utf8_to_utf16(aacfile);
+        if(fileNameW)
+        {
+            b.infile = _wfopen(fileNameW, L"rb");
+            free(fileNameW);
+        }
+        if (b.infile == NULL)
+        {
+            /* unable to open file */
+            faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
+            return 1;
+        }
     }
 
     retval = fseek(b.infile, 0, SEEK_END);
@@ -715,7 +733,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
         if (percent > old_percent)
         {
             old_percent = percent;
-            sprintf(percents, "%d%% decoding %s.", percent, aacfile);
+            _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, aacfile);
             faad_fprintf(stderr, "%s\r", percents);
 #ifdef _WIN32
             SetConsoleTitle(percents);
@@ -817,7 +835,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
     unsigned char *buffer;
     int buffer_size;
 
-    char percents[200];
+    char percents[300];
     int percent, old_percent = -1;
 
     int first_time = 1;
@@ -828,6 +846,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
     unsigned int framesize;
     unsigned long timescale;
 
+    wchar_t *fileNameW;
 
     /* initialise the callback structure */
     mp4ff_callback_t *mp4cb = malloc(sizeof(mp4ff_callback_t));
@@ -837,7 +856,14 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
         return 1;
     }
 
-    mp4File = fopen(mp4file, "rb");
+    mp4File = NULL;
+    fileNameW = utf8_to_utf16(mp4file);
+    if(fileNameW)
+    {
+        mp4File = _wfopen(fileNameW, L"rb");
+        free(fileNameW);
+    }
+
     mp4cb->read = read_callback;
     mp4cb->seek = seek_callback;
     mp4cb->user_data = mp4File;
@@ -854,7 +880,13 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
 
     if (adts_out)
     {
-        adtsFile = fopen(adts_fn, "wb");
+        adtsFile = NULL;
+        fileNameW = utf8_to_utf16(adts_fn);
+        if(fileNameW)
+        {
+            adtsFile = _wfopen(fileNameW, L"wb");
+            free(fileNameW);
+        }
         if (adtsFile == NULL)
         {
             faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
@@ -1060,7 +1092,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
         if (percent > old_percent)
         {
             old_percent = percent;
-            sprintf(percents, "%d%% decoding %s.", percent, mp4file);
+            _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, mp4file);
             faad_fprintf(stderr, "%s\r", percents);
 #ifdef _WIN32
             SetConsoleTitle(percents);
@@ -1098,7 +1130,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
     return frameInfo.error;
 }
 
-int main(int argc, char *argv[])
+int faad_main(int argc, char *argv[])
 {
     int result;
     int infoOnly = 0;
@@ -1122,6 +1154,7 @@ int main(int argc, char *argv[])
     unsigned char header[8];
     float length = 0;
     FILE *hMP4File;
+    wchar_t *fileNameW;
 
 /* System dependant types */
 #ifdef _WIN32
@@ -1352,7 +1385,13 @@ int main(int argc, char *argv[])
     } else {
 
     	mp4file = 0;
-    	hMP4File = fopen(aacFileName, "rb");
+    	hMP4File = NULL;
+    	fileNameW = utf8_to_utf16(aacFileName);
+    	if(fileNameW)
+    	{
+    		hMP4File = _wfopen(fileNameW, L"rb");
+    		free(fileNameW);
+    	}
     	if (!hMP4File)
     	{
     	    faad_fprintf(stderr, "Error opening file: %s\n", aacFileName);
@@ -1415,3 +1454,15 @@ int main(int argc, char *argv[])
 
     return 0;
 }
+
+int wmain(int argc, wchar_t **argv_utf16)
+{
+    int result = 0;
+    char **argv_utf8 = NULL;
+
+    init_commandline_arguments_utf8(argc, &argv_utf8, argv_utf16);
+    result = faad_main(argc, argv_utf8);
+    free_commandline_arguments_utf8(argc, &argv_utf8);
+  
+    return result;
+}
diff --git a/frontend/unicode_support.c b/frontend/unicode_support.c
new file mode 100644
index 0000000..21ecd5c
--- /dev/null
+++ b/frontend/unicode_support.c
@@ -0,0 +1,98 @@
+#include "unicode_support.h"
+
+#include <stdio.h>
+#include <windows.h>
+
+char *utf16_to_utf8(const wchar_t *input)
+{
+	char *Buffer;
+	int BuffSize, Result;
+
+	BuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
+	Buffer = (char*) malloc(sizeof(char) * BuffSize);
+	
+	if(!Buffer)
+	{
+		fprintf(stderr, "Error in utf16_to_utf8: Memory allocation failed!\n");
+		return NULL;
+	}
+
+	Result = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);
+	return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
+}
+
+wchar_t *utf8_to_utf16(const char *input)
+{
+	wchar_t *Buffer;
+	int BuffSize, Result;
+
+	BuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
+	Buffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);
+
+	if(!Buffer)
+	{
+		fprintf(stderr, "Error in utf8_to_utf16: Memory allocation failed!\n");
+		return NULL;
+	}
+
+	Result = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);
+	return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
+}
+
+void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16)
+{
+	int i = 0;
+	
+	*argv_utf8 = (char**) malloc(argc * sizeof(char*));
+	if(!(*argv_utf8))
+	{
+		fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
+		exit(-1);
+	}
+	
+	for(i = 0; i < argc; i++)
+	{
+		(*argv_utf8)[i] = utf16_to_utf8(argv_utf16[i]);
+		if(!(*argv_utf8)[i])
+		{
+			fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
+			exit(-1);
+		}
+	}
+}
+
+void free_commandline_arguments_utf8(int argc, char ***argv_utf8)
+{
+	int i = 0;
+	
+	if(*argv_utf8 != NULL)
+	{
+		for(i = 0; i < argc; i++)
+		{
+			if((*argv_utf8)[i] != NULL)
+			{
+				free((*argv_utf8)[i]);
+				(*argv_utf8)[i] = NULL;
+			}
+		}
+		free(*argv_utf8);
+		*argv_utf8 = NULL;
+	}
+}
+
+FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
+{
+	FILE *ret = NULL;
+	wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
+	wchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);
+	
+	if(filename_utf16 && mode_utf16)
+	{
+		ret = _wfopen(filename_utf16, mode_utf16);
+	}
+
+	if(filename_utf16) free(filename_utf16);
+	if(mode_utf16) free(mode_utf16);
+
+	return ret;
+}
diff --git a/frontend/unicode_support.h b/frontend/unicode_support.h
new file mode 100644
index 0000000..cc13fd9
--- /dev/null
+++ b/frontend/unicode_support.h
@@ -0,0 +1,21 @@
+#ifndef UNICODE_SUPPORT_H_INCLUDED
+#define UNICODE_SUPPORT_H_INCLUDED
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *utf16_to_utf8(const wchar_t *input);
+wchar_t *utf8_to_utf16(const char *input);
+void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16);
+void free_commandline_arguments_utf8(int argc, char ***argv_utf8);
+FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/include/neaacdec.h b/include/neaacdec.h
index 610a00b..7904175 100644
--- a/include/neaacdec.h
+++ b/include/neaacdec.h
@@ -202,7 +202,7 @@ typedef struct NeAACDecFrameInfo
     unsigned char ps;
 } NeAACDecFrameInfo;
 
-char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode);
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
 
 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
 
@@ -235,12 +235,12 @@ void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
 
 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
 
-void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hDecoder,
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
                                  NeAACDecFrameInfo *hInfo,
                                  unsigned char *buffer,
                                  unsigned long buffer_size);
 
-void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hDecoder,
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
                                   NeAACDecFrameInfo *hInfo,
                                   unsigned char *buffer,
                                   unsigned long buffer_size,
diff --git a/libfaad/common.h b/libfaad/common.h
index 897a0f0..74f4a56 100644
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -316,7 +316,7 @@ char *strchr(), *strrchr();
   #if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
     #ifndef HAVE_LRINTF
     #define HAS_LRINTF
-    static INLINE int lrintf(float f)
+    static INLINE int FAAD_lrintf(float f)
     {
         int i;
         __asm
@@ -332,7 +332,7 @@ char *strchr(), *strrchr();
     #ifndef HAVE_LRINTF
     #define HAS_LRINTF
     // from http://www.stereopsis.com/FPU.html
-    static INLINE int lrintf(float f)
+    static INLINE int FAAD_lrintf(float f)
     {
         int i;
         __asm__ __volatile__ (
diff --git a/libfaad/decoder.c b/libfaad/decoder.c
index 42bbc84..67feb9d 100644
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -64,7 +64,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder,
                                   NeAACDecFrameInfo *hInfo);
 
 
-char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode)
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
 {
     if (errcode >= NUM_ERROR_MESSAGES)
         return NULL;
@@ -790,7 +790,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
     }
 }
 
-void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder,
                                  NeAACDecFrameInfo *hInfo,
                                  unsigned char *buffer,
                                  unsigned long buffer_size)
@@ -799,7 +799,7 @@ void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
     return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
 }
 
-void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hpDecoder,
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder,
                                   NeAACDecFrameInfo *hInfo,
                                   unsigned char *buffer,
                                   unsigned long buffer_size,
diff --git a/libfaad/lt_predict.c b/libfaad/lt_predict.c
index 2be18ae..aa02fb0 100644
--- a/libfaad/lt_predict.c
+++ b/libfaad/lt_predict.c
@@ -166,7 +166,7 @@ static INLINE int16_t real_to_int16(real_t sig_in)
             return -32768;
     }
 
-    return lrintf(sig_in);
+    return FAAD_lrintf(sig_in);
 }
 #endif
 
diff --git a/libfaad/output.c b/libfaad/output.c
index 4245627..1aeb747 100644
--- a/libfaad/output.c
+++ b/libfaad/output.c
@@ -103,7 +103,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
 
             CLIP(inp, 32767.0f, -32768.0f);
 
-            (*sample_buffer)[i] = (int16_t)lrintf(inp);
+            (*sample_buffer)[i] = (int16_t)FAAD_lrintf(inp);
         }
         break;
     case CONV(2,0):
@@ -116,8 +116,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
 
                 CLIP(inp0, 32767.0f, -32768.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp0);
             }
         } else {
             ch  = hDecoder->internal_channel[0];
@@ -130,8 +130,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
                 CLIP(inp0, 32767.0f, -32768.0f);
                 CLIP(inp1, 32767.0f, -32768.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp1);
             }
         }
         break;
@@ -144,7 +144,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
 
                 CLIP(inp, 32767.0f, -32768.0f);
 
-                (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
+                (*sample_buffer)[(i*channels)+ch] = (int16_t)FAAD_lrintf(inp);
             }
         }
         break;
@@ -169,7 +169,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
             inp *= 256.0f;
             CLIP(inp, 8388607.0f, -8388608.0f);
 
-            (*sample_buffer)[i] = (int32_t)lrintf(inp);
+            (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
         }
         break;
     case CONV(2,0):
@@ -183,8 +183,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
                 inp0 *= 256.0f;
                 CLIP(inp0, 8388607.0f, -8388608.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
             }
         } else {
             ch  = hDecoder->internal_channel[0];
@@ -199,8 +199,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
                 CLIP(inp0, 8388607.0f, -8388608.0f);
                 CLIP(inp1, 8388607.0f, -8388608.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
             }
         }
         break;
@@ -214,7 +214,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
                 inp *= 256.0f;
                 CLIP(inp, 8388607.0f, -8388608.0f);
 
-                (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+                (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
             }
         }
         break;
@@ -239,7 +239,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
             inp *= 65536.0f;
             CLIP(inp, 2147483647.0f, -2147483648.0f);
 
-            (*sample_buffer)[i] = (int32_t)lrintf(inp);
+            (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
         }
         break;
     case CONV(2,0):
@@ -253,8 +253,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
                 inp0 *= 65536.0f;
                 CLIP(inp0, 2147483647.0f, -2147483648.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
             }
         } else {
             ch  = hDecoder->internal_channel[0];
@@ -269,8 +269,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
                 CLIP(inp0, 2147483647.0f, -2147483648.0f);
                 CLIP(inp1, 2147483647.0f, -2147483648.0f);
 
-                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
             }
         }
         break;
@@ -284,7 +284,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
                 inp *= 65536.0f;
                 CLIP(inp, 2147483647.0f, -2147483648.0f);
 
-                (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+                (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
             }
         }
         break;
