Martin Storsjö
e1b5e038d2
Use .obj as suffix for object files on MSVC
...
This avoids warnings when linking about "unrecognized source file
type, object file assumed".
2014-03-18 19:41:06 +02:00
huili2
090e8cc1ed
modify WELS_CLIP1 to be inline functions
2014-03-18 01:54:25 -07:00
volvet
b21411ad7c
Merge pull request #511 from mstorsjo/remove-unused-define
...
Remove the unused FORMAT_COFF define
2014-03-18 16:11:22 +08:00
volvet
fb1958ad13
Merge pull request #519 from mstorsjo/push-xmm-registers
...
Backup/restore the xmm6-xmm15 SSE registers within asm functions on win64
Reviewed by zhiliang
2014-03-18 15:04:54 +08:00
Martin Storsjö
4633626d69
Remove XMMREG_PROTECT
...
This isn't necessary any longer, when all the assembly routines
take care of restoring registers as necessary.
2014-03-17 13:47:01 +02:00
Martin Storsjö
3cf52554f7
Backup/restore the xmm6-xmm15 SSE registers within asm functions on win64
...
According to the Win64 ABI, these registers need to be preserved,
and compilers are allowed to rely on their content to stay
available - not only for float usage but for any usage, anywhere,
in the calling C++ code.
This adds a macro which pushes the clobbered registers onto the
stack if targeting win64 (and a matching one which restores them).
The parameter to the macro is the number of xmm registers used
(e.g. if using xmm0 - xmm7, the parameter is 8), or in other
words, the number of the highest xmm register used plus one.
This is similar to how the same issue is handled for the NEON
registers q4-q7 with the vpush instruction, except that they needed
to be preserved on all platforms, not only on one particular platform.
This allows removing the XMMREG_PROTECT_* hacks, which can
easily fail if the compiler chooses to use the callee saved
xmm registers in an unexpected spot.
2014-03-17 13:44:33 +02:00
Martin Storsjö
eec968234d
Fold ALIGN 16 and the function label into WELS_EXTERN
...
This simplifies the structure for all x86 assembly functions,
reducing the amount of duplicated code structure.
2014-03-17 13:35:00 +02:00
Martin Storsjö
f96918283f
Remove commented out code for old, 32-bit only x86 assembly function prologues/epilogues
2014-03-17 11:20:11 +02:00
Licai Guo
b5a4d706b9
Merge pull request #496 from mstorsjo/use-sign-extend-macro
...
Use the SIGN_EXTENSION macro where possible
2014-03-17 16:31:03 +08:00
Licai Guo
2c796337ba
Merge pull request #510 from huili2/remove_basemb
...
remove BASE_MB related code
2014-03-17 08:46:25 +08:00
Martin Storsjö
fc260b39e0
Remove the unused FORMAT_COFF define
...
Nothing in the project currently sets FORMAT_COFF - the other generic
branch works just fine on windows.
2014-03-16 17:54:55 +02:00
Martin Storsjö
eb238e6549
Use the SIGN_EXTENSION macro where possible
...
This shortens the x86 assembly by 134 lines in total.
2014-03-16 17:54:24 +02:00
Martin Storsjö
ce8da27287
Format x86 assembly constants in a yasm compatible manner
...
This is similar to what was done in a6463be0cc
- yasm requires
these constants to have a zero after $.
2014-03-15 14:38:28 +02:00
huili2
b1f596fd69
remove BASE_MB related code
2014-03-14 02:03:41 -07:00
Licai Guo
f589c580eb
clean redundant checks in decoder
2014-03-13 23:56:54 -07:00
Licai Guo
8492aac917
Merge pull request #486 from huili2/nzc_bug_fix
...
nzc bug fix and clear
2014-03-14 13:11:45 +08:00
huili2
734e60aeeb
add according to review opinion
2014-03-13 20:21:10 -07:00
Licai Guo
5bffb627d6
nzc bug fix and clear
2014-03-13 19:31:28 -07:00
Martin Storsjö
811c647c0e
Remap registers to avoid clobbering the neon registers q4-q7
...
According to the calling convention, the registers q4-q7 should be
preserved by functions. The caller (generated by the compiler) could
be using those registers anywhere for any intermediate data.
Functions that use 12 or less of the qX registers can avoid
violating the calling convention by simply using other registers instead
of the callee saved registers q4-q7.
This change only remaps the registers used within functions - therefore
this does not affect performance at all. E.g. in functions using
registers q0-q7, we now use q0-q3 and q8-q11 instead.
2014-03-10 22:07:25 +02:00
Licai Guo
731a1466e6
Merge pull request #469 from huili2/svc_sh_bug_fix
...
modify and correct SVC slice header parse
2014-03-10 22:09:44 +08:00
Licai Guo
091315f84c
modify and correct SVC slice header parse
2014-03-10 02:37:41 -07:00
Licai Guo
4cc059bf5b
Merge pull request #461 from mstorsjo/fix-asm-comments
...
Remove unnecessary/stray keywords in function signature comments in x86 assembly
2014-03-10 12:29:22 +08:00
Licai Guo
b2dafa5a92
fix WELS_READ_VERIFY
2014-03-09 18:12:53 -07:00
Martin Storsjö
8d6b368a1c
Remove unnecessary stray __cdecl annotations in function signature comments in x86 assembly
2014-03-09 19:18:02 +02:00
Ethan Hugg
09b45e3ef9
Merge pull request #440 from licaiguo/refine-pps-sps
...
Refine pps sps
2014-03-07 11:02:02 -08:00
Licai Guo
e5f36822a9
Update targets.mk files
2014-03-07 16:22:59 +08:00
Licai Guo
8ad9e0b60d
use temp buffer to store new arrived PPS/SPS
2014-03-06 22:05:12 -08:00
Licai Guo
8a3518f7be
set bAuReadyFlag to true when we meet a PPS
2014-03-06 21:50:31 -08:00
Licai Guo
71467f948a
mv mc_neon.S to common,add MC arm code to encoder
2014-03-07 12:18:58 +08:00
Martin Storsjö
c0043f7053
Use the three-operand form of add/sub with shift
...
When using unified syntax, the two operand form with a shift
isn't allowed.
2014-03-06 16:21:54 +02:00
Licai Guo
201ab42d7e
Merge pull request #431 from huili2/large_to_small_sps_bug
...
Large to small sps bug for issue #373
2014-03-06 16:51:59 +08:00
volvet
8cc332dea1
Merge pull request #432 from zhilwang/arm-asm
...
Arm asm
2014-03-06 16:50:56 +08:00
Licai Guo
8a7a9195d9
remove unused function
2014-03-05 23:14:57 -08:00
Licai Guo
4260a9b2ba
remove CS and RS syntaxs for issue 373
2014-03-05 22:59:27 -08:00
Licai Guo
e7cc8c2780
Add arm asm code for processing.
2014-03-05 16:54:05 +08:00
Licai Guo
9e4ab64c73
move iTotalNumMbRec from refpic to ctx
2014-03-04 19:23:15 -08:00
Licai Guo
248f324c62
Add intra predictor arm asm code.
2014-03-05 10:25:15 +08:00
Ethan Hugg
01a2f582c3
Merge pull request #401 from mstorsjo/android-arm-assembly
...
Enable the arm assembly in android builds
2014-03-04 09:50:07 -08:00
Martin Storsjö
9cf34e7615
Unify the interface for the different variants of WelsCPUFeatureDetect
...
The caller of the function should not need to know exactly which
implementation of it is being used.
For the variants that don't support detecting the number of cores,
the pNumberOfLogicProcessors parameter can be left untouched
and the caller will use a higher level API for finding it out.
This simplifies all the calling code, and simplifies adding
more implementations of cpu feature detection.
2014-03-04 10:18:30 +02:00
volvet
4d729c9418
get cpu cores for android
2014-03-04 15:50:41 +08:00
Martin Storsjö
1118dd4f71
Update the makefile generator to support .S arm assembly files
...
These are built if ASM_ARCH is set to arm.
2014-03-04 08:56:42 +02:00
Martin Storsjö
03e0dcd814
Convert the arm assembly sources to unix newlines
2014-03-04 08:42:28 +02:00
volvet
d9a02d27f2
remove execute attribute of the arm asm files
2014-03-04 11:45:10 +08:00
volvet
f8b0cec68d
Merge pull request #387 from zhilwang/arm-asm
...
Arm asm
2014-03-04 11:08:17 +08:00
volvet
901b89f7ad
Merge pull request #376 from mstorsjo/simplify-x86-asm-makefiles
...
Simplify makefiles with respect to x86 assembly
2014-03-04 10:16:01 +08:00
Licai Guo
cdeb6449c6
remove unused declarations in as264_common.h
2014-03-03 17:42:47 -08:00
Licai Guo
83d0791163
Modify function name according latest cisco master
2014-03-04 09:18:18 +08:00
Licai Guo
7768cd0a98
Modify code style, remove trailing space.
2014-03-03 15:42:01 +08:00
Licai Guo
ba312b0b20
add checks for spsid and ppsid
2014-03-02 17:09:23 -08:00
Martin Storsjö
3ccd2ae4cf
Remove a redundant makefile ifdef
...
ASM_ARCH=x86 is only set if USE_ASM is enabled.
2014-03-01 23:56:14 +02:00
volvet
33017fa722
Merge pull request #368 from huili2/sps_buffer_modif
...
modify SPS, PPS buffer management and remove a build warning
2014-02-28 17:41:46 +08:00
Licai Guo
b7a25df13f
Remove deblocking arm asm code to common folder, add cpu detect for arm, clean some code.
2014-02-28 17:08:24 +08:00
Martin Storsjö
7d2c761604
Allow using the USE_ASM makefile variable for architectures other than x86
...
Add an ASM_ARCH variable which specifies which kind of assembly
is supposed to be built.
2014-02-28 10:19:53 +02:00
Licai Guo
e4b6fc3f9a
modify SPS, PPS buffer management and remove a build warning
2014-02-27 22:28:16 -08:00
Licai Guo
0fd9db2878
Add ARM 32bit asm code for decoder.
2014-02-28 13:36:34 +08:00
Licai Guo
e902f0fea4
refine rpl
2014-02-27 21:04:31 -08:00
Licai Guo
573b02797b
Merge pull request #363 from huili2/remove_store_base
...
remove unused codes in reference picture management
2014-02-27 12:39:23 +08:00
Licai Guo
5303eaaeb9
remove store_ref_base_pic_flag related codes in reference picture management
2014-02-26 20:00:32 -08:00
Martin Storsjö
e239d9fddc
Fix a typo in a function pointer name
2014-02-26 21:26:54 +02:00
Licai Guo
a9fd78f1e2
add a check to parseSliceHeaderSyntaxes
2014-02-25 00:47:12 -08:00
Licai Guo
3c29c92133
Merge pull request #347 from huili2/active_sps_ref_size
...
use active SPS parameters instead of other SPS.
2014-02-24 17:03:25 +08:00
huili2
ab6931496b
Merge pull request #345 from licaiguo/fix-int-conversion-warning
...
fix int conversion warning, using LD32/ST32
2014-02-24 17:02:35 +08:00
Licai Guo
2983c92e1c
use active SPS parameters instead of other SPS.
2014-02-24 00:52:17 -08:00
Licai Guo
d78f8c7ed8
fix int conversion warning, using LD32/ST32
2014-02-24 00:27:33 -08:00
Licai Guo
b7bee7af0a
refine level check
2014-02-24 00:09:40 -08:00
Licai Guo
d5e0b99372
cast to uint32_t in GET_WORD to prevent possible left shift error.
2014-02-23 22:22:13 -08:00
Licai Guo
265741e922
update according to review comments
2014-02-23 18:26:28 -08:00
Licai Guo
fee0f14732
finish syntax checks in ParseSps
2014-02-21 00:16:42 -08:00
Licai Guo
4e0b8d4cbf
refine checks in ParseSps
2014-02-20 19:25:11 -08:00
Licai Guo
d69b2faa9f
fix the crash issues by changing the type iMbWidth & iMbHeight.
2014-02-19 23:06:35 -08:00
Licai Guo
46b9d5d0da
Merge pull request #323 from huili2/check_bit_read
...
add safety check for bit-reading for headers
2014-02-20 14:17:07 +08:00
Licai Guo
a921bc6589
Merge pull request #320 from huili2/mb_residual_size_check
...
remain size to prevent MB residual reading overflow
2014-02-20 11:19:57 +08:00
Martin Storsjö
3532781556
Mark source parameters to MC functions as const
2014-02-19 10:19:56 +02:00
Martin Storsjö
ebb890e03e
Declare static functions within the file they are used/defined in
...
It does not make sense to declare but not define static functions
in a header.
2014-02-19 09:51:25 +02:00
Licai Guo
a3c38b5631
add safety check for bit-reading for headers
2014-02-18 22:55:12 -08:00
huili2
0fcd066cde
Merge pull request #298 from licaiguo/decoder-syntax-element-step1
...
add decoder syntax checks
2014-02-19 08:57:50 +08:00
Ethan Hugg
413b301e9c
Merge pull request #303 from mstorsjo/simplify-decoder-api
...
Simplify the Initialize decoder method
2014-02-18 11:27:38 -08:00
Martin Storsjö
3b297ec866
Remove completely unused variables and private fields
2014-02-18 13:04:13 +02:00
Martin Storsjö
1075338b9b
Use the actual struct type instead of a void pointer to the decoder Initialize method
2014-02-18 13:00:59 +02:00
Martin Storsjö
658d1e3651
Remove the unused iInitType parameter to the decoder Initialize method
2014-02-18 13:00:45 +02:00
Licai Guo
61b64190dd
add decoder syntax checks
2014-02-17 23:57:12 -08:00
Licai Guo
d0a7f9b625
add refine mc.cpp on decoder
...
1. remove unecessary init
2. add static to constant function pointer array
2014-02-17 22:36:56 -08:00
Licai Guo
278597be2f
Merge pull request #292 from huili2/level_prefix
...
fix level_prefix too large in residual decoding
2014-02-18 14:22:30 +08:00
Licai Guo
06d3ed8ddc
Merge pull request #294 from huili2/neg_left_shift
...
negative data with left shift, use cast or multiplication instead
2014-02-18 14:21:44 +08:00
Licai Guo
f5d086eba1
merge the calculate
2014-02-17 22:16:51 -08:00
Licai Guo
a810408cdc
negative data with left shift, use cast or multiplication instead
2014-02-17 19:13:41 -08:00
Licai Guo
7bace8406e
remain size to prvent MB residual reading overflow
2014-02-17 00:47:41 -08:00
Licai Guo
0d1deb578e
fix level_prefix too large in residual decoding
2014-02-13 22:51:45 -08:00
Martin Storsjö
55d7491f3d
Remove stub interfaces for hw decoding
...
There is no implementation available for actually doing decoding
in HW.
2014-02-13 14:21:38 +02:00
Martin Storsjö
ce22f84a2b
Regenerate target makefiles after the latest mktargets.py changes
2014-02-12 22:11:05 +02:00
Ethan Hugg
8b8e0d4b3e
Merge pull request #274 from mstorsjo/typedef-cleanup
...
Remove typedefs for standard C++ types
2014-02-10 10:46:12 -08:00
Ethan Hugg
1e549e6f9a
Merge pull request #271 from mstorsjo/merge-asm-headers
...
Merge declarations of shared asm functions into the comon library
2014-02-10 10:40:34 -08:00
Ethan Hugg
007f5ba773
Merge pull request #258 from mstorsjo/endian-cleanup
...
Avoid endian-specific code
2014-02-10 10:36:05 -08:00
Martin Storsjö
80862eec77
Use the C++ constants true/false instead of defining our own
...
TRUE/FALSE has intentionally been left in use for the few
platform specific APIs that define these constants themselves
and expect them to be used, for consistency.
2014-02-10 08:06:37 +02:00
Martin Storsjö
f2bd22acd5
Use char instead of str_t
2014-02-10 08:06:37 +02:00
Martin Storsjö
7b96c6756e
Use void instead of void_t
...
There's really no reason for adding a typedef for void.
2014-02-10 08:06:33 +02:00
Martin Storsjö
2b77fe7f49
Use bool instead of bool_t
...
bool is one of the built in, standard types in C++, there's no need
for a typedef for it.
2014-02-10 08:05:09 +02:00
Martin Storsjö
17d7b5d72e
Use bool_t instead of BOOL_T
...
One bool typedef is already more than enough, two is too many.
2014-02-10 08:05:09 +02:00
Martin Storsjö
0f7a958ce3
Move declarations of functions in mc_chroma/luma.asm into a header in common
2014-02-10 08:05:02 +02:00
Martin Storsjö
ad209c2d14
Move declarations of functions in expand_picture.asm into a header in common
2014-02-10 08:05:02 +02:00
volvet
bf9a78085e
Merge pull request #273 from mstorsjo/remove-editor-state-file
...
Remove an MSVC resource editor state file
2014-02-10 09:08:09 +08:00
Martin Storsjö
83892ad056
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.
A similar file was removed earlier in c61b040
, but this one
was missed.
2014-02-08 23:40:06 +02:00
Martin Storsjö
a532c1233b
Take the missed WelsDecoderI4x4LumaPredH_sse2 function into use
...
Previously this function was never used.
2014-02-08 23:09:16 +02:00
Martin Storsjö
d0185ab253
Remove redundant /./ parts from pathnames in makefiles
...
This is mostly a cosmetic improvement for the quiet make output.
2014-02-08 18:46:52 +02:00
Martin Storsjö
8ecdcc7172
Add a make option for silencing the commands run
...
Add "V=No" to the make command to silence the make output.
This makes it easier to spot warnings or other unexpected messages
in the build output.
2014-01-30 13:56:19 +02:00
Martin Storsjö
0a14d4c79b
Make the deblocking handling endian independent
...
This avoids having to set a define indicating the endianness.
This doesn't incur any significant measurable slowdown.
2014-01-30 10:33:21 +02:00
Ethan Hugg
1e744b1933
Merge pull request #257 from mstorsjo/simplify-endian-func
...
Simplify the implementation of GetValueOf4Bytes
2014-01-29 15:25:30 -08:00
Ethan Hugg
fbcd962169
Merge pull request #256 from mstorsjo/bigendian
...
Make the library work on big endian
2014-01-29 15:24:32 -08:00
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
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
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ö
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