Commit Graph

307 Commits

Author SHA1 Message Date
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ö
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
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
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ö
ea8a00278f Simplify the make rules for creating libraries 2014-01-27 14:45:18 +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ö
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
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
Licai Guo
56767f8154 add parenthses 2014-01-21 00:23:41 -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
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ö
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
Licai Guo
1a04694d97 fix crash caused by empty packets and add more checks 2014-01-16 22:13:03 -08:00
volvet
856f186b8e fix illegal instruction use 2014-01-16 15:57:22 +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ö
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
ekr
eeb11578ca Merge pull request #123 from licaiguo/update-vs2010-files
Update vs2010 files
2014-01-09 18:07:57 -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
Licai Guo
15bd7dab57 fix crash issue for too big packet size 2014-01-09 00:28:13 -08:00
Licai Guo
77fd9aa4f0 merge macros.h to common/macros.h 2014-01-09 15:41:24 +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
Martin Storsjö
80669ed059 Use make patterns to avoid needing autogenerated rules for each source file 2014-01-08 16:33:35 +02: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
e801b58bf8 Merge pull request #110 from huili2/master
interface clean and inside modification
2014-01-06 11:02:49 -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
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
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ö
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
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
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
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
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
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
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
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
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
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