Commit Graph

251 Commits

Author SHA1 Message Date
Martin Storsjö
09f0254d5e Remove the now unused long_t typedef 2014-01-27 08:44:48 +02:00
Martin Storsjö
cc4507462b Use int32_t instead of long_t in WELS_SIGN/WELS_ABS in the processing lib
This makes them match the same macros in the main decoder/encoder
libraries. long_t (which is typedeffed to long) actually is 64
bit on 64 bit unix platforms, which might not be what was
intended.
2014-01-27 08:44:48 +02:00
Martin Storsjö
0339cd51c5 Unify the definition of WELS_THREAD_ERROR_CODE between libraries
This simplifies the code base, reduces the risk for mixups and
gets rid of the use of a local nonstandard typedef.
2014-01-27 08:44:48 +02:00
Martin Storsjö
109fecc547 Consistently use inline instead of __inline 2014-01-27 08:44:48 +02:00
Martin Storsjö
98dd2d91d9 Use 'inline' instead of 'inline_t' in the processing lib
Just use the standard inline keyword with sufficient backwards
compatibility defines, similar to how it is done in the main decoder
and encoder libraries.
2014-01-27 08:44:48 +02:00
volvet
cbe650a3e5 Merge pull request #227 from mstorsjo/snprintf-fixes
Fix handling of snprintf return values and buffer size calculations
2014-01-26 22:26:38 -08:00
Martin Storsjö
076b1116d6 Fix calculating buffer positions when appending with SNPRINTF/WelsSnprintf
This fixes two separate issues.

First, with the MSVC _snprintf implementations, the return value
is negative if the buffer wasn't large enough - this would in
the worst case lead to making iBufferUsed negative, writing before
the start of the buffer.

Secondly, when both iBufferUsed and iBufferLeft are accumulated,
one can't do "iBufferLeft -= iBufferUsed;". As an example,
say the buffer is 100 bytes in total and iBufferLeft is 40 and
iBufferUsed is 60. If SNPRINTF then writes 5 more bytes to the
buffer, iBufferUsed would be 65, but if we now do
"iBufferLeft -= iBufferUsed;" then iBufferLeft would end up as
-25 even though there's 35 bytes left in the buffer to use.

Therefore, we use a separate variable to store the return value
from the latest SNPRINTF call. This is checked to make sure it
wasn't negative, and only this amount is added to iBufferUsed
and subtracted from iBufferLeft.

This is the same pattern used in codec/encoder/core/src/utils.cpp.

strftime never returns negative numbers, so those calls don't
need as much checking.
2014-01-27 08:03:56 +02:00
Martin Storsjö
a344d100ae Fix buffer size checks when appending using SNPRINTF/WelsSnprintf
Checking iBufferLeft > iBufferUsed does not make sense, since
this would stop writing into the buffer alredy after the buffer
is half full, when there is less space left than has been used.

The right check is iBufferLeft > 0.
2014-01-27 08:03:56 +02:00
Martin Storsjö
98bad4f2b3 Don't manually null terminate after calling SNPRINTF
The following pattern is unsafe on all platforms:
 n = SNPRINTF(buf, ...);
 buf[n] = '\0';

On windows, the _snprintf variants return a negative number
if the buffer was too small, thus buf[n] would be outside
of (before the start of) the buffer.

On other platforms, the C99 snprintf function returns the
total number of characters which would have been written if
the buffer had been large enough, which can be larger than
the buffer size itself, and thus buf[n] would be beyond the
end of the buffer.

The C99 snprintf function always null terminate the buffer.
These invocations of SNPRINTF are within !WIN32, so we can
be sure that the SNPRINTF call itself already null terminated
the buffer.
2014-01-27 08:03:56 +02:00
Martin Storsjö
2f5f25b7e3 Merge the encoder/decoder crt_util_safe_x.h into the common lib 2014-01-27 08:03:03 +02:00
Ethan Hugg
55336dee64 Merge pull request #221 from mstorsjo/freebsd
Update building on FreeBSD
2014-01-26 20:41:11 -08:00
Ethan Hugg
b401098a67 Merge pull request #216 from varunbpatil/processing_cleanup
Removed unused header files in processing src
2014-01-26 20:35:32 -08:00
Ethan Hugg
627c1558ae Merge pull request #215 from varunbpatil/dec_core_cleanup
Removed unused headers in decoder core
2014-01-26 20:09:19 -08:00
Ethan Hugg
36054ac2a2 Merge pull request #212 from varunbpatil/enc_core_cleanup
Removed unused header files in encoder core
2014-01-26 19:24:35 -08:00
kali2
fa91f77b1b Merge pull request #214 from licaiguo/fix-rpl
fix reference picture modification bug -- review #67
2014-01-26 19:24:25 -08:00
volvet
488cc4ec8e Merge pull request #228 from mstorsjo/remove-hardcoded-path
Remove a hardcoded debug path specific to somebody's environment
2014-01-26 18:17:31 -08:00
volvet
5ac52e31e9 Merge pull request #224 from mstorsjo/msvc2005
Fix building on MSVC 2005
2014-01-26 17:51:44 -08:00
Martin Storsjö
2963f4ab6e Remove a hardcoded debug path specific to somebody's environment
Instead of using platform specific paths, just use the local
directory instead, reducing the amounts of ifdefs.
2014-01-26 15:22:41 +02:00
Martin Storsjö
e1d96aeaf3 Fix the old MSVC version of WelsGetTimeOfDay
The _ftime function returns void.

This fixes building on MSVC 2005.
2014-01-26 10:52:08 +02:00
volvet
d67fbe74ce Merge pull request #213 from licaiguo/update-resolution
change resolution update logic -- review #66
2014-01-26 00:51:35 -08:00
Martin Storsjö
8062596d23 Fix building threading for freebsd
FreeBSD (and at least NetBSD as well) still use hw.ncpu without
deprecating it, contrary to apple.
2014-01-26 10:40:24 +02:00
Varun B Patil
e459b91412 Removed unused headers in decoder core 2014-01-26 12:00:57 +05:30
Varun B Patil
d809b7e9ee Removed unused headers in encoder core 2014-01-26 11:28:17 +05:30
Varun B Patil
7dbdfbcef8 Use correct format specifier to avoid compiler warnings 2014-01-26 00:47:50 +05:30
Varun B Patil
77f47edf3b include ifdef guard 2014-01-25 18:08:15 +05:30
Varun B Patil
7c6445418b Removed unused header files in processing src 2014-01-25 15:39:05 +05:30
volvet
8420fd3454 Merge pull request #210 from mstorsjo/cleanup-macros
Cleanup the common/macros.h header
2014-01-25 01:05:27 -08:00
licaiguo
058ceb369f fix reference picture modification bug 2014-01-25 16:37:22 +08:00
licaiguo
1a2dd0c1f1 change resolution update logic 2014-01-25 16:12:52 +08:00
volvet
a1c491499f Merge pull request #204 from mstorsjo/remove-dynamic-load-trace
Remove code for dynamically loading a trace library
2014-01-24 22:32:58 -08:00
Ethan Hugg
58c33b8ee8 Merge pull request #205 from mstorsjo/cleanup-trace
Remove the unused dllname parameter to the trace function
2014-01-24 10:46:51 -08:00
Ethan Hugg
c335d1f1be Merge pull request #206 from mstorsjo/function-pointer-cleanup
Avoid mismatches in function pointer assignments
2014-01-24 10:42:01 -08:00
Ethan Hugg
d821fbfd1c Merge pull request #202 from mstorsjo/remove-extra-msvc-projects
Remove unused/superfluous MSVC project files
2014-01-24 09:48:00 -08:00
Martin Storsjö
89f2c8bf7c Remove a duplicate median function
The decoder used WelsMedian while the encoder used WELS_MEDIAN.
The former has two different implementations, WELS_MEDIAN was
identical to the disabled version of WelsMedian.

Settle on using the same implementation for both decoder and
encoder - whichever version of the implementations is faster
should be used for both.
2014-01-24 15:57:11 +02:00
Martin Storsjö
95ed830342 Clarify ifdefs around implementations of ENDIAN_FIX 2014-01-24 15:57:11 +02:00
Martin Storsjö
af76ec0a6b Bundle all MSVC/GCC alignment macros together
This reduces the number of lines spent on having the same
ifdef conditions over and over.
2014-01-24 15:57:11 +02:00
Martin Storsjö
9d16e0f897 Remove an unnecessary define of inline for APPLE_IOS
The standard inline keyword is supported just fine when building
for iOS, there's no need to define it there.
2014-01-24 15:57:11 +02:00
Martin Storsjö
d932509994 Move the definition of WELS_ALIGN out from the #if
Both versions of WELS_ALIGN are identical, so there's no need to
be able to switch between the two.
2014-01-24 15:57:11 +02:00
Martin Storsjö
232ba77a1e Remove some unused macros 2014-01-24 15:57:10 +02:00
Martin Storsjö
cfe4e0e2f8 Remove duplicate defines
These are defined identically just a few lines above.
2014-01-24 15:50:26 +02:00
Martin Storsjö
0f18b31d91 Remove unused defines of __FASTCALL 2014-01-24 15:50:26 +02:00
Martin Storsjö
fd44db01f6 Fix a typo, "vender" -> "vendor" 2014-01-24 15:01:31 +02:00
Martin Storsjö
44dfad2217 Make the function signatures actually match when used as function pointer
Hiding the function signature mismatch with a cast can lead to
more concrete breakage being missed.
2014-01-24 14:51:44 +02:00
Martin Storsjö
d1341554dd Remove an unnecessary cast when setting function pointers
By removing the casts we make sure that the function signature
actually matches and isn't silenced by the cast.
2014-01-24 14:50:39 +02:00
Martin Storsjö
325dd1ce32 Make a function typedef actually use the right type
All functions that are assigned to function pointers with this
typedef (WelsHadamardQuant2x2Skip_c and WelsHadamardQuant2x2Skip_mmx)
use int32_t instead of BOOL_T for the return value.
2014-01-24 14:50:31 +02:00
Martin Storsjö
1f5d786d6a Remove the unused dllname parameter to the trace function 2014-01-24 12:04:29 +02:00
Martin Storsjö
dd7911bfe7 Remove code for dynamically loading a trace library
No code exists within the project for building such a trace library.

This also fixes building on OS X with -Wno-deprecated-declarations
removed, since this code contained calls to deprecated functions
within #ifdef MACOS, which now are enabled when building on OS X.
2014-01-24 11:44:19 +02:00
Martin Storsjö
0d99d8102e Remove the MSVC solution for WelsVP
This isn't necessary, it can be built via the encoder solution.
2014-01-24 09:32:54 +02:00
Martin Storsjö
bdf3465a7e Remove the unused solution and project files for WelsVideoProcessor
These are for building source files that aren't present in the
project any longer.
2014-01-24 09:32:54 +02:00
Martin Storsjö
aa0b2896e1 Remove the 2010 and 2012 MSVC project files from WelsVP as well
The corresponding files for the decoder and encoder were
removed in ccca04453a. The 2008 version can be imported into
MSVC 2010 and 2012 just fine, reducing the amount of project files
to keep in sync.
2014-01-24 09:32:22 +02:00