Commit Graph

1049 Commits

Author SHA1 Message Date
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
volvet
856f186b8e fix illegal instruction use 2014-01-16 15:57:22 +08:00
Ethan Hugg
b1fc94e314 Merge pull request #134 from mstorsjo/encode-sps-pps
Add an encoder method for encoding the SPS/PPS without encoding a frame
2014-01-14 15:31:18 -08:00
Martin Storsjö
65b339815e Get rid of trailing whitespace in the assembly source files 2014-01-13 20:12:04 +02:00
Martin Storsjö
ddcfc09c49 Convert some assembly files to unix newlines
This makes them consistent with the rest of them.
2014-01-13 20:12:04 +02:00
Ethan Hugg
301b06ad36 Merge pull request #135 from mstorsjo/pointer-cast
Fix casting of the return value integer to a pointer in the thread lib
2014-01-13 09:05:01 -08:00
Ethan Hugg
e560ba58a3 Merge pull request #141 from licaiguo/update-vs2008-files
update vs2008 files
2014-01-13 09:02:47 -08:00
Ethan Hugg
a1d37ff6b5 Merge pull request #142 from mstorsjo/remove-unused-variable
Remove an unused variable
2014-01-13 09:01:59 -08:00
Martin Storsjö
11394f492d Remove accidentally added const for plain non-pointer function parameters
This was accidentally added in 61117c85 when the pointer
parameters were made const.
2014-01-13 12:14:43 +02:00
Martin Storsjö
c5ee5f8f05 Remove an unused variable 2014-01-13 12:11:37 +02:00
licaiguo
b92683691f update vs2008 files 2014-01-13 15:44:07 +08:00
volvet
14f6c4fa72 Merge pull request #131 from mstorsjo/win64-asm
win64: Use rsp instead of esp
2014-01-12 00:42:29 -08:00
Ethan Hugg
4a8a9aabc1 Merge pull request #122 from volvet/core_number_detect_fix
Core number detect fix
2014-01-11 11:29:45 -08:00
Martin Storsjö
2766215545 Add an encoder method for encoding the SPS/PPS without encoding a frame
This is useful if using a muxer that requires the SPS/PPS to be
available before the first frame is encoded.
2014-01-11 13:58:56 +02:00
Martin Storsjö
a78f1b2650 win64: Use rsp instead of esp
Using esp works by coincidence as long as the stack pointer is
within the first 4 GB of the address space - which seems to work
as long as the test binary is built with /dynamicbase:no, but breaks
if this option is removed.
2014-01-11 13:12:35 +02:00
Martin Storsjö
d8d5dfe646 Fix casting of the return value integer to a pointer in the thread lib
This fixes building of the thread lib on 64 bit unix.
2014-01-11 13:12:30 +02:00
volvet
ccaef9fc6d protect code if cpuid.4 return eax as zero 2014-01-11 18:56:22 +08:00
Ethan Hugg
f02d0aa667 Merge pull request #137 from mstorsjo/const-global-tables
Mark some read-only global tables const
2014-01-10 21:32:21 -08:00
Ethan Hugg
2c9f19474a Merge pull request #132 from mstorsjo/mingw64
Add support for building on 64 bit mingw
2014-01-10 14:21:33 -08:00
Martin Storsjö
6412884211 Mark some read-only global tables const 2014-01-10 23:48:53 +02:00
Martin Storsjö
61117c85d8 Mark pointers to quantization functions const where possible 2014-01-10 23:48:35 +02:00
Martin Storsjö
401f6d7160 Remove the HAVE_CACHE_LINE_ALIGN, ENCODER_CORE and WELS_SVC defines from visual studio project files
These defines are not used anywhere any longer.
2014-01-10 15:34:12 +02:00
Martin Storsjö
104494475e Remove the HAVE_CACHE_LINE_ALIGN, ENCODER_CORE and WELS_SVC defines from makefiles
Neither of them are used anywhere any longer.
2014-01-10 15:33:09 +02:00
Martin Storsjö
41a251630d Use intptr_t instead of long for casting pointers to integers
This fixes building on mingw-w64.

Include stdint.h on everything except MSVC for definitions of
common standard types, include stddef.h on MSVC instead, since
MSVC doesn't have stdint.h in all older versions that are
supposed to be supported, but MSVC always defines intptr_t via
stddef.h.
2014-01-10 14:52:09 +02:00
Martin Storsjö
9ccae7b0d6 Remove useless use of the HAVE_CACHE_LINE_ALIGN define
The code ends up as the exact same regardless of whether the
define is set or not.
2014-01-10 12:25:39 +02:00
Martin Storsjö
8bc5bf58a0 Remove the unused global variable g_uiCacheLineSize 2014-01-10 12:20:59 +02:00
volvet
f2a14600a5 check cpuid max level before use cpuid.4 2014-01-10 15:32:35 +08:00
ekr
eeb11578ca Merge pull request #123 from licaiguo/update-vs2010-files
Update vs2010 files
2014-01-09 18:07:57 -08:00
volvet
1834cb3aca Merge branch 'master' of https://github.com/cisco/openh264 into core_number_detect_fix 2014-01-10 09:06:27 +08:00
Martin Storsjö
3b0844e400 Regenerate the targets makefiles
Commit f38111d76b updated these files
manually (based on older versions of them) to something not generated
by the current mktargets.py/sh, losing the compact pattern rules.
2014-01-09 11:30:40 +02:00
volvet
0e38e5c4e7 add exception handler, the AMD cpu must be single core if it do not support HTT 2014-01-09 16:59:07 +08:00
Licai Guo
15bd7dab57 fix crash issue for too big packet size 2014-01-09 00:28:13 -08:00
licaiguo
c7f1974ef7 update vs2010 files 2014-01-09 16:05:23 +08:00
Licai Guo
77fd9aa4f0 merge macros.h to common/macros.h 2014-01-09 15:41:24 +08:00
licaiguo
8a1922837d update vs2010 files, we need to merge macros.h.
Currently We keep three copies
2014-01-09 15:11:36 +08:00
volvet
02e4bf6e9d fix UNIX64 and WIN64: use ecx as input param 2014-01-09 12:31:13 +08:00
volvet
ed8081022b fix cpu core query via cpuid 2014-01-09 12:18:30 +08:00
ekr
61f1bac9ff Merge pull request #119 from sijchen/merge6
complete the encoder interface of bit rate and frame rate updating
2014-01-08 17:39:08 -08:00
sijchen
4999b816ab complete the encoder interface of bit rate and frame rate updating 2014-01-09 09:20:35 +08:00
Licai Guo
f38111d76b file a new commit
Squashed commit of the following:

commit 26be4c66686d2d75ba1eb381ae562d30474429b2
Merge: 91bde82 8df0566
Author: Licai Guo <guolicai@gmail.com>
Date:   Wed Jan 8 16:56:49 2014 -0800

    Merge remote-tracking branch 'upstream/master' into move_to_common

    Conflicts:
    	codec/common/targets.mk
    	codec/console/dec/targets.mk
    	codec/decoder/targets.mk
    	codec/encoder/targets.mk
    	codec/processing/targets.mk

commit 91bde8209dad40eaa0b26cc75467e4ce52b4c8ae
Merge: c827054 cc2ffee
Author: Licai Guo <guolicai@gmail.com>
Date:   Tue Jan 7 20:16:11 2014 -0800

    Merge remote-tracking branch 'upstream/master' into move_to_common

commit c8270543fab8e40cb4aebf62d7646068afe19484
Author: Licai Guo <guolicai@gmail.com>
Date:   Mon Jan 6 19:12:39 2014 -0800

    enable WelsScan4x4DcAc_ssse3

commit c8d2823d54e54cab146098302441ef44a4638382
Author: Licai Guo <guolicai@gmail.com>
Date:   Mon Jan 6 18:46:06 2014 -0800

    remove trailing white spaces

commit 39866a9cf54db6120aabd6a01afd4aedbead8af0
Author: Licai Guo <guolicai@gmail.com>
Date:   Mon Jan 6 18:06:10 2014 -0800

    move common code(deblocking and cpu) to common, rename decoder's
    Intra-prediction functions prefix.
2014-01-08 17:03:00 -08:00
Ethan Hugg
f85911e331 Merge pull request #117 from mstorsjo/make-patterns
Use make patterns to avoid needing autogenerated rules for each source file
2014-01-08 09:48:31 -08:00
Ethan Hugg
4afa4fc7a8 Merge pull request #116 from mstorsjo/make-deps
Add proper dependencies for the command line binaries
2014-01-08 09:35:21 -08:00
Ethan Hugg
59466d0986 Merge pull request #115 from mstorsjo/remove-vc6-project-files
Remove VC6 project files
2014-01-08 08:46:03 -08:00
Martin Storsjö
488fb7bb20 Add proper dependencies for the command line binaries
This makes sure that all the dependency libs are built before trying
to link them together, fixing parallel make (which occasionally
failed due to trying to link the encoder or decoder command line
binaries before the libs had been built) and also fixes building an
individual component by e.g. "make h264enc".
2014-01-08 16:36:11 +02:00
Martin Storsjö
80669ed059 Use make patterns to avoid needing autogenerated rules for each source file 2014-01-08 16:33:35 +02:00
Martin Storsjö
8cf9bb68f0 Remove VC6 project files
These files are unmaintained and outdated, not even functional
in the initial commit of the project. Additionally, no similar
files are present for the decoder.
2014-01-08 12:02:44 +02:00
Martin Storsjö
cd0ee83393 Don't call process affinity functions in windows store or windows phone apps
These functions are only available in the desktop api subset.
2014-01-08 09:21:07 +02:00
Martin Storsjö
d0086b1940 Use the right data type for process affinity mask
This allows using the same code on 64 bit windows as well.

Tested on MSVC 2008-2013.
2014-01-08 09:21:06 +02:00
Martin Storsjö
65fa5d2a37 Enable use of D3D9 only when targeting desktop apps
Don't try to build this when building for phone/windows store (aka
metro/winrt) apps - this API isn't available there.
2014-01-08 09:21:06 +02:00
Martin Storsjö
05bf57a2af Use InitializeCriticalSectionEx for Windows Store or Windows Phone apps
The old InitializeCriticalSection function isn't available in
these API partitions, and the new InitializeCriticalSectionEx
function is only available since Vista, so we want to keep using
the old function for normal desktop code.
2014-01-08 09:20:39 +02:00
Ethan Hugg
8af6e5cf69 Merge pull request #77 from varunbpatil/enc_testapp_arbitrary_res
Non-multiple of 16 width/height support for enc testapp
2014-01-07 13:38:04 -08:00
Ethan Hugg
4033940ba7 Merge pull request #105 from mstorsjo/msvc-disable-inline-asm-on-arm
Use MSVC inline assembly only on (32-bit) X86
2014-01-07 13:13:05 -08:00
Ethan Hugg
9b46788676 Merge pull request #85 from varunbpatil/safe_param_parse
Safe parsing of command line parameters in enc console app
2014-01-06 11:33:13 -08:00
Ethan Hugg
e801b58bf8 Merge pull request #110 from huili2/master
interface clean and inside modification
2014-01-06 11:02:49 -08:00
Ethan Hugg
dd3466cc6b Merge pull request #88 from mstorsjo/remove-pragma-pack
Remove pragmas for non-standard struct packing in the public API
2014-01-06 09:46:17 -08:00
Ethan Hugg
057d3e507b Merge pull request #100 from mstorsjo/trailing-whitespace-cpp-comments
Remove trailing whitespace in comments
2014-01-06 09:33:52 -08:00
Ethan Hugg
9cf180dda6 Merge pull request #103 from mstorsjo/remove-commented-out-pragmas
Remove commented out pragmas
2014-01-06 08:37:33 -08:00
Ethan Hugg
24195dd884 Merge pull request #101 from mstorsjo/rerun-astyle
Rerun astyle on the C++ source files
2014-01-06 08:20:05 -08:00
Ethan Hugg
96ecb0942d Merge pull request #96 from mstorsjo/executablebit
Fix the executable bit on files
2014-01-06 08:17:41 -08:00
huili2
32fd2c4e4d interface clean and inside modification
clean and comment some API.
move the SKIP mv pred location
remove the unused buffer in intra construction.
2014-01-06 13:28:55 +08:00
ekr
42389008a3 Merge pull request #95 from ethanhugg/travis2
Add release builds (ASM) to Travis
2014-01-05 20:00:45 -08:00
licaiguo
a3e0a71c71 remove unused intra-prediction functions and declarations 2014-01-06 11:53:43 +08:00
licaiguo
abb1311fb9 rename decoder's intra-prediction prefix from Wels to WelsDecoder. 2014-01-06 11:22:39 +08:00
Martin Storsjö
4a08781c18 Use MSVC inline assembly only on (32-bit) X86
Currently this used the _MSC_VER && !WIN64 to enable the inline
assembly, which still tried to use this code on windows on arm.
Using _MSC_VER && _M_IX86 is enough since _M_IX86 is defined only
when targeting 32 bit x86, not for x64.
2014-01-05 19:20:20 +02:00
Martin Storsjö
790110b2ce Remove commented out pragmas 2014-01-05 15:04:34 +02:00
Martin Storsjö
b1c070cf8b Remove "pragma once"
The same thing is handled by proper standard C header include guards
in all these files.
2014-01-05 15:03:25 +02:00
Martin Storsjö
d1b0713c76 Add a proper include guard to dec_console.h 2014-01-05 15:03:08 +02:00
Martin Storsjö
55b82b3cd7 Rerun astyle on the C++ source files
astyle was only run on .cpp files this time - already in
ff6b66917 where the style cleanup was done initially, not all
.h files seem to have gotten the same styling (rerunning astyle
on .h files at that commit produces a huge diff).
2014-01-05 14:59:18 +02:00
Martin Storsjö
d3ee1de5ac Remove trailing whitespace in comments
The astyle cleanup keeps trailing whitespace within comments,
but the whitespace here is not significant nor intentional
and thus should be removed.
2014-01-05 14:53:21 +02:00
Martin Storsjö
44240ce778 Remove the executable bit accidentally set on an asm source file 2014-01-05 14:43:53 +02:00
Ethan Hugg
8c1550954b Add release builds to Travis and fix warning in release build. 2014-01-04 22:42:57 -08:00
Andreas Gal
dba62070bf Merge pull request #80 from ethanhugg/othercontribs
Fixed typo in old Linux encoder makefile
2014-01-04 18:50:20 -08:00
volvet
2c828d7918 merge VS2012 makefile for 64bits assembly 2014-01-03 16:12:47 +08:00
volvet
ec84f4bcc9 resolve conflict 2014-01-03 14:49:45 +08:00
unknown
1e5a290855 1. fix gcc 3.4 link error.
2. fix mingw build issue when enable asm
2014-01-02 17:19:25 +08:00
Martin Storsjö
8f3c129f25 Remove pragmas for non-standard struct packing in the public API
These pragmas specified that structs should be packed in a way
different from the normal way defined by the current platform ABI.
Since these pragmas are in headers part of the public API, and the
pragmas are nonstandard, this is a portability and compatibility
hazard (all code calling the library need to have the same support
for the nonstandard pragma).

Additionally, accessing unaligned struct members (as produced by this
tight struct packing) can give reduced performance or even lead to
crashes on platforms that require strict alignment.

The only theoretical possible benefits of using the pragma are either
matching a certain struct layout defined in some other, fixed ABI
(but since this is an interface defined by this library itself, there's
no such prior binary interface that needs to be matched), or to reduce
the memory usage by packing the structs tighter (where the reduction
would be marginal at best).
2013-12-31 10:05:27 +02:00
Varun B Patil
d43e91a8a6 Safe parsing of command line parameters in enc console app 2013-12-29 18:01:32 +05:30
Martin Storsjö
cf59a34464 Don't use include guards with leading underscores
Defines with leading underscores are reserved.

This fixes issue #10.
2013-12-29 00:13:34 +02:00
Ethan Hugg
71e48218c4 Merge pull request #63 from mstorsjo/crossbuild
Use $(AR) instead of explicitly calling 'ar'
2013-12-27 08:23:06 -08:00
Ethan Hugg
9254d722d3 Merge pull request #62 from varunbpatil/cleanup
minor cleanup and bug fixes
2013-12-26 17:52:49 -08:00
Ethan Hugg
90db78dede Fixed typo in old Linux encoder makefile 2013-12-26 07:16:35 -08:00
Varun B Patil
70d2ae8334 Non-multiple of 16 width/height support for enc testapp
Also included test sequence.
../h264enc welsenc_arbitrary_res.cfg
2013-12-25 16:14:37 +05:30
V
b939d91517 Add workaround for missing strnlen.
Enabled by default, define HAVE_STRNLEN to disable workaround.
2013-12-23 22:03:41 +01:00
V
7fa09903cf Add MinGW platform makefile and related source changes 2013-12-23 21:42:31 +01:00
ekr
c01ffd25c8 Merge pull request #58 from ethanhugg/othercontribs
Rollup of minor fixes found by Martin Ettl
2013-12-23 03:53:59 -08:00
ekr
c21b70f159 Merge pull request #73 from ruil2/master
typo correction
2013-12-23 03:37:24 -08:00
ruil2
973902cf3f typo correction-- update another file 2013-12-23 11:01:35 +08:00
ruil2
27bd915423 typo correction 2013-12-23 10:47:13 +08:00
Varun B Patil
e69983d6de Improve command line arguments handling in dec testapp
Problems fixed:
1. No longer segfaults if an option is specified without an accompanying argument.

2. Wrongly incrementing i by 3 instead of by 2 while parsing command line options.
2013-12-20 11:46:09 +05:30
Varun B Patil
5ff3a23c18 Fix typo which ignored dec options file in dec testapp
Options file was not being taken because it was wrongly being taken as output
file for decoder.
2013-12-20 11:31:13 +05:30
Varun B Patil
2bc7d2bf86 memset not required as struct is already initialized to 0.
Moreover, memset causes loss of sDecParam.sVideoProperty.size
that was set previously.
2013-12-20 11:31:13 +05:30
Varun B Patil
301fd58c04 Replace some fancy stuff with simple function 2013-12-20 11:30:58 +05:30
Ethan Hugg
2f87e0c908 Merge pull request #66 from mstorsjo/valgrind
Don't check for scene changes on forced IDR frames
2013-12-19 19:09:41 -08:00
Ethan Hugg
630085ce6e Cast pointer math to long long int 2013-12-19 14:25:42 -08:00
Ethan Hugg
c49f303b14 Use %llu instead to print a size_t. 2013-12-19 11:40:40 -08:00
Ethan Hugg
b2066e1dc2 Move -Werror to platform file. Also, %zu can't be used on Windows. 2013-12-19 11:27:05 -08:00
Ethan Hugg
50a74382f0 Fix warning and turn on -Werror for Travis 2013-12-19 09:27:22 -08:00
Martin Storsjö
3eda5a899e Don't check for scene changes on forced IDR frames
For the first encoded frame, is bEncCurFrmAsIdrFlag true
while bIdrPeriodFlag is false.

Previously, the scene detection code unnecessarily checked for
a scene change in the first encoded frame (where the reference
frame was an uninitialized frame), triggering valgrind warnings
about using uninitialized memory.
2013-12-18 13:41:32 +02:00
Martin Storsjö
785ac16d28 Use $(AR) instead of explicitly calling 'ar'
This simplifies overriding the command used, e.g. for cross
compilation.
2013-12-17 12:29:21 +02:00
Ethan Hugg
69cdf61f49 Merge remote-tracking branch 'upstream/master' into cosmetic 2013-12-16 11:46:07 -08:00
Ethan Hugg
bcf102db83 Fixed warnings found by clang. Removed some trailing whitespace. 2013-12-16 11:36:54 -08:00
Ethan Hugg
c97be377b1 Rollup of minor fixes found by Martin Ettl 2013-12-16 09:25:35 -08:00
Martin Storsjö
f1cfd1e28a Don't link to libdl when building with NO_DYNAMIC_VP defined 2013-12-16 09:35:03 +02:00
Varun B Patil
e65525d7b4 Improve handling of help switch in enc test app
welsenc.exe -h is now a valid command which returns success.

No longer prints help text twice in the case when the -h switch
is given along with a wrong cfg.
2013-12-16 09:30:38 +05:30
Ethan Hugg
8d3b617761 Merge pull request #48 from licaiguo/master
Add 64-bit build support for windows & Linux
2013-12-15 13:01:20 -08:00
Varun B Patil
f5e0058786 Make the two ParseCommandLine functions consistent
with respect to strcmp function call.
Removed unnecessary brackets.
2013-12-15 18:49:08 +05:30
Varun B Patil
077c29a0f1 Remove redundant NULL check
Address of a pointer variable can never be NULL.
2013-12-15 18:36:15 +05:30
Varun B Patil
42097a6ed3 Fix function name typo in enc test app 2013-12-15 18:34:50 +05:30
licaiguo
077ffed5ea Add Windows 64-bit build to VS project files 2013-12-15 15:18:19 +08:00
Licai Guo
ac6828f4fa Enable 64-bit build on Linux & Mac 2013-12-14 20:37:33 -08:00
Martin Storsjö
aa78f205d6 Avoid all calls to libdl (or equivalent) if NO_DYNAMIC_VP is defined
The same ifdefs are already used in the corresponding constructors,
so this just avoids a runtime/link time library dependency which
is practically unused in this build setup.
2013-12-14 13:17:14 +02:00
Cullen Jennings
41d1c31f7f Fix warnings on OSX compile 2013-12-13 13:03:38 -07:00
Ethan Hugg
a913cc853e Merge pull request #32 from mstorsjo/cosmetics
Consistently use unix newlines, remove trailing whitespace
2013-12-13 08:54:14 -08:00
Andreas Gal
90e0057ba6 Merge pull request #36 from mstorsjo/no-mfc-include
Don't include the MFC header afxres.h in windows resource files
2013-12-13 07:36:40 -08:00
Martin Storsjö
309d0bbffb Add a missing NO_DYNAMIC_VP ifdef in the CWelsLib destructor
Previously this would try to free a dynamically loaded library
even if none was loaded.
2013-12-13 15:46:45 +02:00
Martin Storsjö
b911920a77 Don't include the MFC header afxres.h in windows resource files
Just include windows.h instead. This allows building using the
Express edition versions of MSVC as well, that don't include MFC.
2013-12-13 14:43:25 +02:00
Martin Storsjö
f9dea46712 Remove trailing whitespace
Most of it was removed in ff6b669176 from C++ source files,
but other files were left unchanged.
2013-12-13 11:24:17 +02:00
Martin Storsjö
8f9a5469be Convert source files to unix newlines
Most files were converted in ff6b669176, but some (non C++
source files) were left with windows newlines.
2013-12-13 11:20:23 +02:00
tab
3cc719ca0d Fix typo in strnlen fallback 2013-12-12 17:56:29 -05:00
Ethan Hugg
ff6b669176 Pretty printed the C++ code with astyle 2013-12-12 14:21:12 -08:00
Martin Storsjö
3331ff6566 Fix a typo in the public codec API 2013-12-12 16:13:45 +02:00
ruil2
53c8a37ee1 fix VS build issue: can't find typedefs.h in console project 2013-12-12 17:33:38 +08:00
ruil2
661988ada7 Fix issue:#9
update VS2010 and VS2012 project
2013-12-12 17:15:52 +08:00
EKR
fb429bbf67 Add gtest support 2013-12-12 10:56:52 +08:00
Ethan Hugg
a15ad8cc80 Updated makefiles for new logging changes. 2013-12-11 09:52:02 -08:00
Ethan Hugg
2ca14fed1c Rebase of EKR's patches for tracing and frame size 2013-12-11 06:51:26 -08:00
EKR
cf92e8d620 Add support for assembly on linux as well as multiple configs 2013-12-10 18:57:32 +08:00
EKR
2edc251ded First cut at new build system. Tested on Mac 2013-12-10 16:19:42 +08:00
Ethan Hugg
70e5e62f3d Initial Commit 2013-12-09 04:51:09 -08:00