Commit Graph

100 Commits

Author SHA1 Message Date
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
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ö
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
Martin Storsjö
ec20ab58ef Remove some unnecessary STRNCPY/WelsStrncpy calls and intermediate buffers 2014-01-27 20:00:15 +02:00
Martin Storsjö
0439392a79 Fix a typo Millsecond -> Millisecond 2014-01-27 19:20:27 +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
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ö
0ce42ffb89 Rename WelsVsprintf to WelsVsnprintf, to indicate that it actually checks the length 2014-01-27 12:05:53 +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
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ö
2f5f25b7e3 Merge the encoder/decoder crt_util_safe_x.h into the common lib 2014-01-27 08:03:03 +02: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
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
5ac52e31e9 Merge pull request #224 from mstorsjo/msvc2005
Fix building on MSVC 2005
2014-01-26 17:51:44 -08: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
Varun B Patil
e459b91412 Removed unused headers in decoder core 2014-01-26 12:00:57 +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
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ö
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
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
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
huili2
f149843f7a Merge pull request #190 from licaiguo/add-level-limits
Add level limits for decoder
2014-01-22 22:56:39 -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
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
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
Licai Guo
a53377314a fix issues found by coverage scan 2014-01-21 19:13:46 -08: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