Commit Graph

478 Commits

Author SHA1 Message Date
Martin Storsjö
1d2c37f7de Simplify the implementation of GetValueOf4Bytes
What the two different implementations currently do is simply
to write a 32 bit number, in the native endianness, into the
given buffer.

The actual purpose of this function is still unknown though,
it can be removed completely without breaking decoding - it
is possibly a remnant from earlier functionality in the
decoder.
2014-01-29 22:44:42 +02:00
Martin Storsjö
cadbec75d8 Fix shifting tricks in deblocking for big endian
The code interprets an array of 4 uint8_t values as one uint32_t
and does shifts on the value. The same optimization can be
kept in big endian as well, but the shift has to be done in the
other direction.

This code could be made truly independent of endianness, but
that could cause some minimal performance degradaion, at least
in theory.

This makes "make test" pass on big endian, assuming that
WORDS_BIGENDIAN is defined while building.
2014-01-29 22:30:33 +02:00
Martin Storsjö
47ec78843a Don't read an uint8_t array as an uint32_t
This makes the code work properly on big endian.

The MC case is similar to how it's done in the encoder.

Neither of these should have any significant performance
impact.
2014-01-29 22:27:55 +02:00
Martin Storsjö
66c39a4fd4 Remove the array_stack_align.h header from the encoder lib
All of these macros are already available in the common
macros.h header. Unify all the macros to be named ENFORCE_*
instead of mixed FORCE/ENFORCE.
2014-01-29 22:07:52 +02:00
Martin Storsjö
b2178aacc0 Fix a typo in a directory name 2014-01-29 10:29:53 +02:00
Ethan Hugg
ec576baf25 Merge pull request #249 from mstorsjo/encconsole-arg-parsing-ifdef
Fix parsing of the -drec option if ENABLE_FRAME_DUMP isn't set
2014-01-28 11:05:31 -08:00
Ethan Hugg
b58bf88b44 Merge pull request #247 from mstorsjo/simplify-missed-inline-asm-macro
Unify the codepaths for WELS_GET_PERFIX_BITS at the second place
2014-01-28 11:04:50 -08:00
Ethan Hugg
08638a9396 Merge pull request #252 from mstorsjo/share-processing-asm
Merge identical assembly code between the processing and encoder libs
2014-01-28 11:04:12 -08:00
Ethan Hugg
3c40261256 Merge pull request #251 from mstorsjo/crt-string-cleanup
Clean up the rest of the usage of crt_safe_util_x
2014-01-28 09:42:56 -08:00
Ethan Hugg
0d7bafcebc Merge pull request #248 from mstorsjo/msvc-proj-cleanup
MSVC project file warning cleanup
2014-01-28 09:40:17 -08:00
Martin Storsjö
04dba61d22 Remove an unused assembly source file
Nothing within processing uses functions from this file.
2014-01-28 13:55:41 +02:00
Martin Storsjö
3761901ed4 Remove sad.asm from the processing lib, move satd_sad from the encoder to the common lib
sad.asm as used in processing is an exact subset of the
code in satd_sad.asm in the encoder.
2014-01-28 13:54:57 +02:00
Martin Storsjö
e0da5a1686 Remove the now unused STRCAT macro 2014-01-28 12:43:22 +02:00
Martin Storsjö
208f033bcd Use WelsStrcat instead of the STRCAT macro 2014-01-28 12:43:22 +02:00
Martin Storsjö
903f265965 Fix a format string to use the correct type 2014-01-28 12:42:01 +02:00
Martin Storsjö
5c5dcfb14c Remove an unused global variable and commented out code 2014-01-28 12:36:54 +02:00
Martin Storsjö
fa93c88fa2 Implement WelsStrcat based on WelsStrncpy
This is a more convenient behaviour (truncating on overflow and
always null terminating the buffer) compared to the MSVC
safe strcat_s which aborts the process if the string doesn't fit
into the target buffer.

Also mark the source buffer as const in the function prototype.
2014-01-28 12:27:22 +02:00
Martin Storsjö
9840f11784 Remove the now unused count parameter to WelsStrncpy
Also remove manual null termination as WelsStrncpy now always
takes care of it.
2014-01-28 12:13:11 +02:00
Martin Storsjö
a16ccc0b4d Fix the implementations of WelsStrncpy
Make the MSVC "safe" version truncate instead of aborting the
process if the buffer is too small.

Update all the other functions to use the right parameter
(iSizeInBytes, not iCount) as 'n' parameter to strncpy.
(By passing iCount as parameter to the normal strncpy functions,
it meant that the resulting buffer actually never was null
terminated.)

Additionally make sure that the other implementations of WelsStrncpy
always null terminate the resulting buffer, just as the MSVC safe
version does when passed the _TRUNCATE parameter.
2014-01-28 12:08:35 +02:00
Martin Storsjö
74e7c9b6d8 Remove the now unused STRNCPY macro 2014-01-28 12:06:07 +02:00
Martin Storsjö
215eb56453 Use WelsStrncpy instead of STRNCPY 2014-01-28 12:05:28 +02:00
Martin Storsjö
7791a6d28d Use WelsSnprintf instead of a combination of strlen and STRNCAT
This simplifies the code and makes the buffer size checks
more consistent. Additionally, the previous version wrote
the extra space character without checking if it actually fit
into the buffer.
2014-01-28 12:00:04 +02:00
Martin Storsjö
0318922654 Check the right pointer for being non-null in WelsLogDefault
In case the log level was invalid, GetLogTag returns null.
Checking pCtx doesn't make sense since nothing within the
if block uses pCtx.
2014-01-28 12:00:04 +02:00
Martin Storsjö
9b59153263 Remove the STRNLEN/WelsStrnlen compatibility functions
These were essentially useless - if strlen() ever was used as
fallback, it either indicated that those ports of the library
were insecure, or that strnlen never was required at all.
In this case it turned out to be the latter (at least after
the preceding cleanups) - all uses of it were with known null
terminated strings.
2014-01-28 12:00:04 +02:00
Martin Storsjö
19f03d6a26 Fix parsing of the -drec option if ENABLE_FRAME_DUMP isn't set
If the define wasn't set, the argument iterator didn't skip
the file name argument.
2014-01-28 11:46:27 +02:00
Martin Storsjö
92fa4eb400 Use strlen instead of WelsStrnlen/STRNLEN for known null terminated strings
strlen is not dangerous if the string is known to be null
terminated (and MSVC does not warn about its use either).

For the cases in the decoder welsCodecTrace.cpp, the string
passed to all WriteString instances is produced by WelsVsnprintf
which always null terminates the buffer nowadays.

Additionally, as the string was passed to OutputDebugStringA
without any length specifier before, it was already assumed to
be null terminated.

The file name parameter passed to DumpDependencyRec and
DumpRecFrame in encoder.cpp is always null terminated,
which was already assumed as it is passed to WelsFopen as is.

As for the encoder utils.cpp, the strings returned by GetLogPath
are string constants that are null terminated.
2014-01-28 11:40:54 +02:00
Martin Storsjö
082a986990 Use strlen() instead of WelsStrnlen/STRNLEN for string constants
A string constant is guaranteed to be null terminated, and thus
doesn't need to use a version of strlen with a fixed buffer size
limit.
2014-01-28 11:38:26 +02:00
Martin Storsjö
da7d3d9bad Remove an unused and unnecessary string length calculation
This is unused since 771ff739b.
2014-01-28 11:38:22 +02:00
Martin Storsjö
8a0bc0a8b9 Don't pass /LTCG to the linker for the console front end binary
The object files for this tool aren't built with the /GL flag
(Whole Program Optimization), leading to the following warning
when linking:
/LTCG specified but no code generation required; remove /LTCG from
the link command line to improve linker performance

Enabling link time code generation for the console front end binary
isn't of much use, since this tool in itself isn't performance
critical.
2014-01-28 11:01:54 +02:00
Martin Storsjö
e306888d0c Unify the codepaths for WELS_GET_PERFIX_BITS at the second place
This changes a second use of the macro which was missed in
60e0255677.

This avoids warnings about unused local variables in 64 bit
builds in MSVC.
2014-01-28 11:00:20 +02:00
Martin Storsjö
3316938ae4 Enable incremental linking in debug configurations of WelsDecPlus
This avoids the following warning when linking:
LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
2014-01-28 10:30:46 +02:00
Ethan Hugg
4334812eee Merge pull request #235 from mstorsjo/merge-ls-defines
Merge the ls_defines.h headers into the common sub-library
2014-01-27 14:10:00 -08:00
Ethan Hugg
00a76419b4 Merge pull request #237 from mstorsjo/simplify-make-lib-rules
Simplify the make rules for creating libraries
2014-01-27 14:09:20 -08:00
Ethan Hugg
d9cbe19110 Merge pull request #240 from mstorsjo/simplify-inline-asm
Unify the fallback codepath for getting prefix bits into a macro
2014-01-27 13:07:38 -08:00
Ethan Hugg
5616ddb3a5 Merge pull request #242 from mstorsjo/simplify-debug-file-locations
Simplify debugging code by always writing trace files to the current directory
2014-01-27 13:04:29 -08:00
Ethan Hugg
990a71dce7 Merge pull request #244 from mstorsjo/remove-unused-files
Removed an unused pair of files generated by MSVC project wizards
2014-01-27 13:03:17 -08:00
Ethan Hugg
b00523329f Merge pull request #243 from mstorsjo/use-stdio-wrappers
Consistently use the compat wrappers for file IO
2014-01-27 13:02:51 -08:00
Martin Storsjö
d36939580a Removed an unused pair of files generated by MSVC project wizards
These files aren't actually even referenced by the MSVC project
files.
2014-01-27 22:55:33 +02:00
Martin Storsjö
3559f425b4 Consistently use the compat wrappers for file IO
As long as WelsFileHandle* is equal to FILE* this doesn't matter,
but for consistency use the WelsF* functions for all handles
opened by WelsFopen, and use WelsFileHandle* as type for it
instead of FILE*.
2014-01-27 22:49:41 +02:00
Martin Storsjö
98614924e2 Remove the now meaningless field sTracePath 2014-01-27 22:37:11 +02:00
Martin Storsjö
771ff739b6 Simplify debugging code - always write debug trace files to the cur directory
This reduces the amount of platform ifdefs.
2014-01-27 22:36:50 +02:00
Martin Storsjö
60e0255677 Unify the fallback codepath for getting prefix bits into a macro
This avoids having to know the details about when the optimized
codepath is available at the place where it's used.
2014-01-27 22:30:00 +02:00
Martin Storsjö
55717d3fb8 Remove an unused function for byte order swapping 2014-01-27 22:18:23 +02:00
Ethan Hugg
e17e664e1a Merge pull request #239 from mstorsjo/remove-unnecessary-calls
Remove some unnecessary STRNCPY/WelsStrncpy calls and intermediate buffers
2014-01-27 11:50:19 -08:00
Ethan Hugg
e05b607daa Merge pull request #223 from mstorsjo/typedef-cleanup
Clean up typedefs within the libraries
2014-01-27 11:46:44 -08:00
Martin Storsjö
ec20ab58ef Remove some unnecessary STRNCPY/WelsStrncpy calls and intermediate buffers 2014-01-27 20:00:15 +02:00
Martin Storsjö
2bcadff204 Use WelsGetTimeOfDay and WelsStrftime instead of LOCALTIME/FTIME/strftime 2014-01-27 19:20:45 +02:00
Martin Storsjö
0439392a79 Fix a typo Millsecond -> Millisecond 2014-01-27 19:20:27 +02:00
Martin Storsjö
3a5ff9b6c8 Use WelsVsnprintf instead of VSPRINTF 2014-01-27 19:18:36 +02:00
Martin Storsjö
f6fe4ddeaa Use WelsSnprintf instead of SNPRINTF 2014-01-27 19:18:36 +02:00
Ethan Hugg
6fea084a42 Merge pull request #234 from mstorsjo/merge-measure-time
Move the measure_time.h header to the common library
2014-01-27 08:57:16 -08:00
Ethan Hugg
2a55578a98 Merge pull request #208 from mstorsjo/remove-unused-mk-field
Remove an unnecessary field from generated makefiles
2014-01-27 08:55:23 -08:00
Ethan Hugg
d5affbaa3c Merge pull request #232 from mstorsjo/merge-fopen-wrappers
Remove the FOPEN macro, use WelsFopen instead
2014-01-27 08:54:20 -08:00
Ethan Hugg
5a8f5f9ad1 Merge pull request #233 from mstorsjo/snprintf-fixes
Make the *snprintf (and similar) functions always null terminate the buffer properly on all platforms
2014-01-27 08:52:37 -08:00
Ethan Hugg
dacd6735fb Merge pull request #230 from mstorsjo/remove-legacy-make
Remove the legacy makefile based build system
2014-01-27 07:59:03 -08:00
Ethan Hugg
fbf7836b8d Merge pull request #236 from mstorsjo/msvc-proj-moved-headers
Update the MSVC project files for earlier moved/removed files
2014-01-27 07:56:25 -08:00
Ethan Hugg
f3afcd51ff Merge pull request #231 from mstorsjo/fix-msvc-build
Readd a removed include
2014-01-27 07:54:29 -08:00
Martin Storsjö
ea8a00278f Simplify the make rules for creating libraries 2014-01-27 14:45:18 +02:00
Martin Storsjö
ea333863ee Update the MSVC project files for earlier moved/removed files 2014-01-27 14:23:22 +02:00
Martin Storsjö
a44808e276 Merge the ls_defines.h headers into the common sub-library 2014-01-27 14:14:41 +02:00
Martin Storsjö
11bdd8adad Move the measure_time.h header to the common library
Both encoder and decoder versions were functionally equivalent,
but I picked the decoder version (but added the static inline
keywords to it) since the encoder one was quite messy with a lot
of commented out code.
2014-01-27 12:58:23 +02:00
Martin Storsjö
c7b74b2b12 Make sure the buffer is null terminated after strftime
If the buffer is too small, there's no guarantee that it is
null terminated. The docs (on both unix and MSVC) say explicitly
that the function returns 0 and the buffer contents are
indeterminate in this case.
2014-01-27 12:07:00 +02:00
Martin Storsjö
7884e77b2d Make sure the buffer always is null terminated in the *snprintf calls for old MSVC
These functions leave the buffer unterminated in case it was too
small.
2014-01-27 12:06:24 +02:00
Martin Storsjö
4a8f54d767 Use vsnprintf in the old MSVC version of WelsSnprintf as well 2014-01-27 12:06:08 +02:00
Martin Storsjö
0ce42ffb89 Rename WelsVsprintf to WelsVsnprintf, to indicate that it actually checks the length 2014-01-27 12:05:53 +02:00
Martin Storsjö
e42e82aa1f Make WelsVsprintf use vsnprintf, to check the buffer size
Otherwise builds on platforms other than MSVC might be
insecure.

Use vsnprintf_s with the _TRUNCATE flag instead of vsprintf_s
when using MSVC - this truncates the buffer instead of aborting
the whole process in case it's too small.
2014-01-27 12:05:39 +02:00
lyao2
00948873fb fix spell error of RcInitGoomParameters 2014-01-27 17:29:24 +08:00
Martin Storsjö
c174dcd652 Remove the FOPEN macro, use WelsFopen instead
This avoids ifdefs at each place the macro is used.
2014-01-27 10:29:05 +02:00
Martin Storsjö
febf6bb51e Readd a removed include
This fixes builds without NO_DYNAMIC_VP (such as with the MSVC
project files), the include was removed in d809b7e9.
2014-01-27 10:25:32 +02:00
volvet
33fe2b5883 Merge pull request #225 from mstorsjo/simplify-ifdefs
Simplify ifdefs in measure_time.h
2014-01-27 00:14:44 -08:00
Martin Storsjö
b468ed3c0b Unify the declaration of int8_t within the processing lib with the rest
int8_t in general should to be defined as signed char, since there
are actual envrionments where a plain 'char' is unsigned.

This also reduces the differences between the typedef headers of
the different sub-libraries.
2014-01-27 08:44:48 +02:00
Martin Storsjö
a24fd5e120 Make the bool_t typedef in the processing lib match the others
There is no specific reason to use int32_t for this type.
2014-01-27 08:44:48 +02:00
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ö
30bcfea6b8 Simplify ifdefs in measure_time.h
Instead of using "defined(MSC_VER) || defined(__MINGW32__)" to
indicate the windows platform, just check for the _WIN32 define
instead.

Also remove an unused codepath - the removed codepath would
only be used under the condition
"(defined(MSC_VER) || defined(__MINGW32__)) && !defined(_WIN32)",
and I'm not aware of any environment with MSVC or MinGW that
doesn't define _WIN32, thus this codepath never was used.
2014-01-27 08:08:23 +02: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ö
7394254fb5 Remove the legacy makefile based build system
The new one is much more flexible. The old one is unmaintained.
2014-01-26 16:28:58 +02: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
volvet
84f6602120 1 fix crash bug 963392, 2 update help print: the max supported gop size should be 8 2014-01-26 13:35:31 +08:00
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ö
7df69c1482 Remove an unnecessary field from generated makefiles 2014-01-24 15:02:40 +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
Martin Storsjö
20478d4733 Remove MSVC solution user state files that shouldn't be version controlled 2014-01-24 09:31:45 +02:00
Martin Storsjö
e0d45682d3 Add the include dirs for cpu.h to the 32 bit build targets as well 2014-01-23 23:47:12 +02:00
Martin Storsjö
42623deafb Update the project file after removing util.cpp 2014-01-23 23:47:08 +02:00
Martin Storsjö
1a51a1042f Fix 32 bit assembly build with the MSVC project files 2014-01-23 23:47:03 +02:00
Martin Storsjö
c61b040c11 Remove an MSVC resource editor state file
This file contains the local UI state of the resource editor,
and should not be committed to version control.
2014-01-23 22:55:36 +02:00
Martin Storsjö
eaf95566ea Remove an unused function wrapping a standard function
This allows removing a whole file.
2014-01-23 22:55:36 +02:00
Martin Storsjö
aec2ed30cd Simplify an ifdef
We don't need to check both platform and compiler at the same time,
checking the compiler is enough here.
2014-01-23 22:55:36 +02:00
Ethan Hugg
e55d777d17 Merge pull request #191 from zhilwang/fix-decoder-win64-asm-issues
Fix decoder win64 asm issues
2014-01-23 10:47:13 -08:00
Ethan Hugg
63c03b10b4 Merge pull request #194 from volvet/remove_MEMORY_REQUEST_ALIGN_BYTES
remove MEMORY_REQUEST_ALIGN_BYTES
2014-01-23 10:25:27 -08:00
Ethan Hugg
9b0fb562cd Merge pull request #195 from mstorsjo/disable-cpufeature-logging
Only print detected cpu info when in debug mode
2014-01-23 10:13:53 -08:00
Martin Storsjö
3cacaf85f1 Include the executable suffix within make
This makes sure that e.g. "make clean" actually removes
the built exe files, and avoids relinking the exe files each
time make is run when cross compiling from linux to windows.

(Make on windows seems to have an exception that knows to skip
rebuilding the 'h264enc' target if 'h264enc' doesn't exist but
'h264enc.exe' does, but this exception doesn't work on normal
unix make.)
2014-01-23 16:15:22 +02:00
Martin Storsjö
edc6aa8fa2 Only print detected cpu info when in debug mode
The ifdef guards from this block were (accidentally?) commented
out in ec84f4bc.
2014-01-23 14:47:37 +02:00
volvet
277242b3a0 remove MEMORY_REQUEST_ALIGN_BYTES 2014-01-23 17:21:13 +08:00
Licai Guo
fc56c7d007 1. use WELS_CLIP1 to replace table look-up;
2. fix bugs about buffer overflow
3. add more boundary checks
2014-01-23 00:07:21 -08:00
ruil2
99412b0fc2 Merge pull request #167 from licaiguo/fix-961370
fix 961370 -- review request #50
2014-01-22 23:52:30 -08:00
Licai Guo
493c31f6a6 Merge pull request #174 from volvet/coverity_issue_fix
fix coverity issues 26973, 26974, 26975, 26976, 26972, 26980.
2014-01-22 23:50:47 -08:00
Martin Storsjö
8583e13e34 Clear the executable bit on source files 2014-01-23 09:30:50 +02:00
huili2
f149843f7a Merge pull request #190 from licaiguo/add-level-limits
Add level limits for decoder
2014-01-22 22:56:39 -08:00
kali2
c0e72338c1 Merge pull request #188 from ruil2/MaxGOPSize_update
update Max GOP size and minor fixes for early return-- review request#59
2014-01-22 22:48:41 -08:00
Licai Guo
fe2fa96bcb update vs project files 2014-01-22 22:14:31 -08:00
Licai Guo
def55c141e fix decoder win64 asm float issues 2014-01-22 19:01:51 -08:00
ruil2
ca6c00ba18 Merge pull request #168 from licaiguo/fix-960932
fix 960932 by add boundary checks on run_before -- review request #51
2014-01-22 18:59:40 -08:00
Licai Guo
8e201827f4 remove blank lines 2014-01-22 18:48:19 -08:00
Licai Guo
34300be44f add change from master 2014-01-22 18:41:27 -08:00
Licai Guo
9a875532fd add level limits 2014-01-22 18:35:50 -08:00
Licai Guo
e8fc798d02 add parentheses 2014-01-22 18:27:46 -08:00
ruil2
9efbef67b9 Merge pull request #153 from licaiguo/fix-empty-packets
fix crash caused by empty packets and add more checks -- review request #44
2014-01-22 17:44:05 -08:00
Ethan Hugg
256cd0f610 Merge pull request #172 from volvet/win64_float_fix_for_enc_b
fix win64 float issue, enable AQ assembly
2014-01-22 17:25:03 -08:00
Ethan Hugg
691e8379b5 Merge pull request #184 from mstorsjo/c-interface-vtbl
Add a public C API to the library by mimicking the C++ ABI with a C struct
2014-01-22 08:11:40 -08:00
Ethan Hugg
99565beb81 Merge pull request #181 from mstorsjo/threadlib-update-macos-linux
Update the cpu core count detection functions for linux and mac os
2014-01-22 08:09:39 -08:00
ruil2
0a5f4354e9 minor fixes for writting format 2014-01-22 16:09:20 +08:00
volvet
c4f0159620 Merge pull request #187 from licaiguo/fix-coverage-scan
fix issues found by coverage scan -- review request #58
2014-01-22 00:07:02 -08:00
Licai Guo
ff5e6dde2a remove unnecessary return 2014-01-21 23:56:39 -08:00
Licai Guo
048dea434d remove unnecessary check, confirmed safe usage 2014-01-21 23:54:21 -08:00
Martin Storsjö
5e10951c47 Use sysctl instead of the deprecated Gestalt API for getting the number of cores on OS X
Also use the __APPLE__ predefined define instead of MACOS for enabling
these code paths.

This also avoids having to link to the CoreServices framework in
order to get the Gestalt function.
2014-01-22 09:44:49 +02:00
Martin Storsjö
af6feaa45c Use sched_getaffinity to get the number of cores on linux
This gets rid of the code that parses /proc/cpuinfo, and avoids
forking within the library.

The previous code also failed build on modern glibc versions
due to ignoring the return value of the system, read and write
system calls.
2014-01-22 09:44:48 +02:00
ruil2
4fd3bafa65 update Max GOP size and minor fixes for early return 2014-01-22 15:22:58 +08:00
Ethan Hugg
ae73411f9a Merge pull request #176 from mstorsjo/remove-msvc-2010-2012-files
Remove the MSVC 2010 and 2012 project files
2014-01-21 19:29:49 -08:00
Licai Guo
a53377314a fix issues found by coverage scan 2014-01-21 19:13:46 -08:00
Martin Storsjö
36f96cb766 Don't include the headers for dynamically loading the VP library if NO_DYNAMIC_VP is defined
bundleloader.h, which is included if MACOS is defined, defines
inline functions that reference bundle loading system functions,
which requires linking to the core foundation framework.

Avoid requiring linking to extra libraries/frameworks if
NO_DYNAMIC_VP is defined.
2014-01-21 21:15:32 +02:00
Martin Storsjö
043575ffb0 Add a public C API to the library
Add a struct that matches the C++ interface vtable.

This requires that the C++ interface methods are declared to use
the same calling convention as normal C functions, and that the
C struct exactly matches the layout and ordering of the C++
virtual table - MSVC seemed to reorder methods if there were
overloaded methods.
2014-01-21 20:54:32 +02:00
Martin Storsjö
dd0db820fc Rename public interface methods to avoid two overloaded methods with the same name
This is required to make the order in the C++ virtual table
consistent in MSVC - previously the overloaded methods were
ordered differently in the vtable compared to the interface
declaration.
2014-01-21 20:54:32 +02:00
Ethan Hugg
efaa153bb1 Merge pull request #183 from mstorsjo/remove-unused-typedef
Remove unused typedefs
2014-01-21 10:34:14 -08:00
Ethan Hugg
ae0bd3ee02 Merge pull request #182 from mstorsjo/move-threadlib
Move the WelsThreadLib files to the common directory/library
2014-01-21 10:33:50 -08:00
Ethan Hugg
b6dcd94cb0 Merge pull request #180 from mstorsjo/remove-disabled-bundle-loading
Remove disabled/broken/unused code for bundle loading in the console tools
2014-01-21 10:30:28 -08:00
Ethan Hugg
57a292b106 Merge pull request #179 from mstorsjo/fix-bundleloader-64bit
Fix building of macos bundle loading code on 64 bit
2014-01-21 09:46:40 -08:00
Ethan Hugg
c4609af29c Merge pull request #178 from mstorsjo/remove-system-header-hackery
Remove system header/define hackery in welsenc.cpp
2014-01-21 09:45:38 -08:00
Ethan Hugg
47db901f29 Merge pull request #177 from mstorsjo/remove-unused-function
Remove an unused function
2014-01-21 09:44:08 -08:00
Martin Storsjö
c196fd1ef0 Remove unused typedefs 2014-01-21 15:44:05 +02:00
Martin Storsjö
68f32c3c29 Move the WelsThreadLib files to the common directory/library
This simplifies building the thread library code via the
makefile based build system.
2014-01-21 15:11:07 +02:00
Martin Storsjö
249b4e3d1f Only build the thread code if multithreading is enabled
This allows including the source file in the build even if
multithreading isn't desired.
2014-01-21 15:11:07 +02:00
Martin Storsjö
867d39e01b Remove system header/define hackery in welsenc.cpp
There doesn't seem to be any actual need for this, building
on linux still works just fine.
2014-01-21 15:02:51 +02:00
Martin Storsjö
67405177d9 Remove an unused function
This function contains a lot of platform specific constants
whose use is unknown.
2014-01-21 15:01:52 +02:00
Martin Storsjö
d1a6929516 Fix building of macos bundle loading code on 64 bit 2014-01-21 15:00:56 +02:00
Martin Storsjö
41928236e4 Remove unused files about macos bundle loading from the console tools 2014-01-21 14:59:41 +02:00
Martin Storsjö
b903aa8273 Remove/disable broken code for loading the encoder library from a macos bundle
This refers to a file "bundlewelsenc.h" which doesn't even
exist in the project at the moment.

The corresponding bundle loading code is not called at all
in the decoder console tool.
2014-01-21 14:59:41 +02:00
Martin Storsjö
ccca04453a Remove the MSVC 2010 and 2012 project files
Only the 2008 version is kept up to date at the moment.

The newer versions of MSVC can open and upgrade the 2008 version
files anyway, so by removing the unmaintained ones we reduce the
confusion and maintainance burden.

Additionally, the preferred way of building with MSVC is with the
makefile build system, according to the readme.
2014-01-21 13:51:41 +02:00
Martin Storsjö
5cb3fc93e0 Remove the __NO_CTYPE define
Nothing within the project uses it, and it's not necessary to
build the project either, tested on both linux and mingw.
2014-01-21 12:48:33 +02:00
Licai Guo
56767f8154 add parenthses 2014-01-21 00:23:41 -08:00
volvet
1d86dbdc0f fix coverity issues 2014-01-21 16:17:56 +08:00
volvet
5c9f447c0e fix win64 float issue, enable AQ assembly 2014-01-21 11:16:48 +08:00
Ethan Hugg
ae027b83d8 Merge pull request #159 from mstorsjo/frameskip-option
Add a runtime option for controlling frame skipping
2014-01-20 16:56:32 -08:00
Licai Guo
a2164c22af fix 960932 by add boundary checks on run_before 2014-01-19 22:15:25 -08:00
Licai Guo
64380c46b8 fix 961370 2014-01-19 18:54:45 -08:00
V
a6463be0cc Allow yasm to be used instead of nasm.
http://www.nasm.us/doc/nasmdoc3.html#section-3.4.1 says a zero should
follow $ in numeric constants, but yasm complains about it when not
followed.
2014-01-18 13:59:24 +01:00
Ethan Hugg
2011a7407e Merge pull request #147 from volvet/illegal_assembly_fix
fix illegal instruction use
2014-01-17 14:13:24 -08:00
Martin Storsjö
a8d549e343 Omit assembler source rules if no asm sources are found 2014-01-17 18:52:46 +02:00
Martin Storsjö
cee3329ff0 Add a runtime option for controlling frame skipping 2014-01-17 12:39:33 +02:00
Martin Storsjö
6e75136201 Don't load welsdec.dll at runtime in the decConsole test app on windows
Instead just link directly to it. This matches how the library is
linked/loaded in encConsole/h264enc as well.

Only the 2008 version project file is updated for now, since
the 2010 and 2012 ones are out of sync right now.
2014-01-17 12:06:21 +02:00
Martin Storsjö
b842ff30e5 Make the compiler/ar/linker file output parameters overrideable
This is in preparation for allowing building using MSVC via
makefiles.
2014-01-17 12:06:11 +02:00
Martin Storsjö
d7c907198b Fix building in MSVC 2012 by avoiding redefining the inline keyword
While building succeeds in MSVC 2008, it currently fails in 2012
due to error C1189 "The C++ standard library forbids macroizing
keywords", which is caused by doing "#define inline __inline" in
the macros.h header.

This could have been missed before since it only was triggered
if macros.h was included before some other system header was
included that contained checks against these inline defines.
2014-01-17 12:04:27 +02:00
Licai Guo
1a04694d97 fix crash caused by empty packets and add more checks 2014-01-16 22:13:03 -08:00
sijchen
49c24646a9 fix the range of SAD 2014-01-17 13:55:03 +08:00
Varun B Patil
98ff18d15d fix typo 2014-01-17 00:50:03 +05:30