Compare commits

..

50 Commits

Author SHA1 Message Date
sijchen
2706e36bf0 Merge pull request #2316 from pengyanhai/v1.5.3-Firefox39
Update plugin to v1.5.3
2015-12-17 13:02:15 -08:00
Hank Peng
ee9c398b1f Update the plugin version in Makefile 2015-12-17 12:08:13 -08:00
Hank Peng
264c4357a1 Update plugin to v1.5.3 2015-12-17 11:24:12 -08:00
HaiboZhu
01d9132430 Merge pull request #2303 from HaiboZhu/Sync_Debug_symbols_for_1.5.2
Sync debug symbols related commits into 1.5.2
2015-12-09 14:29:03 +08:00
Guangwei Wang
778e87520e Sync the debug symbols commits into v1.5.2-firefox39 branch 2015-12-09 12:54:51 +08:00
Guangwei Wang
ac9ca8f879 add stripped lib for firefox 2015-12-09 12:51:32 +08:00
Haibo Zhu
48002c8091 Add DEBUGSYMBOLS option for makefile under release mode 2015-12-09 12:51:12 +08:00
sijchen
8ce9ff9e34 Merge pull request #2299 from pengyanhai/v1.5.2-Firefox39
Avoid a potential deadlock between the main thread and worker thread when encoding or decoding complete
2015-12-08 11:20:39 -08:00
Hank Peng
941966f1e8 Avoid a potential deadlock between the main thread and worker thread when encoding or decoding complete 2015-12-02 23:46:43 -08:00
HaiboZhu
21e44bda8b Merge pull request #2253 from pengyanhai/v1.5.2-Firefox39
add an echo-plugin-name target
2015-11-19 09:20:36 +08:00
Ted Mielczarek
c9b3fe54a4 add an echo-plugin-name target 2015-11-18 10:50:51 -08:00
HaiboZhu
e264547368 Merge pull request #2250 from pengyanhai/v1.5.2-Firefox39
Generate PDB file for openh264.dll and gmpopenh264.dll
2015-11-18 12:17:42 +08:00
pengyanhai
347c463f0a Generate PDB file for openh264.dll and gmpopenh264.dll 2015-11-17 18:52:57 -08:00
sijchen
e1a472cab5 Merge pull request #2235 from pengyanhai/v1.5.2-Firefox39
Fix the android crash and update the version to v1.5.2
2015-11-13 11:00:53 -08:00
Hank Peng
71d99d0408 Update the plugin version to v1.5.2 2015-11-13 10:26:41 -08:00
Hank Peng
e5d0bce6d0 Shut down the encoder/decoder thread when Encoding/DecodingComplete is invoked, to avoid potential crash on Android 2015-11-13 10:01:10 -08:00
huili2
b664150875 Merge pull request #2228 from pengyanhai/v1.5.2-Firefox39
Avoid to call any host API after Encoding/DecodingComplete(), to avoid potential crash in the browser
2015-11-13 09:14:06 +08:00
Hank Peng
6212a5984b Avoid to call any host API after Encoding/DecodingComplete(), to avoid potential crash in the browser 2015-11-12 11:57:20 -08:00
sijchen
1539616777 Merge pull request #2222 from sijchen/v151
Update codec version and release note to v1.5.1
2015-11-11 10:39:42 -08:00
sijchen
d804e8b443 apply review 1376 for version update 2015-11-11 10:32:27 -08:00
pengyanhai
0ce464d83e Tear down the OpenH264 encoder and decoder properly to avoid potential crash and memory leak 2015-11-11 13:41:57 +08:00
Hank Peng
08473ae184 Never call GMPVideoDecoderCallback after DecodingComplete, to fix bug #1204588 in Bugzilla 2015-11-11 13:41:01 +08:00
sijchen
02d7f3d386 Merge pull request #2198 from HaiboZhu/Add_binary_address_RELEASES_v1.5
Add binary package address in RELEASES
2015-10-28 21:53:33 -07:00
Haibo Zhu
59cec41c53 Add binary package address in RELEASES 2015-10-29 09:24:38 +08:00
HaiboZhu
2610ab1832 Merge pull request #2174 from HaiboZhu/Bugfix_CHECK_SE_UPPER_conditions_v1.5
Fix the macro UPPER_CHECK conditions
2015-10-20 09:49:05 +08:00
Haibo Zhu
1072deea64 Fix the macro UPPER_CHECK conditions 2015-10-19 18:14:18 -07:00
HaiboZhu
9e1f1790e3 Merge pull request #2171 from HaiboZhu/Bugfix_entropy_decoding_upper_check_v1.5
Add protection for unsigned int output for openh264v1.5
2015-10-19 16:31:26 +08:00
Haibo Zhu
fdc713099e (1) add protection for golomb GetUe output value
(2) change the max length of cabac bypass to 16
2015-10-18 23:47:38 -07:00
HaiboZhu
32c51ecb11 Merge pull request #2164 from HaiboZhu/Remove_cabac_shift_exponent_too_large_v1.5
Remove the shift exponent too large warning
2015-10-16 21:17:06 +08:00
HaiboZhu
c24aad5654 Merge pull request #2162 from huili2/MMCO_overflow_1.5
prevent too many MMCO num overflow
2015-10-16 16:58:25 +08:00
Haibo Zhu
f99f65099b Remove the shift exponent too large warning 2015-10-16 01:40:05 -07:00
huili2
e007606545 prevent too many MMCO num overflow 2015-10-16 16:00:24 +08:00
HaiboZhu
9c88070c6e Merge pull request #2156 from HaiboZhu/Remove_UBSAN_negative_left_shift_warning_v1.5
Remove ubsan negative left shift warning in v1.5
2015-10-15 12:03:34 +08:00
Haibo Zhu
6e052edcef Remove UBSAN warnings about negative left shift 2015-10-14 19:49:01 -07:00
HaiboZhu
fcab199083 Merge pull request #2154 from HaiboZhu/Fix_warnings_from_Martin
Fix some warnings according to master branch pull request
2015-10-13 19:35:03 +08:00
Haibo Zhu
aa2c5cee0d Fix some warnings according to master branch pull request 2015-10-13 18:37:13 +08:00
sijchen
68c6835c76 Merge pull request #2149 from sijchen/doc2
add release notes and version updates for v1.5 release
2015-10-12 22:31:40 -07:00
Sijia Chen
e86a91498d complete the description of CHP 2015-10-12 21:42:26 -07:00
huili2
97ba688a54 Merge pull request #2148 from HaiboZhu/Bugfix_uninit_strcat_v1.5
Init the string value and add protection for WelsStrcat()
2015-10-13 09:05:09 +08:00
Sijia Chen
02904aa40e add release notes and version updates for v1.5 release 2015-10-12 16:59:16 -07:00
Haibo Zhu
a58e169ee8 Init the string value and add protection for WelsStrcat() 2015-10-10 08:53:57 -07:00
sijchen
0b2d724c3e Merge pull request #2141 from sijchen/v15api2
correct a typo along with the in-plan v1.5 release
2015-10-09 09:58:33 -07:00
huili2
d6b1680842 Merge pull request #2142 from HaiboZhu/Bugfix_SPS_update_logic_under_EC_v1.5
Fix the SPS update logic bug under EC mode
2015-10-09 11:42:07 +08:00
huili2
c6714d395f Merge pull request #2143 from HaiboZhu/Bugfix_CAVLC_8x8_init_error_v1.5
Fix the 8x8 init bug under CAVCL when scalinglist enable
2015-10-09 11:41:53 +08:00
Haibo Zhu
ba5a21705b Fix the SPS update logic bug under EC mode 2015-10-08 19:32:40 -07:00
Haibo Zhu
b548bd098e Fix the 8x8 init bug under CAVCL when scalinglist enable 2015-10-08 18:19:54 -07:00
Sijia Chen
ccf994f00a correct a typo along with the in-plan v1.5 release 2015-10-08 12:23:32 -07:00
huili2
7fc14895ee Merge pull request #2125 from HaiboZhu/Bugfix_Duplicate_frame_num_v1.5
Check the duplicate frame_num in short ref list
2015-09-22 15:45:50 +08:00
HaiboZhu
8599789ac0 Merge pull request #2123 from sijchen/fixsimul
[Encoder] fix for simulcast case when the frame rate of lower resolution is higher
2015-09-22 14:51:41 +08:00
unknown
a1e09bf8c0 Check the duplicate frame_num in short ref list
Add more judgement for return value in WelsMarkAsRef()
2015-09-21 23:47:40 -07:00
201 changed files with 20666 additions and 25547 deletions

9
.gitignore vendored
View File

@ -30,7 +30,6 @@ codec_unittest
# Other files generated by the MSVC compiler
*.exp
*.pdb
*.map
# Executables built by the MSVC project files
bin
@ -47,13 +46,5 @@ testbin/test_vd_rc.yuv
testbin/test.264
testbin/test.yuv
# iOS output files
codec/build/iOS/common/build/
codec/build/iOS/dec/welsdec/build/
# pkg-config file
*.pc
# editor files
*~

View File

@ -1,5 +1,4 @@
language: cpp
dist: trusty
compiler:
- g++
@ -7,7 +6,7 @@ compiler:
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386
- sudo apt-get install -qq nasm g++-4.6-multilib gcc-multilib libc6-dev-i386
install:
- make gmp-bootstrap
@ -22,12 +21,15 @@ before_script:
env:
- TASK=UnitTest; TestParameter=""
- TASK=BinaryCompare; TestParameter=BA_MW_D.264
- TASK=BinaryCompare; TestParameter=LS_SVA_D.264
- TASK=BinaryCompare; TestParameter=CVPCMNL1_SVA_C.264
matrix:
exclude:
- compiler: clang
env: TASK=BinaryCompare; TestParameter=BA_MW_D.264
- compiler: clang
env: TASK=BinaryCompare; TestParameter=LS_SVA_D.264
- compiler: clang
env: TASK=BinaryCompare; TestParameter=CVPCMNL1_SVA_C.264
script:

View File

@ -1,4 +1,4 @@
# Contributors to the OpenH264 project
# Contributors to the OpenH264 project
Patrick Ai
Sijia Chen
@ -35,7 +35,6 @@ James Wang
Juanny Wang
Zhiliang Wang
Hervé Willems
Gregory J Wolfe
Katherine Wu
Guang Xu
Jeffery Xu

View File

@ -33,8 +33,8 @@ GMP_API_BRANCH=Firefox39
CCASFLAGS=$(CFLAGS)
STATIC_LDFLAGS=-lstdc++
VERSION=1.6
SHAREDLIBVERSION=3
VERSION=1.5.3
SHAREDLIBVERSION=1
ifeq (,$(wildcard $(SRC_PATH)gmp-api))
HAVE_GMP_API=No
@ -51,13 +51,10 @@ endif
# Configurations
ifeq ($(BUILDTYPE), Release)
CFLAGS += $(CFLAGS_OPT)
CFLAGS += -DNDEBUG
USE_ASM = Yes
ifeq ($(DEBUGSYMBOLS), True)
CFLAGS += -g
CXXFLAGS += -g
DEBUGSYMBOLS_TAG := _debug_symbols
PROCESS_FILES := True
endif
else
CFLAGS += $(CFLAGS_DEBUG)
@ -121,11 +118,11 @@ PROCESSING_INCLUDES += \
-I$(SRC_PATH)codec/processing/src/vaacalc
GTEST_INCLUDES += \
-I$(SRC_PATH)gtest/googletest \
-I$(SRC_PATH)gtest/googletest/include
-I$(SRC_PATH)gtest \
-I$(SRC_PATH)gtest/include
CODEC_UNITTEST_INCLUDES += \
-I$(SRC_PATH)gtest/googletest/include \
-I$(SRC_PATH)gtest/include \
-I$(SRC_PATH)codec/common/inc \
-I$(SRC_PATH)test
@ -167,14 +164,14 @@ clean:
ifeq (android,$(OS))
clean: clean_Android
endif
$(QUIET)rm -f $(OBJS) $(OBJS:.$(OBJ)=.d) $(OBJS:.$(OBJ)=.obj) $(LIBRARIES) $(BINARIES) *.lib *.a *.dylib *.dll *.so *.exe *.pdb *.exp *.pc *.res *.map
$(QUIET)rm -f $(OBJS) $(OBJS:.$(OBJ)=.d) $(OBJS:.$(OBJ)=.obj) $(LIBRARIES) $(BINARIES) *.lib *.a *.dylib *.dll *.so *.exe *.pdb *.exp *.pc *.res
gmp-bootstrap:
if [ ! -d gmp-api ] ; then git clone https://github.com/mozilla/gmp-api gmp-api ; fi
cd gmp-api && git fetch origin && git checkout $(GMP_API_BRANCH)
gtest-bootstrap:
git clone https://github.com/google/googletest.git gtest
svn co https://googletest.googlecode.com/svn/trunk/ gtest
ifeq ($(HAVE_GTEST),Yes)
@ -228,25 +225,20 @@ LIBRARIES += $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME
$(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
$(QUIET)rm -f $@
$(QUIET_AR)$(AR) $(AR_OPTS) $+
ifeq (True, $(PROCESS_FILES))
cp $@ $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(LIBSUFFIX)
strip $(STRIP_FLAGS) $@ -o $@
ifeq (True, $(DEBUGSYMBOLS))
strip $(STRIP_FLAGS) $@ -o $(LIBPREFIX)$(PROJECT_NAME)_stripped.$(LIBSUFFIX)
endif
$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
$(QUIET)rm -f $@
$(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS)
ifeq (True, $(PROCESS_FILES))
cp $@ $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXVER)
strip $(STRIP_FLAGS) $@ -o $@
ifeq (True, $(DEBUGSYMBOLS))
strip $(STRIP_FLAGS) $@ -o $(LIBPREFIX)$(PROJECT_NAME)_stripped.$(SHAREDLIBSUFFIXVER)
endif
ifneq ($(SHAREDLIBSUFFIXVER),$(SHAREDLIBSUFFIX))
$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX): $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
$(QUIET)ln -sfn $+ $@
ifeq (True, $(PROCESS_FILES))
$(QUIET)ln -sfn $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXVER) $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIX)
endif
endif
ifeq ($(HAVE_GMP_API),Yes)
@ -264,16 +256,15 @@ echo-plugin-name:
$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
$(QUIET)rm -f $@
$(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS) $(MODULE_LDFLAGS)
ifeq (True, $(PROCESS_FILES))
cp $@ $(LIBPREFIX)$(MODULE_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXVER)
strip $(STRIP_FLAGS) $@ -o $@
ifeq (True, $(DEBUGSYMBOLS))
strip $(STRIP_FLAGS) $@ -o $(LIBPREFIX)$(MODULE_NAME)_stripped.$(SHAREDLIBSUFFIXVER)
endif
ifneq ($(SHAREDLIBSUFFIXVER),$(SHAREDLIBSUFFIX))
$(MODULE): $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER)
$(QUIET)ln -sfn $+ $@
ifeq (True, $(PROCESS_FILES))
$(QUIET)ln -sfn $(LIBPREFIX)$(MODULE_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXVER) $(LIBPREFIX)$(MODULE_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIX)
ifeq (True, $(DEBUGSYMBOLS))
$(QUIET)ln -sfn $(LIBPREFIX)$(MODULE_NAME)_stripped.$(SHAREDLIBSUFFIXVER) $(LIBPREFIX)$(MODULE_NAME)_stripped.$(SHAREDLIBSUFFIX)
endif
endif

View File

@ -4,13 +4,12 @@ OpenH264 is a codec library which supports H.264 encoding and decoding. It is su
Encoder Features
----------------
- Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
- Constrained Baseline Profile up to Level 5.2 (4096x2304)
- Arbitrary resolution, not constrained to multiples of 16x16
- Rate control with adaptive quantization, or constant quantization
- Slice options: 1 slice per frame, N slices per frame, N macroblocks per slice, or N bytes per slice
- Multiple threads automatically used for multiple slices
- Temporal scalability up to 4 layers in a dyadic hierarchy
- Simulcast AVC up to 4 resolutions from a single input
- Spatial simulcast up to 4 resolutions from a single input
- Long Term Reference (LTR) frames
- Memory Management Control Operation (MMCO)
@ -24,7 +23,7 @@ Encoder Features
Decoder Features
----------------
- Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
- Constrained Baseline Profile up to Level 5.2 (4096x2304)
- Arbitrary resolution, not constrained to multiples of 16x16
- Single thread for all slices
- Long Term Reference (LTR) frames
@ -51,7 +50,7 @@ Processor Support
Building the Library
--------------------
NASM needed to be installed for assembly code: workable version 2.10.06 or above, nasm can downloaded from http://www.nasm.us/
NASM needed to be installed for assembly code: workable version 2.07 or above, nasm can downloaded from http://www.nasm.us/
For Mac OSX 64-bit NASM needed to be below version 2.11.08 as nasm 2.11.08 will introduce error when using RIP-relative addresses in Mac OSX 64-bit
To build the arm assembly for Windows Phone, gas-preprocessor is required. It can be downloaded from git://git.libav.org/gas-preprocessor.git
@ -69,12 +68,11 @@ The codec and demo can be built by
Valid `**ANDROID_TARGET**` can be found in `**ANDROID_SDK**/platforms`, such as `android-12`.
You can also set `ARCH`, `NDKLEVEL` according to your device and NDK version.
`ARCH` specifies the architecture of android device. Currently `arm`, `arm64`, `x86` and `x86_64` are supported, the default is `arm`. (`mips` and `mips64` can also be used, but there's no specific optimization for those architectures.)
`NDKLEVEL` specifies android api level, the default is 12. Available possibilities can be found in `**ANDROID_NDK**/platforms`, such as `android-21` (strip away the `android-` prefix).
`NDKLEVEL` specifies android api level, the api level can be 12-19, the default is 12.
By default these commands build for the `armeabi-v7a` ABI. To build for the other android
ABIs, add `ARCH=arm64`, `ARCH=x86`, `ARCH=x86_64`, `ARCH=mips` or `ARCH=mips64`.
To build for the older `armeabi` ABI (which has armv5te as baseline), add `APP_ABI=armeabi` (`ARCH=arm` is implicit).
To build for 64-bit ABI, such as `arm64`, explicitly set `NDKLEVEL` to 21 or higher.
For iOS Builds
--------------

View File

@ -1,26 +1,9 @@
Releases
-----------
v1.6.0
------
- Adjusted the encoder API structures
- Removed the unused data format in decoder API
- Encoder support of simulcast AVC
- Added support of video signal type present information
- Added support of encoder load-balancing
- Improved encoder multi-threads, rate control and down-sampling
- Fixed the frame size constraint in encoder
- Bug fixes for rate control, multi-threading, simulcasting in encoder
- Bug fixes for interface call, return value check, memory leak in decoder
- Bug fixes for UT and statistic information
- Bug fixes for assembly code
- Remove the unused and redundant code
- Improvements on UT, memory allocation failed protection, error-protection in decoder, input parameters checking in encoder, assembly for AVX2 support, assembly code performance, logging and documentation
- Correct some typos in source code and documents
v1.5.3
------
- Bug fixes for GMP Plugin
- Fix GMP Plugin hang on Android devices
v1.5.2
------
@ -124,17 +107,6 @@ Binaries
These binary releases are distributed under this license:
http://www.openh264.org/BINARY_LICENSE.txt
v1.6.0
------
http://ciscobinary.openh264.org/libopenh264-1.6.0-android19.so.bz2
http://ciscobinary.openh264.org/libopenh264-1.6.0-ios.a.bz2
http://ciscobinary.openh264.org/libopenh264-1.6.0-linux32.3.so.bz2
http://ciscobinary.openh264.org/libopenh264-1.6.0-linux64.3.so.bz2
http://ciscobinary.openh264.org/libopenh264-1.6.0-osx32.3.dylib.bz2
http://ciscobinary.openh264.org/libopenh264-1.6.0-osx64.3.dylib.bz2
http://ciscobinary.openh264.org/openh264-1.6.0-win32msvc.dll.bz2
http://ciscobinary.openh264.org/openh264-1.6.0-win64msvc.dll.bz2
v1.5.0
------
http://ciscobinary.openh264.org/libopenh264-1.5.0-android19.so.bz2

View File

@ -1,431 +0,0 @@
#!/bin/bash
#*******************************************************************
# brief: multi-encoders comparision for openh264
# (one given sequence only)
# comparision almong encoders in \$TestEncoderList
#
# more detail, please refer to runUsage() and runBrief()
#
# date: 2015-12-16
#*******************************************************************
runUsage()
{
echo -e "\033[32m ********************************************************************* \033[0m"
echo " Usage: "
echo " --$0 \$TestPicW \$TestPicH \$TestEncoderList"
echo ""
echo " --example:"
echo " $0 1280 720 h264enc_master h264enc_target1 h264enc_target2 "
echo ""
echo " Pre-test:"
echo " --1) copy welsenc.cfg from ./openh264/testbin/ to current dir"
echo " --2) set test YUV path in welsenc.cfg "
echo " --3) copy layer0.cfg from ./openh264/testbin/layer2.cfg to current dir"
echo " --4) copy layer1.cfg from ./openh264/testbin/layer2.cfg to current dir"
echo " --5) copy layer2.cfg from ./openh264/testbin/layer2.cfg to current dir"
echo " --6) copy layer3.cfg from ./openh264/testbin/layer2.cfg to current dir"
echo " layer0.cfg~layer3.cfg are used for multi-layers test cases"
echo ""
echo " --7) generate at least one encoder, "
echo " eg. h264enc_master----master branch as benchmark codec"
echo " h264enc_target----your branch CodecChanged as target codec"
echo ""
echo " --8) copy all tests codec to folder ./Encoder"
echo " --9) run below command line:"
echo " $0 \$TestPicW \$TestPicH \$TestEncoderList"
echo ""
echo " Post-test:"
echo " --1) temp cases log will be output in ./Trace-AllTestData"
echo " --2) all comparision data parsed from log files will be output to "
echo " related .csv file under ./Trace-AllTestData "
echo ""
echo " example:"
echo " --comparison almong h264enc_master h264enc_target1 h264enc_target2"
echo " for Zhuling_1280x720.yuv"
echo ""
echo " --run command as below:"
echo " $0 1280 720 h264enc_master h264enc_target1 h264enc_target2 "
echo ""
echo " --get final result files(.csv) under ./Trace-AllTestData"
echo ""
echo -e "\033[32m ********************************************************************* \033[0m"
}
runBrief()
{
echo -e "\033[32m ********************************************************************* \033[0m"
echo " brief:"
echo ""
echo " encoder veision comparision "
echo " --comparision almong encoders in \$TestEncoderList"
echo " --please generate at least one encoder and copy to folder ./Encoder"
echo " --script will run all test cases for each test encoder"
echo " and generate related trace log files for each encoder"
echo " --script will parse and extact data based on keyword from trace log file"
echo " and output to related .csv files for all encoder"
echo " --the test outout file will be put under ./Trace-AllTestData"
echo ""
echo " test cases:"
echo " --add more cases in function runGlobleInit()"
echo " --add new argument with for loop like rc. etc in function "
echo " runAllEncodeCasesAndGenerateLog()"
echo ""
echo " new data:"
echo " --currently only memory usage, you can add new data for your comparision"
echo " --need to add related data parse in function runParseTraceLog()"
echo ""
echo -e "\033[32m ********************************************************************* \033[0m"
}
runPrompt()
{
echo -e "\033[32m ********************************************************************* \033[0m"
echo ""
echo " ------Test completed!--------"
echo ""
echo -e "\033[32m ********************************************************************* \033[0m"
echo " "
echo " --Total ${iTotalCaseNum} cases run for encoders: ${aEncoderList[@]}"
echo ""
echo " --Statistic files for comparision are list as below:"
echo " ${MemoryUsageStatic}"
echo ""
echo " --trace log files can be found under:"
echo " ${LogDir}"
echo ""
echo -e "\033[32m ********************************************************************* \033[0m"
}
runGlobleInit()
{
CurrenDir=`pwd`
LogDir="${CurrenDir}/Trace-AllTestData"
EncoderDir="${CurrenDir}/Encoder"
if [ ! -d ${LogDir} ]
then
mkdir ${LogDir}
fi
LogFile="Log_EncTraceInfo.log"
MemoryUsageStatic="${LogDir}/MemoryUsage.csv"
TempEncoderList=""
for((i=0; i<${#aEncoderList[@]}; i++))
do
if [ -z "${TempEncoderList}" ]
then
TempEncoderList="${aEncoderList[$i]},"
else
TempEncoderList="${TempEncoderList} ${aEncoderList[$i]},"
fi
done
let "iTotalCaseNum=0"
let "MemoryUsage = 0"
echo "LogDir is ${LogDir}"
echo "MemoryUsageStatic file is ${MemoryUsageStatic}"
echo "SpatialLayerNum, ThreadNum, SliceMode, SliceNum, SlicMbNum, ${TempEncoderList}" >${MemoryUsageStatic}
echo "LogDir is ${LogDir}"
echo "MemoryUsageStatic file is ${MemoryUsageStatic}"
let "iTraceLevel=4"
let "iFrameToBeEncoded = 32"
let "iMaxNalSize=0"
#you can add more test case like rc, gop size, et.
#and add "for loop" in function runAllEncodeCasesAndGenerateLog()
aSpatialLayerNum=(1 2 3 4 )
aThreadIdc=(1 4)
aSliceMode=(0 1 2 3)
aSliceNum=(0 8 16 32)
aSliceMbNum=(0 960)
Encoder=""
sEncoderCommand=""
}
runCheck()
{
if [ ! -d ${EncoderDir} ]
then
echo "encoder folder does not exist, please following below command to copy encoder to test folder--./Encoder"
echo " mkdir Encoder"
echo " cp \${AllVersionEncoders} ./Encoder "
exit 1
fi
let "bEncoderFlag = 0"
echo "aEncoderList is ${aEncoderList[@]} "
for file in ${aEncoderList[@]}
do
if [ -x ${EncoderDir}/${file} ]
then
let "bEncoderFlag = 1"
fi
done
if [ ${bEncoderFlag} -eq 0 ]
then
echo "no encoder under test folder, please following below command to copy encoder to test folder--./Encoder"
echo " cp \${AllVersionEncoders} ./Encoder "
echo " chmod u+x ./Encoder/* "
exit 1
fi
}
runGenerateSpatialLayerResolution()
{
SpatialLayerNum=$1
if [ -z "${SpatialLayerNum}" ]
then
let "SpatialLayerNum =1"
fi
let "PicW_L0= PicW / 8"
let "PicW_L1= PicW / 4"
let "PicW_L2= PicW / 2"
let "PicW_L3= PicW"
let "PicH_L0= PicH / 8"
let "PicH_L1= PicH / 4"
let "PicH_L2= PicH / 2"
let "PicH_L3= PicH"
if [ ${SpatialLayerNum} -eq 1 ]
then
aPicW=( ${PicW_L3} 0 0 0 )
aPicH=( ${PicH_L3} 0 0 0 )
elif [ ${SpatialLayerNum} -eq 2 ]
then
aPicW=( ${PicW_L2} ${PicW_L3} 0 0 )
aPicH=( ${PicH_L2} ${PicH_L3} 0 0 )
elif [ ${SpatialLayerNum} -eq 3 ]
then
aPicW=( ${PicW_L1} ${PicW_L2} ${PicW_L3} 0 )
aPicH=( ${PicH_L1} ${PicH_L2} ${PicH_L3} 0 )
elif [ ${SpatialLayerNum} -eq 4 ]
then
aPicW=( ${PicW_L0} ${PicW_L1} ${PicW_L2} ${PicW_L3} )
aPicH=( ${PicH_L0} ${PicH_L1} ${PicH_L2} ${PicH_L3} )
fi
echo "*************************************************************************"
echo " ${SpatialLayerNum} layers spactial resolution for ${PicW}x${PicH} are:"
echo ""
echo " aPicW is ${aPicW[@]}"
echo " aPicH is ${aPicH[@]}"
echo "*************************************************************************"
}
#parse data from encoder trace log
#you can add more key word to extract data from log file
runParseTraceLog()
{
TempLogFile=$1
let "MemoryUsage = 0"
echo "*****************************************"
echo "parsing trace log file"
echo "log file name is ${TempLogFile}"
echo "*****************************************"
if [ ! -e ${TempLogFile} ]
then
echo "LogFile ${TempLogFile} does not exist, please double check!"
return 1
fi
MemUsageInLog=""
while read line
do
if [[ "${line}" =~ "overall memory usage" ]]
then
#[OpenH264] this = 0x0x7fa4d2c04c30, Info:WelsInitEncoderExt() exit, overall memory usage: 40907254 bytes
MemUsageInLog=(`echo $line | awk 'BEGIN {FS="usage:"} {print $2}' `)
fi
# you can add more key word to extract data from log file
# e.g.: bit rate, fps, encoder time, psnr etc.
# add script block like:
# ****************************************************
# if [[ "${line}" =~ "KeyWordYouWantToSearch" ]]
# then
# $line in log file which contain data you want
# DataYouWant=(`echo $line | awk 'BEGIN {FS="keywordYourSearch"} {print $2}' `)
# fi
# ****************************************************
done < ${TempLogFile}
let "MemoryUsage = ${MemUsageInLog}"
echo "MemoryUsage is ${MemoryUsage}"
}
runEncodeOneCase()
{
#encoding process
echo "------------------------------------------------------"
echo "${Encoder} welsenc.cfg ${sEncoderCommand}" >${LogFile}
${Encoder} welsenc.cfg ${sEncoderCommand} 2>>${LogFile}
${Encoder} welsenc.cfg ${sEncoderCommand} >>${LogFile}
echo "------------------------------------------------------"
}
runAllEncodeCasesAndGenerateLog()
{
echo "aSpatialLayerNum is ${aSpatialLayerNum[@]}"
echo "aThreadIdc is ${aThreadIdc[@]}"
echo "aSliceMode is ${aSliceMode[@]}"
echo "aSliceNum is ${aSliceNum[@]}"
echo "aSliceMbNum is ${aSliceMbNum[@]}"
sEncoderCommand1="-lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg"
TempMemoryUsage=""
OtherDataYouWant=""
TempTestCase=""
let "CaseNum=1"
for iSLayerNum in ${aSpatialLayerNum[@]}
do
for iThreadNum in ${aThreadIdc[@]}
do
for iSliceMode in ${aSliceMode[@]}
do
for iSliceNum in ${aSliceNum[@]}
do
#raster slice mb mode, slice-mb-num =0, switch to row-mb-mode
if [ ${iSliceMode} -eq 2 ]
then
aSliceMbNum=(0 960)
else
aSliceMbNum=(960)
fi
for iSlicMbNum in ${aSliceMbNum[@]}
do
TempMemoryUsage=""
#for cases output to statistic file
TempTestCase="${iSLayerNum}, ${iThreadNum}, ${iSliceMode}, ${iSliceNum}, ${iSlicMbNum}"
for eEncoder in ${aEncoderList[@]}
do
Encoder=${EncoderDir}/${eEncoder}
if [ -x ${Encoder} ]
then
if [ ${iSliceMode} -eq 3 ]
then
iMaxNalSize=1000
else
iMaxNalSize=0
fi
runGenerateSpatialLayerResolution ${iSLayerNum}
sEncoderCommand2="-slcmd 0 ${iSliceMode} -slcmd 1 ${iSliceMode} -slcmd 2 ${iSliceMode} -slcmd 3 ${iSliceMode}"
sEncoderCommand3="-slcnum 0 ${iSliceNum} -slcnum 1 ${iSliceNum} -slcnum 2 ${iSliceNum} -slcnum 3 ${iSliceNum}"
sEncoderCommand4="-slcmbnum 0 ${iSlicMbNum} -slcmbnum 1 ${iSlicMbNum} -slcmbnum 2 ${iSlicMbNum} -slcmbnum 3 ${iSlicMbNum} "
sEncoderCommand5="-trace ${iTraceLevel} -numl ${iSLayerNum} -thread ${iThreadNum} -nalsize ${iMaxNalSize}"
sEncoderCommand6="-dw 0 ${aPicW[0]} -dw 1 ${aPicW[1]} -dw 2 ${aPicW[2]} -dw 3 ${aPicW[3]}"
sEncoderCommand7="-dh 0 ${aPicH[0]} -dh 1 ${aPicH[1]} -dh 2 ${aPicH[2]} -dh 3 ${aPicH[3]}"
sEncoderCommand="-frms ${iFrameToBeEncoded} ${sEncoderCommand1} ${sEncoderCommand2} ${sEncoderCommand3} ${sEncoderCommand4} ${sEncoderCommand5} ${sEncoderCommand6} ${sEncoderCommand7}"
LogFile="${LogDir}/${CaseNum}_LogInfo_iSLNum_${iSLayerNum}_ThrNum_${iThreadNum}_SlcM_${iSliceMode}_SlcN_${iSliceNum}_${eEncoder}.log"
echo "Encode command is: "
echo "${Encoder} welsenc.cfg ${sEncoderCommand}"
echo ""
echo "log file is ${LogFile}"
#encode one case
runEncodeOneCase
#parse trace log
runParseTraceLog ${LogFile}
#data extracted from log
#you can add new data here like rc, fps , etc.
echo "memory usage is ${MemoryUsage}"
if [ -z ${TempMemoryUsage} ]
then
TempMemoryUsage="${MemoryUsage},"
else
TempMemoryUsage="${TempMemoryUsage} ${MemoryUsage},"
fi
echo "TempMemoryUsage is ${TempMemoryUsage}"
fi
done
#output memory usage for all encoders
echo "${TempTestCase}, ${TempMemoryUsage}, ${OtherDataYouWant}" >>${MemoryUsageStatic}
let " CaseNum ++"
let "iTotalCaseNum ++"
done
done
done
done
done
}
runMain()
{
runGlobleInit
runCheck
runAllEncodeCasesAndGenerateLog
runPrompt
}
#*************************************************************
if [ $# -lt 3 ]
then
runUsage
runBrief
exit 1
fi
declare -a aEncoderList
declare -a aParamList
aParamList=( $@ )
ParamNum=$#
PicW=${aParamList[0]}
PicH=${aParamList[1]}
for((i=2;i<$#;i++))
do
echo "encoder is ${aParamList[$i]}"
aEncoderList="${aEncoderList} ${aParamList[$i]}"
done
aEncoderList=(${aEncoderList})
echo -e "\033[32m ********************************* \033[0m"
echo ""
echo " --num parameters is ${ParamNum} "
echo " --input parameters are:"
echo " $0 $@"
echo ""
echo -e "\033[32m ********************************* \033[0m"
runMain
#*************************************************************

View File

@ -3,29 +3,29 @@ rem ****************************************************************************
rem usage:
rem AutoBuildForWPAndWindows.bat % Configuration %
rem --For debug version:
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Debug-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Debug-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Debug-C
rem Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Debug-ASM
rem ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-Debug-C
rem ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-Debug-ASM
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Debug-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Debug-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Debug-C
rem Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Debug-ASM
rem ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-Debug-C
rem ARM-ASM: AutoBuildForWPAndWindows.bat ARM-Debug-ASM
rem --For release version:
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Release-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Release-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Release-C
rem Win64-ASM(WP8): AutoBuildForWPAndWindows.bat Win64-Release-ASM
rem ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-Release-C
rem ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-Release-ASM
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Release-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Release-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Release-C
rem Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Release-ASM
rem ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-Release-C
rem ARM-ASM: AutoBuildForWPAndWindows.bat ARM-Release-ASM
rem --For debug and release version:
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-All-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-All-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-All-C
rem Win64-ASM: AutoBuildForWPAndWindows.bat Win64-All-ASM
rem ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-All-C
rem ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-All-ASM
rem Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-All-C
rem Win32-ASM: AutoBuildForWPAndWindows.bat Win32-All-ASM
rem Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-All-C
rem Win64-ASM: AutoBuildForWPAndWindows.bat Win64-All-ASM
rem ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-All-C
rem ARM-ASM: AutoBuildForWPAndWindows.bat ARM-All-ASM
rem --For default:
rem AutoBuildForWPAndWindows.bat
rem ARM-All-ASM(WP8)
rem ARM-All-ASM
rem
rem --lib/dll files will be copied to folder .\bin
rem --win32 folder bin\i386*
@ -46,8 +46,6 @@ rem --more detail, please refer to http://www.mingw.org/
rem
rem 2015/03/15 huashi@cisco.com
rem *************************************************************************************************
set WP8Flag=0
call :BasicSetting
call :PathSetting
call :SetBuildOption %1
@ -98,8 +96,8 @@ goto :EOF
set MinGWPath=C:\MinGW\bin
set MsysPath=C:\MinGW\msys\1.0\bin
set GitPath=C:\Program Files (x86)\Git\bin
set GasScriptPath=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
set VC14Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
set VC12Path=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
set VC11Path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
set VC10Path=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
@ -109,14 +107,10 @@ goto :EOF
set VC12ArmLib02=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\arm
set WP8KitLib=C:\Program Files (x86)\Windows Phone Kits\8.1\lib\arm
if exist "%VC9Path%" set VCPATH=%VC9Path%
if exist "%VC10Path%" set VCPATH=%VC10Path%
if exist "%VC11Path%" set VCPATH=%VC11Path%
if exist "%VC12Path%" set VCPATH=%VC12Path%
if exist "%VC14Path%" set VCPATH=%VC14Path%
if %WP8Flag%==1 set VCPATH=%VC12Path%
set GasScriptPath=%VCPATH%\bin
if exist "%VC9Path%" set VCPATH=%VC9Path%
if exist "%VC10Path%" set VCPATH=%VC10Path%
if exist "%VC11Path%" set VCPATH=%VC11Path%
if exist "%VC12Path%" set VCPATH=%VC12Path%
if "%vArcType%" =="i386" set PATH=%MinGWPath%;%MsysPath%;%VCPATH%\bin;%GitPath%;%PATH%
if "%vArcType%" =="x86_64" set PATH=%MinGWPath%;%MsysPath%;%VCPATH%\bin;%GitPath%;%PATH%
@ -126,7 +120,7 @@ goto :EOF
if "%vArcType%" =="i386" call "%VCPATH%\vcvarsall.bat" x86
if "%vArcType%" =="x86_64" call "%VCPATH%\vcvarsall.bat" x64
if "%vArcType%" =="arm" call "%VCPATH%\vcvarsall.bat" x86_arm
if %WP8Flag%==1 call :WPSetting
if "%vArcType%" =="arm" call :WPSetting
echo PATH is %PATH%
echo LIB is %LIB%
@ -134,8 +128,6 @@ goto :EOF
:WPSetting
set LIB=%VC12ArmLib01%;%VC12ArmLib02%;%WP8KitLib%
echo LIB setting for wp8 is:
echo %LIB%
if not exist "%VC12Path%" (
echo VC12 does not exist,
echo ******************************************
@ -153,73 +145,69 @@ goto :EOF
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=Yes
set WP8Flag=1
echo default setting
echo default setting
) else if "%1"=="Win32-Debug-C" (
set aConfigurationList=Debug
set vArcType=i386
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=No
echo Win32-Debug-C setting
echo Win32-Debug-C setting
) else if "%1"=="Win32-Release-C" (
set aConfigurationList=Release
set vArcType=i386
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=No
echo Win32-Release-C setting
echo Win32-Release-C setting
) else if "%1"=="Win64-Debug-C" (
set aConfigurationList=Debug
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=No
echo All-C setting
echo All-C setting
) else if "%1"=="Win64-Release-C" (
set aConfigurationList=Release
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=No
echo Win64-Release-C setting
echo Win64-Release-C setting
) else if "%1"=="ARM-Debug-C" (
set aConfigurationList=Debug
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=No
set WP8Flag=1
echo ARM-Debug-C setting
echo ARM-Debug-C setting
) else if "%1"=="ARM-Release-C" (
set aConfigurationList=Debug Release
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=No
set WP8Flag=1
echo ARM-Release-C setting
echo ARM-Release-C setting
) else if "%1"=="Win32-All-C" (
set aConfigurationList=Debug Release
set vArcType=i386
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=No
echo Win32-All-C setting
echo Win32-All-C setting
) else if "%1"=="Win64-All-C" (
set aConfigurationList=Debug Release
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=No
echo All-C setting
echo All-C setting
) else if "%1"=="ARM-All-C" (
set aConfigurationList=Debug Release
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=No
set WP8Flag=1
echo ARM-All-C setting
) else if "%1"=="Win32-Debug-ASM" (
set aConfigurationList=Debug
@ -227,66 +215,63 @@ goto :EOF
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=Yes
echo Win32-Debug-ASM setting
echo Win32-Debug-ASM setting
) else if "%1"=="Win32-Release-ASM" (
set aConfigurationList=Release
set vArcType=i386
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=Yes
echo Win32-Release-ASM setting
echo Win32-Release-ASM setting
) else if "%1"=="Win64-Debug-ASM" (
set aConfigurationList=Debug
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=Yes
echo All-ASM setting
echo All-ASM setting
) else if "%1"=="Win64-Release-ASM" (
set aConfigurationList=Release
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=Yes
echo Win64-Release-ASM setting
echo Win64-Release-ASM setting
) else if "%1"=="ARM-Debug-ASM" (
set aConfigurationList=Debug
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=Yes
set WP8Flag=1
echo ARM-Debug-ASM setting
echo ARM-Debug-ASM setting
) else if "%1"=="ARM-Release-ASM" (
set aConfigurationList=Release
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=Yes
set WP8Flag=1
echo ARM-Release-ASM setting
echo ARM-Release-ASM setting
) else if "%1"=="Win32-All-ASM" (
set aConfigurationList=Debug Release
set vArcType=i386
set vOSType=msvc
set vEnable64BitFlag=No
set vASMFlag=Yes
echo Win32-All-ASM setting
echo Win32-All-ASM setting
) else if "%1"=="Win64-All-ASM" (
set aConfigurationList=Debug Release
set vArcType=x86_64
set vOSType=msvc
set vEnable64BitFlag=Yes
set vASMFlag=Yes
echo All-ASM setting
echo All-ASM setting
) else if "%1"=="ARM-All-ASM" (
set aConfigurationList=Debug Release
set vArcType=arm
set vOSType=msvc-wp
set vEnable64BitFlag=No
set vASMFlag=Yes
set WP8Flag=1
echo ARM-All-ASM setting
echo ARM-All-ASM setting
) else (
call :help
goto :ErrorReturn
@ -353,29 +338,29 @@ rem ***********************************************
echo usage:
echo AutoBuildForWPAndWindows.bat % Configuration %
echo --For debug version:
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Debug-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Debug-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Debug-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Debug-ASM
echo ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-Debug-C
echo ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-Debug-ASM
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Debug-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Debug-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Debug-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Debug-ASM
echo ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-Debug-C
echo ARM-ASM: AutoBuildForWPAndWindows.bat ARM-Debug-ASM
echo --For release version:
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Release-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Release-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Release-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Release-ASM
echo ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-Release-C
echo ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-Release-ASM
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-Release-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-Release-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-Release-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-Release-ASM
echo ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-Release-C
echo ARM-ASM: AutoBuildForWPAndWindows.bat ARM-Release-ASM
echo --For debug and release version:
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-All-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-All-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-All-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-All-ASM
echo ARM-C-Only(WP8): AutoBuildForWPAndWindows.bat ARM-All-C
echo ARM-ASM(WP8): AutoBuildForWPAndWindows.bat ARM-All-ASM
echo Win32-C-Only: AutoBuildForWPAndWindows.bat Win32-All-C
echo Win32-ASM: AutoBuildForWPAndWindows.bat Win32-All-ASM
echo Win64-C-Only: AutoBuildForWPAndWindows.bat Win64-All-C
echo Win64-ASM: AutoBuildForWPAndWindows.bat Win64-All-ASM
echo ARM-C-Only: AutoBuildForWPAndWindows.bat ARM-All-C
echo ARM-ASM: AutoBuildForWPAndWindows.bat ARM-All-ASM
echo --For default:
echo AutoBuildForWPAndWindows.bat
echo ARM-All-ASM(WP8)
echo ARM-All-ASM
echo *******************************************************************************
goto :EOF

View File

@ -1,51 +0,0 @@
# This is a docker image with all the tools to build openh264 for linux
# build the docker image with: sudo docker build -t openh264tools - < Dockerfile
# get the result with: sudo docker run -t -i -v /tmp/openH264:/build openh264tools /bin/cp libopenh264.so log /build
# the results will be left in /tmp/openH264
# have a look at log file and if the hash match the "Fluffy got" hashes
FROM ubuntu:14.04
MAINTAINER Cullen Jennings <fluffy@cisco.com>
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y bison flex g++ gcc git libgmp3-dev libmpc-dev libmpfr-dev libz-dev make wget
WORKDIR /tmp
RUN wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz
RUN tar xvfz gcc-4.9.2.tar.gz
WORKDIR /tmp/gcc-4.9.2/
RUN mkdir build
WORKDIR /tmp/gcc-4.9.2/build
RUN ../configure --disable-checking --enable-languages=c,c++ --enable-multiarch --enable-shared --enable-threads=posix --with-gmp=/usr/local/lib --with-mpc=/usr/lib --with-mpfr=/usr/lib --without-included-gettext --with-system-zlib --with-tune=generic --disable-multilib --disable-nls
RUN make -j 8
RUN make install
WORKDIR /tmp
RUN wget http://www.nasm.us/pub/nasm/releasebuilds/2.11.06/nasm-2.11.06.tar.gz
RUN tar xvfz nasm-2.11.06.tar.gz
WORKDIR /tmp/nasm-2.11.06/
RUN ./configure
RUN make
RUN make install
WORKDIR /tmp
RUN git clone https://github.com/cisco/openh264.git
WORKDIR /tmp/openh264
RUN git checkout v1.1
RUN make ENABLE64BIT=Yes
RUN date > log
RUN uname -a >> log
RUN nasm -v >> log
RUN gcc -v 2>> log
RUN git status -v >> log
RUN openssl dgst -sha1 libopenh264.so >> log
RUN echo "Fluffy Got hash of - 3b6280fce36111ab9c911453f4ee1fd99ce6f841" >> log

View File

@ -1,18 +1,6 @@
#for x86
HAVE_AVX2 := true
ifneq ($(filter %86 x86_64, $(ARCH)),)
include $(SRC_PATH)build/x86-common.mk
ifeq ($(USE_ASM), Yes)
ifeq ($(HAVE_AVX2), true)
CFLAGS += -DHAVE_AVX2
CXXFLAGS += -DHAVE_AVX2
ASMFLAGS += -DHAVE_AVX2
endif
endif
endif
#for arm
ifneq ($(filter-out arm64, $(filter arm%, $(ARCH))),)
ifeq ($(USE_ASM), Yes)
ASM_ARCH = arm
@ -20,8 +8,6 @@ ASMFLAGS += -I$(SRC_PATH)codec/common/arm/
CFLAGS += -DHAVE_NEON
endif
endif
#for arm64
ifneq ($(filter arm64 aarch64, $(ARCH)),)
ifeq ($(USE_ASM), Yes)
ASM_ARCH = arm64

View File

@ -1,4 +1,4 @@
GTEST_SRCDIR=gtest/googletest
GTEST_SRCDIR=gtest
GTEST_CPP_SRCS=\
$(GTEST_SRCDIR)/src/gtest-all.cc\

View File

@ -14,4 +14,4 @@ python build/mktargets.py --directory test/processing --prefix processing_unitte
python build/mktargets.py --directory test/api --prefix api_test
python build/mktargets.py --directory test/common --prefix common_unittest
python build/mktargets.py --directory module --prefix module
python build/mktargets.py --directory gtest/googletest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
python build/mktargets.py --directory gtest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc

View File

@ -41,7 +41,7 @@ SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX)
SHARED=-LD
EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
LDFLAGS += -link
SHLDFLAGS=-debug -map -opt:ref -opt:icf -def:$(SRC_PATH)openh264.def -implib:$(EXTRA_LIBRARY)
SHLDFLAGS=-debug -opt:ref -opt:icf -def:$(SRC_PATH)openh264.def -implib:$(EXTRA_LIBRARY)
STATIC_LDFLAGS=
CODEC_UNITTEST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS

View File

@ -12,6 +12,6 @@ SDK_MIN = 5.1
XCODE=$(shell xcode-select -p)
SDKROOT = $(XCODE)/Platforms/$(SDKTYPE).platform/Developer/SDKs/$(SDKTYPE)$(SDK).sdk
CFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) -DAPPLE_IOS -fembed-bitcode
CFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) -DAPPLE_IOS
LDFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN)

View File

@ -148,14 +148,15 @@ typedef enum {
* @brief Option types introduced in decoder application
*/
typedef enum {
DECODER_OPTION_END_OF_STREAM = 1, ///< end of stream flag
DECODER_OPTION_DATAFORMAT = 0, ///< color format, now supports 23 only (I420)
DECODER_OPTION_END_OF_STREAM, ///< end of stream flag
DECODER_OPTION_VCL_NAL, ///< feedback whether or not have VCL NAL in current AU for application layer
DECODER_OPTION_TEMPORAL_ID, ///< feedback temporal id for application layer
DECODER_OPTION_FRAME_NUM, ///< feedback current decoded frame number
DECODER_OPTION_IDR_PIC_ID, ///< feedback current frame belong to which IDR period
DECODER_OPTION_LTR_MARKING_FLAG, ///< feedback wether current frame mark a LTR
DECODER_OPTION_LTR_MARKED_FRAME_NUM, ///< feedback frame num marked by current Frame
DECODER_OPTION_ERROR_CON_IDC, ///< indicate decoder error concealment method
DECODER_OPTION_ERROR_CON_IDC, ///< not finished yet, indicate decoder error concealment status, in progress
DECODER_OPTION_TRACE_LEVEL,
DECODER_OPTION_TRACE_CALLBACK, ///< a void (*)(void* context, int level, const char* message) function which receives log messages
DECODER_OPTION_TRACE_CALLBACK_CONTEXT,///< context info of trace callbac
@ -253,6 +254,29 @@ typedef struct {
int iLTRRefNum; ///< TODO: not supported to set it arbitrary yet
} SLTRConfig;
/**
* @brief Structure for slice argument
*/
typedef struct {
unsigned int
uiSliceMbNum[MAX_SLICES_NUM_TMP]; ///< only used when uiSliceMode=2;here we use a tmp fixed value since MAX_SLICES_NUM is not defined here and its definition may be changed;
unsigned int uiSliceNum; ///< only used when uiSliceMode=1
unsigned int uiSliceSizeConstraint; ///< only used when uiSliceMode=4
} SSliceArgument; ///< not all the elements in this argument will be used, how it will be used depends on uiSliceMode; please refer to SliceModeEnum
/**
* @brief Enumerate the type of slice mode
*/
typedef enum {
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
SM_ROWMB_SLICE = 3, ///< | according to PictureMBHeight | typical of single row of mbs each slice + slice size constraint which including re-encoding
SM_DYN_SLICE = 4, ///< | according to SliceSize | dynamic slicing (have no idea about slice_nums until encoding current frame)
SM_AUTO_SLICE = 5, ///< | according to thread number
SM_RESERVED = 6
} SliceModeEnum;
/**
* @brief Enumerate the type of rate control mode
*/
@ -323,97 +347,12 @@ enum {
};
/**
* @brief Enumerate the type of slice mode
*/
typedef enum {
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
SM_SIZELIMITED_SLICE = 3, ///< | according to SliceSize | slicing according to size, the slicing will be dynamic(have no idea about slice_nums until encoding current frame)
SM_RESERVED = 4
} SliceModeEnum;
/**
* @brief Structure for slice argument
*/
* @brief Structure for slice configuration
*/
typedef struct {
SliceModeEnum uiSliceMode; ///< by default, uiSliceMode will be SM_SINGLE_SLICE
unsigned int uiSliceNum; ///< only used when uiSliceMode=1, when uiSliceNum=0 means auto design it with cpu core number
unsigned int uiSliceMbNum[MAX_SLICES_NUM_TMP]; ///< only used when uiSliceMode=2; when =0 means setting one MB row a slice
unsigned int uiSliceSizeConstraint; ///< now only used when uiSliceMode=4
} SSliceArgument;
/**
* @brief Enumerate the type of video format
*/
typedef enum {
VF_COMPONENT,
VF_PAL,
VF_NTSC,
VF_SECAM,
VF_MAC,
VF_UNDEF,
VF_NUM_ENUM
} EVideoFormatSPS; // EVideoFormat is already defined/used elsewhere!
/**
* @brief Enumerate the type of color primaries
*/
typedef enum {
CP_RESERVED0,
CP_BT709,
CP_UNDEF,
CP_RESERVED3,
CP_BT470M,
CP_BT470BG,
CP_SMPTE170M,
CP_SMPTE240M,
CP_FILM,
CP_BT2020,
CP_NUM_ENUM
} EColorPrimaries;
/**
* @brief Enumerate the type of transfer characteristics
*/
typedef enum {
TRC_RESERVED0,
TRC_BT709,
TRC_UNDEF,
TRC_RESERVED3,
TRC_BT470M,
TRC_BT470BG,
TRC_SMPTE170M,
TRC_SMPTE240M,
TRC_LINEAR,
TRC_LOG100,
TRC_LOG316,
TRC_IEC61966_2_4,
TRC_BT1361E,
TRC_IEC61966_2_1,
TRC_BT2020_10,
TRC_BT2020_12,
TRC_NUM_ENUM
} ETransferCharacteristics;
/**
* @brief Enumerate the type of color matrix
*/
typedef enum {
CM_GBR,
CM_BT709,
CM_UNDEF,
CM_RESERVED3,
CM_FCC,
CM_BT470BG,
CM_SMPTE170M,
CM_SMPTE240M,
CM_YCGCO,
CM_BT2020NC,
CM_BT2020C,
CM_NUM_ENUM
} EColorMatrix;
SSliceArgument sSliceArgument;
} SSliceConfig;
/**
* @brief Structure for spatial layer configuration
*/
@ -427,19 +366,7 @@ typedef struct {
ELevelIdc uiLevelIdc; ///< value of profile IDC (0 for auto-detection)
int iDLayerQp; ///< value of level IDC (0 for auto-detection)
SSliceArgument sSliceArgument;
// Note: members bVideoSignalTypePresent through uiColorMatrix below are also defined in SWelsSPS in parameter_sets.h.
bool bVideoSignalTypePresent; // false => do not write any of the following information to the header
unsigned char uiVideoFormat; // EVideoFormatSPS; 3 bits in header; 0-5 => component, kpal, ntsc, secam, mac, undef
bool bFullRange; // false => analog video data range [16, 235]; true => full data range [0,255]
bool bColorDescriptionPresent; // false => do not write any of the following three items to the header
unsigned char uiColorPrimaries; // EColorPrimaries; 8 bits in header; 0 - 9 => ???, bt709, undef, ???, bt470m, bt470bg,
// smpte170m, smpte240m, film, bt2020
unsigned char uiTransferCharacteristics; // ETransferCharacteristics; 8 bits in header; 0 - 15 => ???, bt709, undef, ???, bt470m, bt470bg, smpte170m,
// smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, bt2020-10, bt2020-12
unsigned char uiColorMatrix; // EColorMatrix; 8 bits in header (corresponds to FFmpeg "colorspace"); 0 - 10 => GBR, bt709,
// undef, ???, fcc, bt470bg, smpte170m, smpte240m, YCgCo, bt2020nc, bt2020c
SSliceConfig sSliceCfg; ///< slice configuration for a layer
} SSpatialLayerConfig;
/**
@ -511,7 +438,7 @@ typedef struct TagEncParamExt {
eSpsPpsIdStrategy; ///< different stategy in adjust ID in SPS/PPS: 0- constant ID, 1-additional ID, 6-mapping and additional
bool bPrefixNalAddingCtrl; ///< false:not use Prefix NAL; true: use Prefix NAL
bool bEnableSSEI; ///< false:not use SSEI; true: use SSEI -- TODO: planning to remove the interface of SSEI
bool bSimulcastAVC; ///< (when encoding more than 1 spatial layer) false: use SVC syntax for higher layers; true: use Simulcast AVC
bool bSimulcastAVC; ///< (when encoding more than 1 spatial layer) false: use SVC syntax for higher layers; true: use Simulcast AVC -- coming soon
int iPaddingFlag; ///< 0:disable padding;1:padding
int iEntropyCodingModeFlag; ///< 0:CAVLC 1:CABAC.
@ -529,7 +456,6 @@ typedef struct TagEncParamExt {
/* multi-thread settings*/
unsigned short
iMultipleThreadIdc; ///< 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; lager than 1: count number of threads;
bool bUseLoadBalancing; ///< only used when uiSliceMode=1 or 3, will change slicing of a picture during the run-time of multi-thread encoding, so the result of each run may be different
/* Deblocking loop filter */
int iLoopFilterDisableIdc; ///< 0: on, 1: off, 2: on except for slice boundaries
@ -559,6 +485,7 @@ typedef struct {
typedef struct TagSVCDecodingParam {
char* pFileNameRestructed; ///< file name of reconstructed frame used for PSNR calculation based debug
EVideoFormatType eOutputColorFormat; ///< color space format to be outputed, EVideoFormatType specified in codec_def.h
unsigned int uiCpuLoad; ///< CPU load
unsigned char uiTargetDqLayer; ///< setting target dq layer id
@ -575,14 +502,9 @@ typedef struct {
unsigned char uiTemporalId;
unsigned char uiSpatialId;
unsigned char uiQualityId;
EVideoFrameType eFrameType;
unsigned char uiLayerType;
/**
* The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be
* predicted from any picture on any higher layer.
*/
int iSubSeqId; ///< refer to D.2.11 Sub-sequence information SEI message semantics
int iNalCount; ///< count number of NAL coded already
int* pNalLengthInByte; ///< length of NAL size in byte from 0 to iNalCount-1
unsigned char* pBsBuf; ///< buffer of bitstream contained
@ -592,6 +514,14 @@ typedef struct {
* @brief Frame bit stream info
*/
typedef struct {
int iTemporalId; ///< temporal ID
/**
* The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be
* predicted from any picture on any higher layer.
*/
int iSubSeqId; ///< refer to D.2.11 Sub-sequence information SEI message semantics
int iLayerNum;
SLayerBSInfo sLayerInfo[MAX_LAYER_NUM_OF_FRAME];

View File

@ -4,12 +4,12 @@
#include "codec_app_def.h"
static const OpenH264Version g_stCodecVersion = {1, 6, 0, 0};
static const char* const g_strCodecVer = "OpenH264 version:1.6.0.0";
static const OpenH264Version g_stCodecVersion = {1, 5, 3, 0};
static const char* const g_strCodecVer = "OpenH264 version:1.5.3.0";
#define OPENH264_MAJOR (1)
#define OPENH264_MINOR (6)
#define OPENH264_REVISION (0)
#define OPENH264_MINOR (5)
#define OPENH264_REVISION (3)
#define OPENH264_RESERVED (0)
#endif // CODEC_VER_H

View File

@ -7,9 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
0DD32A861B467902009181A1 /* WelsThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A851B467902009181A1 /* WelsThread.cpp */; };
0DD32A881B467911009181A1 /* WelsTaskThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A871B467911009181A1 /* WelsTaskThread.cpp */; };
0DD32A941B468F77009181A1 /* WelsThreadPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A931B468F77009181A1 /* WelsThreadPool.cpp */; };
4C3406C918D96EA600DFA14A /* arm_arch_common_macro.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C3406B218D96EA600DFA14A /* arm_arch_common_macro.S */; };
4C3406CA18D96EA600DFA14A /* deblocking_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C3406B318D96EA600DFA14A /* deblocking_neon.S */; };
4C3406CB18D96EA600DFA14A /* expand_picture_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C3406B418D96EA600DFA14A /* expand_picture_neon.S */; };
@ -49,16 +46,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0DB71EF31BAB273500EABC51 /* WelsCircleQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsCircleQueue.h; sourceTree = "<group>"; };
0DD32A851B467902009181A1 /* WelsThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WelsThread.cpp; sourceTree = "<group>"; };
0DD32A871B467911009181A1 /* WelsTaskThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WelsTaskThread.cpp; sourceTree = "<group>"; };
0DD32A8E1B467B83009181A1 /* WelsLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsLock.h; sourceTree = "<group>"; };
0DD32A8F1B467C73009181A1 /* WelsTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsTask.h; sourceTree = "<group>"; };
0DD32A901B467C73009181A1 /* WelsTaskThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsTaskThread.h; sourceTree = "<group>"; };
0DD32A911B467C73009181A1 /* WelsThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsThread.h; sourceTree = "<group>"; };
0DD32A921B467C73009181A1 /* WelsThreadPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsThreadPool.h; sourceTree = "<group>"; };
0DD32A931B468F77009181A1 /* WelsThreadPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WelsThreadPool.cpp; sourceTree = "<group>"; };
0DEA477E1BB36FE100ADD134 /* WelsList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelsList.h; sourceTree = "<group>"; };
4C3406B218D96EA600DFA14A /* arm_arch_common_macro.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = arm_arch_common_macro.S; sourceTree = "<group>"; };
4C3406B318D96EA600DFA14A /* deblocking_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = deblocking_neon.S; sourceTree = "<group>"; };
4C3406B418D96EA600DFA14A /* expand_picture_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = expand_picture_neon.S; sourceTree = "<group>"; };
@ -147,13 +134,6 @@
5BD896B81A7B837700D32B7D /* memory_align.h */,
4C3406C118D96EA600DFA14A /* typedefs.h */,
5BA8F2BE19603F3500011CE4 /* wels_common_defs.h */,
0DB71EF31BAB273500EABC51 /* WelsCircleQueue.h */,
0DEA477E1BB36FE100ADD134 /* WelsList.h */,
0DD32A8E1B467B83009181A1 /* WelsLock.h */,
0DD32A8F1B467C73009181A1 /* WelsTask.h */,
0DD32A901B467C73009181A1 /* WelsTaskThread.h */,
0DD32A911B467C73009181A1 /* WelsThread.h */,
0DD32A921B467C73009181A1 /* WelsThreadPool.h */,
5B9196F91A7F8BA40075D641 /* wels_const_common.h */,
4C3406C218D96EA600DFA14A /* WelsThreadLib.h */,
);
@ -173,9 +153,6 @@
4C3406C618D96EA600DFA14A /* deblocking_common.cpp */,
5BDD15EC1A79027600B6CA2E /* mc.cpp */,
5BD896B91A7B839B00D32B7D /* memory_align.cpp */,
0DD32A871B467911009181A1 /* WelsTaskThread.cpp */,
0DD32A931B468F77009181A1 /* WelsThreadPool.cpp */,
0DD32A851B467902009181A1 /* WelsThread.cpp */,
4C3406C818D96EA600DFA14A /* WelsThreadLib.cpp */,
);
path = src;
@ -283,7 +260,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0DD32A941B468F77009181A1 /* WelsThreadPool.cpp in Sources */,
F5B8D82D190757290037849A /* mc_aarch64_neon.S in Sources */,
4C3406C918D96EA600DFA14A /* arm_arch_common_macro.S in Sources */,
F556A8241906673900E156A8 /* arm_arch64_common_macro.S in Sources */,
@ -292,10 +268,8 @@
4C3406CE18D96EA600DFA14A /* crt_util_safe_x.cpp in Sources */,
F791965919D3BE2200F60C6B /* intra_pred_common.cpp in Sources */,
5BD896BA1A7B839B00D32B7D /* memory_align.cpp in Sources */,
0DD32A881B467911009181A1 /* WelsTaskThread.cpp in Sources */,
4C3406CF18D96EA600DFA14A /* deblocking_common.cpp in Sources */,
5BA8F2C019603F5F00011CE4 /* common_tables.cpp in Sources */,
0DD32A861B467902009181A1 /* WelsThread.cpp in Sources */,
F791965419D3B89D00F60C6B /* intra_pred_common_aarch64_neon.S in Sources */,
4C3406D118D96EA600DFA14A /* WelsThreadLib.cpp in Sources */,
4C3406CC18D96EA600DFA14A /* mc_neon.S in Sources */,

View File

@ -7,10 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
0D6970BE1CA5BCFB001D88F8 /* paraset_strategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0D6970BC1CA5BCFB001D88F8 /* paraset_strategy.cpp */; };
0DD32A961B4A478B009181A1 /* wels_task_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A951B4A478B009181A1 /* wels_task_base.cpp */; };
0DD32A991B4A4997009181A1 /* wels_task_management.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A981B4A4997009181A1 /* wels_task_management.cpp */; };
0DD32A9C1B4A4E8F009181A1 /* wels_task_encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0DD32A9B1B4A4E8F009181A1 /* wels_task_encoder.cpp */; };
4C23BC60195A77E0003B81FC /* intra_pred_sad_3_opt_aarch64_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C23BC5F195A77E0003B81FC /* intra_pred_sad_3_opt_aarch64_neon.S */; };
4C34066D18C57D0400DFA14A /* intra_pred_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C34066618C57D0400DFA14A /* intra_pred_neon.S */; };
4C34066E18C57D0400DFA14A /* intra_pred_sad_3_opt_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4C34066718C57D0400DFA14A /* intra_pred_sad_3_opt_neon.S */; };
@ -32,6 +28,7 @@
4CE4471A18BC605C0017DF25 /* mv_pred.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446E918BC605C0017DF25 /* mv_pred.cpp */; };
4CE4471B18BC605C0017DF25 /* nal_encap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446EA18BC605C0017DF25 /* nal_encap.cpp */; };
4CE4471C18BC605C0017DF25 /* picture_handle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446EB18BC605C0017DF25 /* picture_handle.cpp */; };
4CE4471D18BC605C0017DF25 /* property.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446EC18BC605C0017DF25 /* property.cpp */; };
4CE4471E18BC605C0017DF25 /* ratectl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446ED18BC605C0017DF25 /* ratectl.cpp */; };
4CE4471F18BC605C0017DF25 /* ref_list_mgr_svc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446EE18BC605C0017DF25 /* ref_list_mgr_svc.cpp */; };
4CE4472018BC605C0017DF25 /* sample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446EF18BC605C0017DF25 /* sample.cpp */; };
@ -70,14 +67,6 @@
/* Begin PBXFileReference section */
04FE0684196FD9370004D7CE /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = ../../../common/inc/version.h; sourceTree = "<group>"; };
0D6970BC1CA5BCFB001D88F8 /* paraset_strategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = paraset_strategy.cpp; sourceTree = "<group>"; };
0D6970BF1CA5BD26001D88F8 /* paraset_strategy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = paraset_strategy.h; sourceTree = "<group>"; };
0DD32A951B4A478B009181A1 /* wels_task_base.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wels_task_base.cpp; sourceTree = "<group>"; };
0DD32A971B4A47D0009181A1 /* wels_task_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_task_base.h; sourceTree = "<group>"; };
0DD32A981B4A4997009181A1 /* wels_task_management.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wels_task_management.cpp; sourceTree = "<group>"; };
0DD32A9A1B4A49AC009181A1 /* wels_task_management.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_task_management.h; sourceTree = "<group>"; };
0DD32A9B1B4A4E8F009181A1 /* wels_task_encoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wels_task_encoder.cpp; sourceTree = "<group>"; };
0DD32A9D1B4A4E9C009181A1 /* wels_task_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_task_encoder.h; sourceTree = "<group>"; };
4C23BC5F195A77E0003B81FC /* intra_pred_sad_3_opt_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = intra_pred_sad_3_opt_aarch64_neon.S; path = arm64/intra_pred_sad_3_opt_aarch64_neon.S; sourceTree = "<group>"; };
4C34066618C57D0400DFA14A /* intra_pred_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = intra_pred_neon.S; sourceTree = "<group>"; };
4C34066718C57D0400DFA14A /* intra_pred_sad_3_opt_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = intra_pred_sad_3_opt_neon.S; sourceTree = "<group>"; };
@ -109,6 +98,7 @@
4CE446C018BC605C0017DF25 /* parameter_sets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parameter_sets.h; sourceTree = "<group>"; };
4CE446C118BC605C0017DF25 /* picture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picture.h; sourceTree = "<group>"; };
4CE446C218BC605C0017DF25 /* picture_handle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picture_handle.h; sourceTree = "<group>"; };
4CE446C318BC605C0017DF25 /* property.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = property.h; sourceTree = "<group>"; };
4CE446C418BC605C0017DF25 /* rc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rc.h; sourceTree = "<group>"; };
4CE446C518BC605C0017DF25 /* ref_list_mgr_svc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ref_list_mgr_svc.h; sourceTree = "<group>"; };
4CE446C618BC605C0017DF25 /* sample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sample.h; sourceTree = "<group>"; };
@ -143,6 +133,7 @@
4CE446E918BC605C0017DF25 /* mv_pred.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mv_pred.cpp; sourceTree = "<group>"; };
4CE446EA18BC605C0017DF25 /* nal_encap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nal_encap.cpp; sourceTree = "<group>"; };
4CE446EB18BC605C0017DF25 /* picture_handle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = picture_handle.cpp; sourceTree = "<group>"; };
4CE446EC18BC605C0017DF25 /* property.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = property.cpp; sourceTree = "<group>"; };
4CE446ED18BC605C0017DF25 /* ratectl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ratectl.cpp; sourceTree = "<group>"; };
4CE446EE18BC605C0017DF25 /* ref_list_mgr_svc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ref_list_mgr_svc.cpp; sourceTree = "<group>"; };
4CE446EF18BC605C0017DF25 /* sample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sample.cpp; sourceTree = "<group>"; };
@ -284,9 +275,9 @@
4CE446BD18BC605C0017DF25 /* nal_encap.h */,
4CE446BF18BC605C0017DF25 /* param_svc.h */,
4CE446C018BC605C0017DF25 /* parameter_sets.h */,
0D6970BF1CA5BD26001D88F8 /* paraset_strategy.h */,
4CE446C118BC605C0017DF25 /* picture.h */,
4CE446C218BC605C0017DF25 /* picture_handle.h */,
4CE446C318BC605C0017DF25 /* property.h */,
4CE446C418BC605C0017DF25 /* rc.h */,
4CE446C518BC605C0017DF25 /* ref_list_mgr_svc.h */,
4CE446C618BC605C0017DF25 /* sample.h */,
@ -309,9 +300,6 @@
4CE446D918BC605C0017DF25 /* wels_const.h */,
4CE446DA18BC605C0017DF25 /* wels_func_ptr_def.h */,
4CE446DB18BC605C0017DF25 /* wels_preprocess.h */,
0DD32A971B4A47D0009181A1 /* wels_task_base.h */,
0DD32A9D1B4A4E9C009181A1 /* wels_task_encoder.h */,
0DD32A9A1B4A49AC009181A1 /* wels_task_management.h */,
);
path = inc;
sourceTree = "<group>";
@ -333,8 +321,8 @@
4CE446E718BC605C0017DF25 /* md.cpp */,
4CE446E918BC605C0017DF25 /* mv_pred.cpp */,
4CE446EA18BC605C0017DF25 /* nal_encap.cpp */,
0D6970BC1CA5BCFB001D88F8 /* paraset_strategy.cpp */,
4CE446EB18BC605C0017DF25 /* picture_handle.cpp */,
4CE446EC18BC605C0017DF25 /* property.cpp */,
4CE446ED18BC605C0017DF25 /* ratectl.cpp */,
4CE446EE18BC605C0017DF25 /* ref_list_mgr_svc.cpp */,
4CE446EF18BC605C0017DF25 /* sample.cpp */,
@ -348,9 +336,6 @@
4CE446F718BC605C0017DF25 /* svc_motion_estimate.cpp */,
4CE446F818BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp */,
4CE446FA18BC605C0017DF25 /* wels_preprocess.cpp */,
0DD32A951B4A478B009181A1 /* wels_task_base.cpp */,
0DD32A9B1B4A4E8F009181A1 /* wels_task_encoder.cpp */,
0DD32A981B4A4997009181A1 /* wels_task_management.cpp */,
);
path = src;
sourceTree = "<group>";
@ -439,10 +424,10 @@
4CE4471118BC605C0017DF25 /* encode_mb_aux.cpp in Sources */,
4CE4472718BC605C0017DF25 /* svc_mode_decision.cpp in Sources */,
4CE4472818BC605C0017DF25 /* svc_motion_estimate.cpp in Sources */,
4CE4471D18BC605C0017DF25 /* property.cpp in Sources */,
4CE4471018BC605C0017DF25 /* decode_mb_aux.cpp in Sources */,
4CE4472018BC605C0017DF25 /* sample.cpp in Sources */,
6CA38DA31991CACE003EAAE0 /* svc_motion_estimation.S in Sources */,
0DD32A9C1B4A4E8F009181A1 /* wels_task_encoder.cpp in Sources */,
4CE4471318BC605C0017DF25 /* encoder_data_tables.cpp in Sources */,
4C34067118C57D0400DFA14A /* pixel_neon.S in Sources */,
9AED665019469FC1009A3567 /* welsCodecTrace.cpp in Sources */,
@ -475,12 +460,9 @@
4CE4471618BC605C0017DF25 /* get_intra_predictor.cpp in Sources */,
4CE4472E18BC605C0017DF25 /* welsEncoderExt.cpp in Sources */,
6CA38DA51991D31A003EAAE0 /* svc_motion_estimation_aarch64_neon.S in Sources */,
0DD32A991B4A4997009181A1 /* wels_task_management.cpp in Sources */,
4CE4471418BC605C0017DF25 /* encoder_ext.cpp in Sources */,
4C34067218C57D0400DFA14A /* reconstruct_neon.S in Sources */,
0DD32A961B4A478B009181A1 /* wels_task_base.cpp in Sources */,
F7E9994919EBD1F8009B1021 /* set_mb_syn_cabac.cpp in Sources */,
0D6970BE1CA5BCFB001D88F8 /* paraset_strategy.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -355,46 +355,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\common\x86\dct.asm"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\decoder\core\x86\dct.asm"
>

View File

@ -406,11 +406,11 @@
>
</File>
<File
RelativePath="..\..\..\encoder\core\src\paraset_strategy.cpp"
RelativePath="..\..\..\encoder\core\src\picture_handle.cpp"
>
</File>
<File
RelativePath="..\..\..\encoder\core\src\picture_handle.cpp"
RelativePath="..\..\..\encoder\core\src\property.cpp"
>
</File>
<File
@ -477,34 +477,10 @@
RelativePath="..\..\..\common\src\utils.cpp"
>
</File>
<File
RelativePath="..\..\..\encoder\core\src\wels_task_base.cpp"
>
</File>
<File
RelativePath="..\..\..\encoder\core\src\wels_task_encoder.cpp"
>
</File>
<File
RelativePath="..\..\..\encoder\core\src\wels_task_management.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\WelsTaskThread.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\WelsThread.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\WelsThreadLib.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\WelsThreadPool.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@ -622,10 +598,6 @@
RelativePath="..\..\..\encoder\core\inc\parameter_sets.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\paraset_strategy.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\picture.h"
>
@ -634,6 +606,10 @@
RelativePath="..\..\..\encoder\core\inc\picture_handle.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\property.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\rc.h"
>
@ -835,46 +811,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\common\x86\dct.asm"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName)_common.obj $(InputPath)&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName)_common.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\encoder\core\x86\dct.asm"
>

View File

@ -62,7 +62,3 @@ ret
.endm
#endif
.macro SIGN_EXTENSION arg0, arg1
sxtw \arg0, \arg1
.endm

View File

@ -105,10 +105,9 @@
// }
.endm
//void WelsCopy8x8_AArch64_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy8x8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
LOAD_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x2, x3
STORE_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x0, x1
@ -121,8 +120,7 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy16x16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
LOAD16_ALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x2, x3
STORE16_ALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x0, x1
@ -143,8 +141,7 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy16x16NotAligned_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
LOAD16_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x2, x3
STORE16_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x0, x1
@ -165,8 +162,7 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy16x8NotAligned_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
LOAD16_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x2, x3
STORE16_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x0, x1
@ -179,8 +175,7 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsCopy8x16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
LOAD_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x2, x3
STORE_UNALIGNED_DATA_WITH_STRIDE v0, v1, v2, v3, x0, x1

View File

@ -305,7 +305,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN DeblockLumaLt4V_AArch64_neon //uint8_t* pPix, int32_t iStride, int32_t iAlpha, int32_t iBeta, int8_t* tc
dup v16.16b, w2 //alpha
dup v17.16b, w3 //beta
SIGN_EXTENSION x1,w1
add x2, x1, x1, lsl #1
sub x2, x0, x2
movi v23.16b, #128
@ -364,8 +363,8 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN DeblockLumaEq4V_AArch64_neon
dup v16.16b, w2 //alpha
dup v17.16b, w3 //beta
SIGN_EXTENSION x1,w1
sub x3, x0, x1, lsl #2
ld1 {v0.16b}, [x3], x1
ld1 {v4.16b}, [x0], x1
ld1 {v1.16b}, [x3], x1
@ -432,7 +431,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN DeblockLumaLt4H_AArch64_neon //uint8_t* pPix, int32_
dup v17.16b, w3 //beta
sub x2, x0, #3
movi v23.16b, #128
SIGN_EXTENSION x1,w1
LOAD_LUMA_DATA_3 v0, v1, v2, v3, v4, v5, 0
LOAD_LUMA_DATA_3 v0, v1, v2, v3, v4, v5, 1
LOAD_LUMA_DATA_3 v0, v1, v2, v3, v4, v5, 2
@ -516,7 +515,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN DeblockLumaEq4H_AArch64_neon
dup v16.16b, w2 //alpha
dup v17.16b, w3 //beta
sub x3, x0, #4
SIGN_EXTENSION x1,w1
LOAD_LUMA_DATA_4 v0, v1, v2, v3, v4, v5, v6, v7, 0
LOAD_LUMA_DATA_4 v0, v1, v2, v3, v4, v5, v6, v7, 1
LOAD_LUMA_DATA_4 v0, v1, v2, v3, v4, v5, v6, v7, 2

View File

@ -32,11 +32,8 @@
#ifdef HAVE_NEON_AARCH64
#include "arm_arch64_common_macro.S"
//void ExpandPictureLuma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
WELS_ASM_AARCH64_FUNC_BEGIN ExpandPictureLuma_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x2,w2
SIGN_EXTENSION x3,w3
mov x7, x0
mov x8, x3
add x4, x7, x2
@ -76,13 +73,8 @@ _expand_picture_luma_loop1:
cbnz x2, _expand_picture_luma_loop0
WELS_ASM_AARCH64_FUNC_END
//void ExpandPictureChroma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
// const int32_t kiPicH);
WELS_ASM_AARCH64_FUNC_BEGIN ExpandPictureChroma_AArch64_neon
//Save the dst
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x2,w2
SIGN_EXTENSION x3,w3
mov x7, x0
mov x8, x3
mov x10, #16

View File

@ -34,9 +34,7 @@
#include "arm_arch64_common_macro.S"
//for Luma 16x16
//void WelsI16x16LumaPredV_AArch64_neon (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride);
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredV_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.16b}, [x3]
.rept 16
@ -44,9 +42,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredV_AArch64_neon
.endr
WELS_ASM_AARCH64_FUNC_END
//void WelsI16x16LumaPredH_AArch64_neon (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride);
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredH_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
.rept 16
ld1r {v0.16b}, [x3], x2

View File

@ -294,9 +294,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20WidthEq16_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w16_h_mc_luma_loop:
ld1 {v2.8b, v3.8b, v4.8b}, [x0], x1 //only use 21(16+5); v2=src[-2]
trn1 v2.2d, v2.2d, v3.2d
@ -315,15 +312,11 @@ w16_h_mc_luma_loop:
cbnz x4, w16_h_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer20WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20WidthEq8_AArch64_neon
sub x0, x0, #2
stp d8,d9, [sp,#-16]!
movi v8.8h, #20, lsl #0
movi v9.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w8_h_mc_luma_loop:
VEC4_LD1_8BITS_16ELEMENT x0, x1, v16, v20, v24, v28 //load src[-2] in v16,v20,v24,v28 for 4 row; only use 13(8+5);
sub x4, x4, #4
@ -373,15 +366,10 @@ w8_h_mc_luma_loop:
ldp d8,d9,[sp],#16
WELS_ASM_AARCH64_FUNC_END
//void McHorVer20WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20WidthEq4_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
asr x4, x4, #1
w4_h_mc_luma_loop:
ld1 {v2.16b}, [x0], x1 //only use 9(4+5); 1st row src[-2:6]
@ -413,15 +401,10 @@ w4_h_mc_luma_loop:
cbnz x4, w4_h_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer10WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer10WidthEq16_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w16_xy_10_mc_luma_loop:
ld1 {v2.8b, v3.8b, v4.8b}, [x0], x1 //only use 21(16+5); v2=src[-2]
trn1 v2.2d, v2.2d, v3.2d
@ -440,16 +423,11 @@ w16_xy_10_mc_luma_loop:
cbnz x4, w16_xy_10_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer10WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer10WidthEq8_AArch64_neon
sub x0, x0, #2
stp d8,d9, [sp,#-16]!
movi v8.8h, #20, lsl #0
movi v9.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w8_xy_10_mc_luma_loop:
VEC4_LD1_8BITS_16ELEMENT x0, x1, v16, v20, v24, v28 //load src[-2] in v16,v20,v24,v28 for 4 row; only use 13(8+5);
sub x4, x4, #4
@ -501,15 +479,10 @@ w8_xy_10_mc_luma_loop:
ldp d8,d9,[sp],#16
WELS_ASM_AARCH64_FUNC_END
//void McHorVer10WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer10WidthEq4_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
asr x4, x4, #1
w4_xy_10_mc_luma_loop:
ld1 {v2.16b}, [x0], x1 //only use 9(4+5); 1st row src[-2:6]
@ -541,15 +514,11 @@ w4_xy_10_mc_luma_loop:
cbnz x4, w4_xy_10_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer30WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer30WidthEq16_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w16_xy_30_mc_luma_loop:
ld1 {v2.8b, v3.8b, v4.8b}, [x0], x1 //only use 21(16+5); v2=src[-2]
trn1 v2.2d, v2.2d, v3.2d
@ -568,16 +537,11 @@ w16_xy_30_mc_luma_loop:
cbnz x4, w16_xy_30_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer30WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer30WidthEq8_AArch64_neon
sub x0, x0, #2
stp d8,d9, [sp,#-16]!
movi v8.8h, #20, lsl #0
movi v9.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w8_xy_30_mc_luma_loop:
VEC4_LD1_8BITS_16ELEMENT x0, x1, v16, v20, v24, v28 //load src[-2] in v16,v20,v24,v28 for 4 row; only use 13(8+5);
sub x4, x4, #4
@ -629,15 +593,10 @@ w8_xy_30_mc_luma_loop:
ldp d8,d9,[sp],#16
WELS_ASM_AARCH64_FUNC_END
//void McHorVer30WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer30WidthEq4_AArch64_neon
sub x0, x0, #2
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
asr x4, x4, #1
w4_xy_30_mc_luma_loop:
ld1 {v2.16b}, [x0], x1 //only use 9(4+5); 1st row src[-2:6]
@ -669,12 +628,8 @@ w4_xy_30_mc_luma_loop:
cbnz x4, w4_xy_30_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer01WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer01WidthEq16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -756,12 +711,7 @@ w16_xy_01_mc_luma_loop:
cbnz x4, w16_xy_01_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer01WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer01WidthEq8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v30.8h, #20, lsl #0
movi v31.8h, #5, lsl #0
@ -800,12 +750,7 @@ w8_xy_01_mc_luma_loop:
cbnz x4, w8_xy_01_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer01WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer01WidthEq4_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -860,12 +805,8 @@ w4_xy_01_mc_luma_loop:
cbnz x4, w4_xy_01_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer03WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer03WidthEq16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -947,12 +888,7 @@ w16_xy_03_mc_luma_loop:
cbnz x4, w16_xy_03_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer03WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer03WidthEq8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v30.8h, #20, lsl #0
movi v31.8h, #5, lsl #0
@ -991,12 +927,7 @@ w8_xy_03_mc_luma_loop:
cbnz x4, w8_xy_03_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer03WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer03WidthEq4_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -1051,12 +982,8 @@ w4_xy_03_mc_luma_loop:
cbnz x4, w4_xy_03_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02WidthEq16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -1138,12 +1065,7 @@ w16_xy_02_mc_luma_loop:
cbnz x4, w16_xy_02_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02WidthEq8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v30.8h, #20, lsl #0
movi v31.8h, #5, lsl #0
@ -1178,12 +1100,7 @@ w8_xy_02_mc_luma_loop:
cbnz x4, w8_xy_02_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02WidthEq4_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -1238,12 +1155,8 @@ w4_xy_02_mc_luma_loop:
cbnz x4, w4_xy_02_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22WidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22WidthEq16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
stp d8, d9, [sp,#-16]!
stp d10, d11, [sp,#-16]!
stp d12, d13, [sp,#-16]!
@ -1408,12 +1321,7 @@ w16_hv_mc_luma_loop:
ldp d8, d9, [sp], #16
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22WidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22WidthEq8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
@ -1483,13 +1391,9 @@ w8_hv_mc_luma_loop:
sub x4, x4, #4
cbnz x4, w8_hv_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22WidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22WidthEq4_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
@ -1558,13 +1462,9 @@ w4_hv_mc_luma_loop:
sub x4, x4, #4
cbnz x4, w4_hv_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McCopyWidthEq16_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McCopyWidthEq16_AArch64_neon
//prfm pldl1strm, [x0]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w16_copy_loop:
//prfm pldl1strm, [x0, x1]
ld1 {v0.16b}, [x0], x1 //read 16Byte : 0 line
@ -1576,13 +1476,9 @@ w16_copy_loop:
sub x4, x4, #2
cbnz x4, w16_copy_loop
WELS_ASM_AARCH64_FUNC_END
//void McCopyWidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McCopyWidthEq8_AArch64_neon
//prfm pldl1strm, [x0]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w8_copy_loop:
//prfm pldl1strm, [x0, x1]
ld1 {v0.8b}, [x0], x1 //read 16Byte : 0 line
@ -1597,9 +1493,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN McCopyWidthEq4_AArch64_neon
//prfm pldl1strm, [x0]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
w4_copy_loop:
//prfm pldl1strm, [x0, x1]
ld1 {v0.s}[0], [x0], x1 //read 16Byte : 0 line
@ -1612,14 +1505,8 @@ w4_copy_loop:
cbnz x4, w4_copy_loop
WELS_ASM_AARCH64_FUNC_END
//void PixStrideAvgWidthEq16_AArch64_neon (uint8_t* pDst, int32_t iDstStride, const uint8_t* pSrcA, int32_t iSrcStrideA,
//const uint8_t* pSrcB, int32_t iSrcStrideB, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN PixStrideAvgWidthEq16_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
SIGN_EXTENSION x6,w6
enc_w16_pix_avg_loop:
ld1 {v0.16b}, [x2], x3 //read 16Byte : src0: 0 line
ld1 {v1.16b}, [x4], x5 //read 16Byte : src1: 0 line
@ -1651,15 +1538,9 @@ enc_w16_pix_avg_loop:
cbnz x6, enc_w16_pix_avg_loop
WELS_ASM_AARCH64_FUNC_END
//void PixStrideAvgWidthEq8_AArch64_neon (uint8_t* pDst, int32_t iDstStride, const uint8_t* pSrcA, int32_t iSrcStrideA,
// const uint8_t* pSrcB, int32_t iSrcStrideB, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN PixStrideAvgWidthEq8_AArch64_neon
//prfm pldl1strm, [x2]
//prfm pldl1strm, [x4]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
SIGN_EXTENSION x6,w6
enc_w8_pix_avg_loop:
//prfm pldl1strm, [x2, x3]
//prfm pldl1strm, [x4, x5]
@ -1693,15 +1574,10 @@ enc_w8_pix_avg_loop:
sub x6, x6, #4
cbnz x6, enc_w8_pix_avg_loop
WELS_ASM_AARCH64_FUNC_END
//void PixelAvgWidthEq16_AArch64_neon (uint8_t* pDst, int32_t iDstStride, const uint8_t* pSrcA, int32_t iSrcAStride,
// const uint8_t* pSrcB, int32_t iSrcBStride, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN PixelAvgWidthEq16_AArch64_neon
//prfm pldl1strm, [x2]
//prfm pldl1strm, [x4]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
SIGN_EXTENSION x6,w6
w16_pix_avg_loop:
//prfm pldl1strm, [x2, x3]
//prfm pldl1strm, [x4, x5]
@ -1740,15 +1616,10 @@ w16_pix_avg_loop:
sub x6, x6, #4
cbnz x6, w16_pix_avg_loop
WELS_ASM_AARCH64_FUNC_END
//void PixelAvgWidthEq8_AArch64_neon (uint8_t* pDst, int32_t iDstStride, const uint8_t* pSrcA, int32_t iSrcAStride,
// const uint8_t* pSrcB, int32_t iSrcBStride, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN PixelAvgWidthEq8_AArch64_neon
//prfm pldl1strm, [x2]
//prfm pldl1strm, [x4]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
SIGN_EXTENSION x6,w6
w8_pix_avg_loop:
//prfm pldl1strm, [x2, x3]
//prfm pldl1strm, [x4, x5]
@ -1783,15 +1654,10 @@ w8_pix_avg_loop:
cbnz x6, w8_pix_avg_loop
WELS_ASM_AARCH64_FUNC_END
//void PixelAvgWidthEq4_AArch64_neon (uint8_t* pDst, int32_t iDstStride, const uint8_t* pSrcA, int32_t iSrcAStride,
// const uint8_t* pSrcB, int32_t iSrcBStride, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN PixelAvgWidthEq4_AArch64_neon
//prfm pldl1strm, [x2]
//prfm pldl1strm, [x4]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
SIGN_EXTENSION x6,w6
w4_pix_avg_loop:
//prfm pldl1strm, [x2, x3]
//prfm pldl1strm, [x4, x5]
@ -1808,12 +1674,8 @@ w4_pix_avg_loop:
sub x6, x6, #2
cbnz x6, w4_pix_avg_loop
WELS_ASM_AARCH64_FUNC_END
//void McChromaWidthEq8_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t* pWeights, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McChromaWidthEq8_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
ld4r {v28.8b, v29.8b, v30.8b, v31.8b}, [x4] //load A/B/C/D
ld1 {v16.16b}, [x0], x1 // src[x]
ext v17.16b, v16.16b, v16.16b, #1 // src[x+1]
@ -1867,12 +1729,8 @@ w8_mc_chroma_loop:
sub x5, x5, #4
cbnz x5, w8_mc_chroma_loop
WELS_ASM_AARCH64_FUNC_END
//void McChromaWidthEq4_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t* pWeights, int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McChromaWidthEq4_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
ld4r {v4.8b, v5.8b, v6.8b, v7.8b}, [x4] //load A/B/C/D
ld1 {v0.8b}, [x0], x1 // src[x]
ext v1.8b, v0.8b, v0.8b, #1 // src[x+1]
@ -1901,12 +1759,8 @@ w4_mc_chroma_loop:
cbnz x5, w4_mc_chroma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer20Width17_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// width+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20Width17_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x3, x3, #16
mov x5, #16
@ -1935,12 +1789,7 @@ w17_h_mc_luma_loop:
cbnz x4, w17_h_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer20Width9_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// width+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20Width9_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x3, x3, #8
mov x5, #8
@ -1968,12 +1817,8 @@ w9_h_mc_luma_loop:
cbnz x4, w9_h_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer20Width5_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// width+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer20Width5_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x3, x3, #4
mov x5, #4
@ -1996,16 +1841,12 @@ w5_h_mc_luma_loop:
cbnz x4, w5_h_mc_luma_loop
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22Width17_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22Width17_AArch64_neon
stp d8, d9, [sp,#-16]!
stp d10, d11, [sp,#-16]!
stp d12, d13, [sp,#-16]!
stp d14, d15, [sp,#-16]!
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
@ -2203,12 +2044,8 @@ w17_hv_mc_luma_loop:
ldp d8, d9, [sp], #16
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22Width9_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);//width+1&&height+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22Width9_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
@ -2303,12 +2140,8 @@ w9_hv_mc_luma_loop:
st1 {v26.b}[0], [x2], x3 //write 8th Byte : 0 line
WELS_ASM_AARCH64_FUNC_END
//void McHorVer22Width5_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);//width+1&&height+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer22Width5_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, #2
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
@ -2398,12 +2231,8 @@ w5_hv_mc_luma_loop:
st1 {v26.b}[4], [x2], x3 //write 5th Byte : 0 line
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02Height17_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// height+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02Height17_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -2491,12 +2320,8 @@ w17_v_mc_luma_loop:
FILTER_6TAG_8BITS2 v2, v3, v4, v5, v6, v7, v20, v0, v1
st1 {v20.16b}, [x2], x3 //write 16Byte : last line
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02Height9_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// height+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02Height9_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0
@ -2550,12 +2375,8 @@ w9_v_mc_luma_loop:
st1 {v20.8b}, [x2], x3 //write 8Byte : 0 line
WELS_ASM_AARCH64_FUNC_END
//void McHorVer02Height5_AArch64_neon (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
// int32_t iHeight);// height+1
WELS_ASM_AARCH64_FUNC_BEGIN McHorVer02Height5_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x4,w4
sub x0, x0, x1, lsl #1
movi v0.8h, #20, lsl #0
movi v1.8h, #5, lsl #0

View File

@ -1,180 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsCircleQueue.h
*
* \brief for the queue function needed in ThreadPool
*
* \date 9/27/2015 Created
*
*************************************************************************************
*/
#ifndef _WELS_CIRCLE_QUEUE_H_
#define _WELS_CIRCLE_QUEUE_H_
#include "typedefs.h"
#include <stdlib.h>
namespace WelsCommon {
template<typename TNodeType>
class CWelsCircleQueue {
public:
CWelsCircleQueue() {
m_iMaxNodeCount = 50;
m_pCurrentQueue = static_cast<TNodeType**> (malloc (m_iMaxNodeCount * sizeof (TNodeType*)));
//here using array to simulate list is to avoid the frequent malloc/free of Nodes which may cause fragmented memory
m_iCurrentListStart = m_iCurrentListEnd = 0;
};
~CWelsCircleQueue() {
free (m_pCurrentQueue);
};
int32_t size() {
return ((m_iCurrentListEnd >= m_iCurrentListStart)
? (m_iCurrentListEnd - m_iCurrentListStart)
: (m_iMaxNodeCount - m_iCurrentListStart + m_iCurrentListEnd));
}
int32_t push_back (TNodeType* pNode) {
if ((NULL != pNode) && (find (pNode))) { //not checking NULL for easier testing
return 1;
}
return InternalPushBack (pNode);
}
bool find (TNodeType* pNode) {
if (size() > 0) {
if (m_iCurrentListEnd > m_iCurrentListStart) {
for (int32_t idx = m_iCurrentListStart; idx < m_iCurrentListEnd; idx++) {
if (pNode == m_pCurrentQueue[idx]) {
return true;
}
}
} else {
for (int32_t idx = m_iCurrentListStart; idx < m_iMaxNodeCount; idx++) {
if (pNode == m_pCurrentQueue[idx]) {
return true;
}
}
for (int32_t idx = 0; idx < m_iCurrentListEnd; idx++) {
if (pNode == m_pCurrentQueue[idx]) {
return true;
}
}
}
}
return false;
}
void pop_front() {
if (size() > 0) {
m_pCurrentQueue[m_iCurrentListStart] = NULL;
m_iCurrentListStart = ((m_iCurrentListStart < (m_iMaxNodeCount - 1))
? (m_iCurrentListStart + 1)
: 0);
}
}
TNodeType* begin() {
if (size() > 0) {
return m_pCurrentQueue[m_iCurrentListStart];
}
return NULL;
}
TNodeType* GetIndexNode (const int32_t iIdx) {
if (size() > 0) {
if ((iIdx + m_iCurrentListStart) < m_iMaxNodeCount) {
return m_pCurrentQueue[m_iCurrentListStart + iIdx];
} else {
return m_pCurrentQueue[m_iCurrentListStart + iIdx - m_iMaxNodeCount];
}
}
return NULL;
}
private:
int32_t InternalPushBack (TNodeType* pNode) {
m_pCurrentQueue[m_iCurrentListEnd] = pNode;
m_iCurrentListEnd ++;
if (m_iCurrentListEnd == m_iMaxNodeCount) {
m_iCurrentListEnd = 0;
}
if (m_iCurrentListEnd == m_iCurrentListStart) {
int32_t ret = ExpandQueue();
if (ret) {
return 1;
}
}
return 0;
}
int32_t ExpandQueue() {
TNodeType** tmpCurrentTaskQueue = static_cast<TNodeType**> (malloc (m_iMaxNodeCount * 2 * sizeof (TNodeType*)));
if (tmpCurrentTaskQueue == NULL) {
return 1;
}
memcpy (tmpCurrentTaskQueue,
(m_pCurrentQueue + m_iCurrentListStart),
(m_iMaxNodeCount - m_iCurrentListStart)*sizeof (TNodeType*));
if (m_iCurrentListEnd > 0) {
memcpy (tmpCurrentTaskQueue + m_iMaxNodeCount - m_iCurrentListStart,
m_pCurrentQueue,
m_iCurrentListEnd * sizeof (TNodeType*));
}
free (m_pCurrentQueue);
m_pCurrentQueue = tmpCurrentTaskQueue;
m_iCurrentListEnd = m_iMaxNodeCount;
m_iCurrentListStart = 0;
m_iMaxNodeCount = m_iMaxNodeCount * 2;
return 0;
}
int32_t m_iCurrentListStart;
int32_t m_iCurrentListEnd;
int32_t m_iMaxNodeCount;
TNodeType** m_pCurrentQueue;
};
}
#endif

View File

@ -1,233 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsList
*
* \brief for the list function needed in ThreadPool
*
* \date 9/27/2015 Created
*
*************************************************************************************
*/
#ifndef _WELS_LIST_H_
#define _WELS_LIST_H_
#include "typedefs.h"
namespace WelsCommon {
template<typename TNodeType>
struct SNode {
TNodeType* pPointer;
SNode* pPrevNode;
SNode* pNextNode;
};
template<typename TNodeType>
class CWelsList {
public:
CWelsList() {
m_iCurrentNodeCount = 0;
m_iMaxNodeCount = 50;
m_pCurrentList = static_cast<SNode<TNodeType>*> (malloc (m_iMaxNodeCount * sizeof (SNode<TNodeType>)));
//here using array storage to simulate list is to avoid the frequent malloc/free of Nodes which may cause fragmented memory
ResetStorage();
};
~CWelsList() {
free (m_pCurrentList);
};
int32_t size() {
return m_iCurrentNodeCount;
}
bool push_back (TNodeType* pNode) {
m_pCurrent->pPointer = pNode;
if (0 == m_iCurrentNodeCount) {
m_pFirst = m_pCurrent;
}
m_iCurrentNodeCount++;
if (m_iCurrentNodeCount == m_iMaxNodeCount) {
if (!ExpandList()) {
return false;
}
}
SNode<TNodeType>* pNext = FindNextStorage();
m_pCurrent->pNextNode = pNext;
pNext->pPrevNode = m_pCurrent;
m_pCurrent = pNext;
return true;
}
TNodeType* begin() {
if (m_pFirst) {
return m_pFirst->pPointer;
}
return NULL;
}
void pop_front() {
if (m_iCurrentNodeCount == 0) {
return;
}
SNode<TNodeType>* pTemp = m_pFirst;
if (m_iCurrentNodeCount > 0) {
m_iCurrentNodeCount --;
}
if (0 == m_iCurrentNodeCount) {
ResetStorage();
} else {
m_pFirst = m_pFirst->pNextNode;
m_pFirst->pPrevNode = NULL;
CleanOneNode (pTemp);
}
}
bool erase (TNodeType* pNode) {
if (0 == m_iCurrentNodeCount) {
return false;
}
SNode<TNodeType>* pTemp = m_pFirst;
do {
if (pNode == pTemp->pPointer) {
if (pTemp->pPrevNode) {
pTemp->pPrevNode->pNextNode = pTemp->pNextNode;
} else {
m_pFirst = pTemp->pNextNode;
}
if (pTemp->pNextNode) {
pTemp->pNextNode->pPrevNode = pTemp->pPrevNode;
}
CleanOneNode (pTemp);
m_iCurrentNodeCount --;
return true;
}
if (pTemp->pNextNode) {
pTemp = pTemp->pNextNode;
} else {
break;
}
} while (pTemp->pPointer && pTemp->pNextNode);
return false;
}
private:
bool ExpandList() {
SNode<TNodeType>* tmpCurrentList = static_cast<SNode<TNodeType>*> (malloc (m_iMaxNodeCount * 2 * sizeof (
SNode<TNodeType>)));
if (tmpCurrentList == NULL) {
return false;
}
InitStorage (tmpCurrentList, (m_iMaxNodeCount * 2) - 1);
SNode<TNodeType>* pTemp = m_pFirst;
for (int i = 0; ((i < m_iMaxNodeCount) && pTemp); i++) {
tmpCurrentList[i].pPointer = pTemp->pPointer;
pTemp = pTemp->pNextNode;
}
free (m_pCurrentList);
m_pCurrentList = tmpCurrentList;
m_iCurrentNodeCount = m_iMaxNodeCount;
m_iMaxNodeCount = m_iMaxNodeCount * 2;
m_pFirst = m_pCurrentList;
m_pCurrent = & (m_pCurrentList[m_iCurrentNodeCount - 1]);
return true;
}
void InitStorage (SNode<TNodeType>* pList, const int32_t iMaxIndex) {
pList[0].pPrevNode = NULL;
pList[0].pPointer = NULL;
pList[0].pNextNode = & (pList[1]);
for (int i = 1; i < iMaxIndex; i++) {
pList[i].pPrevNode = & (pList[i - 1]);
pList[i].pPointer = NULL;
pList[i].pNextNode = & (pList[i + 1]);
}
pList[iMaxIndex].pPrevNode = & (pList[iMaxIndex - 1]);
pList[iMaxIndex].pPointer = NULL;
pList[iMaxIndex].pNextNode = NULL;
}
SNode<TNodeType>* FindNextStorage() {
if (NULL != m_pCurrent->pNextNode) {
if (NULL == m_pCurrent->pNextNode->pPointer) {
return (m_pCurrent->pNextNode);
}
}
for (int32_t i = 0; i < m_iMaxNodeCount; i++) {
if (NULL == m_pCurrentList[i].pPointer) {
return (&m_pCurrentList[i]);
}
}
return NULL;
}
void CleanOneNode (SNode<TNodeType>* pSNode) {
pSNode->pPointer = NULL;
pSNode->pPrevNode = NULL;
pSNode->pNextNode = NULL;
}
void ResetStorage() {
m_pFirst = NULL;
m_pCurrent = m_pCurrentList;
InitStorage (m_pCurrentList, m_iMaxNodeCount - 1);
}
int32_t m_iCurrentNodeCount;
int32_t m_iMaxNodeCount;
SNode<TNodeType>* m_pCurrentList;
SNode<TNodeType>* m_pFirst;
SNode<TNodeType>* m_pCurrent;
};
}
#endif

View File

@ -1,97 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsLock.h
*
* \brief class wrapping for locks
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#ifndef _WELS_LOCK_H_
#define _WELS_LOCK_H_
#include "macros.h"
#include "typedefs.h"
#include "WelsThreadLib.h"
namespace WelsCommon {
class CWelsLock {
DISALLOW_COPY_AND_ASSIGN (CWelsLock);
public:
CWelsLock() {
WelsMutexInit (&m_cMutex);
}
virtual ~CWelsLock() {
WelsMutexDestroy (&m_cMutex);
}
WELS_THREAD_ERROR_CODE Lock() {
return WelsMutexLock (&m_cMutex);
}
WELS_THREAD_ERROR_CODE Unlock() {
return WelsMutexUnlock (&m_cMutex);
}
private:
WELS_MUTEX m_cMutex;
};
class CWelsAutoLock {
DISALLOW_COPY_AND_ASSIGN (CWelsAutoLock);
public:
CWelsAutoLock (CWelsLock& cLock) : m_cLock (cLock) {
m_cLock.Lock();
}
virtual ~CWelsAutoLock() {
m_cLock.Unlock();
}
private:
CWelsLock& m_cLock;
};
}
#endif

View File

@ -1,75 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsTask.h
*
* \brief Interfaces introduced in thread pool
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#ifndef _WELS_TASK_H_
#define _WELS_TASK_H_
#include "codec_def.h"
namespace WelsCommon {
class IWelsTaskSink {
public:
virtual int OnTaskExecuted() = 0;
virtual int OnTaskCancelled() = 0;
};
class IWelsTask {
public:
IWelsTask (IWelsTaskSink* pSink) {
m_pSink = pSink;
};
virtual ~IWelsTask() { }
virtual int Execute() = 0;
IWelsTaskSink* GetSink() {
return m_pSink;
};
protected:
IWelsTaskSink* m_pSink;
};
}
#endif

View File

@ -1,83 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsTaskThread.h
*
* \brief connecting task and thread
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#ifndef _WELS_TASK_THREAD_H_
#define _WELS_TASK_THREAD_H_
#include "WelsTask.h"
#include "WelsThread.h"
namespace WelsCommon {
class CWelsTaskThread;
class IWelsTaskThreadSink {
public:
virtual WELS_THREAD_ERROR_CODE OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask) = 0;
virtual WELS_THREAD_ERROR_CODE OnTaskStop (CWelsTaskThread* pThread, IWelsTask* pTask) = 0;
};
class CWelsTaskThread : public CWelsThread {
public:
CWelsTaskThread (IWelsTaskThreadSink* pSink);
virtual ~CWelsTaskThread();
WELS_THREAD_ERROR_CODE SetTask (IWelsTask* pTask);
virtual void ExecuteTask();
uintptr_t GetID() const {
return m_uiID;
}
private:
CWelsLock m_cLockTask;
IWelsTaskThreadSink* m_pSink;
IWelsTask* m_pTask;
uintptr_t m_uiID;
DISALLOW_COPY_AND_ASSIGN (CWelsTaskThread);
};
}
#endif

View File

@ -1,105 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsThread.h
*
* \brief Interfaces introduced in threads
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#ifndef _WELS_THREAD_H_
#define _WELS_THREAD_H_
#include "macros.h"
#include "WelsLock.h"
#include "WelsThreadLib.h"
namespace WelsCommon {
class CWelsThread {
public:
CWelsThread();
virtual ~CWelsThread();
virtual void Thread();
virtual void ExecuteTask() = 0;
virtual WELS_THREAD_ERROR_CODE Start();
virtual void Kill();
protected:
static WELS_THREAD_ROUTINE_TYPE TheThread (void* pParam);
void SetRunning (bool bRunning) {
CWelsAutoLock cLock (m_cLockStatus);
m_bRunning = bRunning;
}
void SetEndFlag (bool bEndFlag) {
CWelsAutoLock cLock (m_cLockStatus);
m_bEndFlag = bEndFlag;
}
bool GetRunning() const {
return m_bRunning;
}
bool GetEndFlag() const {
return m_bEndFlag;
}
void SignalThread() {
WelsEventSignal (&m_hEvent);
}
private:
WELS_THREAD_HANDLE m_hThread;
WELS_EVENT m_hEvent;
CWelsLock m_cLockStatus;
bool m_bRunning;
bool m_bEndFlag;
DISALLOW_COPY_AND_ASSIGN (CWelsThread);
};
}
#endif

View File

@ -104,9 +104,8 @@ WELS_THREAD_ERROR_CODE WelsMutexLock (WELS_MUTEX* mutex);
WELS_THREAD_ERROR_CODE WelsMutexUnlock (WELS_MUTEX* mutex);
WELS_THREAD_ERROR_CODE WelsMutexDestroy (WELS_MUTEX* mutex);
WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_name = NULL);
WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_name = NULL);
WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_name);
WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_name);
WELS_THREAD_ERROR_CODE WelsEventSignal (WELS_EVENT* event);
WELS_THREAD_ERROR_CODE WelsEventWait (WELS_EVENT* event);
WELS_THREAD_ERROR_CODE WelsEventWaitWithTimeOut (WELS_EVENT* event, uint32_t dwMilliseconds);
@ -126,7 +125,6 @@ WELS_THREAD_HANDLE WelsThreadSelf();
WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* pInfo);
void WelsSleep (uint32_t dwMilliSecond);
#ifdef __cplusplus
}

View File

@ -1,125 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsThreadPool.h
*
* \brief Interfaces introduced in thread pool
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#ifndef _WELS_THREAD_POOL_H_
#define _WELS_THREAD_POOL_H_
#include <stdio.h>
#include "WelsTask.h"
#include "WelsTaskThread.h"
#include "WelsCircleQueue.h"
#include "WelsList.h"
namespace WelsCommon {
class CWelsThreadPool : public CWelsThread, public IWelsTaskThreadSink {
public:
enum {
DEFAULT_THREAD_NUM = 4,
};
static WELS_THREAD_ERROR_CODE SetThreadNum (int32_t iMaxThreadNum);
static CWelsThreadPool& AddReference();
void RemoveInstance();
static bool IsReferenced();
//IWelsTaskThreadSink
virtual WELS_THREAD_ERROR_CODE OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask);
virtual WELS_THREAD_ERROR_CODE OnTaskStop (CWelsTaskThread* pThread, IWelsTask* pTask);
// CWelsThread
virtual void ExecuteTask();
WELS_THREAD_ERROR_CODE QueueTask (IWelsTask* pTask);
int32_t GetThreadNum() const {
return m_iMaxThreadNum;
}
protected:
WELS_THREAD_ERROR_CODE Init();
WELS_THREAD_ERROR_CODE Uninit();
WELS_THREAD_ERROR_CODE CreateIdleThread();
void DestroyThread (CWelsTaskThread* pThread);
WELS_THREAD_ERROR_CODE AddThreadToIdleQueue (CWelsTaskThread* pThread);
WELS_THREAD_ERROR_CODE AddThreadToBusyList (CWelsTaskThread* pThread);
WELS_THREAD_ERROR_CODE RemoveThreadFromBusyList (CWelsTaskThread* pThread);
void AddTaskToWaitedList (IWelsTask* pTask);
CWelsTaskThread* GetIdleThread();
IWelsTask* GetWaitedTask();
int32_t GetIdleThreadNum();
int32_t GetBusyThreadNum();
int32_t GetWaitedTaskNum();
void ClearWaitedTasks();
private:
CWelsThreadPool();
virtual ~CWelsThreadPool();
WELS_THREAD_ERROR_CODE StopAllRunning();
static int32_t m_iRefCount;
static CWelsLock m_cInitLock;
static int32_t m_iMaxThreadNum;
CWelsCircleQueue<IWelsTask>* m_cWaitedTasks;
CWelsCircleQueue<CWelsTaskThread>* m_cIdleThreads;
CWelsList<CWelsTaskThread>* m_cBusyThreads;
CWelsLock m_cLockPool;
CWelsLock m_cLockWaitedTasks;
CWelsLock m_cLockIdleTasks;
CWelsLock m_cLockBusyTasks;
DISALLOW_COPY_AND_ASSIGN (CWelsThreadPool);
};
}
#endif

View File

@ -56,6 +56,7 @@
#define WELS_CPU_SSE42 0x00000400 /* sse 4.2 */
/* CPU features application extensive */
#define WELS_CPU_AVX 0x00000800 /* Advanced Vector eXtentions */
#define WELS_CPU_FPU 0x00001000 /* x87-FPU on chip */
#define WELS_CPU_HTT 0x00002000 /* Hyper-Threading Technology (HTT), Multi-threading enabled feature:
physical processor package is capable of supporting more than one logic processor
@ -66,13 +67,7 @@
#define WELS_CPU_MOVBE 0x00008000 /* MOVBE instruction */
#define WELS_CPU_AES 0x00010000 /* AES instruction extensions */
#define WELS_CPU_FMA 0x00020000 /* AVX VEX FMA instruction sets */
#define WELS_CPU_AVX 0x00000800 /* Advanced Vector eXtentions */
#ifdef HAVE_AVX2
#define WELS_CPU_AVX2 0x00040000 /* AVX2 */
#else
#define WELS_CPU_AVX2 0x00000000 /* !AVX2 */
#endif
#define WELS_CPU_CACHELINE_16 0x10000000 /* CacheLine Size 16 */
#define WELS_CPU_CACHELINE_32 0x20000000 /* CacheLine Size 32 */

View File

@ -205,11 +205,6 @@ template<typename T> T WelsClip3(T iX, T iY, T iZ) {
return iX;
}
#define DISALLOW_COPY_AND_ASSIGN(cclass) \
private: \
cclass(const cclass &); \
cclass& operator=(const cclass &);
/*
* Description: to check variable validation and return the specified result
* iResult: value to be checked

View File

@ -104,12 +104,6 @@ void WelsFree (void* pPtr, const char* kpTag);
#define WELS_SAFE_FREE(pPtr, pTag) if (pPtr) { WelsFree(pPtr, pTag); pPtr = NULL; }
#define WELS_NEW_OP(object, type) \
(type*)(new object);
#define WELS_DELETE_OP(p) \
delete p; \
p = NULL;
}

View File

@ -43,7 +43,8 @@
#include "typedefs.h"
#define MAX_LOG_SIZE 1024
#define MAX_MBS_PER_FRAME 36864 //in accordance with max level support in Rec
#define MAX_WIDTH (4096)
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
/*
* Function pointer declaration for various tool sets
*/

View File

@ -97,12 +97,12 @@ enum EWelsNalUnitType {
NAL_UNIT_SPS_EXT = 13,
NAL_UNIT_PREFIX = 14,
NAL_UNIT_SUBSET_SPS = 15,
NAL_UNIT_DEPTH_PARAM = 16, // NAL_UNIT_RESV_16
NAL_UNIT_RESV_16 = 16,
NAL_UNIT_RESV_17 = 17,
NAL_UNIT_RESV_18 = 18,
NAL_UNIT_AUX_CODED_SLICE = 19,
NAL_UNIT_CODED_SLICE_EXT = 20,
NAL_UNIT_MVC_SLICE_EXT = 21, // NAL_UNIT_RESV_21
NAL_UNIT_RESV_21 = 21,
NAL_UNIT_RESV_22 = 22,
NAL_UNIT_RESV_23 = 23,
NAL_UNIT_UNSPEC_24 = 24,

View File

@ -1,88 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsTaskThread.cpp
*
* \brief functions for TaskThread
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#include "WelsTaskThread.h"
namespace WelsCommon {
CWelsTaskThread::CWelsTaskThread (IWelsTaskThreadSink* pSink) : m_pSink (pSink) {
WelsThreadSetName ("CWelsTaskThread");
m_uiID = (uintptr_t) (this);
m_pTask = NULL;
}
CWelsTaskThread::~CWelsTaskThread() {
}
void CWelsTaskThread::ExecuteTask() {
CWelsAutoLock cLock (m_cLockTask);
if (m_pSink) {
m_pSink->OnTaskStart (this, m_pTask);
}
if (m_pTask) {
m_pTask->Execute();
}
if (m_pSink) {
m_pSink->OnTaskStop (this, m_pTask);
}
m_pTask = NULL;
}
WELS_THREAD_ERROR_CODE CWelsTaskThread::SetTask (WelsCommon::IWelsTask* pTask) {
CWelsAutoLock cLock (m_cLockTask);
if (!GetRunning()) {
return WELS_THREAD_ERROR_GENERAL;
}
m_pTask = pTask;
SignalThread();
return WELS_THREAD_ERROR_OK;
}
}

View File

@ -1,125 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsThreadPool.cpp
*
* \brief functions for Thread Pool
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#include "WelsThread.h"
namespace WelsCommon {
CWelsThread::CWelsThread() :
m_hThread (0),
m_bRunning (false),
m_bEndFlag (false) {
WELS_THREAD_ERROR_CODE rc = WelsEventOpen (&m_hEvent);
if (WELS_THREAD_ERROR_OK != rc) {
m_hEvent = NULL;
}
}
CWelsThread::~CWelsThread() {
Kill();
WelsEventClose (&m_hEvent);
m_hEvent = NULL;
}
void CWelsThread::Thread() {
while (true) {
WelsEventWait (&m_hEvent);
if (GetEndFlag()) {
break;
}
ExecuteTask();
}
SetRunning (false);
}
WELS_THREAD_ERROR_CODE CWelsThread::Start() {
if (NULL == m_hEvent) {
return WELS_THREAD_ERROR_GENERAL;
}
if (GetRunning()) {
return WELS_THREAD_ERROR_OK;
}
SetEndFlag (false);
WELS_THREAD_ERROR_CODE rc = WelsThreadCreate (&m_hThread,
(LPWELS_THREAD_ROUTINE)TheThread, this, 0);
if (WELS_THREAD_ERROR_OK != rc) {
return rc;
}
while (!GetRunning()) {
WelsSleep (1);
}
return WELS_THREAD_ERROR_OK;
}
void CWelsThread::Kill() {
if (!GetRunning()) {
return;
}
SetEndFlag (true);
WelsEventSignal (&m_hEvent);
WelsThreadJoin (m_hThread);
return;
}
WELS_THREAD_ROUTINE_TYPE CWelsThread::TheThread (void* pParam) {
CWelsThread* pThis = static_cast<CWelsThread*> (pParam);
pThis->SetRunning (true);
pThis->Thread();
WELS_THREAD_ROUTINE_RETURN (NULL);
}
}

View File

@ -71,7 +71,6 @@
#ifdef WINAPI_FAMILY
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define WP80
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::System::Threading;
@ -175,30 +174,6 @@ WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_n
return WELS_THREAD_ERROR_OK;
}
#ifndef WP80
void WelsSleep (uint32_t dwMilliSecond) {
::Sleep (dwMilliSecond);
}
#else
void WelsSleep (uint32_t dwMilliSecond) {
static WELS_EVENT hSleepEvent = NULL;
if (!hSleepEvent) {
WELS_EVENT hLocalSleepEvent = NULL;
WELS_THREAD_ERROR_CODE ret = WelsEventOpen (&hLocalSleepEvent);
if (WELS_THREAD_ERROR_OK != ret) {
return;
}
WELS_EVENT hPreviousEvent = InterlockedCompareExchangePointerRelease (&hSleepEvent, hLocalSleepEvent, NULL);
if (hPreviousEvent) {
WelsEventClose (&hLocalSleepEvent);
}
//On this singleton usage idea of using InterlockedCompareExchangePointerRelease:
// similar idea of can be found at msdn blog when introducing InterlockedCompareExchangePointerRelease
}
WaitForSingleObject (hSleepEvent, dwMilliSecond);
}
#endif
WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_THREAD_ROUTINE routine,
void* arg, WELS_THREAD_ATTR attr) {
@ -251,7 +226,7 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
return WELS_THREAD_ERROR_OK;
}
#else //platform: #ifdef _WIN32
#else
WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_THREAD_ROUTINE routine,
void* arg, WELS_THREAD_ATTR attr) {
@ -299,21 +274,14 @@ WELS_THREAD_HANDLE WelsThreadSelf() {
WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_name) {
#ifdef __APPLE__
if (p_event == NULL) {
if (p_event == NULL || event_name == NULL)
return WELS_THREAD_ERROR_GENERAL;
}
char strSuffix[100] = { 0 };
if (NULL == event_name) {
sprintf (strSuffix, "WelsSem%ld_p%ld", (intptr_t)p_event, (long) (getpid()));
event_name = &strSuffix[0];
}
*p_event = sem_open (event_name, O_CREAT, (S_IRUSR | S_IWUSR)/*0600*/, 0);
if (*p_event == (sem_t*)SEM_FAILED) {
sem_unlink (event_name);
*p_event = NULL;
return WELS_THREAD_ERROR_GENERAL;
} else {
//printf("event_open:%x, %s\n", p_event, event_name);
return WELS_THREAD_ERROR_OK;
}
#else
@ -330,7 +298,6 @@ WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_
#endif
}
WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_name) {
//printf("event_close:%x, %s\n", event, event_name);
#ifdef __APPLE__
WELS_THREAD_ERROR_CODE err = sem_close (*event); // match with sem_open
if (event_name)
@ -343,10 +310,6 @@ WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_n
#endif
}
void WelsSleep (uint32_t dwMilliSecond) {
usleep (dwMilliSecond * 1000);
}
WELS_THREAD_ERROR_CODE WelsEventSignal (WELS_EVENT* event) {
WELS_THREAD_ERROR_CODE err = 0;
// int32_t val = 0;
@ -358,7 +321,7 @@ WELS_THREAD_ERROR_CODE WelsEventSignal (WELS_EVENT* event) {
return err;
}
WELS_THREAD_ERROR_CODE WelsEventWait (WELS_EVENT* event) {
WELS_THREAD_ERROR_CODE WelsEventWait (WELS_EVENT* event) {
return sem_wait (*event); // blocking until signaled
}

View File

@ -1,350 +0,0 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file WelsThreadPool.cpp
*
* \brief functions for Thread Pool
*
* \date 5/09/2012 Created
*
*************************************************************************************
*/
#include "typedefs.h"
#include "memory_align.h"
#include "WelsThreadPool.h"
namespace WelsCommon {
int32_t CWelsThreadPool::m_iRefCount = 0;
CWelsLock CWelsThreadPool::m_cInitLock;
int32_t CWelsThreadPool::m_iMaxThreadNum = DEFAULT_THREAD_NUM;
CWelsThreadPool::CWelsThreadPool() :
m_cWaitedTasks (NULL), m_cIdleThreads (NULL), m_cBusyThreads (NULL) {
}
CWelsThreadPool::~CWelsThreadPool() {
//fprintf(stdout, "CWelsThreadPool::~CWelsThreadPool: delete %x, %x, %x\n", m_cWaitedTasks, m_cIdleThreads, m_cBusyThreads);
if (0 != m_iRefCount) {
m_iRefCount = 0;
Uninit();
}
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::SetThreadNum (int32_t iMaxThreadNum) {
CWelsAutoLock cLock (m_cInitLock);
if (m_iRefCount != 0) {
return WELS_THREAD_ERROR_GENERAL;
}
if (iMaxThreadNum <= 0) {
iMaxThreadNum = 1;
}
m_iMaxThreadNum = iMaxThreadNum;
return WELS_THREAD_ERROR_OK;
}
CWelsThreadPool& CWelsThreadPool::AddReference () {
CWelsAutoLock cLock (m_cInitLock);
static CWelsThreadPool m_cThreadPoolSelf;
if (m_iRefCount == 0) {
//TODO: will remove this afterwards
if (WELS_THREAD_ERROR_OK != m_cThreadPoolSelf.Init()) {
m_cThreadPoolSelf.Uninit();
}
}
//fprintf(stdout, "m_iRefCount=%d, pSink=%x, iMaxThreadNum=%d\n", m_iRefCount, pSink, iMaxThreadNum);
++ m_iRefCount;
//fprintf(stdout, "m_iRefCount2=%d\n", m_iRefCount);
return m_cThreadPoolSelf;
}
void CWelsThreadPool::RemoveInstance() {
CWelsAutoLock cLock (m_cInitLock);
//fprintf(stdout, "m_iRefCount=%d\n", m_iRefCount);
-- m_iRefCount;
if (0 == m_iRefCount) {
StopAllRunning();
Uninit();
//fprintf(stdout, "m_iRefCount=%d, IdleThreadNum=%d, BusyThreadNum=%d, WaitedTask=%d\n", m_iRefCount, GetIdleThreadNum(), GetBusyThreadNum(), GetWaitedTaskNum());
}
}
bool CWelsThreadPool::IsReferenced() {
CWelsAutoLock cLock (m_cInitLock);
return (m_iRefCount>0);
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask) {
AddThreadToBusyList (pThread);
//fprintf(stdout, "CWelsThreadPool::AddThreadToBusyList: Task %x at Thread %x\n", pTask, pThread);
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::OnTaskStop (CWelsTaskThread* pThread, IWelsTask* pTask) {
//fprintf(stdout, "CWelsThreadPool::OnTaskStop 0: Task %x at Thread %x Finished\n", pTask, pThread);
RemoveThreadFromBusyList (pThread);
AddThreadToIdleQueue (pThread);
//fprintf(stdout, "CWelsThreadPool::OnTaskStop 1: Task %x at Thread %x Finished, m_pSink=%x\n", pTask, pThread, m_pSink);
if (pTask->GetSink()) {
pTask->GetSink()->OnTaskExecuted();
}
//if (m_pSink) {
// m_pSink->OnTaskExecuted (pTask);
//}
//fprintf(stdout, "CWelsThreadPool::OnTaskStop 2: Task %x at Thread %x Finished\n", pTask, pThread);
SignalThread();
//fprintf(stdout, "ThreadPool: Task %x at Thread %x Finished\n", pTask, pThread);
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::Init () {
//fprintf(stdout, "Enter WelsThreadPool Init\n");
CWelsAutoLock cLock (m_cLockPool);
m_cWaitedTasks = new CWelsCircleQueue<IWelsTask>();
m_cIdleThreads = new CWelsCircleQueue<CWelsTaskThread>();
m_cBusyThreads = new CWelsList<CWelsTaskThread>();
if (NULL == m_cWaitedTasks || NULL == m_cIdleThreads || NULL == m_cBusyThreads) {
return WELS_THREAD_ERROR_GENERAL;
}
for (int32_t i = 0; i < m_iMaxThreadNum; i++) {
if (WELS_THREAD_ERROR_OK != CreateIdleThread()) {
return WELS_THREAD_ERROR_GENERAL;
}
}
if (WELS_THREAD_ERROR_OK != Start()) {
return WELS_THREAD_ERROR_GENERAL;
}
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::StopAllRunning() {
WELS_THREAD_ERROR_CODE iReturn = WELS_THREAD_ERROR_OK;
ClearWaitedTasks();
while (GetBusyThreadNum() > 0) {
//WELS_INFO_TRACE ("CWelsThreadPool::Uninit - Waiting all thread to exit");
WelsSleep (10);
}
if (GetIdleThreadNum() != m_iMaxThreadNum) {
iReturn = WELS_THREAD_ERROR_GENERAL;
}
return iReturn;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::Uninit() {
WELS_THREAD_ERROR_CODE iReturn = WELS_THREAD_ERROR_OK;
CWelsAutoLock cLock (m_cLockPool);
iReturn = StopAllRunning();
if (WELS_THREAD_ERROR_OK != iReturn) {
return iReturn;
}
m_cLockIdleTasks.Lock();
while (m_cIdleThreads->size() > 0) {
DestroyThread (m_cIdleThreads->begin());
m_cIdleThreads->pop_front();
}
m_cLockIdleTasks.Unlock();
Kill();
WELS_DELETE_OP(m_cWaitedTasks);
WELS_DELETE_OP(m_cIdleThreads);
WELS_DELETE_OP(m_cBusyThreads);
return iReturn;
}
void CWelsThreadPool::ExecuteTask() {
//fprintf(stdout, "ThreadPool: scheduled tasks: ExecuteTask\n");
CWelsTaskThread* pThread = NULL;
IWelsTask* pTask = NULL;
while (GetWaitedTaskNum() > 0) {
pThread = GetIdleThread();
if (pThread == NULL) {
break;
}
pTask = GetWaitedTask();
//fprintf(stdout, "ThreadPool: ExecuteTask = %x at thread %x\n", pTask, pThread);
pThread->SetTask (pTask);
}
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::QueueTask (IWelsTask* pTask) {
CWelsAutoLock cLock (m_cLockPool);
//fprintf(stdout, "CWelsThreadPool::QueueTask: %d, pTask=%x\n", m_iRefCount, pTask);
if (GetWaitedTaskNum() == 0) {
CWelsTaskThread* pThread = GetIdleThread();
if (pThread != NULL) {
//fprintf(stdout, "ThreadPool: ExecuteTask = %x at thread %x\n", pTask, pThread);
pThread->SetTask (pTask);
return WELS_THREAD_ERROR_OK;
}
}
//fprintf(stdout, "ThreadPool: AddTaskToWaitedList: %x\n", pTask);
AddTaskToWaitedList (pTask);
//fprintf(stdout, "ThreadPool: SignalThread: %x\n", pTask);
SignalThread();
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::CreateIdleThread() {
CWelsTaskThread* pThread = new CWelsTaskThread (this);
if (NULL == pThread) {
return WELS_THREAD_ERROR_GENERAL;
}
if (WELS_THREAD_ERROR_OK != pThread->Start()) {
return WELS_THREAD_ERROR_GENERAL;
}
//fprintf(stdout, "ThreadPool: AddThreadToIdleQueue: %x\n", pThread);
AddThreadToIdleQueue (pThread);
return WELS_THREAD_ERROR_OK;
}
void CWelsThreadPool::DestroyThread (CWelsTaskThread* pThread) {
pThread->Kill();
WELS_DELETE_OP(pThread);
return;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::AddThreadToIdleQueue (CWelsTaskThread* pThread) {
CWelsAutoLock cLock (m_cLockIdleTasks);
m_cIdleThreads->push_back (pThread);
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::AddThreadToBusyList (CWelsTaskThread* pThread) {
CWelsAutoLock cLock (m_cLockBusyTasks);
m_cBusyThreads->push_back (pThread);
return WELS_THREAD_ERROR_OK;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::RemoveThreadFromBusyList (CWelsTaskThread* pThread) {
CWelsAutoLock cLock (m_cLockBusyTasks);
if (m_cBusyThreads->erase (pThread)) {
return WELS_THREAD_ERROR_OK;
} else {
return WELS_THREAD_ERROR_GENERAL;
}
}
void CWelsThreadPool::AddTaskToWaitedList (IWelsTask* pTask) {
CWelsAutoLock cLock (m_cLockWaitedTasks);
m_cWaitedTasks->push_back (pTask);
//fprintf(stdout, "CWelsThreadPool::AddTaskToWaitedList=%d, pTask=%x\n", m_cWaitedTasks->size(), pTask);
return;
}
CWelsTaskThread* CWelsThreadPool::GetIdleThread() {
CWelsAutoLock cLock (m_cLockIdleTasks);
//fprintf(stdout, "CWelsThreadPool::GetIdleThread=%d\n", m_cIdleThreads->size());
if (m_cIdleThreads->size() == 0) {
return NULL;
}
CWelsTaskThread* pThread = m_cIdleThreads->begin();
m_cIdleThreads->pop_front();
return pThread;
}
int32_t CWelsThreadPool::GetBusyThreadNum() {
return m_cBusyThreads->size();
}
int32_t CWelsThreadPool::GetIdleThreadNum() {
return m_cIdleThreads->size();
}
int32_t CWelsThreadPool::GetWaitedTaskNum() {
//fprintf(stdout, "CWelsThreadPool::m_cWaitedTasks=%d\n", m_cWaitedTasks->size());
return m_cWaitedTasks->size();
}
IWelsTask* CWelsThreadPool::GetWaitedTask() {
CWelsAutoLock lock (m_cLockWaitedTasks);
if (m_cWaitedTasks->size() == 0) {
return NULL;
}
IWelsTask* pTask = m_cWaitedTasks->begin();
m_cWaitedTasks->pop_front();
return pTask;
}
void CWelsThreadPool::ClearWaitedTasks() {
CWelsAutoLock cLock (m_cLockWaitedTasks);
IWelsTask* pTask = NULL;
while (0 != m_cWaitedTasks->size()) {
pTask = m_cWaitedTasks->begin();
if (pTask->GetSink()) {
pTask->GetSink()->OnTaskCancelled();
}
m_cWaitedTasks->pop_front();
}
}
}

View File

@ -165,12 +165,12 @@ const EVclType g_keTypeMap[32][2] = {
{ NON_VCL, NON_VCL }, // 13: NAL_UNIT_SPS_EXT
{ NON_VCL, NON_VCL }, // 14: NAL_UNIT_PREFIX, NEED associate succeeded NAL to make a VCL
{ NON_VCL, NON_VCL }, // 15: NAL_UNIT_SUBSET_SPS
{ NON_VCL, NON_VCL }, // 16: NAL_UNIT_DEPTH_PARAM
{ NON_VCL, NON_VCL }, // 16: NAL_UNIT_RESV_16
{ NON_VCL, NON_VCL }, // 17: NAL_UNIT_RESV_17
{ NON_VCL, NON_VCL }, // 18: NAL_UNIT_RESV_18
{ NON_VCL, NON_VCL }, // 19: NAL_UNIT_AUX_CODED_SLICE
{ NON_VCL, VCL }, // 20: NAL_UNIT_CODED_SLICE_EXT
{ NON_VCL, NON_VCL }, // 21: NAL_UNIT_MVC_SLICE_EXT
{ NON_VCL, NON_VCL }, // 21: NAL_UNIT_RESV_21
{ NON_VCL, NON_VCL }, // 22: NAL_UNIT_RESV_22
{ NON_VCL, NON_VCL }, // 23: NAL_UNIT_RESV_23
{ NON_VCL, NON_VCL }, // 24: NAL_UNIT_UNSPEC_24

View File

@ -70,9 +70,6 @@ void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAl
const uint32_t kiPayloadSize = kuiSize;
uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);
if (NULL == pBuf)
return NULL;
#ifdef MEMORY_CHECK
if (fpMemChkPoint == NULL) {
fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+");
@ -90,6 +87,10 @@ void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAl
}
#endif
uint8_t* pAlignedBuffer;
if (NULL == pBuf)
return NULL;
pAlignedBuffer = pBuf + kiAlignedBytes + kiSizeOfVoidPointer + kiSizeOfInt;
pAlignedBuffer -= ((uintptr_t) pAlignedBuffer & kiAlignedBytes);
* ((void**) (pAlignedBuffer - kiSizeOfVoidPointer)) = pBuf;

View File

@ -12,16 +12,12 @@ COMMON_CPP_SRCS=\
$(COMMON_SRCDIR)/src/sad_common.cpp\
$(COMMON_SRCDIR)/src/utils.cpp\
$(COMMON_SRCDIR)/src/welsCodecTrace.cpp\
$(COMMON_SRCDIR)/src/WelsTaskThread.cpp\
$(COMMON_SRCDIR)/src/WelsThread.cpp\
$(COMMON_SRCDIR)/src/WelsThreadLib.cpp\
$(COMMON_SRCDIR)/src/WelsThreadPool.cpp\
COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.$(OBJ))
COMMON_ASM_SRCS=\
$(COMMON_SRCDIR)/x86/cpuid.asm\
$(COMMON_SRCDIR)/x86/dct.asm\
$(COMMON_SRCDIR)/x86/deblock.asm\
$(COMMON_SRCDIR)/x86/expand_picture.asm\
$(COMMON_SRCDIR)/x86/intra_pred_com.asm\

View File

@ -79,19 +79,6 @@ BITS 64
%define arg11 [rsp + push_num*8 + 88]
%define arg12 [rsp + push_num*8 + 96]
%define arg1d ecx
%define arg2d edx
%define arg3d r8d
%define arg4d r9d
%define arg5d arg5
%define arg6d arg6
%define arg7d arg7
%define arg8d arg8
%define arg9d arg9
%define arg10d arg10
%define arg11d arg11
%define arg12d arg12
%define r0 rcx
%define r1 rdx
%define r2 r8
@ -113,7 +100,6 @@ BITS 64
%define r1w dx
%define r2w r8w
%define r3w r9w
%define r4w ax
%define r6w r11w
%define r0b cl
@ -149,19 +135,6 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
%define arg11 [rsp + push_num*8 + 40]
%define arg12 [rsp + push_num*8 + 48]
%define arg1d edi
%define arg2d esi
%define arg3d edx
%define arg4d ecx
%define arg5d r8d
%define arg6d r9d
%define arg7d arg7
%define arg8d arg8
%define arg9d arg9
%define arg10d arg10
%define arg11d arg11
%define arg12d arg12
%define r0 rdi
%define r1 rsi
%define r2 rdx
@ -183,7 +156,6 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
%define r1w si
%define r2w dx
%define r3w cx
%define r4w r8w
%define r6w r10w
%define r0b dil
@ -217,19 +189,6 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
%define arg11 [esp + push_num*4 + 44]
%define arg12 [esp + push_num*4 + 48]
%define arg1d arg1
%define arg2d arg2
%define arg3d arg3
%define arg4d arg4
%define arg5d arg5
%define arg6d arg6
%define arg7d arg7
%define arg8d arg8
%define arg9d arg9
%define arg10d arg10
%define arg11d arg11
%define arg12d arg12
%define r0 eax
%define r1 ecx
%define r2 edx
@ -251,7 +210,6 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
%define r1w cx
%define r2w dx
%define r3w bx
%define r4w si
%define r6w bp
%define r0b al
@ -478,14 +436,8 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
%endif
%endmacro
%macro ZERO_EXTENSION 1
%ifndef X86_32
mov dword %1, %1
%endif
%endmacro
%macro WELS_EXTERN 1
ALIGN 16, nop
ALIGN 16
%ifdef PREFIX
global _%1
%define %1 _%1
@ -653,18 +605,8 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-
packuswb %1,%1
%endmacro
%macro WELS_DW1_VEX 1
vpcmpeqw %1, %1, %1
vpsrlw %1, %1, 15
%endmacro
%macro WELS_DW32_VEX 1
vpcmpeqw %1, %1, %1
vpsrlw %1, %1, 15
vpsllw %1, %1, 5
%endmacro
%macro WELS_DW32767_VEX 1
vpcmpeqw %1, %1, %1
vpsrlw %1, %1, 1
%endmacro

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -68,8 +68,6 @@ WELS_EXTERN WelsCopy16x16_sse2
%assign push_num 2
LOAD_4_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
lea r4, [r1+2*r1] ;ebx, [eax+2*eax] ; x3
lea r5, [r3+2*r3] ;edx, [ecx+2*ecx] ; x3
@ -134,8 +132,6 @@ WELS_EXTERN WelsCopy16x16NotAligned_sse2
%assign push_num 2
LOAD_4_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
lea r4, [r1+2*r1] ;ebx, [eax+2*eax] ; x3
lea r5, [r3+2*r3] ;edx, [ecx+2*ecx] ; x3
@ -200,8 +196,6 @@ WELS_EXTERN WelsCopy16x8NotAligned_sse2
%assign push_num 2
LOAD_4_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
lea r4, [r1+2*r1] ;ebx, [eax+2*eax] ; x3
lea r5, [r3+2*r3] ;edx, [ecx+2*ecx] ; x3
@ -241,8 +235,6 @@ WELS_EXTERN WelsCopy16x8NotAligned_sse2
WELS_EXTERN WelsCopy8x16_mmx
%assign push_num 0
LOAD_4_PARA
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
movq mm0, [r2]
movq mm1, [r2+r3]
@ -308,8 +300,6 @@ WELS_EXTERN WelsCopy8x8_mmx
push r4
%assign push_num 1
LOAD_4_PARA
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
lea r4, [r3+2*r3] ;edx, [ebx+2*ebx]
; to prefetch next loop

View File

@ -1498,240 +1498,6 @@ loop_get_satd_16x16_right:
;
;***********************************************************************
;***********************************************************************
;
;Pixel_satd_wxh_avx2 BEGIN
;
;***********************************************************************
%ifdef HAVE_AVX2
; out=%1 pSrcA=%2 pSrcB=%3 HSumSubDB1_256=%4 ymm_clobber=%5
%macro AVX2_LoadDiffSatd16x1 5
vbroadcasti128 %1, [%2]
vpmaddubsw %1, %1, %4 ; hadamard neighboring horizontal sums and differences
vbroadcasti128 %5, [%3]
vpmaddubsw %5, %5, %4 ; hadamard neighboring horizontal sums and differences
vpsubw %1, %1, %5 ; diff srcA srcB
%endmacro
; out=%1 pSrcA=%2 pSrcA+4*iStride=%3 pSrcB=%4 pSrcB+4*iStride=%5 HSumSubDB1_128x2=%6 ymm_clobber=%7,%8
%macro AVX2_LoadDiffSatd8x2 8
vpbroadcastq %1, [%2]
vpbroadcastq %7, [%3]
vpblendd %1, %1, %7, 11110000b
vpmaddubsw %1, %1, %6 ; hadamard neighboring horizontal sums and differences
vpbroadcastq %7, [%4]
vpbroadcastq %8, [%5]
vpblendd %7, %7, %8, 11110000b
vpmaddubsw %7, %7, %6 ; hadamard neighboring horizontal sums and differences
vpsubw %1, %1, %7 ; diff srcA srcB
%endmacro
; in/out=%1,%2,%3,%4 clobber=%5
%macro AVX2_HDMFour4x4 5
vpsubw %5, %1, %4 ; s3 = x0 - x3
vpaddw %1, %1, %4 ; s0 = x0 + x3
vpsubw %4, %2, %3 ; s2 = x1 - x2
vpaddw %2, %2, %3 ; s1 = x1 + x2
vpsubw %3, %1, %2 ; y2 = s0 - s1
vpaddw %1, %1, %2 ; y0 = s0 + s1
vpaddw %2, %5, %4 ; y1 = s3 + s2
vpsubw %4, %5, %4 ; y3 = s3 - s2
%endmacro
; out=%1 in=%1,%2,%3,%4 clobber=%5
%macro AVX2_SatdFour4x4 5
AVX2_HDMFour4x4 %1, %2, %3, %4, %5
vpabsw %1, %1
vpabsw %2, %2
vpabsw %3, %3
vpabsw %4, %4
; second stage of horizontal hadamard.
; utilizes that |a + b| + |a - b| = 2 * max(|a|, |b|)
vpblendw %5, %1, %2, 10101010b
vpslld %2, %2, 16
vpsrld %1, %1, 16
vpor %2, %2, %1
vpmaxuw %2, %2, %5
vpblendw %5, %3, %4, 10101010b
vpslld %4, %4, 16
vpsrld %3, %3, 16
vpor %4, %4, %3
vpmaxuw %3, %5, %4
vpaddw %1, %2, %3
%endmacro
; out=%1 pSrcA=%2 iStrideA=%3 3*iStrideA=%4 pSrcB=%5 iStrideB=%6 3*iStrideB=%7 HSumSubDB1_256=%8 ymm_clobber=%9,%10,%11,%12
%macro AVX2_GetSatd16x4 12
AVX2_LoadDiffSatd16x1 %1, %2 + 0 * %3, %5 + 0 * %6, %8, %12
AVX2_LoadDiffSatd16x1 %9, %2 + 1 * %3, %5 + 1 * %6, %8, %12
AVX2_LoadDiffSatd16x1 %10, %2 + 2 * %3, %5 + 2 * %6, %8, %12
AVX2_LoadDiffSatd16x1 %11, %2 + 1 * %4, %5 + 1 * %7, %8, %12
AVX2_SatdFour4x4 %1, %9, %10, %11, %12
%endmacro
; out=%1 pSrcA=%2 iStrideA=%3 3*iStrideA=%4 pSrcB=%5 iStrideB=%6 3*iStrideB=%7 HSumSubDB1_128x2=%8 ymm_clobber=%9,%10,%11,%12,%13
%macro AVX2_GetSatd8x8 13
AVX2_LoadDiffSatd8x2 %1, %2 + 0 * %3, %2 + 4 * %3, %5 + 0 * %6, %5 + 4 * %6, %8, %12, %13
AVX2_LoadDiffSatd8x2 %10, %2 + 2 * %3, %2 + 2 * %4, %5 + 2 * %6, %5 + 2 * %7, %8, %12, %13
add %2, %3
add %5, %6
AVX2_LoadDiffSatd8x2 %9, %2 + 0 * %3, %2 + 4 * %3, %5 + 0 * %6, %5 + 4 * %6, %8, %12, %13
AVX2_LoadDiffSatd8x2 %11, %2 + 2 * %3, %2 + 2 * %4, %5 + 2 * %6, %5 + 2 * %7, %8, %12, %13
AVX2_SatdFour4x4 %1, %9, %10, %11, %12
%endmacro
; d_out=%1 mm_in=%2 mm_clobber=%3
%macro AVX2_SumWHorizon 3
WELS_DW1_VEX y%3
vpmaddwd y%2, y%2, y%3
vextracti128 x%3, y%2, 1
vpaddd x%2, x%2, x%3
vpunpckhqdq x%3, x%2, x%2
vpaddd x%2, x%2, x%3
vpsrldq x%3, x%2, 4
vpaddd x%2, x%2, x%3
vmovd %1, x%2
%endmacro
;***********************************************************************
;
;int32_t WelsSampleSatd8x16_avx2( uint8_t *, int32_t, uint8_t *, int32_t, );
;
;***********************************************************************
WELS_EXTERN WelsSampleSatd8x16_avx2
%assign push_num 0
%ifdef X86_32
push r4
%assign push_num 1
%endif
mov r4, 2 ; loop cnt
jmp WelsSampleSatd8x8N_avx2
;***********************************************************************
;
;int32_t WelsSampleSatd8x8_avx2( uint8_t *, int32_t, uint8_t *, int32_t, );
;
;***********************************************************************
WELS_EXTERN WelsSampleSatd8x8_avx2
%assign push_num 0
%ifdef X86_32
push r4
%assign push_num 1
%endif
mov r4, 1 ; loop cnt
; fall through
WelsSampleSatd8x8N_avx2:
%ifdef X86_32
push r5
push r6
%assign push_num push_num+2
%endif
LOAD_4_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
vbroadcasti128 ymm7, [HSumSubDB1]
lea r5, [3 * r1]
lea r6, [3 * r3]
vpxor ymm6, ymm6, ymm6
.loop:
AVX2_GetSatd8x8 ymm0, r0, r1, r5, r2, r3, r6, ymm7, ymm1, ymm2, ymm3, ymm4, ymm5
vpaddw ymm6, ymm6, ymm0
sub r4, 1
jbe .loop_end
add r0, r5
add r2, r6
lea r0, [r0 + 4 * r1]
lea r2, [r2 + 4 * r3]
jmp .loop
.loop_end:
AVX2_SumWHorizon retrd, mm6, mm5
vzeroupper
POP_XMM
LOAD_4_PARA_POP
%ifdef X86_32
pop r6
pop r5
pop r4
%endif
ret
;***********************************************************************
;
;int32_t WelsSampleSatd16x16_avx2( uint8_t *, int32_t, uint8_t *, int32_t, );
;
;***********************************************************************
WELS_EXTERN WelsSampleSatd16x16_avx2
%assign push_num 0
%ifdef X86_32
push r4
%assign push_num 1
%endif
mov r4, 4 ; loop cnt
jmp WelsSampleSatd16x4N_avx2
;***********************************************************************
;
;int32_t WelsSampleSatd16x8_avx2( uint8_t *, int32_t, uint8_t *, int32_t, );
;
;***********************************************************************
WELS_EXTERN WelsSampleSatd16x8_avx2
%assign push_num 0
%ifdef X86_32
push r4
%assign push_num 1
%endif
mov r4, 2 ; loop cnt
; fall through
WelsSampleSatd16x4N_avx2:
%ifdef X86_32
push r5
push r6
%assign push_num push_num+2
%endif
LOAD_4_PARA
PUSH_XMM 7
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
vpbroadcastq xmm0, [HSumSubDB1]
vpbroadcastq ymm6, [HSumSubDB1 + 8]
vpblendd ymm6, ymm0, ymm6, 11110000b
lea r5, [3 * r1]
lea r6, [3 * r3]
vpxor ymm5, ymm5, ymm5
.loop:
AVX2_GetSatd16x4 ymm0, r0, r1, r5, r2, r3, r6, ymm6, ymm1, ymm2, ymm3, ymm4
vpaddw ymm5, ymm5, ymm0
lea r0, [r0 + 4 * r1]
lea r2, [r2 + 4 * r3]
sub r4, 1
ja .loop
AVX2_SumWHorizon retrd, mm5, mm0
vzeroupper
POP_XMM
LOAD_4_PARA_POP
%ifdef X86_32
pop r6
pop r5
pop r4
%endif
ret
%endif
;***********************************************************************
;
;Pixel_satd_wxh_avx2 END
;
;***********************************************************************
;***********************************************************************
;
;Pixel_sad_wxh_sse2 BEGIN

View File

@ -102,6 +102,7 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
int32_t iLastWidth = 0, iLastHeight = 0;
int32_t iFrameCount = 0;
int32_t iEndOfStreamFlag = 0;
int32_t iColorFormat = videoFormatInternal;
//for coverage test purpose
int32_t iErrorConMethod = (int32_t) ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
pDecoder->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iErrorConMethod);
@ -167,6 +168,11 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
memcpy (pBuf + iFileSize, &uiStartCode[0], 4); //confirmed_safe_unsafe_usage
if (pDecoder->SetOption (DECODER_OPTION_DATAFORMAT, &iColorFormat)) {
fprintf (stderr, "SetOption() failed, opt_id : %d ..\n", DECODER_OPTION_DATAFORMAT);
goto label_exit;
}
while (true) {
if (iBufPos >= iFileSize) {
@ -195,6 +201,8 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
}
//for coverage test purpose
int32_t iOutputColorFormat;
pDecoder->GetOption (DECODER_OPTION_DATAFORMAT, &iOutputColorFormat);
int32_t iEndOfStreamFlag;
pDecoder->GetOption (DECODER_OPTION_END_OF_STREAM, &iEndOfStreamFlag);
int32_t iCurIdrPicId;
@ -368,6 +376,8 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
strncpy (sDecParam.pFileNameRestructed, strReconFile.c_str(), iLen); //confirmed_safe_unsafe_usage
} else if (strTag[0].compare ("TargetDQID") == 0) {
sDecParam.uiTargetDqLayer = (uint8_t)atol (strTag[1].c_str());
} else if (strTag[0].compare ("OutColorFormat") == 0) {
sDecParam.eOutputColorFormat = (EVideoFormatType) atoi (strTag[1].c_str());
} else if (strTag[0].compare ("ErrorConcealmentIdc") == 0) {
sDecParam.eEcActiveIdc = (ERROR_CON_IDC)atol (strTag[1].c_str());
} else if (strTag[0].compare ("CPULoad") == 0) {
@ -384,6 +394,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
} else if (strstr (pArgV[1],
".264")) { // no output dump yuv file, just try to render the decoded pictures //confirmed_safe_unsafe_usage
strInputFile = pArgV[1];
sDecParam.eOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@ -391,6 +402,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
} else { //iArgC > 2
strInputFile = pArgV[1];
strOutputFile = pArgV[2];
sDecParam.eOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;

View File

@ -88,10 +88,6 @@ int g_iEncodedFrame = 0;
#endif
#endif /* _WIN32 */
#if defined(__linux__) || defined(__unix__)
#define _FILE_OFFSET_BITS 64
#endif
#include <iostream>
using namespace std;
using namespace WelsEnc;
@ -101,7 +97,7 @@ using namespace WelsEnc;
*/
typedef struct LayerpEncCtx_s {
int32_t iDLayerQp;
SSliceArgument sSliceArgument;
SSliceConfig sSliceCfg;
} SLayerPEncCtx;
typedef struct tagFilesSet {
@ -187,26 +183,26 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
} else if (strTag[0].compare ("InitialQP") == 0) {
sLayerCtx.iDLayerQp = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("SliceMode") == 0) {
sLayerCtx.sSliceArgument.uiSliceMode = (SliceModeEnum)atoi (strTag[1].c_str());
} else if (strTag[0].compare ("SliceSize") == 0) { //SM_SIZELIMITED_SLICE
sLayerCtx.sSliceArgument.uiSliceSizeConstraint = atoi (strTag[1].c_str());
sLayerCtx.sSliceCfg.uiSliceMode = (SliceModeEnum)atoi (strTag[1].c_str());
} else if (strTag[0].compare ("SliceSize") == 0) { //SM_DYN_SLICE
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceSizeConstraint = atoi (strTag[1].c_str());
continue;
} else if (strTag[0].compare ("SliceNum") == 0) {
sLayerCtx.sSliceArgument.uiSliceNum = atoi (strTag[1].c_str());
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceNum = atoi (strTag[1].c_str());
} else if (strTag[0].compare (0, kiSize, str_) == 0) {
const char* kpString = strTag[0].c_str();
int uiSliceIdx = atoi (&kpString[kiSize]);
assert (uiSliceIdx < MAX_SLICES_NUM);
sLayerCtx.sSliceArgument.uiSliceMbNum[uiSliceIdx] = atoi (strTag[1].c_str());
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = atoi (strTag[1].c_str());
}
}
}
pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
pDLayer->sSliceArgument.uiSliceMode = sLayerCtx.sSliceArgument.uiSliceMode;
pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
memcpy (&pDLayer->sSliceArgument, &sLayerCtx.sSliceArgument, sizeof (SSliceArgument)); // confirmed_safe_unsafe_usage
memcpy (&pDLayer->sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceArgument.uiSliceMbNum[0],
sizeof (sLayerCtx.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig)); // confirmed_safe_unsafe_usage
memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
sizeof (sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
return 0;
}
@ -223,9 +219,7 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
if (strTag[0].compare ("UsageType") == 0) {
pSvcParam.iUsageType = (EUsageType)atoi (strTag[1].c_str());
}else if (strTag[0].compare ("SimulcastAVC") == 0) {
pSvcParam.bSimulcastAVC = atoi (strTag[1].c_str()) ? true : false;
}else if (strTag[0].compare ("SourceWidth") == 0) {
} else if (strTag[0].compare ("SourceWidth") == 0) {
pSrcPic->iPicWidth = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("SourceHeight") == 0) {
pSrcPic->iPicHeight = atoi (strTag[1].c_str());
@ -247,24 +241,24 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
} else if (strTag[0].compare ("SpsPpsIDStrategy") == 0) {
int32_t iValue = atoi (strTag[1].c_str());
switch (iValue) {
case 0:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0x01:
pSvcParam.eSpsPpsIdStrategy = INCREASING_ID;
break;
case 0x02:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING;
break;
case 0x03:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
break;
case 0x06:
pSvcParam.eSpsPpsIdStrategy = SPS_PPS_LISTING;
break;
default:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0x01:
pSvcParam.eSpsPpsIdStrategy = INCREASING_ID;
break;
case 0x02:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING;
break;
case 0x03:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
break;
case 0x06:
pSvcParam.eSpsPpsIdStrategy = SPS_PPS_LISTING;
break;
default:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
}
} else if (strTag[0].compare ("EnableScalableSEI") == 0) {
pSvcParam.bEnableSSEI = atoi (strTag[1].c_str()) ? true : false;
@ -298,8 +292,6 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
pSvcParam.iMultipleThreadIdc = 0;
else if (pSvcParam.iMultipleThreadIdc > MAX_THREADS_NUM)
pSvcParam.iMultipleThreadIdc = MAX_THREADS_NUM;
} else if (strTag[0].compare ("UseLoadBalancing") == 0) {
pSvcParam.bUseLoadBalancing = (atoi (strTag[1].c_str())) ? true : false;
} else if (strTag[0].compare ("RCMode") == 0) {
pSvcParam.iRCMode = (RC_MODES) atoi (strTag[1].c_str());
} else if (strTag[0].compare ("TargetBitrate") == 0) {
@ -314,10 +306,6 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
fprintf (stderr, "Invalid max overall bitrate setting due to RC enabled. Check MaxOverallBitrate field please!\n");
return 1;
}
} else if (strTag[0].compare ("MaxQp") == 0) {
pSvcParam.iMaxQp = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("MinQp") == 0) {
pSvcParam.iMinQp = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("EnableDenoise") == 0) {
pSvcParam.bEnableDenoise = atoi (strTag[1].c_str()) ? true : false;
} else if (strTag[0].compare ("EnableSceneChangeDetection") == 0) {
@ -389,13 +377,11 @@ void PrintHelp() {
printf (" -org Original file, example: -org src.yuv\n");
printf (" -sw the source width\n");
printf (" -sh the source height\n");
printf (" -utype usage type\n");
printf (" -savc simulcast avc\n");
printf (" -frms Number of total frames to be encoded\n");
printf (" -frin input frame rate\n");
printf (" -numtl Temporal layer number (default: 1)\n");
printf (" -iper Intra period (default: -1) : must be a power of 2 of GOP size (or -1)\n");
printf (" -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_SIZELIMITED_SLICE\n");
printf (" -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_DYN_SLICE\n");
printf (" -spsid Enable id adding in SPS/PPS per IDR \n");
printf (" -cabac Entropy coding mode(0:cavlc 1:cabac \n");
printf (" -denois Control denoising (default: 0)\n");
@ -405,15 +391,12 @@ void PrintHelp() {
printf (" -ltr Control long term reference (default: 0)\n");
printf (" -ltrnum Control the number of long term reference((1-4):screen LTR,(1-2):video LTR \n");
printf (" -threadIdc 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads \n");
printf (" -loadbalancing 0: turn off loadbalancing between slices when multi-threading available; 1: (default value) turn on loadbalancing between slices when multi-threading available\n");
printf (" -deblockIdc Loop filter idc (0: on, 1: off, \n");
printf (" -alphaOffset AlphaOffset(-6..+6): valid range \n");
printf (" -betaOffset BetaOffset (-6..+6): valid range\n");
printf (" -rc rate control mode: 0-quality mode; 1-bitrate mode; 2-bitrate limited mode; -1-rc off \n");
printf (" -tarb Overall target bitrate\n");
printf (" -maxbrTotal Overall max bitrate\n");
printf (" -maxqp Maximum Qp\n");
printf (" -minqp Minimum Qp\n");
printf (" -numl Number Of Layers: Must exist with layer_cfg file and the number of input layer_cfg file must equal to the value set by this command\n");
printf (" The options below are layer-based: (need to be set with layer id)\n");
printf (" -lconfig (Layer) (spatial layer configure file)\n");
@ -424,7 +407,7 @@ void PrintHelp() {
printf (" -lqp (Layer) (base quality layer qp : must work with -ldeltaqp or -lqparr)\n");
printf (" -ltarb (Layer) (spatial layer target bitrate)\n");
printf (" -lmaxb (Layer) (spatial layer max bitrate)\n");
printf (" -slcmd (Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num; -slcsize: set target slice size constraint ; -slcmbnum: set the first slice mb num under some slice modes) \n");
printf (" -slcmd (Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num; -slcsize: set target slice size constraint ) \n");
printf (" -trace (Level)\n");
printf ("\n");
}
@ -443,9 +426,6 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
else if (!strcmp (pCommand, "-utype") && (n < argc))
pSvcParam.iUsageType = (EUsageType)atoi (argv[n++]);
else if (!strcmp (pCommand, "-savc") && (n < argc))
pSvcParam.bSimulcastAVC = atoi (argv[n++]) ? true : false;
else if (!strcmp (pCommand, "-org") && (n < argc))
sFileSet.strSeqFile.assign (argv[n++]);
@ -473,26 +453,27 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
else if (!strcmp (pCommand, "-spsid") && (n < argc)) {
int32_t iValue = atoi (argv[n++]);
switch (iValue) {
case 0:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0x01:
pSvcParam.eSpsPpsIdStrategy = INCREASING_ID;
break;
case 0x02:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING;
break;
case 0x03:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
break;
case 0x06:
pSvcParam.eSpsPpsIdStrategy = SPS_PPS_LISTING;
break;
default:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
case 0x01:
pSvcParam.eSpsPpsIdStrategy = INCREASING_ID;
break;
case 0x02:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING;
break;
case 0x03:
pSvcParam.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
break;
case 0x06:
pSvcParam.eSpsPpsIdStrategy = SPS_PPS_LISTING;
break;
default:
pSvcParam.eSpsPpsIdStrategy = CONSTANT_ID;
break;
}
} else if (!strcmp (pCommand, "-cabac") && (n < argc))
}
else if (!strcmp (pCommand, "-cabac") && (n < argc))
pSvcParam.iEntropyCodingModeFlag = atoi (argv[n++]);
else if (!strcmp (pCommand, "-denois") && (n < argc))
@ -521,9 +502,8 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
else if (!strcmp (pCommand, "-threadIdc") && (n < argc))
pSvcParam.iMultipleThreadIdc = atoi (argv[n++]);
else if (!strcmp (pCommand, "-loadbalancing") && (n + 1 < argc)) {
pSvcParam.bUseLoadBalancing = (atoi (argv[n++])) ? true : false;
} else if (!strcmp (pCommand, "-deblockIdc") && (n < argc))
else if (!strcmp (pCommand, "-deblockIdc") && (n < argc))
pSvcParam.iLoopFilterDisableIdc = atoi (argv[n++]);
else if (!strcmp (pCommand, "-alphaOffset") && (n < argc))
@ -544,12 +524,6 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
else if (!strcmp (pCommand, "-maxbrTotal") && (n < argc))
pSvcParam.iMaxBitrate = 1000 * atoi (argv[n++]);
else if (!strcmp (pCommand, "-maxqp") && (n < argc))
pSvcParam.iMaxQp = atoi (argv[n++]);
else if (!strcmp (pCommand, "-minqp") && (n < argc))
pSvcParam.iMinQp = atoi (argv[n++]);
else if (!strcmp (pCommand, "-numl") && (n < argc)) {
pSvcParam.iSpatialLayerNum = atoi (argv[n++]);
} else if (!strcmp (pCommand, "-lconfig") && (n < argc)) {
@ -609,19 +583,25 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
switch (atoi (argv[n++])) {
case 0:
pDLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
pDLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
break;
case 1:
pDLayer->sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
pDLayer->sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
break;
case 2:
pDLayer->sSliceArgument.uiSliceMode = SM_RASTER_SLICE;
pDLayer->sSliceCfg.uiSliceMode = SM_RASTER_SLICE;
break;
case 3:
pDLayer->sSliceArgument.uiSliceMode = SM_SIZELIMITED_SLICE;
pDLayer->sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
break;
case 4:
pDLayer->sSliceCfg.uiSliceMode = SM_DYN_SLICE;
break;
case 5:
pDLayer->sSliceCfg.uiSliceMode = SM_AUTO_SLICE;
break;
default:
pDLayer->sSliceArgument.uiSliceMode = SM_RESERVED;
pDLayer->sSliceCfg.uiSliceMode = SM_RESERVED;
break;
}
}
@ -629,17 +609,13 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
else if (!strcmp (pCommand, "-slcsize") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
pDLayer->sSliceArgument.uiSliceSizeConstraint = atoi (argv[n++]);
pDLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = atoi (argv[n++]);
}
else if (!strcmp (pCommand, "-slcnum") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
pDLayer->sSliceArgument.uiSliceNum = atoi (argv[n++]);
} else if (!strcmp (pCommand, "-slcmbnum") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
pDLayer->sSliceArgument.uiSliceMbNum[0] = atoi (argv[n++]);
pDLayer->sSliceCfg.sSliceArgument.uiSliceNum = atoi (argv[n++]);
}
}
return 0;
@ -668,7 +644,6 @@ int FillSpecificParameters (SEncParamExt& sParam) {
sParam.eSpsPpsIdStrategy = INCREASING_ID;
sParam.bPrefixNalAddingCtrl = 0;
sParam.iComplexityMode = MEDIUM_COMPLEXITY;
sParam.bSimulcastAVC = false;
int iIndexLayer = 0;
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_BASELINE;
sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 160;
@ -676,7 +651,7 @@ int FillSpecificParameters (SEncParamExt& sParam) {
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 7.5f;
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 64000;
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
++ iIndexLayer;
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
@ -685,7 +660,7 @@ int FillSpecificParameters (SEncParamExt& sParam) {
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 15.0f;
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 160000;
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
++ iIndexLayer;
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
@ -694,8 +669,8 @@ int FillSpecificParameters (SEncParamExt& sParam) {
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 512000;
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
++ iIndexLayer;
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
@ -704,8 +679,8 @@ int FillSpecificParameters (SEncParamExt& sParam) {
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 1500000;
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
float fMaxFr = sParam.sSpatialLayers[sParam.iSpatialLayerNum - 1].fFrameRate;
for (int32_t i = sParam.iSpatialLayerNum - 2; i >= 0; -- i) {
@ -818,7 +793,7 @@ int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFi
sSvcParam.iPicHeight = (!sSvcParam.iPicHeight) ? iSourceHeight : sSvcParam.iPicHeight;
iTotalFrameMax = (int32_t)fs.uiFrameToBeCoded;
// sSvcParam.bSimulcastAVC = true;
if (cmResultSuccess != pPtrEnc->InitializeExt (&sSvcParam)) { // SVC encoder initialization
fprintf (stderr, "SVC encoder Initialize failed\n");
iRet = 1;
@ -857,27 +832,11 @@ int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFi
pFileYUV = fopen (fs.strSeqFile.c_str(), "rb");
if (pFileYUV != NULL) {
#if defined(_WIN32) || defined(_WIN64)
#if _MSC_VER >= 1400
if (!_fseeki64 (pFileYUV, 0, SEEK_END)) {
int64_t i_size = _ftelli64 (pFileYUV);
_fseeki64 (pFileYUV, 0, SEEK_SET);
iTotalFrameMax = WELS_MAX ((int32_t) (i_size / kiPicResSize), iTotalFrameMax);
}
#else
if (!fseek (pFileYUV, 0, SEEK_END)) {
int64_t i_size = ftell (pFileYUV);
fseek (pFileYUV, 0, SEEK_SET);
iTotalFrameMax = WELS_MAX ((int32_t) (i_size / kiPicResSize), iTotalFrameMax);
}
#endif
#else
if (!fseeko (pFileYUV, 0, SEEK_END)) {
int64_t i_size = ftello (pFileYUV);
fseeko (pFileYUV, 0, SEEK_SET);
iTotalFrameMax = WELS_MAX ((int32_t) (i_size / kiPicResSize), iTotalFrameMax);
}
#endif
} else {
fprintf (stderr, "Unable to open source sequence file (%s), check corresponding path!\n",
fs.strSeqFile.c_str());

View File

@ -68,7 +68,7 @@
// uint8_t *pred, const int32_t stride, int16_t *rs
WELS_ASM_AARCH64_FUNC_BEGIN IdctResAddPred_AArch64_neon
SIGN_EXTENSION x1,w1
ld4 {v0.4h, v1.4h, v2.4h, v3.4h}, [x2] // cost 3 cycles!
ROW_TRANSFORM_1_STEP v0, v1, v2, v3, v16, v17, v18, v19, v4, v5
TRANSFORM_4BYTES v0, v1, v2, v3, v16, v17, v18, v19
@ -113,7 +113,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsBlockZero16x16_AArch64_neon
eor v0.16b, v0.16b, v0.16b
eor v1.16b, v1.16b, v1.16b
SIGN_EXTENSION x1,w1
lsl x1, x1, 1
.rept 16
st1 {v0.16b, v1.16b}, [x0], x1
@ -122,7 +121,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsBlockZero8x8_AArch64_neon
eor v0.16b, v0.16b, v0.16b
SIGN_EXTENSION x1, w1
lsl x1, x1, 1
.rept 8
st1 {v0.16b}, [x0], x1

View File

@ -47,11 +47,6 @@ extern "C" {
#if defined(X86_ASM)
void IdctResAddPred_mmx (uint8_t* pPred, const int32_t kiStride, int16_t* pRs);
void IdctResAddPred_sse2 (uint8_t* pPred, const int32_t kiStride, int16_t* pRs);
#if defined(HAVE_AVX2)
void IdctResAddPred_avx2 (uint8_t* pPred, const int32_t kiStride, int16_t* pRs);
void IdctFourResAddPred_avx2 (uint8_t* pPred, int32_t iStride, int16_t* pRs, const int8_t* pNzc);
#endif
#endif//X86_ASM
#if defined(HAVE_NEON)

View File

@ -54,11 +54,6 @@ extern "C" {
*/
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam);
/*!
* \brief fill in default values of decoder context
*/
void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx);
/*!
*************************************************************************************
* \brief Initialize Wels decoder parameters and memory
@ -73,7 +68,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx);
* \note N/A
*************************************************************************************
*/
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx);
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx);
/*!
*************************************************************************************
@ -111,13 +106,18 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
/*
* request memory blocks for decoder avc part
*/
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight, bool& bReallocFlag);
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
/*
* free memory dynamically allocated during decoder
* free memory blocks in avc
*/
void WelsFreeDynamicMemory (PWelsDecoderContext pCtx);
void WelsFreeMem (PWelsDecoderContext pCtx);
/*
* set colorspace format in decoder
*/
int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat);
/*!
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
@ -130,19 +130,7 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx);
*/
int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
/*!
* \brief init decoder predictive function pointers including ASM functions during MB reconstruction
* \param pCtx Wels decoder context
* \param uiCpuFlag cpu assembly indication
*/
void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag);
/*!
* \brief init decoder internal function pointers including ASM functions
* \param pCtx Wels decoder context
* \param uiCpuFlag cpu assembly indication
*/
void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag);
void AssignFuncPointerForRec (PWelsDecoderContext pCtx);
void GetVclNalTemporalId (PWelsDecoderContext pCtx); //get the info that whether or not have VCL NAL in current AU,
//and if YES, get the temporal ID

View File

@ -136,7 +136,6 @@ typedef struct TagPpsBsInfo {
/*typedef for get intra predictor func pointer*/
typedef void (*PGetIntraPredFunc) (uint8_t* pPred, const int32_t kiLumaStride);
typedef void (*PIdctResAddPredFunc) (uint8_t* pPred, const int32_t kiStride, int16_t* pRs);
typedef void (*PIdctFourResAddPredFunc) (uint8_t* pPred, int32_t iStride, int16_t* pRs, const int8_t* pNzc);
typedef void (*PExpandPictureFunc) (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicWidth,
const int32_t kiPicHeight);
@ -243,6 +242,7 @@ typedef struct TagWelsDecoderContext {
SDecodingParam* pParam;
uint32_t uiCpuFlag; // CPU compatibility detected
EVideoFormatType eOutputColorFormat; // color space format to be outputed
VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection.
bool bHaveGotMemory; // global memory for decoder context related ever requested?
@ -376,6 +376,7 @@ typedef struct TagWelsDecoderContext {
ERROR_CON_IDC eErrorConMethod; //
//for Parse only
bool bParseOnly;
bool bFramePending;
bool bFrameFinish;
int32_t iNalNum;
@ -390,7 +391,6 @@ typedef struct TagWelsDecoderContext {
PGetIntraPredFunc pGetI4x4LumaPredFunc[14]; // h264_predict_4x4_t
PGetIntraPredFunc pGetIChromaPredFunc[7]; // h264_predict_8x8_t
PIdctResAddPredFunc pIdctResAddPredFunc;
PIdctFourResAddPredFunc pIdctFourResAddPredFunc;
SMcFunc sMcFunc;
//Transform8x8
PGetIntraPred8x8Func pGetI8x8LumaPredFunc[14];

View File

@ -72,21 +72,21 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen);
/*
* WelsInitStaticMemory
* Memory request for introduced data at decoder start
* WelsInitMemory
* Memory request for introduced data
* Especially for:
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
* return:
* 0 - success; otherwise returned error_no defined in error_no.h.
*/
int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx);
int32_t WelsInitMemory (PWelsDecoderContext pCtx);
/*
* WelsFreeStaticMemory
* Free memory introduced in WelsInitStaticMemory at destruction of decoder.
* WelsFreeMemory
* Free memory introduced in WelsInitMemory at destruction of decoder.
*
*/
void WelsFreeStaticMemory (PWelsDecoderContext pCtx);
void WelsFreeMemory (PWelsDecoderContext pCtx);
/*!
* \brief request memory when maximal picture width and height are available

View File

@ -129,7 +129,6 @@ ERR_INFO_INVALID_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4,
ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE,
ERR_INFO_INVALID_DBLOCKING_IDC,
ERR_INFO_INVALID_MB_TYPE,
ERR_INFO_INVALID_MB_SKIP_RUN,
ERR_INFO_INVALID_SPS_ID,
ERR_INFO_INVALID_PPS_ID,
ERR_INFO_INVALID_SUB_MB_TYPE,
@ -200,16 +199,6 @@ ERR_CABAC_NO_BS_TO_READ,
ERR_CABAC_UNEXPECTED_VALUE,
//for scaling list
ERR_SCALING_LIST_DELTA_SCALE,
//logic error related to multi-layer
ERR_INFO_WIDTH_MISMATCH,
//reconstruction error
ERR_INFO_MB_RECON_FAIL,
ERR_INFO_MB_NUM_EXCEED_FAIL,
ERR_INFO_BS_INCOMPLETE,
ERR_INFO_MB_NUM_INADEQUATE,
//parse only error
ERR_INFO_PARSEONLY_PENDING,
ERR_INFO_PARSEONLY_ERROR,
};
//-----------------------------------------------------------------------------------------------------------

View File

@ -48,7 +48,7 @@
namespace WelsDec {
#ifndef MB_XY_T
#define MB_XY_T int32_t
#define MB_XY_T int16_t
#endif//MB_XY_T
/*!

View File

@ -317,7 +317,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
iNalSize -= NAL_UNIT_HEADER_EXT_SIZE;
*pConsumedBytes += NAL_UNIT_HEADER_EXT_SIZE;
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
int32_t iTrailingZeroByte = 0;
while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes
@ -346,7 +346,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
pSavedData->pCurPos += iActualLen - iOffset;
}
} else {
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
pCurNal->sNalData.sVclNal.pNalPos = pSavedData->pCurPos;
int32_t iTrailingZeroByte = 0;
while (pSrcNal[iSrcNalLen - iTrailingZeroByte - 1] == 0x0) //remove final trailing 0 bytes
@ -782,7 +782,7 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin
return ERR_NONE;
return 0;
}
const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) {
@ -915,18 +915,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
int32_t iSpsId;
uint32_t uiCode;
int32_t iCode;
int32_t iRet = ERR_NONE;
bool bConstraintSetFlags[6] = { false };
const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType);
WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc
uiProfileIdc = uiCode;
if (uiProfileIdc != PRO_BASELINE && uiProfileIdc != PRO_MAIN && uiProfileIdc != PRO_SCALABLE_BASELINE
&& uiProfileIdc != PRO_SCALABLE_HIGH
&& uiProfileIdc != PRO_EXTENDED && uiProfileIdc != PRO_HIGH) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "SPS ID can not be supported!\n");
return false;
}
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set0_flag
bConstraintSetFlags[0] = !!uiCode;
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set1_flag
@ -951,8 +944,6 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
pSubsetSps = &sTempSubsetSps;
pSps = &sTempSubsetSps.sSps;
memset (pSubsetSps, 0, sizeof (SSubsetSps));
// Use the level 5.2 for compatibility
const SLevelLimits* pSMaxLevelLimits = GetLevelLimits (52, false);
const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]);
if (NULL == pSLevelLimits) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc);
@ -1057,12 +1048,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
}
if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) {
if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSMaxLevelLimits->uiMaxFS)) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the pic_width_in_mbs exceeds the level limits!");
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the pic_width_in_mbs exceeds the level limits!");
}
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, " the pic_width_in_mbs exceeds the level limits!");
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
}
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1
pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode;
@ -1071,23 +1058,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
}
if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) {
if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSMaxLevelLimits->uiMaxFS)) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the pic_height_in_mbs exceeds the level limits!");
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the pic_height_in_mbs exceeds the level limits!");
}
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, " the pic_height_in_mbs exceeds the level limits!");
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
}
uint64_t uiTmp64 = (uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbHeight;
if (uiTmp64 > (uint64_t)pSLevelLimits->uiMaxFS) {
if (uiTmp64 > (uint64_t)pSMaxLevelLimits->uiMaxFS) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the total count of mb exceeds the level limits!");
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the total count of mb exceeds the level limits!");
}
uint32_t uiTmp32 = pSps->iMbWidth * pSps->iMbHeight;
if (uiTmp32 > (uint32_t)pSLevelLimits->uiMaxFS) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!");
}
pSps->uiTotalMbCount = (uint32_t)uiTmp64;
pSps->uiTotalMbCount = uiTmp32;
WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames",
GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES));
// here we check max_num_ref_frames
@ -1135,7 +1113,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag
pSps->bVuiParamPresentFlag = !!uiCode;
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds!
pCtx->iErrorCode |= dsOutOfMemory;
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);
@ -1223,8 +1201,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
}
// Check if SPS SVC extension applicated
if (kbUseSubsetFlag && (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc)) {
if ((iRet = DecodeSpsSvcExt (pCtx, pSubsetSps, pBs)) != ERR_NONE) {
return iRet;
if (DecodeSpsSvcExt (pCtx, pSubsetSps, pBs) != ERR_NONE) {
return -1;
}
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //svc_vui_parameters_present_flag
@ -1287,7 +1265,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
pCtx->bSpsAvailFlags[iSpsId] = true;
pCtx->bSpsExistAheadFlag = true;
}
return ERR_NONE;
return 0;
}
/*!
@ -1317,7 +1295,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //pic_parameter_set_id
uiPpsId = uiCode;
if (uiPpsId >= MAX_PPS_COUNT) {
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_PPS_ID_OVERFLOW);
return ERR_INFO_PPS_ID_OVERFLOW;
}
pPps = &sTempPps;
memset (pPps, 0, sizeof (SPps));
@ -1327,7 +1305,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
pPps->iSpsId = uiCode;
if (pPps->iSpsId >= MAX_SPS_COUNT) {
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
return ERR_INFO_SPS_ID_OVERFLOW;
}
WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //entropy_coding_mode_flag
@ -1339,7 +1317,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
pPps->uiNumSliceGroups = NUM_SLICE_GROUPS_OFFSET + uiCode;
if (pPps->uiNumSliceGroups > MAX_SLICEGROUP_IDS) {
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_SLICEGROUP);
return ERR_INFO_INVALID_SLICEGROUP;
}
if (pPps->uiNumSliceGroups > 1) {
@ -1370,14 +1348,19 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
if (pPps->uiNumRefIdxL0Active > MAX_REF_PIC_COUNT ||
pPps->uiNumRefIdxL1Active > MAX_REF_PIC_COUNT) {
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_REF_COUNT_OVERFLOW);
return ERR_INFO_REF_COUNT_OVERFLOW;
}
WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //weighted_pred_flag
pPps->bWeightedPredFlag = !!uiCode;
WELS_READ_VERIFY (BsGetBits (pBsAux, 2, &uiCode)); //weighted_bipred_idc
pPps->uiWeightedBipredIdc = uiCode;
// weighted_bipred_idc > 0 NOT supported now, but no impact when we ignore it
if (pPps->uiWeightedBipredIdc != 0) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"ParsePps(): weighted_bipred_idc (%d) not supported.\n",
pPps->uiWeightedBipredIdc);
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP);
}
WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode)); //pic_init_qp_minus26
pPps->iPicInitQp = PIC_INIT_QP_OFFSET + iCode;
@ -1433,7 +1416,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps));
pCtx->bPpsAvailFlags[uiPpsId] = true;
}
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds
pCtx->iErrorCode |= dsOutOfMemory;
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);

View File

@ -107,7 +107,7 @@ int32_t Read32BitsCabac (PWelsCabacDecEngine pDecEngine, uint32_t& uiValue, int3
iNumBitsRead = 0;
uiValue = 0;
if (iLeftBytes <= 0) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_NO_BS_TO_READ);
return ERR_CABAC_NO_BS_TO_READ;
}
switch (iLeftBytes) {
case 3:
@ -275,7 +275,7 @@ int32_t DecodeExpBypassCabac (PWelsCabacDecEngine pDecEngine, int32_t iCount, ui
}
} while (uiCode != 0 && iCount != 16);
if (iCount == 16) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_UNEXPECTED_VALUE);
return ERR_CABAC_UNEXPECTED_VALUE;
}
while (iCount--) {

View File

@ -70,7 +70,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
PDeblockingFilterMbFunc pDeblockMb;
if (!pCtx->bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) {
return ERR_INFO_WIDTH_MISMATCH;
return -1;
}
iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;
@ -90,13 +90,13 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
break;
}
if (!pCtx->pParam->bParseOnly) { //for parse only, actual recon MB unnecessary
if (!pCtx->bParseOnly) { //for parse only, actual recon MB unnecessary
if (WelsTargetMbConstruction (pCtx)) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",
pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType);
return ERR_INFO_MB_RECON_FAIL;
return -1;
}
}
@ -112,7 +112,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
"WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d",
pCtx->iTotalNumMbRec, iTotalMbTargetLayer);
return ERR_INFO_MB_NUM_EXCEED_FAIL;
return -1;
}
if (pSliceHeader->pPps->uiNumSliceGroups > 1) {
@ -132,22 +132,22 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
pCtx->pDec->iHeightInPixel = iCurLayerHeight;
if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE))
return ERR_NONE; //no error but just ignore the type unsupported
return 0;
if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on
return ERR_NONE;
if (pCtx->bParseOnly) //for parse only, deblocking should not go on
return 0;
pDeblockMb = WelsDeblockingMb;
if (1 == pSliceHeader->uiDisableDeblockingFilterIdc
|| pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice <= 0) {
return ERR_NONE;//NO_SUPPORTED_FILTER_IDX
return 0;//NO_SUPPORTED_FILTER_IDX
} else {
WelsDeblockingFilterSlice (pCtx, pDeblockMb);
}
// any other filter_idc not supported here, 7/22/2010
return ERR_NONE;
return 0;
}
int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer,
@ -168,23 +168,30 @@ int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLa
}
}
} else {
// luma.
const int8_t* pNzc = pCurLayer->pNzc[iMbXy];
int16_t* pScaledTCoeff = pCurLayer->pScaledTCoeff[iMbXy];
pCtx->pIdctFourResAddPredFunc (pDstY + 0 * iStrideL + 0, iStrideL, pScaledTCoeff + 0 * 64, pNzc + 0);
pCtx->pIdctFourResAddPredFunc (pDstY + 0 * iStrideL + 8, iStrideL, pScaledTCoeff + 1 * 64, pNzc + 2);
pCtx->pIdctFourResAddPredFunc (pDstY + 8 * iStrideL + 0, iStrideL, pScaledTCoeff + 2 * 64, pNzc + 8);
pCtx->pIdctFourResAddPredFunc (pDstY + 8 * iStrideL + 8, iStrideL, pScaledTCoeff + 3 * 64, pNzc + 10);
for (i = 0; i < 16; i++) { //luma
iIndex = g_kuiMbCountScan4Idx[i];
if (pCurLayer->pNzc[iMbXy][iIndex]) {
iOffset = ((iIndex >> 2) << 2) * iStrideL + ((iIndex % 4) << 2);
pCtx->pIdctResAddPredFunc (pDstY + iOffset, iStrideL, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4));
}
}
}
const int8_t* pNzc = pCurLayer->pNzc[iMbXy];
int16_t* pScaledTCoeff = pCurLayer->pScaledTCoeff[iMbXy];
// Cb.
pCtx->pIdctFourResAddPredFunc (pDstU, iStrideC, pScaledTCoeff + 4 * 64, pNzc + 16);
// Cr.
pCtx->pIdctFourResAddPredFunc (pDstV, iStrideC, pScaledTCoeff + 5 * 64, pNzc + 18);
for (i = 0; i < 4; i++) { //chroma
iIndex = g_kuiMbCountScan4Idx[i + 16]; //Cb
if (pCurLayer->pNzc[iMbXy][iIndex] || * (pCurLayer->pScaledTCoeff[iMbXy] + ((i + 16) << 4))) {
iOffset = (((iIndex - 16) >> 2) << 2) * iStrideC + (((iIndex - 16) % 4) << 2);
pCtx->pIdctResAddPredFunc (pDstU + iOffset, iStrideC, pCurLayer->pScaledTCoeff[iMbXy] + ((i + 16) << 4));
}
return ERR_NONE;
iIndex = g_kuiMbCountScan4Idx[i + 20]; //Cr
if (pCurLayer->pNzc[iMbXy][iIndex] || * (pCurLayer->pScaledTCoeff[iMbXy] + ((i + 20) << 4))) {
iOffset = (((iIndex - 18) >> 2) << 2) * iStrideC + (((iIndex - 18) % 4) << 2);
pCtx->pIdctResAddPredFunc (pDstV + iOffset, iStrideC , pCurLayer->pScaledTCoeff[iMbXy] + ((i + 20) << 4));
}
}
return 0;
}
int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
int32_t iMbX = pCurLayer->iMbX;
@ -203,7 +210,7 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
return ERR_NONE;
return 0;
}
void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx) {
@ -258,7 +265,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC
WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx);
RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
return ERR_NONE;
return 0;
}
if (IS_INTRA8x8 (pCurLayer->pMbType[iMbXy])) {
@ -268,7 +275,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC
if (IS_INTRA4x4 (pCurLayer->pMbType[iMbXy]))
RecI4x4Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
return ERR_NONE;
return 0;
}
int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
@ -285,14 +292,14 @@ int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
GetInterPred (pDstY, pDstCb, pDstCr, pCtx);
return ERR_NONE;
return 0;
}
int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) {
PDqLayer pCurLayer = pCtx->pCurDqLayer;
if (MB_TYPE_INTRA_PCM == pCurLayer->pMbType[pCurLayer->iMbXyIndex]) {
//already decoded and reconstructed when parsing
return ERR_NONE;
return 0;
} else if (IS_INTRA (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) {
WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1);
} else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB
@ -304,10 +311,10 @@ int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) {
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetMbConstruction():::::Unknown MB type: %d",
pCurLayer->pMbType[pCurLayer->iMbXyIndex]);
return ERR_INFO_MB_RECON_FAIL;
return -1;
}
return ERR_NONE;
return 0;
}
void WelsChromaDcIdct (int16_t* pBlock) {
@ -437,8 +444,8 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
}
iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i, false);
if (iFinalMode == GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE);
if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) {
return ERR_INFO_INVALID_I4x4_PRED_MODE;
}
pCurDqLayer->pIntra4x4FinalMode[iMbXy][g_kuiScan4[i]] = iFinalMode;
@ -458,20 +465,20 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
} else {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
}
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
return ERR_NONE;
}
@ -521,8 +528,8 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i << 2, true);
if (iFinalMode == GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE);
if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) {
return ERR_INFO_INVALID_I4x4_PRED_MODE;
}
for (int j = 0; j < 4; j++) {
@ -535,27 +542,23 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail
pCurDqLayer->pIntraPredMode[iMbXy][4] = pIntraPredMode[4 + 8 * 1];
pCurDqLayer->pIntraPredMode[iMbXy][5] = pIntraPredMode[4 + 8 * 2];
pCurDqLayer->pIntraPredMode[iMbXy][6] = pIntraPredMode[4 + 8 * 3];
if (pCtx->pSps->uiChromaFormatIdc == 0)
return ERR_NONE;
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
} else {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
}
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
return ERR_NONE;
@ -571,7 +574,7 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva
if (CheckIntra16x16PredMode (uiNeighAvail,
&pCurDqLayer->pIntraPredMode[iMbXy][7])) { //invalid iPredMode, must stop decoding
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
return ERR_INFO_INVALID_I16x16_PRED_MODE;
}
if (pCtx->pSps->uiChromaFormatIdc == 0)
return ERR_NONE;
@ -579,19 +582,19 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva
if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
if (iCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = iCode;
} else {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode
if (uiCode > MAX_PRED_MODE_ID_CHROMA) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
pCurDqLayer->pChromaPredMode[iMbXy] = uiCode;
}
if (-1 == pCurDqLayer->pChromaPredMode[iMbXy]
|| CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
return ERR_NONE;
@ -619,10 +622,10 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui
GetNeighborAvailMbType (&sNeighAvail, pCurLayer);
WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType));
if (uiMbType > 25) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
} else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17
&& uiMbType <= 24))) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
} else if (25 == uiMbType) { //I_PCM
WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
pSlice->iLastDeltaQp = 0;
@ -685,7 +688,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui
int32_t iQpDelta, iId8x8, iId4x4;
WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
return ERR_INFO_INVALID_QP;
}
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
@ -838,9 +841,9 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv
} else { //Intra mode
uiMbType -= 5;
if (uiMbType > 25)
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (25 == uiMbType) { //I_PCM
WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
@ -919,7 +922,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv
WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
return ERR_INFO_INVALID_QP;
}
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
@ -1273,7 +1276,6 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
const int32_t iMbXy = pCurLayer->iMbXyIndex;
int8_t* pNzc = pCurLayer->pNzc[iMbXy];
int32_t i;
int32_t iRet = ERR_NONE;
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
uint32_t uiCode;
int32_t iCode;
@ -1289,9 +1291,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType
uiMbType = uiCode;
if (uiMbType > 25)
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (25 == uiMbType) {
int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
@ -1343,7 +1345,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
memset (pCurLayer->pChromaQp[iMbXy], 0, sizeof (pCurLayer->pChromaQp[iMbXy]));
memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16
WELS_READ_VERIFY (InitReadBits (pBs, 0));
return ERR_NONE;
return 0;
} else if (0 == uiMbType) { //reference to JM
ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);
pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4;
@ -1367,9 +1369,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
uiCbp = uiCode;
//G.9.1 Alternative parsing process for coded pBlock pattern
if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
return ERR_INFO_INVALID_CBP;
if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
return ERR_INFO_INVALID_CBP;
if (pCtx->pSps->uiChromaFormatIdc)
uiCbp = g_kuiIntra4x4CbpTable[uiCbp];
@ -1414,7 +1416,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
iQpDelta = iCode;
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
return ERR_INFO_INVALID_QP;
}
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
@ -1430,17 +1432,17 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
//step1: Luma DC
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC,
pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16,
g_kuiLumaDcZigzagScan, I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
//step2: Luma AC
if (uiCbpL) {
for (i = 0; i < 16; i++) {
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1,
g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4),
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i,
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
}
ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
@ -1455,10 +1457,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
if (uiCbpL & (1 << iId8x8)) {
int32_t iIndex = (iId8x8 << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4,
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;
if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty,
pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;
}
iIndex++;
}
@ -1477,10 +1479,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
int32_t iIndex = (iId8x8 << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
//Luma (DC and AC decoding together)
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,
LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
iIndex++;
}
@ -1501,9 +1503,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
if (1 == uiCbpC || 2 == uiCbpC) {
for (i = 0; i < 2; i++) { //Cb Cr
iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty,
pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
return -1;//abnormal
}
}
}
@ -1514,10 +1517,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
int32_t iIndex = 16 + (i << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
return -1;//abnormal
}
iIndex++;
}
@ -1530,7 +1533,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
BsEndCavlc (pBs);
}
return ERR_NONE;
return 0;
}
int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
@ -1569,9 +1572,9 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.",
(int64_t) iUsedBits, pBs->iBits);
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE);
return -1;
}
return ERR_NONE;
return 0;
}
int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
@ -1590,7 +1593,6 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
const int32_t iMbXy = pCurLayer->iMbXyIndex;
int8_t* pNzc = pCurLayer->pNzc[iMbXy];
int32_t i;
int32_t iRet = ERR_NONE;
uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
uint32_t uiCode;
int32_t iCode;
@ -1607,8 +1609,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
pCurLayer->pMbType[iMbXy] = g_ksInterMbTypeInfo[uiMbType].iType;
WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurLayer);
if ((iRet = ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) != ERR_NONE) {
return iRet;//abnormal
if (ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) {
return -1;//abnormal
}
if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) {
@ -1622,14 +1624,14 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "residual_pred_flag = 1 not supported.");
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP);
return -1;
}
} else { //intra MB type
uiMbType -= 5;
if (uiMbType > 25)
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE);
return ERR_INFO_INVALID_MB_TYPE;
if (25 == uiMbType) {
int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
@ -1687,7 +1689,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
ST32A4 (&pNzc[16], 0x10101010);
ST32A4 (&pNzc[20], 0x10101010);
WELS_READ_VERIFY (InitReadBits (pBs, 0));
return ERR_NONE;
return 0;
} else {
if (0 == uiMbType) {
ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);
@ -1715,8 +1717,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0;
uiCbpL = pCurLayer->pCbp[iMbXy] & 15;
WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) != ERR_NONE) {
return iRet;
if (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) {
return -1;
}
}
}
@ -1727,9 +1729,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
uiCbp = uiCode;
{
if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
return ERR_INFO_INVALID_CBP;
if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP);
return ERR_INFO_INVALID_CBP;
if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurLayer->pMbType[iMbXy]) {
uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp];
@ -1777,7 +1779,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
iQpDelta = iCode;
if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP);
return ERR_INFO_INVALID_QP;
}
pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp
@ -1792,17 +1794,17 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
//step1: Luma DC
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC,
pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan,
I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
//step2: Luma AC
if (uiCbpL) {
for (i = 0; i < 16; i++) {
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1,
g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4),
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i,
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
}
ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
@ -1817,10 +1819,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
if (uiCbpL & (1 << iId8x8)) {
int32_t iIndex = (iId8x8 << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4,
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;
if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty,
pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;
}
iIndex++;
}
@ -1840,10 +1842,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
int32_t iIndex = (iId8x8 << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
//Luma (DC and AC decoding together)
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1,
g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, iMbResProperty,
pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
return -1;//abnormal
}
iIndex++;
}
@ -1869,9 +1871,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
else
iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty,
pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
return -1;//abnormal
}
}
} else {
@ -1886,10 +1889,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
int32_t iIndex = 16 + (i << 2);
for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
return iRet;//abnormal
if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) {
return -1;//abnormal
}
iIndex++;
}
@ -1902,7 +1905,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) {
BsEndCavlc (pBs);
}
return ERR_NONE;
return 0;
}
int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) {
@ -1925,7 +1928,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run
pSlice->iMbSkipRun = uiCode;
if (-1 == pSlice->iMbSkipRun) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_SKIP_RUN);
return -1;
}
}
if (pSlice->iMbSkipRun--) {
@ -1992,9 +1995,9 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.",
(int64_t) iUsedBits, pBs->iBits);
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE);
return -1;
}
return ERR_NONE;
return 0;
}
void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) {

View File

@ -64,7 +64,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
PPicBuff pPicBuf = NULL;
int32_t iPicIdx = 0;
if (kiSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
return ERR_INFO_INVALID_PARAM;
return 1;
}
CMemoryAlign* pMa = pCtx->pMemAlign;
@ -72,7 +72,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
pPicBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
if (NULL == pPicBuf) {
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
pPicBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiSize * sizeof (PPicture), "PPicture*");
@ -80,7 +80,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
if (NULL == pPicBuf->ppPic) {
pPicBuf->iCapacity = 0;
DestroyPicBuff (&pPicBuf, pMa);
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
for (iPicIdx = 0; iPicIdx < kiSize; ++ iPicIdx) {
@ -89,7 +89,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
// init capacity first for free memory
pPicBuf->iCapacity = iPicIdx;
DestroyPicBuff (&pPicBuf, pMa);
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
pPicBuf->ppPic[iPicIdx] = pPic;
}
@ -99,7 +99,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons
pPicBuf->iCurrentIdx = 0;
* ppPicBuf = pPicBuf;
return ERR_NONE;
return 0;
}
static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
@ -108,14 +108,14 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
PPicBuff pPicNewBuf = NULL;
int32_t iPicIdx = 0;
if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
return ERR_INFO_INVALID_PARAM;
return 1;
}
CMemoryAlign* pMa = pCtx->pMemAlign;
pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
if (NULL == pPicNewBuf) {
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
@ -123,7 +123,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
if (NULL == pPicNewBuf->ppPic) {
pPicNewBuf->iCapacity = 0;
DestroyPicBuff (&pPicNewBuf, pMa);
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
// increase new PicBuf
@ -133,7 +133,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
// Set maximum capacity as the new malloc memory at the tail
pPicNewBuf->iCapacity = iPicIdx;
DestroyPicBuff (&pPicNewBuf, pMa);
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
pPicNewBuf->ppPic[iPicIdx] = pPic;
}
@ -162,7 +162,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
pPicOldBuf->iCurrentIdx = 0;
pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
pPicOldBuf = NULL;
return ERR_NONE;
return 0;
}
static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
@ -171,7 +171,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
PPicBuff pPicNewBuf = NULL;
int32_t iPicIdx = 0;
if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
return ERR_INFO_INVALID_PARAM;
return 1;
}
CMemoryAlign* pMa = pCtx->pMemAlign;
@ -179,7 +179,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
if (NULL == pPicNewBuf) {
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
@ -187,7 +187,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
if (NULL == pPicNewBuf->ppPic) {
pPicNewBuf->iCapacity = 0;
DestroyPicBuff (&pPicNewBuf, pMa);
return ERR_INFO_OUT_OF_MEMORY;
return 1;
}
int32_t iPrevPicIdx = -1;
@ -239,7 +239,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co
pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
pPicOldBuf = NULL;
return ERR_NONE;
return 0;
}
void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) {
@ -272,16 +272,18 @@ void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) {
pPicBuf = NULL;
*ppPicBuf = NULL;
}
/*
* fill data fields in default for decoder context
*/
void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx, CMemoryAlign* pMa) {
int32_t iCpuCores = 1;
memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
pCtx->sLogCtx = *pLogCtx;
pCtx->pMemAlign = pMa;
pCtx->pArgDec = NULL;
pCtx->eOutputColorFormat = videoFormatI420; // yuv in default
pCtx->bHaveGotMemory = false; // not ever request memory blocks for decoder context related
pCtx->uiCpuFlag = 0;
@ -356,15 +358,13 @@ static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) {
/*
* request memory blocks for decoder avc part
*/
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight,
bool& bReallocFlag) {
int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight) {
const int32_t kiPicWidth = kiMbWidth << 4;
const int32_t kiPicHeight = kiMbHeight << 4;
int32_t iErr = ERR_NONE;
int32_t iListIdx = 0; //, mb_blocks = 0;
int32_t iPicQueueSize = 0; // adaptive size of picture queue, = (pSps->iNumRefFrames x 2)
bReallocFlag = false;
bool bNeedChangePicQueue = true;
CMemoryAlign* pMa = pCtx->pMemAlign;
@ -434,26 +434,22 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const
if (pCtx->pCabacDecEngine == NULL)
pCtx->pCabacDecEngine = (SWelsCabacDecEngine*) pMa->WelsMallocz (sizeof (SWelsCabacDecEngine), "pCtx->pCabacDecEngine");
WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pCtx->pCabacDecEngine))
bReallocFlag = true; // memory re-allocation successfully finished
return ERR_NONE;
}
/*
* free memory dynamically allocated during decoder
* free memory blocks in avc
*/
void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {
void WelsFreeMem (PWelsDecoderContext pCtx) {
int32_t iListIdx = 0;
CMemoryAlign* pMa = pCtx->pMemAlign;
//free dq layer memory
UninitialDqLayersContext (pCtx);
//free FMO memory
/* TODO: free memory blocks introduced in avc */
ResetFmoList (pCtx);
//free ref-pic list & picture memory
WelsResetRefPic (pCtx);
// for sPicBuff
for (iListIdx = LIST_0; iListIdx < LIST_A; ++ iListIdx) {
PPicBuff* pPicBuff = &pCtx->pPicBuff[iListIdx];
if (NULL != pPicBuff && NULL != *pPicBuff) {
@ -468,8 +464,6 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {
pCtx->iLastImgHeightInPixel = 0;
pCtx->bFreezeOutput = true;
pCtx->bHaveGotMemory = false;
//free CABAC memory
pMa->WelsFree (pCtx->pCabacDecEngine, "pCtx->pCabacDecEngine");
}
@ -477,15 +471,19 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) {
* \brief Open decoder
*/
int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
int iRet = ERR_NONE;
// function pointers
InitDecFuncs (pCtx, pCtx->uiCpuFlag);
//initial MC function pointer--
int iRet = ERR_NONE;
InitMcFunc (& (pCtx->sMcFunc), pCtx->uiCpuFlag);
InitExpandPictureFunc (& (pCtx->sExpandPicFunc), pCtx->uiCpuFlag);
AssignFuncPointerForRec (pCtx);
// vlc tables
InitVlcTable (&pCtx->sVlcTable);
// static memory
iRet = WelsInitStaticMemory (pCtx);
// startup memory
iRet = WelsInitMemory (pCtx);
if (ERR_NONE != iRet)
return iRet;
@ -505,9 +503,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
* \brief Close decoder
*/
void WelsCloseDecoder (PWelsDecoderContext pCtx) {
WelsFreeDynamicMemory (pCtx);
WelsFreeMem (pCtx);
WelsFreeStaticMemory (pCtx);
WelsFreeMemory (pCtx);
UninitialDqLayersContext (pCtx);
#ifdef LONG_TERM_REF
pCtx->bParamSetsLostFlag = false;
@ -523,20 +523,25 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) {
*/
int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
if (NULL == pCtx || NULL == kpParam)
return ERR_INFO_INVALID_PARAM;
return 1;
CMemoryAlign* pMa = pCtx->pMemAlign;
pCtx->pParam = (SDecodingParam*)pMa->WelsMallocz (sizeof (SDecodingParam), "SDecodingParam");
if (NULL == pCtx->pParam)
return 1;
memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
if ((pCtx->pParam->eEcActiveIdc > ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
|| (pCtx->pParam->eEcActiveIdc < ERROR_CON_DISABLE)) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"eErrorConMethod (%d) not in range: (%d - %d). Set as default value: (%d).", pCtx->pParam->eEcActiveIdc,
ERROR_CON_DISABLE, ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE,
ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE);
pCtx->pParam->eEcActiveIdc = ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
pCtx->eOutputColorFormat = pCtx->pParam->eOutputColorFormat;
if (!pCtx->bParseOnly) {
int32_t iRet = DecoderSetCsp (pCtx, pCtx->pParam->eOutputColorFormat);
if (iRet)
return iRet;
}
pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
if (pCtx->pParam->bParseOnly) //parse only, disable EC method
if (pCtx->bParseOnly) //parse only, disable EC method
pCtx->eErrorConMethod = ERROR_CON_DISABLE;
InitErrorCon (pCtx);
@ -549,7 +554,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "eVideoType: %d", pCtx->eVideoType);
return ERR_NONE;
return 0;
}
/*!
@ -564,11 +569,15 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
* \note N/A
*************************************************************************************
*/
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
int32_t WelsInitDecoder (PWelsDecoderContext pCtx, const bool bParseOnly, SLogContext* pLogCtx) {
if (pCtx == NULL) {
return ERR_INFO_INVALID_PTR;
}
// default
WelsDecoderDefaults (pCtx, pLogCtx, pCtx->pMemAlign);
pCtx->bParseOnly = bParseOnly;
// open decoder
return WelsOpenDecoder (pCtx);
}
@ -645,7 +654,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
pRawData->pCurPos = pRawData->pHead;
}
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
pSavedData = &pCtx->sSavedData;
if ((kiBsLen + 4) > (pSavedData->pEnd - pSavedData->pCurPos)) {
pSavedData->pCurPos = pSavedData->pHead;
@ -655,23 +664,11 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
//0x03 removal and extract all of NAL Unit from current raw data
pDstNal = pRawData->pCurPos;
bool bNalStartBytes = false;
while (iSrcConsumed < iSrcLength) {
if ((2 + iSrcConsumed < iSrcLength) && (0 == LD16 (pSrcNal + iSrcIdx)) && (pSrcNal[2 + iSrcIdx] <= 0x03)) {
if (bNalStartBytes && (pSrcNal[2 + iSrcIdx] != 0x00 && pSrcNal[2 + iSrcIdx] != 0x01)) {
pCtx->iErrorCode |= dsBitstreamError;
return pCtx->iErrorCode;
}
if (pSrcNal[2 + iSrcIdx] == 0x02) {
pCtx->iErrorCode |= dsBitstreamError;
return pCtx->iErrorCode;
} else if (pSrcNal[2 + iSrcIdx] == 0x00) {
pDstNal[iDstIdx++] = pSrcNal[iSrcIdx++];
iSrcConsumed++;
bNalStartBytes = true;
} else if (pSrcNal[2 + iSrcIdx] == 0x03) {
if ((2 + iSrcConsumed < iSrcLength) &&
(0 == LD16 (pSrcNal + iSrcIdx)) &&
((pSrcNal[2 + iSrcIdx] == 0x03) || (pSrcNal[2 + iSrcIdx] == 0x01))) {
if (pSrcNal[2 + iSrcIdx] == 0x03) {
if ((3 + iSrcConsumed < iSrcLength) && pSrcNal[3 + iSrcIdx] > 0x03) {
pCtx->iErrorCode |= dsBitstreamError;
return pCtx->iErrorCode;
@ -681,8 +678,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
iSrcIdx += 3;
iSrcConsumed += 3;
}
} else { // 0x01
bNalStartBytes = false;
} else {
iConsumedBytes = 0;
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
@ -802,6 +798,29 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
return pCtx->iErrorCode;
}
/*
* set colorspace format in decoder
*/
int32_t DecoderSetCsp (PWelsDecoderContext pCtx, const int32_t kiColorFormat) {
WELS_VERIFY_RETURN_IF (1, (NULL == pCtx));
pCtx->eOutputColorFormat = (EVideoFormatType) kiColorFormat;
if (pCtx->pParam != NULL) {
pCtx->pParam->eOutputColorFormat = (EVideoFormatType) kiColorFormat;
}
//For now, support only videoFormatI420!
if (kiColorFormat == (int32_t) videoFormatInternal) {
pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420;
} else if (kiColorFormat != (int32_t) videoFormatI420) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Support I420 output only for now! Change to I420...");
pCtx->pParam->eOutputColorFormat = pCtx->eOutputColorFormat = videoFormatI420;
return cmUnsupportedData;
}
return 0;
}
/*!
* \brief make sure synchonozization picture resolution (get from slice header) among different parts (i.e, memory related and so on)
* over decoder internal
@ -816,8 +835,7 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi
const int32_t kiPicWidth = kiMbWidth << 4;
const int32_t kiPicHeight = kiMbHeight << 4;
bool bReallocFlag = false;
iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used
iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight); // common memory used
if (ERR_NONE != iErr) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");
@ -832,39 +850,13 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi
pCtx->iErrorCode = dsOutOfMemory;
}
#if defined(MEMORY_MONITOR)
if (bReallocFlag) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "SyncPictureResolutionExt(), overall memory usage: %llu bytes",
static_cast<unsigned long long> (sizeof (SWelsDecoderContext) + pCtx->pMemAlign->WelsGetMemoryUsage()));
}
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "SyncPictureResolutionExt(), overall memory usage: %llu bytes",
static_cast<unsigned long long> (sizeof (SWelsDecoderContext) + pCtx->pMemAlign->WelsGetMemoryUsage()));
#endif//MEMORY_MONITOR
return iErr;
}
void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
WelsBlockFuncInit (&pCtx->sBlockFunc, uiCpuFlag);
InitPredFunc (pCtx, uiCpuFlag);
InitMcFunc (& (pCtx->sMcFunc), uiCpuFlag);
InitExpandPictureFunc (& (pCtx->sExpandPicFunc), uiCpuFlag);
DeblockingInit (&pCtx->sDeblockingFunc, uiCpuFlag);
}
namespace {
template<void pfIdctResAddPred (uint8_t* pPred, int32_t iStride, int16_t* pRs)>
void IdctFourResAddPred_ (uint8_t* pPred, int32_t iStride, int16_t* pRs, const int8_t* pNzc) {
if (pNzc[0] || pRs[0 * 16])
pfIdctResAddPred (pPred + 0 * iStride + 0, iStride, pRs + 0 * 16);
if (pNzc[1] || pRs[1 * 16])
pfIdctResAddPred (pPred + 0 * iStride + 4, iStride, pRs + 1 * 16);
if (pNzc[4] || pRs[2 * 16])
pfIdctResAddPred (pPred + 4 * iStride + 0, iStride, pRs + 2 * 16);
if (pNzc[5] || pRs[3 * 16])
pfIdctResAddPred (pPred + 4 * iStride + 4, iStride, pRs + 3 * 16);
}
} // anon ns
void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
void AssignFuncPointerForRec (PWelsDecoderContext pCtx) {
pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC ] = WelsI16x16LumaPredDc_c;
@ -912,14 +904,12 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
pCtx->pGetIChromaPredFunc[C_PRED_DC_128] = WelsIChromaPredDcNA_c;
pCtx->pIdctResAddPredFunc = IdctResAddPred_c;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_c>;
pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c;
#if defined(HAVE_NEON)
if (uiCpuFlag & WELS_CPU_NEON) {
if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
pCtx->pIdctResAddPredFunc = IdctResAddPred_neon;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_neon>;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_neon;
@ -943,9 +933,8 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
#endif//HAVE_NEON
#if defined(HAVE_NEON_AARCH64)
if (uiCpuFlag & WELS_CPU_NEON) {
if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_AArch64_neon>;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_AArch64_neon;
@ -974,9 +963,8 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
#endif//HAVE_NEON_AARCH64
#if defined(X86_ASM)
if (uiCpuFlag & WELS_CPU_MMXEXT) {
if (pCtx->uiCpuFlag & WELS_CPU_MMXEXT) {
pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_mmx>;
///////mmx code opt---
pCtx->pGetIChromaPredFunc[C_PRED_H] = WelsDecoderIChromaPredH_mmx;
@ -990,10 +978,8 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
pCtx->pGetI4x4LumaPredFunc[I4_PRED_DDL] = WelsDecoderI4x4LumaPredDDL_mmx;
pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx;
}
if (uiCpuFlag & WELS_CPU_SSE2) {
pCtx->pIdctResAddPredFunc = IdctResAddPred_sse2;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_sse2>;
if (pCtx->uiCpuFlag & WELS_CPU_SSE2) {
/////////sse2 code opt---
pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2;
pCtx->pGetI16x16LumaPredFunc[I16_PRED_H] = WelsDecoderI16x16LumaPredH_sse2;
@ -1005,14 +991,10 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) {
pCtx->pGetIChromaPredFunc[C_PRED_DC_T] = WelsDecoderIChromaPredDcTop_sse2;
pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2;
}
#if defined(HAVE_AVX2)
if (uiCpuFlag & WELS_CPU_AVX2) {
pCtx->pIdctResAddPredFunc = IdctResAddPred_avx2;
pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_avx2;
}
#endif
DeblockingInit (&pCtx->sDeblockingFunc, pCtx->uiCpuFlag);
#endif
WelsBlockFuncInit (&pCtx->sBlockFunc, pCtx->uiCpuFlag);
}
//reset decoder number related statistics info
@ -1046,15 +1028,10 @@ void UpdateDecStatNoFreezingInfo (PWelsDecoderContext pCtx) {
//update QP info
int32_t iTotalQp = 0;
const int32_t kiMbNum = pCurDq->iMbWidth * pCurDq->iMbHeight;
int32_t iCorrectMbNum = 0;
for (int32_t iMb = 0; iMb < kiMbNum; ++iMb) {
iCorrectMbNum += (int32_t) pCurDq->pMbCorrectlyDecodedFlag[iMb];
iTotalQp += pCurDq->pLumaQp[iMb] * pCurDq->pMbCorrectlyDecodedFlag[iMb];
}
if (iCorrectMbNum == 0) //non MB is correct, should remain QP statistic info
iTotalQp = pDecStat->iAvgLumaQp;
else
iTotalQp /= iCorrectMbNum;
iTotalQp /= kiMbNum;
if (pDecStat->uiDecodedFrameCount + 1 == 0) { //maximum uint32_t reached
ResetDecStatNums (pDecStat);
pDecStat->iAvgLumaQp = iTotalQp;

View File

@ -72,7 +72,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
}
}
if (pCtx->pParam->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
PAccessUnit pCurAu = pCtx->pAccessUnitList;
if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
SParserBsInfo* pParser = pCtx->pParserBsInfo;
@ -133,7 +133,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pCtx->pDec->bIsComplete = false;
pCtx->bFrameFinish = false; //current frame not finished
pCtx->iErrorCode |= dsFramePending;
return ERR_INFO_PARSEONLY_PENDING;
return -1;
//pCtx->pParserBsInfo->iNalNum = 0;
}
} else { //error
@ -141,9 +141,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pCtx->pParserBsInfo->iNalNum = 0;
pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
return ERR_INFO_PARSEONLY_ERROR;
return -1;
}
return ERR_NONE;
return 0;
}
if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
@ -152,7 +152,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
bFrameCompleteFlag = false; //return later after output buffer is done
if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice
return ERR_INFO_MB_NUM_INADEQUATE;
return -1;
} else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag
&& (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done
pCtx->pDec->bIsComplete = true;
@ -193,7 +193,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
if (pDstInfo->iBufferStatus == 0) {
if (!bFrameCompleteFlag)
pCtx->iErrorCode |= dsBitstreamError;
return ERR_INFO_MB_NUM_INADEQUATE;
return -1;
}
if (pCtx->bFreezeOutput) {
pDstInfo->iBufferStatus = 0;
@ -206,7 +206,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum;
UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0);
return ERR_NONE;
return 0;
}
inline bool CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) {
@ -467,7 +467,7 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx) {
}
pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;
pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
pCtx->pParserBsInfo = static_cast<SParserBsInfo*> (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));
if (pCtx->pParserBsInfo == NULL) {
return ERR_INFO_OUT_OF_MEMORY;
@ -538,14 +538,14 @@ int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) {
}
/*
* WelsInitStaticMemory
* WelsInitMemory
* Memory request for new introduced data
* Especially for:
* rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache.
* return:
* 0 - success; otherwise returned error_no defined in error_no.h.
*/
int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) {
int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
if (pCtx == NULL) {
return ERR_INFO_INVALID_PTR;
}
@ -563,16 +563,22 @@ int32_t WelsInitStaticMemory (PWelsDecoderContext pCtx) {
}
/*
* WelsFreeStaticMemory
* Free memory introduced in WelsInitStaticMemory at destruction of decoder.
* WelsFreeMemory
* Free memory introduced in WelsInitMemory at destruction of decoder.
*
*/
void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {
void WelsFreeMemory (PWelsDecoderContext pCtx) {
if (pCtx == NULL)
return;
CMemoryAlign* pMa = pCtx->pMemAlign;
if (NULL != pCtx->pParam) {
pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
pCtx->pParam = NULL;
}
MemFreeNalList (&pCtx->pAccessUnitList, pMa);
if (pCtx->sRawData.pHead) {
@ -582,7 +588,7 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {
pCtx->sRawData.pEnd = NULL;
pCtx->sRawData.pStartPos = NULL;
pCtx->sRawData.pCurPos = NULL;
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
if (pCtx->sSavedData.pHead) {
pMa->WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead");
}
@ -599,12 +605,6 @@ void WelsFreeStaticMemory (PWelsDecoderContext pCtx) {
pCtx->pParserBsInfo = NULL;
}
}
if (NULL != pCtx->pParam) {
pMa->WelsFree (pCtx->pParam, "pCtx->pParam");
pCtx->pParam = NULL;
}
}
/*
* DecodeNalHeaderExt
@ -723,9 +723,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
pSliceHead->eSliceType = static_cast <EWelsSliceType> (uiSliceType);
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_parameter_set_id
WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range",
GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
ERR_INFO_PPS_ID_OVERFLOW));
WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range", GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
ERR_INFO_PPS_ID_OVERFLOW));
iPpsId = uiCode;
//add check PPS available here
@ -971,7 +970,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
if (pSliceHead->uiDisableDeblockingFilterIdc > 6) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "disable_deblock_filter_idc (%d) out of range [0, 6]",
pSliceHead->uiDisableDeblockingFilterIdc);
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
return ERR_INFO_INVALID_DBLOCKING_IDC;
}
if (pSliceHead->uiDisableDeblockingFilterIdc != 1) {
WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_alpha_c0_offset_div2
@ -1018,7 +1017,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]",
pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc);
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC);
return ERR_INFO_INVALID_DBLOCKING_IDC;
}
if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc != 1) {
WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //inter_layer_slice_alpha_c0_offset_div2
@ -1247,7 +1246,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
if (pDq == NULL)
return ERR_INFO_OUT_OF_MEMORY;
pCtx->pDqLayersList[i] = pDq; //to keep consistence with in UninitialDqLayersContext()
memset (pDq, 0, sizeof (SDqLayer));
pCtx->sMb.pMbType[i] = (int16_t*)pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int16_t),
@ -1299,6 +1297,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
"pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
pCtx->sMb.pResidualPredFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
"pCtx->sMb.pResidualPredFlag[]");
//pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) pMa->WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]");
pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");
@ -1314,8 +1313,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
(NULL == pCtx->sMb.pMv[i][0]) ||
(NULL == pCtx->sMb.pRefIndex[i][0]) ||
(NULL == pCtx->sMb.pLumaQp[i]) ||
(NULL == pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[i]) ||
(NULL == pCtx->sMb.pTransformSize8x8Flag[i]) ||
(NULL == pCtx->sMb.pChromaQp[i]) ||
(NULL == pCtx->sMb.pMvd[i][0]) ||
(NULL == pCtx->sMb.pCbfDc[i]) ||
@ -1324,7 +1321,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
(NULL == pCtx->sMb.pScaledTCoeff[i]) ||
(NULL == pCtx->sMb.pIntraPredMode[i]) ||
(NULL == pCtx->sMb.pIntra4x4FinalMode[i]) ||
(NULL == pCtx->sMb.pIntraNxNAvailFlag[i]) ||
(NULL == pCtx->sMb.pChromaPredMode[i]) ||
(NULL == pCtx->sMb.pCbp[i]) ||
(NULL == pCtx->sMb.pSubMbType[i]) ||
@ -1338,6 +1334,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
memset (pCtx->sMb.pSliceIdc[i], 0xff, (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t)));
pCtx->pDqLayersList[i] = pDq;
++ i;
} while (i < LAYER_NUM_EXCHANGEABLE);
@ -1977,7 +1974,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
if (ERR_NONE != iErr) {
ForceResetCurrentAccessUnit (pCtx->pAccessUnitList);
if (!pCtx->pParam->bParseOnly)
if (!pCtx->bParseOnly)
pDstInfo->iBufferStatus = 0;
pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
pCtx->bNextNewSeqBegin = false; // reset it
@ -2009,7 +2006,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
return iErr;
}
return ERR_NONE;
return 0;
}
static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) {
@ -2253,7 +2250,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
#else
pCtx->bReferenceLostAtT0Flag = true;
#endif
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_REFERENCE_PIC_LOST);
return ERR_INFO_REFERENCE_PIC_LOST;
}
}
}
@ -2292,9 +2289,9 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
}
if (bReconstructSlice) {
if ((iRet = WelsDecodeConstructSlice (pCtx, pNalCur)) != ERR_NONE) {
if (WelsDecodeConstructSlice (pCtx, pNalCur)) {
pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false
return iRet;
return -1;
}
}
if (bAllRefComplete && pCtx->eSliceType != I_SLICE) {
@ -2342,7 +2339,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
if (!pCtx->bInstantDecFlag) {
if (!pCtx->pParam->bParseOnly) {
if (!pCtx->bParseOnly) {
//Do error concealment here
if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
ImplementErrorCon (pCtx);
@ -2368,7 +2365,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
return iRet;
}
}
if (!pCtx->pParam->bParseOnly)
if (!pCtx->bParseOnly)
ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
pCtx->pDec->iLinesize,
pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
@ -2424,7 +2421,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn
if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
MarkECFrameAsRef (pCtx);
}
} else if (pCtx->pParam->bParseOnly) { //clear parse only internal data status
} else if (pCtx->bParseOnly) { //clear parse only internal data status
pCtx->pParserBsInfo->iNalNum = 0;
pCtx->bFrameFinish = true; //clear frame pending status here!
} else {
@ -2481,8 +2478,6 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) {
}
iRealMbIdx = (pCtx->pPps->uiNumSliceGroups > 1) ? FmoNextMb (pCtx->pFmo, iRealMbIdx) :
(pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice + iMbIdx);
if (iRealMbIdx == -1) //caused by abnormal return of FmoNextMb()
return false;
}
return bAllRefComplete;
}

View File

@ -246,7 +246,7 @@ void DoMbECMvCopy (PWelsDecoderContext pCtx, PPicture pDec, PPicture pRef, int32
iMVs[1] = iFullMVy - (iMbYInPix << 2);
BaseMC (pMCRefMem, iMbXInPix, iMbYInPix, &pCtx->sMcFunc, 16, 16, iMVs);
}
return;
return ;
}
void GetAvilInfoFromCorrectMb (PWelsDecoderContext pCtx) {

View File

@ -40,7 +40,6 @@
#include "fmo.h"
#include "memory_align.h"
#include "error_code.h"
namespace WelsDec {
@ -57,11 +56,10 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
int32_t iMbNum = 0;
int32_t i = 0;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps))
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps))
uiNumSliceGroups = pPps->uiNumSliceGroups;
iMbNum = pFmo->iCountMbNum;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || uiNumSliceGroups > MAX_SLICEGROUP_IDS))
do {
uint8_t uiGroup = 0;
@ -77,7 +75,7 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
} while (uiGroup < uiNumSliceGroups && i < iMbNum);
} while (i < iMbNum);
return ERR_NONE; // well here
return 0; // well here
}
/*!
@ -93,18 +91,18 @@ static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const in
uint32_t uiNumSliceGroups = 0;
int32_t iMbNum = 0;
int32_t i = 0;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == pPps))
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps))
uiNumSliceGroups = pPps->uiNumSliceGroups;
iMbNum = pFmo->iCountMbNum;
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap || iMbNum <= 0 || kiMbWidth == 0
|| uiNumSliceGroups > MAX_SLICEGROUP_IDS))
do {
pFmo->pMbAllocMap[i] = (uint8_t) (((i % kiMbWidth) + (((i / kiMbWidth) * uiNumSliceGroups) >> 1)) % uiNumSliceGroups);
++ i;
} while (i < iMbNum);
return ERR_NONE; // well here
return 0; // well here
}
/*!
@ -124,18 +122,18 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
bool bResolutionChanged = false;
// the cases we would not like
WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pFmo || NULL == kpPps))
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == kpPps))
iNumMb = pFmo->iCountMbNum;
iNumMb = kiMbWidth * kiMbHeight;
if (0 == iNumMb)
return ERR_INFO_INVALID_PARAM;
return 1;
pMa->WelsFree (pFmo->pMbAllocMap, "_fmo->pMbAllocMap");
pFmo->pMbAllocMap = (uint8_t*)pMa->WelsMallocz (iNumMb * sizeof (uint8_t), "_fmo->pMbAllocMap");
WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pFmo->pMbAllocMap)) // out of memory
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo->pMbAllocMap)) // out of memory
pFmo->iCountMbNum = iNumMb;
@ -144,7 +142,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
pFmo->iSliceGroupCount = 1;
return ERR_NONE;
return 0;
}
if (bResolutionChanged || ((int32_t)kpPps->uiSliceGroupMapType != pFmo->iSliceGroupType)
@ -165,7 +163,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
iErr = 1;
break;
default:
return ERR_INFO_UNSUPPORTED_FMOTYPE;
return 1;
}
}

View File

@ -40,7 +40,6 @@
*****************************************************************************/
#include "memmgr_nal_unit.h"
#include "memory_align.h"
#include "error_code.h"
namespace WelsDec {
@ -53,7 +52,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
const uint32_t kuiCountSize = (kuiSizeAu + kuiSizeNalUnitPtr + kuiSize * kuiSizeNalUnit) * sizeof (uint8_t);
if (kuiSize == 0)
return ERR_INFO_INVALID_PARAM;
return 1;
if (*ppAu != NULL) {
MemFreeNalList (ppAu, pMa);
@ -61,7 +60,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
pBase = (uint8_t*)pMa->WelsMallocz (kuiCountSize, "Access Unit");
if (pBase == NULL)
return ERR_INFO_OUT_OF_MEMORY;
return 1;
pPtr = pBase;
*ppAu = (PAccessUnit)pPtr;
pPtr += kuiSizeAu;
@ -80,7 +79,7 @@ int32_t MemInitNalList (PAccessUnit* ppAu, const uint32_t kuiSize, CMemoryAlign*
(*ppAu)->uiEndPos = 0;
(*ppAu)->bCompletedAuFlag = false;
return ERR_NONE;
return 0;
}
int32_t MemFreeNalList (PAccessUnit* ppAu, CMemoryAlign* pMa) {
@ -91,19 +90,19 @@ int32_t MemFreeNalList (PAccessUnit* ppAu, CMemoryAlign* pMa) {
*ppAu = NULL;
}
}
return ERR_NONE;
return 0;
}
int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int32_t kiExpSize, CMemoryAlign* pMa) {
if (kiExpSize <= kiOrgSize)
return ERR_INFO_INVALID_PARAM;
return 1;
else {
PAccessUnit pTmp = NULL;
int32_t iIdx = 0;
int32_t iRet = ERR_NONE;
if ((iRet = MemInitNalList (&pTmp, kiExpSize, pMa)) != ERR_NONE) // request new list with expanding
return iRet;
if (MemInitNalList (&pTmp, kiExpSize, pMa)) // request new list with expanding
return 1;
do {
memcpy (pTmp->pNalUnitsList[iIdx], (*ppAu)->pNalUnitsList[iIdx], sizeof (SNalUnit)); //confirmed_safe_unsafe_usage
@ -118,7 +117,7 @@ int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int
MemFreeNalList (ppAu, pMa); // free old list
*ppAu = pTmp;
return ERR_NONE;
return 0;
}
}

View File

@ -48,7 +48,7 @@ void PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]) {
int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc;
int32_t iLeftTopType, iRightTopType, iTopType, iLeftType;
int32_t iCurX, iCurY, iCurXy, iLeftXy, iTopXy = 0, iLeftTopXy = 0, iRightTopXy = 0;
int32_t iCurX, iCurY, iCurXy, iLeftXy, iTopXy, iLeftTopXy, iRightTopXy = 0;
int8_t iLeftRef;
int8_t iTopRef;

View File

@ -401,7 +401,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
iRef[0] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[0]]
@ -427,7 +427,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
iRef[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[i]]
@ -457,7 +457,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
iRef[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRef[i]]
@ -485,7 +485,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
for (i = 0; i < 4; i++) {
WELS_READ_VERIFY (ParseSubMBTypeCabac (pCtx, pNeighAvail, uiSubMbType));
if (uiSubMbType >= 4) { //invalid sub_mb_type
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_SUB_MB_TYPE);
return ERR_INFO_INVALID_SUB_MB_TYPE;
}
pCurDqLayer->pSubMbType[iMbXy][i] = g_ksInterSubMbTypeInfo[uiSubMbType].iType;
pSubPartCount[i] = g_ksInterSubMbTypeInfo[uiSubMbType].iPartCount;
@ -505,7 +505,7 @@ int32_t ParseInterMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNe
pRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[pRefIdx[i]]
@ -934,16 +934,14 @@ int32_t ParseResidualBlockCabac (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroC
} else if (iResProperty == CHROMA_DC_U || iResProperty == CHROMA_DC_V) {
do {
if (pSignificantMap[j] != 0)
sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (int16_t) ((int64_t)pSignificantMap[j] *
(int64_t)pDeQuantMul[0] >> 4) :
sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[0]) >> 4 :
(pSignificantMap[j] * pDeQuantMul[0]);
++j;
} while (j < 16);
} else { //luma ac, chroma ac
do {
if (pSignificantMap[j] != 0)
sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (int16_t) ((int64_t)pSignificantMap[j] *
(int64_t)pDeQuantMul[pScanTable[j]] >> 4) :
sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[pScanTable[j]] >> 4) :
pSignificantMap[j] * pDeQuantMul[pScanTable[j] & 0x07];
++j;
} while (j < 16);
@ -975,7 +973,7 @@ int32_t ParseIPCMInfoCabac (PWelsDecoderContext pCtx) {
RestoreCabacDecEngineToBS (pCabacDecEngine, pBsAux);
intX_t iBytesLeft = pBsAux->pEndBuf - pBsAux->pCurBuf;
if (iBytesLeft < 384) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_NO_BS_TO_READ);
return ERR_CABAC_NO_BS_TO_READ;
}
pPtrSrc = pBsAux->pCurBuf;
for (i = 0; i < 16; i++) { //luma

View File

@ -518,12 +518,12 @@ int32_t CheckIntra16x16PredMode (uint8_t uiSampleAvail, int8_t* pMode) {
int32_t iTopAvail = uiSampleAvail & 0x01;
if ((*pMode < 0) || (*pMode > MAX_PRED_MODE_ID_I16x16)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
return ERR_INFO_INVALID_I16x16_PRED_MODE;
}
if (I16_PRED_DC == *pMode) {
if (iLeftAvail && iTopAvail) {
return ERR_NONE;
return 0;
} else if (iLeftAvail) {
*pMode = I16_PRED_DC_L;
} else if (iTopAvail) {
@ -534,10 +534,10 @@ int32_t CheckIntra16x16PredMode (uint8_t uiSampleAvail, int8_t* pMode) {
} else {
bool bModeAvail = CHECK_I16_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
if (0 == bModeAvail) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE);
return ERR_INFO_INVALID_I16x16_PRED_MODE;
}
}
return ERR_NONE;
return 0;
}
@ -548,7 +548,7 @@ int32_t CheckIntraChromaPredMode (uint8_t uiSampleAvail, int8_t* pMode) {
if (C_PRED_DC == *pMode) {
if (iLeftAvail && iTopAvail) {
return ERR_NONE;
return 0;
} else if (iLeftAvail) {
*pMode = C_PRED_DC_L;
} else if (iTopAvail) {
@ -559,10 +559,10 @@ int32_t CheckIntraChromaPredMode (uint8_t uiSampleAvail, int8_t* pMode) {
} else {
bool bModeAvail = CHECK_CHROMA_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
if (0 == bModeAvail) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE);
return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
}
}
return ERR_NONE;
return 0;
}
int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIndex, bool b8x8) {
@ -576,7 +576,7 @@ int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIn
int8_t iFinalMode;
if ((*pMode < 0) || (*pMode > MAX_PRED_MODE_ID_I4x4)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE);
return ERR_INVALID_INTRA4X4_MODE;
}
if (I4_PRED_DC == *pMode) {
@ -592,7 +592,7 @@ int32_t CheckIntraNxNPredMode (int32_t* pSampleAvail, int8_t* pMode, int32_t iIn
} else {
bool bModeAvail = CHECK_I4_MODE (*pMode, iLeftAvail, iTopAvail, bLeftTopAvail);
if (0 == bModeAvail) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE);
return ERR_INVALID_INTRA4X4_MODE;
}
iFinalMode = *pMode;
@ -848,13 +848,13 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
}
if (0 == uiTotalCoeff) {
pBs->iIndex += iUsedBits;
return ERR_NONE;
return 0;
}
if ((uiTrailingOnes > 3) || (uiTotalCoeff > 16)) { /////////////////check uiTrailingOnes and uiTotalCoeff
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES);
return ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES;
}
if ((i = CavlcGetLevelVal (iLevel, &sReadBitsCache, uiTotalCoeff, uiTrailingOnes)) == -1) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_LEVEL);
return ERR_INFO_CAVLC_INVALID_LEVEL;
}
iUsedBits += i;
if (uiTotalCoeff < iMaxNumCoeff) {
@ -864,10 +864,10 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
}
if ((iZerosLeft < 0) || ((iZerosLeft + uiTotalCoeff) > iMaxNumCoeff)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_ZERO_LEFT);
return ERR_INFO_CAVLC_INVALID_ZERO_LEFT;
}
if ((i = CavlcGetRunBefore (iRun, &sReadBitsCache, uiTotalCoeff, pVlcTable, iZerosLeft)) == -1) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_RUN_BEFORE);
return ERR_INFO_CAVLC_INVALID_RUN_BEFORE;
}
iUsedBits += i;
pBs->iIndex += iUsedBits;
@ -898,7 +898,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
}
}
return ERR_NONE;
return 0;
}
int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCache, PBitStringAux pBs, int32_t iIndex,
@ -951,13 +951,13 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
}
if (0 == uiTotalCoeff) {
pBs->iIndex += iUsedBits;
return ERR_NONE;
return 0;
}
if ((uiTrailingOnes > 3) || (uiTotalCoeff > 16)) { /////////////////check uiTrailingOnes and uiTotalCoeff
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES);
return ERR_INFO_CAVLC_INVALID_TOTAL_COEFF_OR_TRAILING_ONES;
}
if ((i = CavlcGetLevelVal (iLevel, &sReadBitsCache, uiTotalCoeff, uiTrailingOnes)) == -1) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_LEVEL);
return ERR_INFO_CAVLC_INVALID_LEVEL;
}
iUsedBits += i;
if (uiTotalCoeff < iMaxNumCoeff) {
@ -967,10 +967,10 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
}
if ((iZerosLeft < 0) || ((iZerosLeft + uiTotalCoeff) > iMaxNumCoeff)) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_ZERO_LEFT);
return ERR_INFO_CAVLC_INVALID_ZERO_LEFT;
}
if ((i = CavlcGetRunBefore (iRun, &sReadBitsCache, uiTotalCoeff, pVlcTable, iZerosLeft)) == -1) {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_CAVLC_INVALID_RUN_BEFORE);
return ERR_INFO_CAVLC_INVALID_RUN_BEFORE;
}
iUsedBits += i;
pBs->iIndex += iUsedBits;
@ -985,7 +985,7 @@ int32_t WelsResidualBlockCavlc8x8 (SVlcTable* pVlcTable, uint8_t* pNonZeroCountC
: ((iLevel[i] * kpDequantCoeff[j] + (1 << (5 - uiQp / 6))) >> (6 - uiQp / 6));
}
return ERR_NONE;
return 0;
}
int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30],
@ -1026,7 +1026,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
iRefIdx = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx]
@ -1067,7 +1067,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
@ -1104,7 +1104,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
@ -1142,7 +1142,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //sub_mb_type[ mbPartIdx ]
uiSubMbType = uiCode;
if (uiSubMbType >= 4) { //invalid uiSubMbType
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_SUB_MB_TYPE);
return ERR_INFO_INVALID_SUB_MB_TYPE;
}
pCurDqLayer->pSubMbType[iMbXy][i] = g_ksInterSubMbTypeInfo[uiSubMbType].iType;
iSubPartCount[i] = g_ksInterSubMbTypeInfo[uiSubMbType].iPartCount;
@ -1176,7 +1176,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[iRefIdx[i]]
@ -1245,7 +1245,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
break;
}
return ERR_NONE;
return 0;
}
} // namespace WelsDec

View File

@ -83,7 +83,7 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const
iLumaSize = iPicWidth * iPicHeight;
iChromaSize = iPicChromaWidth * iPicChromaHeight;
if (pCtx->pParam->bParseOnly) {
if (pCtx->bParseOnly) {
pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL;
pPic->pData[0] = pPic->pData[1] = pPic->pData[2] = NULL;
pPic->iLinesize[0] = iPicWidth;

View File

@ -186,21 +186,27 @@ int32_t RecI16x16Mb (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLe
/*common use by decoder&encoder*/
int32_t iYStride = pDqLayer->iLumaStride;
int32_t* pBlockOffset = pCtx->iDecBlockOffsetArray;
int16_t* pRS = pScoeffLevel;
uint8_t* pPred = pDqLayer->pPred[0];
PIdctFourResAddPredFunc pIdctFourResAddPredFunc = pCtx->pIdctFourResAddPredFunc;
PIdctResAddPredFunc pIdctResAddPredFunc = pCtx->pIdctResAddPredFunc;
uint8_t i = 0;
/*decode i16x16 y*/
pGetI16x16LumaPredFunc[iI16x16PredMode] (pPred, iYStride);
/*1 mb is divided 16 4x4_block to idct*/
const int8_t* pNzc = pDqLayer->pNzc[iMBXY];
pIdctFourResAddPredFunc (pPred + 0 * iYStride + 0, iYStride, pRS + 0 * 64, pNzc + 0);
pIdctFourResAddPredFunc (pPred + 0 * iYStride + 8, iYStride, pRS + 1 * 64, pNzc + 2);
pIdctFourResAddPredFunc (pPred + 8 * iYStride + 0, iYStride, pRS + 2 * 64, pNzc + 8);
pIdctFourResAddPredFunc (pPred + 8 * iYStride + 8, iYStride, pRS + 3 * 64, pNzc + 10);
for (i = 0; i < 16; i++) {
int16_t* pRSI4x4 = pRS + (i << 4);
uint8_t* pPredI4x4 = pPred + pBlockOffset[i];
if (pDqLayer->pNzc[iMBXY][g_kuiMbCountScan4Idx[i]] || pRSI4x4[0]) {
pIdctResAddPredFunc (pPredI4x4, iYStride, pRSI4x4);
}
}
/*decode intra mb cb&cr*/
pPred = pDqLayer->pPred[1];
@ -535,9 +541,9 @@ void GetInterPred (uint8_t* pPredY, uint8_t* pPredCb, uint8_t* pPredCr, PWelsDec
int32_t RecChroma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLevel, PDqLayer pDqLayer) {
int32_t iChromaStride = pCtx->pCurDqLayer->pDec->iLinesize[1];
PIdctFourResAddPredFunc pIdctFourResAddPredFunc = pCtx->pIdctFourResAddPredFunc;
PIdctResAddPredFunc pIdctResAddPredFunc = pCtx->pIdctResAddPredFunc;
uint8_t i = 0;
uint8_t i = 0, j = 0;
uint8_t uiCbpC = pDqLayer->pCbp[iMBXY] >> 4;
if (1 == uiCbpC || 2 == uiCbpC) {
@ -546,10 +552,17 @@ int32_t RecChroma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLeve
for (i = 0; i < 2; i++) {
int16_t* pRS = pScoeffLevel + 256 + (i << 6);
uint8_t* pPred = pDqLayer->pPred[i + 1];
const int8_t* pNzc = pDqLayer->pNzc[iMBXY] + 16 + 2 * i;
int32_t* pBlockOffset = i == 0 ? &pCtx->iDecBlockOffsetArray[16] : &pCtx->iDecBlockOffsetArray[20];
/*1 chroma is divided 4 4x4_block to idct*/
pIdctFourResAddPredFunc (pPred, iChromaStride, pRS, pNzc);
for (j = 0; j < 4; j++) {
int16_t* pRSI4x4 = &pRS[j << 4];
uint8_t* pPredI4x4 = pPred + pBlockOffset[j];
if (pDqLayer->pNzc[iMBXY][g_kuiMbCountScan4Idx[16 + (i << 2) + j]] || pRSI4x4[0]) {
pIdctResAddPredFunc (pPredI4x4, iChromaStride, pRSI4x4);
}
}
}
}

View File

@ -42,8 +42,78 @@
%include "asm_inc.asm"
;*******************************************************************************
; Macros and other preprocessor constants
;*******************************************************************************
%macro MMX_SumSubDiv2 3
movq %3, %2
psraw %3, $01
paddw %3, %1
psraw %1, $01
psubw %1, %2
%endmacro
%macro MMX_SumSub 3
movq %3, %2
psubw %2, %1
paddw %1, %3
%endmacro
%macro MMX_IDCT 6
MMX_SumSub %4, %5, %6
MMX_SumSubDiv2 %3, %2, %1
MMX_SumSub %1, %4, %6
MMX_SumSub %3, %5, %6
%endmacro
%macro MMX_StoreDiff4P 5
movd %2, %5
punpcklbw %2, %4
paddw %1, %3
psraw %1, $06
paddsw %1, %2
packuswb %1, %2
movd %5, %1
%endmacro
;*******************************************************************************
; Code
;*******************************************************************************
SECTION .text
;*******************************************************************************
; void IdctResAddPred_mmx( uint8_t *pPred, const int32_t kiStride, int16_t *pRs )
;*******************************************************************************
WELS_EXTERN IdctResAddPred_mmx
%assign push_num 0
LOAD_3_PARA
SIGN_EXTENSION r1, r1d
movq mm0, [r2+ 0]
movq mm1, [r2+ 8]
movq mm2, [r2+16]
movq mm3, [r2+24]
MMX_Trans4x4W mm0, mm1, mm2, mm3, mm4
MMX_IDCT mm1, mm2, mm3, mm4, mm0, mm6
MMX_Trans4x4W mm1, mm3, mm0, mm4, mm2
MMX_IDCT mm3, mm0, mm4, mm2, mm1, mm6
WELS_Zero mm7
WELS_DW32 mm6
MMX_StoreDiff4P mm3, mm0, mm6, mm7, [r0]
MMX_StoreDiff4P mm4, mm0, mm6, mm7, [r0+r1]
lea r0, [r0+2*r1]
MMX_StoreDiff4P mm1, mm0, mm6, mm7, [r0]
MMX_StoreDiff4P mm2, mm0, mm6, mm7, [r0+r1]
emms
ret
;void WelsBlockZero16x16_sse2(int16_t * block, int32_t stride);
WELS_EXTERN WelsBlockZero16x16_sse2
%assign push_num 0

View File

@ -109,7 +109,7 @@ virtual long EXTAPI GetOption (DECODER_OPTION eOptID, void* pOption);
PWelsDecoderContext m_pDecContext;
welsCodecTrace* m_pWelsTrace;
int32_t InitDecoder (const SDecodingParam* pParam);
int32_t InitDecoder (const bool);
void UninitDecoder (void);
int32_t ResetDecoder();

View File

@ -198,7 +198,11 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
}
// H.264 decoder initialization,including memory allocation,then open it ready to decode
iRet = InitDecoder (pParam);
iRet = InitDecoder (pParam->bParseOnly);
if (iRet)
return iRet;
iRet = DecoderConfigParam (m_pDecContext, pParam);
if (iRet)
return iRet;
@ -237,13 +241,12 @@ void CWelsDecoder::UninitDecoder (void) {
}
// the return value of this function is not suitable, it need report failure info to upper layer.
int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) {
int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d",
VERSION_NUMBER, (int32_t)pParam->bParseOnly);
VERSION_NUMBER, (int32_t)bParseOnly);
//reset decoder context
if (m_pDecContext) //free
UninitDecoder();
m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext");
@ -253,20 +256,7 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) {
m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize);
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder())
//fill in default value into context
WelsDecoderDefaults (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
//check param and update decoder context
m_pDecContext->pParam = (SDecodingParam*) m_pDecContext->pMemAlign->WelsMallocz (sizeof (SDecodingParam),
"SDecodingParam");
WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == m_pDecContext->pParam), UninitDecoder());
int32_t iRet = DecoderConfigParam (m_pDecContext, pParam);
WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess);
//init decoder
WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx), UninitDecoder())
return cmResultSuccess;
return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx);
}
int32_t CWelsDecoder::ResetDecoder() {
@ -277,7 +267,11 @@ int32_t CWelsDecoder::ResetDecoder() {
SDecodingParam sPrevParam;
memcpy (&sPrevParam, m_pDecContext->pParam, sizeof (SDecodingParam));
WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, InitDecoder (&sPrevParam), UninitDecoder());
int32_t iRet = InitDecoder (m_pDecContext->bParseOnly);
if (iRet)
return iRet;
return DecoderConfigParam (m_pDecContext, &sPrevParam);
} else if (m_pWelsTrace != NULL) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null");
}
@ -293,7 +287,20 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
if (m_pDecContext == NULL && eOptID != DECODER_OPTION_TRACE_LEVEL &&
eOptID != DECODER_OPTION_TRACE_CALLBACK && eOptID != DECODER_OPTION_TRACE_CALLBACK_CONTEXT)
return dsInitialOptExpected;
if (eOptID == DECODER_OPTION_END_OF_STREAM) { // Indicate bit-stream of the final frame to be decoded
if (eOptID == DECODER_OPTION_DATAFORMAT) { // Set color space of decoding output frame
if (m_pDecContext->bParseOnly) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
"CWelsDecoder::SetOption for data format meaningless for parseonly.");
return cmResultSuccess;
}
if (pOption == NULL)
return cmInitParaError;
iVal = * ((int*)pOption); // is_rgb
return DecoderSetCsp (m_pDecContext, iVal);
} else if (eOptID == DECODER_OPTION_END_OF_STREAM) { // Indicate bit-stream of the final frame to be decoded
if (pOption == NULL)
return cmInitParaError;
@ -308,13 +315,13 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
iVal = * ((int*)pOption); // int value for error concealment idc
iVal = WELS_CLIP3 (iVal, (int32_t) ERROR_CON_DISABLE, (int32_t) ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE);
if ((m_pDecContext->pParam->bParseOnly) && (iVal != (int32_t) ERROR_CON_DISABLE)) {
m_pDecContext->pParam->eEcActiveIdc = m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
if ((m_pDecContext->bParseOnly) && (m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE)) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsDecoder::SetOption for ERROR_CON_IDC = %d not allowd for parse only!.", iVal);
return cmInitParaError;
}
m_pDecContext->pParam->eEcActiveIdc = m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
InitErrorCon (m_pDecContext);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsDecoder::SetOption for ERROR_CON_IDC = %d.", iVal);
@ -330,9 +337,8 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
if (m_pWelsTrace) {
WelsTraceCallback callback = * ((WelsTraceCallback*)pOption);
m_pWelsTrace->SetTraceCallback (callback);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsDecoder::SetOption():DECODER_OPTION_TRACE_CALLBACK callback = %p.",
callback);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::SetOption(), openh264 codec version = %s.",
VERSION_NUMBER);
}
return cmResultSuccess;
} else if (eOptID == DECODER_OPTION_TRACE_CALLBACK_CONTEXT) {
@ -363,7 +369,11 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
if (pOption == NULL)
return cmInitParaError;
if (DECODER_OPTION_END_OF_STREAM == eOptID) {
if (DECODER_OPTION_DATAFORMAT == eOptID) {
iVal = (int32_t) m_pDecContext->eOutputColorFormat;
* ((int*)pOption) = iVal;
return cmResultSuccess;
} else if (DECODER_OPTION_END_OF_STREAM == eOptID) {
iVal = m_pDecContext->bEndOfStreamFlag;
* ((int*)pOption) = iVal;
return cmResultSuccess;
@ -404,13 +414,11 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
memcpy (pDecoderStatistics, &m_pDecContext->sDecoderStatistics, sizeof (SDecoderStatistics));
if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount != 0) { //not original status
pDecoderStatistics->fAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
(m_pDecContext->sDecoderStatistics.uiDecodedFrameCount);
pDecoderStatistics->fActualAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
(m_pDecContext->sDecoderStatistics.uiDecodedFrameCount + m_pDecContext->sDecoderStatistics.uiFreezingIDRNum +
m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum);
}
pDecoderStatistics->fAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
(m_pDecContext->sDecoderStatistics.uiDecodedFrameCount);
pDecoderStatistics->fActualAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
(m_pDecContext->sDecoderStatistics.uiDecodedFrameCount + m_pDecContext->sDecoderStatistics.uiFreezingIDRNum +
m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum);
return cmResultSuccess;
}
@ -445,18 +453,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
const int kiSrcLen,
unsigned char** ppDst,
SBufferInfo* pDstInfo) {
if (m_pDecContext == NULL || m_pDecContext->pParam == NULL) {
if (m_pWelsTrace != NULL) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeFrame2 without Initialize.\n");
}
return dsInitialOptExpected;
}
if (m_pDecContext->pParam->bParseOnly) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be false for this API calling! \n");
m_pDecContext->iErrorCode |= dsInvalidArgument;
return dsInvalidArgument;
}
if (CheckBsBuffer (m_pDecContext, kiSrcLen)) {
return dsOutOfMemory;
}
@ -511,8 +507,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
if (m_pDecContext->iErrorCode & dsOutOfMemory) {
if (ResetDecoder())
return dsOutOfMemory;
ResetDecoder();
}
//for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.
if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
@ -598,18 +593,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,
const int kiSrcLen,
SParserBsInfo* pDstInfo) {
if (m_pDecContext == NULL || m_pDecContext->pParam == NULL) {
if (m_pWelsTrace != NULL) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeParser without Initialize.\n");
}
return dsInitialOptExpected;
}
if (!m_pDecContext->pParam->bParseOnly) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be true for this API calling! \n");
m_pDecContext->iErrorCode |= dsInvalidArgument;
return dsInvalidArgument;
}
if (CheckBsBuffer (m_pDecContext, kiSrcLen)) {
return dsOutOfMemory;
}
@ -649,11 +632,6 @@ DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,
m_pDecContext->bInstantDecFlag = false; //reset no-delay flag
if (m_pDecContext->iErrorCode && m_pDecContext->bPrintFrameErrorTraceFlag) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n", m_pDecContext->iErrorCode);
m_pDecContext->bPrintFrameErrorTraceFlag = false;
}
return (DECODING_STATE) m_pDecContext->iErrorCode;
}

View File

@ -35,7 +35,6 @@
// for Luma 4x4
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredH_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
.rept 4
ld1r {v0.8b}, [x3], x2
@ -44,7 +43,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredH_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDc_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub x4, x1, #1
ldr s0, [x3]
@ -61,7 +59,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDc_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDcTop_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub v0.8b, v0.8b, v0.8b
ldr s0, [x3]
@ -74,7 +71,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDcTop_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDDL_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
dup v1.8b, v0.b[7]
@ -94,7 +90,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDDL_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDDLTop_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
dup v1.8b, v0.b[3]
@ -115,7 +110,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredDDLTop_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredVL_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
ext v1.8b, v0.8b, v0.8b, #1
@ -133,7 +127,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredVL_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredVLTop_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
dup v1.8b, v0.b[3]
@ -153,7 +146,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredVLTop_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredVR_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.s}[1], [x3]
sub x3, x3, #1
@ -185,7 +177,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredHU_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
mov x4, #3
mul x4, x4, x2
@ -212,7 +203,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredHU_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI4x4LumaPredHD_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
sub x3, x3, x2 // x2 points to top left
ld1 {v0.s}[1], [x3], x2
@ -238,7 +228,6 @@ WELS_ASM_AARCH64_FUNC_END
// for Chroma 8x8
WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredV_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
.rept 8
@ -247,7 +236,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredV_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredH_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
.rept 8
ld1r {v0.8b}, [x3], x2
@ -257,7 +245,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredDc_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub x4, x1, #1
ld1 {v0.8b}, [x3]
@ -293,7 +280,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredDc_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredDcTop_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.8b}, [x3]
uaddlp v0.4h, v0.8b
@ -312,7 +298,6 @@ intra_1_to_4: .short 17*1, 17*2, 17*3, 17*4, 17*1, 17*2, 17*3, 17*4
intra_m3_to_p4: .short -3, -2, -1, 0, 1, 2, 3, 4
WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredPlane_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub x3, x3, #1
mov x4, x3
@ -364,7 +349,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIChromaPredPlane_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredDc_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub x4, x1, #1
ld1 {v0.16b}, [x3]
@ -396,7 +380,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredDc_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredDcTop_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
ld1 {v0.16b}, [x3]
// reduce instruction
@ -409,7 +392,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredDcTop_AArch64_neon
WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredDcLeft_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, #1
ld1 {v1.b}[0], [x3], x2
ld1 {v1.b}[1], [x3], x2
@ -440,9 +422,8 @@ WELS_ASM_AARCH64_FUNC_END
.align 4
intra_1_to_8: .short 5, 10, 15, 20, 25, 30, 35, 40
intra_m7_to_p8: .short -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8
//void WelsI16x16LumaPredPlane_AArch64_neon (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride);
WELS_ASM_AARCH64_FUNC_BEGIN WelsI16x16LumaPredPlane_AArch64_neon
SIGN_EXTENSION x2,w2
sub x3, x1, x2
sub x3, x3, #1
mov x4, x3

View File

@ -179,12 +179,9 @@
add \arg7, \arg7, v4.4s
.endm
//int32_t WelsIntra8x8Combined3Sad_AArch64_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*,uint8_t*);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra8x8Combined3Sad_AArch64_neon
ldr x11, [sp, #0]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
LOAD_CHROMA_DATA x0, v0.8b, v0.b
uaddlp v1.8h, v0.16b
@ -282,11 +279,8 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra8x8Combined3Sad_AArch64_neon
str w7, [x4]
WELS_ASM_AARCH64_FUNC_END
//int32_t WelsIntra16x16Combined3Sad_AArch64_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra16x16Combined3Sad_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
LOAD_LUMA_DATA
uaddlv h2, v0.16b
@ -337,13 +331,7 @@ sad_intra_16x16_x3_opt_loop0:
str w7, [x4]
WELS_ASM_AARCH64_FUNC_END
//int32_t WelsIntra4x4Combined3Satd_AArch64_neon (uint8_t*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t*, int32_t, int32_t,int32_t);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra4x4Combined3Satd_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x6,w6
SIGN_EXTENSION x7,w7
sub x9, x0, x1
ld1 {v16.s}[0], [x9] //top
sub x9, x0, #1
@ -433,13 +421,9 @@ satd_intra_4x4_x3_opt_end:
WELS_ASM_AARCH64_FUNC_END
//int32_t WelsIntra8x8Combined3Satd_AArch64_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*, uint8_t*,uint8_t*);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra8x8Combined3Satd_AArch64_neon
ldr x11, [sp, #0]
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
LOAD_CHROMA_DATA x0, v0.8b, v0.b
LOAD_CHROMA_DATA x7, v1.8b, v1.b
@ -527,11 +511,8 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra8x8Combined3Satd_AArch64_neon
str w7, [x4]
WELS_ASM_AARCH64_FUNC_END
//int32_t WelsIntra16x16Combined3Satd_AArch64_neon (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIntra16x16Combined3Satd_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
SIGN_EXTENSION x5,w5
LOAD_LUMA_DATA
uaddlv h2, v0.16b

View File

@ -33,10 +33,9 @@
#ifdef HAVE_NEON_AARCH64
#include "arm_arch64_common_macro.S"
//void WelsSetMemZero_AArch64_neon (void* pDst, int32_t iSize);
WELS_ASM_AARCH64_FUNC_BEGIN WelsSetMemZero_AArch64_neon
eor v0.16b, v0.16b, v0.16b
SIGN_EXTENSION x1,w1
cmp x1, #32
b.eq mem_zero_32_neon_start
b.lt mem_zero_24_neon_start

View File

@ -469,10 +469,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsDequantIHadamard4x4_AArch64_neon
st1 {v0.16b, v1.16b}, [x0]
WELS_ASM_AARCH64_FUNC_END
//void WelsDctT4_AArch64_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
WELS_ASM_AARCH64_FUNC_BEGIN WelsDctT4_AArch64_neon
SIGN_EXTENSION x2, w2
SIGN_EXTENSION x4, w4
LOAD_4x4_DATA_FOR_DCT v0, v1, x1, x2, x3, x4
usubl v2.8h, v0.8b, v1.8b
usubl2 v4.8h, v0.16b, v1.16b
@ -493,10 +490,8 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsDctT4_AArch64_neon
st4 {v0.d, v1.d, v2.d, v3.d}[0], [x0]
WELS_ASM_AARCH64_FUNC_END
//void WelsDctFourT4_AArch64_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
WELS_ASM_AARCH64_FUNC_BEGIN WelsDctFourT4_AArch64_neon
SIGN_EXTENSION x2,w2
SIGN_EXTENSION x4,w4
.rept 2
LOAD_8x4_DATA_FOR_DCT v0, v1, v2, v3, v4, v5, v6, v7, x1, x3
usubl v0.8h, v0.8b, v4.8b
@ -523,10 +518,8 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsDctFourT4_AArch64_neon
st1 {v6.16b, v7.16b}, [x0], #32
.endr
WELS_ASM_AARCH64_FUNC_END
//void WelsIDctT4Rec_AArch64_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct)
WELS_ASM_AARCH64_FUNC_BEGIN WelsIDctT4Rec_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
ld1 {v16.s}[0], [x2], x3
ld1 {v16.s}[1], [x2], x3
ld1 {v16.s}[2], [x2], x3
@ -559,10 +552,8 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsIDctT4Rec_AArch64_neon
st1 {v1.s}[0],[x0],x1
st1 {v1.s}[1],[x0],x1
WELS_ASM_AARCH64_FUNC_END
//void WelsIDctFourT4Rec_AArch64_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIDctFourT4Rec_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
.rept 2
ld1 {v16.d}[0], [x2], x3
ld1 {v16.d}[1], [x2], x3
@ -653,11 +644,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN WelsHadamardT4Dc_AArch64_neon
st1 {v4.16b, v5.16b}, [x0] //store
WELS_ASM_AARCH64_FUNC_END
//void WelsIDctRecI16x16Dc_AArch64_neon (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride,
// int16_t* pDctDc);
WELS_ASM_AARCH64_FUNC_BEGIN WelsIDctRecI16x16Dc_AArch64_neon
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x3,w3
ld1 {v16.16b,v17.16b}, [x4]
srshr v16.8h, v16.8h, #6
srshr v17.8h, v17.8h, #6

View File

@ -32,9 +32,8 @@
#ifdef HAVE_NEON_AARCH64
#include "arm_arch64_common_macro.S"
//int32_t SumOf8x8SingleBlock_AArch64_neon (uint8_t* pRef, const int32_t kiRefStride);
WELS_ASM_AARCH64_FUNC_BEGIN SumOf8x8SingleBlock_AArch64_neon
SIGN_EXTENSION x1,w1
ld1 {v0.d}[0], [x0], x1
ld1 {v0.d}[1], [x0], x1
ld1 {v1.d}[0], [x0], x1
@ -51,9 +50,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN SumOf8x8SingleBlock_AArch64_neon
mov x0, v0.d[0]
WELS_ASM_AARCH64_FUNC_END
//int32_t SumOf16x16SingleBlock_AArch64_neon (uint8_t* pRef, const int32_t kiRefStride);
WELS_ASM_AARCH64_FUNC_BEGIN SumOf16x16SingleBlock_AArch64_neon
SIGN_EXTENSION x1,w1
ld1 {v0.16b}, [x0], x1
uaddlp v0.8h, v0.16b
.rept 15
@ -64,17 +61,11 @@ WELS_ASM_AARCH64_FUNC_BEGIN SumOf16x16SingleBlock_AArch64_neon
mov x0, v0.d[0]
WELS_ASM_AARCH64_FUNC_END
//void SumOf8x8BlockOfFrame_AArch64_neon (uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,
// const int32_t kiRefStride,
// uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);
WELS_ASM_AARCH64_FUNC_BEGIN SumOf8x8BlockOfFrame_AArch64_neon
//(uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight,const int32_t kiRefStride,uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[])
//x5: pTimesOfFeatureValue
//x4: pFeatureOfBlock
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x2,w2
SIGN_EXTENSION x3,w3
mov x8, x0
mov x6, x1
add x8, x8, x6
@ -156,9 +147,6 @@ WELS_ASM_AARCH64_FUNC_BEGIN SumOf16x16BlockOfFrame_AArch64_neon
//x5: pTimesOfFeatureValue
//x4: pFeatureOfBlock
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x2,w2
SIGN_EXTENSION x3,w3
mov x8, x0
mov x6, x1
add x8, x8, x6
@ -231,7 +219,6 @@ WELS_ASM_AARCH64_FUNC_END
WELS_ASM_AARCH64_FUNC_BEGIN InitializeHashforFeature_AArch64_neon
// (uint32_t* pTimesOfFeatureValue, uint16_t* pBuf, const int32_t kiListSize, uint16_t** pLocationOfFeature, uint16_t** pFeatureValuePointerList);
SIGN_EXTENSION x2,w2
mov x9, #3
bic x5, x2, x9
mov x8, #0
@ -293,8 +280,7 @@ WELS_ASM_AARCH64_FUNC_BEGIN FillQpelLocationByFeatureValue_AArch64_neon
ldr q7, mv_x_inc_x4
ldr q6, mv_y_inc_x4
ldr q5, mx_x_offset_x4
SIGN_EXTENSION x1,w1
SIGN_EXTENSION x2,w2
eor v4.16b, v4.16b, v4.16b
eor v3.16b, v3.16b, v3.16b
dup v16.2d, x3 // v8->v16

View File

@ -43,7 +43,6 @@
#define WELS_ACCESS_UNIT_WRITER_H__
#include "parameter_sets.h"
#include "paraset_strategy.h"
#include "param_svc.h"
#include "utils.h"
namespace WelsEnc {
@ -93,7 +92,7 @@ int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStr
* \note Call it in case EWelsNalUnitType is PPS.
*************************************************************************************
*/
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, IWelsParametersetStrategy* pParametersetStrategy);
int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaSetOffset* sPSOVector);
/*!
* \brief initialize pSps based on configurable parameters in svc
@ -148,5 +147,21 @@ int32_t WelsCheckRefFrameLimitationLevelIdcFirst (SLogContext* pLogCtx, SWelsSvc
int32_t WelsAdjustLevel (SSpatialLayerConfig* pSpatialLayer);
/*!
* \brief check if the current parameter can found a presenting sps
* \param pParam the current encoding paramter in SWelsSvcCodingParam
* \param kbUseSubsetSps bool
* \param iDlayerIndex int, the index of current D layer
* \param iDlayerCount int, the number of total D layer
* \param pSpsArray array of all the stored SPSs
* \param pSubsetArray array of all the stored Subset-SPSs
* \return 0 - successful
* -1 - cannot find existing SPS for current encoder parameter
*/
int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
const int32_t iDlayerCount, const int32_t iSpsNumInUse,
SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray,
bool bSVCBaselayer);
}
#endif//WELS_ACCESS_UNIT_PARSER_H__

View File

@ -65,12 +65,9 @@ void WelsDequantFour4x4_sse2 (int16_t* pDct, const uint16_t* kpMF);
void WelsDequantIHadamard4x4_sse2 (int16_t* pRes, const uint16_t kuiMF);
void WelsIDctT4Rec_mmx (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctT4Rec_sse2 (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctFourT4Rec_sse2 (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctRecI16x16Dc_sse2 (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride,
int16_t* pDctDc);
void WelsIDctT4Rec_avx2 (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
void WelsIDctFourT4Rec_avx2 (uint8_t* pRec, int32_t iStride, uint8_t* pPrediction, int32_t iPredStride, int16_t* pDct);
#endif//X86_ASM
#ifdef HAVE_NEON

View File

@ -76,7 +76,6 @@ extern "C" {
#ifdef X86_ASM
int32_t WelsGetNoneZeroCount_sse2 (int16_t* pLevel);
int32_t WelsGetNoneZeroCount_sse42 (int16_t* pLevel);
/****************************************************************************
* Scan and Score functions
@ -90,10 +89,7 @@ int32_t WelsCalculateSingleCtr4x4_sse2 (int16_t* pDct);
* DCT functions
****************************************************************************/
void WelsDctT4_mmx (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
void WelsDctT4_sse2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
void WelsDctFourT4_sse2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
void WelsDctT4_avx2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
void WelsDctFourT4_avx2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2);
/****************************************************************************
* HDM and Quant functions
@ -107,11 +103,6 @@ void WelsQuant4x4Dc_sse2 (int16_t* pDct, int16_t iFF, int16_t iMF);
void WelsQuantFour4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
void WelsQuantFour4x4Max_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax);
void WelsQuant4x4_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
void WelsQuant4x4Dc_avx2 (int16_t* pDct, int16_t iFF, int16_t iMF);
void WelsQuantFour4x4_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
void WelsQuantFour4x4Max_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax);
#endif
#ifdef HAVE_NEON

View File

@ -82,11 +82,11 @@ int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* _param,
/*!
* \brief initialize frame coding
*/
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType,const int32_t kiDidx);
void LoadBackFrameNum(sWelsEncCtx* pEncCtx,const int32_t kiDidx);
void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType);
void LoadBackFrameNum(sWelsEncCtx* pEncCtx);
EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum);
EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum,const int32_t kiDidx, bool bSkipFrameFlag);
void InitBitStream(sWelsEncCtx* pEncCtx);
int32_t GetTemporalLevel (SSpatialLayerInternal* fDlp, const int32_t kiFrameNum, const int32_t kiGopSize);
/*!
* \brief Dump reconstruction for dependency layer

View File

@ -45,7 +45,6 @@
#include "param_svc.h"
#include "nal_encap.h"
#include "picture.h"
#include "paraset_strategy.h"
#include "dq_map.h"
#include "stat.h"
#include "macros.h"
@ -58,13 +57,9 @@
#include "mt_defs.h" // for multiple threadin,
#include "WelsThreadLib.h"
#include "wels_task_management.h"
namespace WelsEnc {
class IWelsTaskManage;
class IWelsReferenceStrategy;
/*
* reference list for each quality layer in SVC
*/
@ -117,6 +112,7 @@ typedef struct TagWelsEncCtx {
SLogContext sLogCtx;
// Input
SWelsSvcCodingParam* pSvcParam; // SVC parameter, WelsSVCParamConfig in svc_param_settings.h
SWelsSliceBs* pSliceBs; // bitstream buffering for various slices, [uiSliceIdx]
int32_t* pSadCostMb;
/* MVD cost tables for Inter MB */
@ -137,10 +133,10 @@ typedef struct TagWelsEncCtx {
SWelsFuncPtrList* pFuncList;
SSliceThreading* pSliceThreading;
IWelsTaskManage* pTaskManage; //was planning to put it under CWelsH264SVCEncoder but it may be updated (lock/no lock) when param is changed
IWelsReferenceStrategy* pReferenceStrategy;
// pointers
// SSlice context
SSliceCtx* pSliceCtxList;// slice context table for each dependency quality layer
// pointers
SPicture* pEncPic; // pointer to current picture to be encoded
SPicture* pDecPic; // pointer to current picture being reconstructed
SPicture* pRefPic; // pointer to current reference picture
@ -153,7 +149,10 @@ typedef struct TagWelsEncCtx {
SLTRState* pLtr;//[MAX_DEPENDENCY_LAYER];
bool bCurFrameMarkedAsSceneLtr;
// Derived
int32_t iCodingIndex;
int32_t iFrameIndex; // count how many frames elapsed during coding context currently
int32_t iFrameNum; // current frame number coding
int32_t iPOC; // frame iPOC
EWelsSliceType eSliceType; // currently coding slice type
EWelsNalUnitType eNalType; // NAL type
EWelsNalRefIdc eNalPriority; // NAL_Reference_Idc currently
@ -163,6 +162,7 @@ typedef struct TagWelsEncCtx {
uint8_t uiDependencyId; // Idc of dependecy layer to be coded
uint8_t uiTemporalId; // Idc of temporal layer to be coded
bool bNeedPrefixNalFlag; // whether add prefix nal
bool bEncCurFrmAsIdrFlag;
// Rate control routine
SWelsSvcRc* pWelsSvcRc;
@ -172,6 +172,8 @@ typedef struct TagWelsEncCtx {
int32_t iCheckWindowInterval;
int32_t iCheckWindowIntervalShift;
bool bCheckWindowShiftResetFlag;
int32_t iSkipFrameFlag; //_GOM_RC_
int32_t iContinualSkipFrames;
int32_t iGlobalQp; // global qp
// VAA
@ -196,10 +198,10 @@ typedef struct TagWelsEncCtx {
int32_t iPosBsBuffer; // current writing position of frame bs pBuffer
SSpatialPicIndex sSpatialIndexMap[MAX_DEPENDENCY_LAYER];
int32_t iSliceBufferSize[MAX_DEPENDENCY_LAYER];
bool bRefOfCurTidIsLtr[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL];
uint16_t uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR
int32_t iMaxSliceCount;// maximal count number of slices for all layers observation
int16_t iActiveThreadsNum; // number of threads active so far
@ -222,12 +224,12 @@ typedef struct TagWelsEncCtx {
//related to Statistics
int64_t uiStartTimestamp;
SEncoderStatistics sEncoderStatistics[MAX_DEPENDENCY_LAYER];
SEncoderStatistics sEncoderStatistics;
int32_t iStatisticsLogInterval;
int64_t iLastStatisticsLogTs;
int64_t iTotalEncodedBytes[MAX_DEPENDENCY_LAYER];
int64_t iLastStatisticsBytes[MAX_DEPENDENCY_LAYER];
int64_t iLastStatisticsFrameCount[MAX_DEPENDENCY_LAYER];
int64_t iTotalEncodedBytes;
int64_t iLastStatisticsBytes;
int64_t iLastStatisticsFrameCount;
int32_t iEncoderError;
WELS_MUTEX mutexEncoderError;
@ -237,8 +239,31 @@ typedef struct TagWelsEncCtx {
bool bDependencyRecFlag[MAX_DEPENDENCY_LAYER];
bool bRecFlag;
#endif
int64_t uiLastTimestamp;
uint32_t GetNeededSpsNum() {
if (0 == sPSOVector.uiNeededSpsNum) {
sPSOVector.uiNeededSpsNum = ((SPS_LISTING & pSvcParam->eSpsPpsIdStrategy) ? (MAX_SPS_COUNT) : (1));
sPSOVector.uiNeededSpsNum *= ((pSvcParam->bSimulcastAVC) ? (pSvcParam->iSpatialLayerNum) : (1));
}
return sPSOVector.uiNeededSpsNum;
}
uint32_t GetNeededSubsetSpsNum() {
if (0 == sPSOVector.uiNeededSubsetSpsNum) {
sPSOVector.uiNeededSubsetSpsNum = ((pSvcParam->bSimulcastAVC) ? (0) :
((SPS_LISTING & pSvcParam->eSpsPpsIdStrategy) ? (MAX_SPS_COUNT) : (pSvcParam->iSpatialLayerNum - 1)));
}
return sPSOVector.uiNeededSubsetSpsNum;
}
uint32_t GetNeededPpsNum() {
if (0 == sPSOVector.uiNeededPpsNum) {
sPSOVector.uiNeededPpsNum = ((pSvcParam->eSpsPpsIdStrategy & SPS_PPS_LISTING) ? (MAX_PPS_COUNT) :
(1 + pSvcParam->iSpatialLayerNum));
sPSOVector.uiNeededPpsNum *= ((pSvcParam->bSimulcastAVC) ? (pSvcParam->iSpatialLayerNum) : (1));
}
return sPSOVector.uiNeededPpsNum;
}
} sWelsEncCtx/*, *PWelsEncCtx*/;
}
#endif//sWelsEncCtx_H__

View File

@ -44,9 +44,7 @@
#include "codec_app_def.h"
#include "wels_const.h"
#include "WelsThreadLib.h"
#include "slice.h"
using namespace WelsEnc;
/*
* MT_DEBUG: output trace MT related into log file
*/
@ -82,14 +80,14 @@ WELS_EVENT pThreadMasterEvent[MAX_THREADS_NUM]; // event
WELS_MUTEX mutexSliceNumUpdate; // for dynamic slicing mode MT
uint32_t* pSliceConsumeTime[MAX_DEPENDENCY_LAYER]; // consuming time for each slice, [iSpatialIdx][uiSliceIdx]
int32_t* pSliceComplexRatio[MAX_DEPENDENCY_LAYER]; // *INT_MULTIPLY
#ifdef MT_DEBUG
FILE* pFSliceDiff; // file handle for debug
#endif//MT_DEBUG
uint8_t* pThreadBsBuffer[MAX_THREADS_NUM]; //actual memory for slice buffer
bool bThreadBsBufferUsage[MAX_THREADS_NUM];
WELS_MUTEX mutexThreadBsBufferUsage;
} SSliceThreading;
#endif//MULTIPLE_THREADING_DEFINES_H__

View File

@ -86,12 +86,7 @@ typedef struct TagDLayerParam {
int8_t iHighestTemporalId;
float fInputFrameRate; // input frame rate
float fOutputFrameRate; // output frame rate
// uint16_t uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR
int32_t iCodingIndex;
int32_t iFrameIndex; // count how many frames elapsed during coding context currently
bool bEncCurFrmAsIdrFlag;
int32_t iFrameNum; // current frame number coding
int32_t iPOC; // frame iPOC
#ifdef ENABLE_FRAME_DUMP
char sRecFileName[MAX_FNAME_LEN]; // file to be constructed
#endif//ENABLE_FRAME_DUMP
@ -116,6 +111,8 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
bool bDeblockingParallelFlag; // deblocking filter parallelization control flag
int32_t iBitsVaryPercentage;
short
iCountThreadsNum; // # derived from disable_multiple_slice_idc (=0 or >1) means;
int8_t iDecompStages; // GOP size dependency
int32_t iMaxNumRefFrame;
@ -140,7 +137,6 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
param.iTargetBitrate = UNSPECIFIED_BIT_RATE; // overall target bitrate introduced in RC module
param.iMaxBitrate = UNSPECIFIED_BIT_RATE;
param.iMultipleThreadIdc = 1;
param.bUseLoadBalancing = true;
param.iLTRRefNum = 0;
param.iLtrMarkPeriod = 30; //the min distance of two int32_t references
@ -180,25 +176,13 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
param.sSpatialLayers[iLayer].uiLevelIdc = LEVEL_UNKNOWN;
param.sSpatialLayers[iLayer].iDLayerQp = SVC_QUALITY_BASE_QP;
param.sSpatialLayers[iLayer].fFrameRate = param.fMaxFrameRate;
param.sSpatialLayers[iLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1500;
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
param.sSpatialLayers[iLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceNum = 0; //AUTO, using number of CPU cores
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceSizeConstraint = 1500;
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
for (int32_t idx = 0; idx < kiLesserSliceNum; idx++)
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceMbNum[idx] = 0; //default, using one row a slice if uiSliceMode is SM_RASTER_MODE
// See codec_app_def.h for more info about members bVideoSignalTypePresent through uiColorMatrix. The default values
// used below preserve the previous behavior; i.e., no additional information will be written to the output file.
param.sSpatialLayers[iLayer].bVideoSignalTypePresent = false; // do not write any of the following information to the header
param.sSpatialLayers[iLayer].uiVideoFormat = VF_UNDEF; // undefined
param.sSpatialLayers[iLayer].bFullRange = false; // analog video data range [16, 235]
param.sSpatialLayers[iLayer].bColorDescriptionPresent = false; // do not write any of the following three items to the header
param.sSpatialLayers[iLayer].uiColorPrimaries = CP_UNDEF; // undefined
param.sSpatialLayers[iLayer].uiTransferCharacteristics = TRC_UNDEF; // undefined
param.sSpatialLayers[iLayer].uiColorMatrix = CM_UNDEF; // undefined
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceMbNum[idx] = 960;
}
}
@ -215,8 +199,10 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
bDeblockingParallelFlag = false;// deblocking filter parallelization control flag
iCountThreadsNum = 1; // # derived from disable_multiple_slice_idc (=0 or >1) means;
iDecompStages = 0; // GOP size dependency, unknown here and be revised later
iBitsVaryPercentage = 10;
iBitsVaryPercentage = 0;
}
int32_t ParamBaseTranscode (const SEncParamBase& pCodingParam) {
@ -292,7 +278,6 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
SUsedPicRect.iHeight = ((iPicHeight >> 1) << 1);
iMultipleThreadIdc = pCodingParam.iMultipleThreadIdc;
bUseLoadBalancing = pCodingParam.bUseLoadBalancing;
/* Deblocking loop filter */
iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
@ -409,23 +394,18 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
pCodingParam.sSpatialLayers[iIdxSpatial].iMaxSpatialBitrate;
//multi slice
pSpatialLayer->sSliceArgument = pCodingParam.sSpatialLayers[iIdxSpatial].sSliceArgument;
memcpy (&(pSpatialLayer->sSliceArgument),
&(pCodingParam.sSpatialLayers[iIdxSpatial].sSliceArgument), // confirmed_safe_unsafe_usage
sizeof (SSliceArgument)) ;
pSpatialLayer->sSliceCfg.uiSliceMode = pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.uiSliceMode;
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint
= (uint32_t) (pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceSizeConstraint);
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum
= pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceNum;
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
memcpy (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum,
pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceMbNum, // confirmed_safe_unsafe_usage
kiLesserSliceNum * sizeof (uint32_t)) ;
pSpatialLayer->iDLayerQp = pCodingParam.sSpatialLayers[iIdxSpatial].iDLayerQp;
// See codec_app_def.h and parameter_sets.h for more info about members bVideoSignalTypePresent through uiColorMatrix.
pSpatialLayer->bVideoSignalTypePresent = pCodingParam.sSpatialLayers[iIdxSpatial].bVideoSignalTypePresent;
pSpatialLayer->uiVideoFormat = pCodingParam.sSpatialLayers[iIdxSpatial].uiVideoFormat;
pSpatialLayer->bFullRange = pCodingParam.sSpatialLayers[iIdxSpatial].bFullRange;
pSpatialLayer->bColorDescriptionPresent = pCodingParam.sSpatialLayers[iIdxSpatial].bColorDescriptionPresent;
pSpatialLayer->uiColorPrimaries = pCodingParam.sSpatialLayers[iIdxSpatial].uiColorPrimaries;
pSpatialLayer->uiTransferCharacteristics = pCodingParam.sSpatialLayers[iIdxSpatial].uiTransferCharacteristics;
pSpatialLayer->uiColorMatrix = pCodingParam.sSpatialLayers[iIdxSpatial].uiColorMatrix;
uiProfileIdc = (!bSimulcastAVC) ? PRO_SCALABLE_BASELINE : PRO_BASELINE;
++ pDlp;
++ pSpatialLayer;

View File

@ -79,19 +79,6 @@ bool bVuiParamPresentFlag;
// bool bTimingInfoPresentFlag;
// bool bFixedFrameRateFlag;
// Note: members bVideoSignalTypePresent through uiColorMatrix below are also defined in SSpatialLayerConfig in codec_app_def.h,
// along with definitions for enumerators EVideoFormatSPS, EColorPrimaries, ETransferCharacteristics, and EColorMatrix.
bool bVideoSignalTypePresent; // false => do not write any of the following information to the header
uint8_t uiVideoFormat; // EVideoFormatSPS; 3 bits in header; 0-5 => component, kpal, ntsc, secam, mac, undef
bool bFullRange; // false => analog video data range [16, 235]; true => full data range [0,255]
bool bColorDescriptionPresent; // false => do not write any of the following three items to the header
uint8_t uiColorPrimaries; // EColorPrimaries; 8 bits in header; 0 - 9 => ???, bt709, undef, ???, bt470m, bt470bg,
// smpte170m, smpte240m, film, bt2020
uint8_t uiTransferCharacteristics; // ETransferCharacteristics; 8 bits in header; 0 - 15 => ???, bt709, undef, ???, bt470m, bt470bg, smpte170m,
// smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, bt2020-10, bt2020-12
uint8_t uiColorMatrix; // EColorMatrix; 8 bits in header (corresponds to FFmpeg "colorspace"); 0 - 10 => GBR, bt709,
// undef, ???, fcc, bt470bg, smpte170m, smpte240m, YCgCo, bt2020nc, bt2020c
bool bConstraintSet0Flag;
bool bConstraintSet1Flag;
bool bConstraintSet2Flag;

View File

@ -1,310 +0,0 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WELS_PARASET_STRATEGY_H
#define WELS_PARASET_STRATEGY_H
#include "param_svc.h"
#include "utils.h"
namespace WelsEnc {
class IWelsParametersetStrategy {
public:
virtual ~IWelsParametersetStrategy() { }
static IWelsParametersetStrategy* CreateParametersetStrategy (EParameterSetStrategy eSpsPpsIdStrategy,
const bool bSimulcastAVC, const int32_t kiSpatialLayerNum);
//virtual SParaSetOffset* GetParaSetOffset() = 0;
virtual int32_t GetPpsIdOffset (const int32_t iPpsId) = 0;
virtual int32_t GetSpsIdOffset (const int32_t iPpsId, const int32_t iSpsId) = 0;
virtual int32_t* GetSpsIdOffsetList (const int iParasetType) = 0;
virtual uint32_t GetAllNeededParasetNum() = 0;
virtual uint32_t GetNeededSpsNum() = 0;
virtual uint32_t GetNeededSubsetSpsNum() = 0;
virtual uint32_t GetNeededPpsNum() = 0;
virtual void LoadPrevious (SExistingParasetList* pExistingParasetList, SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray,
SWelsPPS* pPpsArray) = 0;
virtual void Update (const uint32_t kuiId, const int iParasetType) = 0;
virtual void UpdatePpsList (sWelsEncCtx* pCtx) = 0;
virtual bool CheckParamCompatibility (SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx) = 0;
virtual uint32_t GenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
const int32_t iDlayerCount,
uint32_t kuiSpsId,
SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer) = 0;
virtual uint32_t InitPps (sWelsEncCtx* pCtx, uint32_t kiSpsId,
SWelsSPS* pSps,
SSubsetSps* pSubsetSps,
uint32_t kuiPpsId,
const bool kbDeblockingFilterPresentFlag,
const bool kbUsingSubsetSps,
const bool kbEntropyCodingModeFlag) = 0;
virtual void SetUseSubsetFlag (const uint32_t iPpsId, const bool bUseSubsetSps) = 0;
virtual void UpdateParaSetNum (sWelsEncCtx* pCtx) = 0;
virtual int32_t GetCurrentPpsId (const int32_t iPpsId, const int32_t iIdrLoop) = 0;
virtual void OutputCurrentStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList,
sWelsEncCtx* pCtx, SExistingParasetList* pExistingParasetList) = 0;
virtual void LoadPreviousStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList) = 0;
virtual int32_t GetSpsIdx (const int32_t iIdx) = 0;
};
class CWelsParametersetIdConstant : public IWelsParametersetStrategy {
public:
CWelsParametersetIdConstant (const bool bSimulcastAVC, const int32_t kiSpatialLayerNum);
virtual ~ CWelsParametersetIdConstant();
virtual int32_t GetPpsIdOffset (const int32_t iPpsId);
virtual int32_t GetSpsIdOffset (const int32_t iPpsId, const int32_t iSpsId);
int32_t* GetSpsIdOffsetList (const int iParasetType);
uint32_t GetAllNeededParasetNum();
virtual uint32_t GetNeededSpsNum();
virtual uint32_t GetNeededSubsetSpsNum();
virtual uint32_t GetNeededPpsNum();
virtual void LoadPrevious (SExistingParasetList* pExistingParasetList, SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray,
SWelsPPS* pPpsArray);
virtual void Update (const uint32_t kuiId, const int iParasetType);
virtual void UpdatePpsList (sWelsEncCtx* pCtx) {};
bool CheckParamCompatibility (SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx) {
return true;
};
virtual uint32_t GenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
const int32_t iDlayerCount, uint32_t kuiSpsId,
SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer);
virtual uint32_t InitPps (sWelsEncCtx* pCtx, uint32_t kiSpsId,
SWelsSPS* pSps,
SSubsetSps* pSubsetSps,
uint32_t kuiPpsId,
const bool kbDeblockingFilterPresentFlag,
const bool kbUsingSubsetSps,
const bool kbEntropyCodingModeFlag);
virtual void SetUseSubsetFlag (const uint32_t iPpsId, const bool bUseSubsetSps);
virtual void UpdateParaSetNum (sWelsEncCtx* pCtx) {};
virtual int32_t GetCurrentPpsId (const int32_t iPpsId, const int32_t iIdrLoop) {
return iPpsId;
};
virtual void OutputCurrentStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList,
sWelsEncCtx* pCtx,
SExistingParasetList* pExistingParasetList) {};
virtual void LoadPreviousStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList) {};
virtual int32_t GetSpsIdx (const int32_t iIdx) {
return 0;
};
protected:
virtual void LoadPreviousSps (SExistingParasetList* pExistingParasetList, SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray) {};
virtual void LoadPreviousPps (SExistingParasetList* pExistingParasetList, SWelsPPS* pPpsArray) {};
protected:
SParaSetOffset m_sParaSetOffset;
bool m_bSimulcastAVC;
int32_t m_iSpatialLayerNum;
uint32_t m_iBasicNeededSpsNum;
uint32_t m_iBasicNeededPpsNum;
};
/*
typedef struct TagParaSetOffsetVariable {
int32_t iParaSetIdDelta[MAX_DQ_LAYER_NUM+1];//mark delta between SPS_ID_in_bs and sps_id_in_encoder, can be minus, for each dq-layer
//need not extra +1 due no MGS and FMO case so far
bool bUsedParaSetIdInBs[MAX_PPS_COUNT]; //mark the used SPS_ID with 1
uint32_t uiNextParaSetIdToUseInBs; //mark the next SPS_ID_in_bs, for all layers
} SParaSetOffsetVariable;
typedef struct TagParaSetOffset {
//in PS0 design, "sParaSetOffsetVariable" record the previous paras before current IDR, AND NEED to be stacked and recover across IDR
SParaSetOffsetVariable
sParaSetOffsetVariable[PARA_SET_TYPE]; //PARA_SET_TYPE=3; paraset_type = 0: AVC_SPS; =1: Subset_SPS; =2: PPS
//in PSO design, "bPpsIdMappingIntoSubsetsps" uses the current para of current IDR period
bool
bPpsIdMappingIntoSubsetsps[MAX_DQ_LAYER_NUM+1]; // need not extra +1 due no MGS and FMO case so far
int32_t iPpsIdList[MAX_DQ_LAYER_NUM][MAX_PPS_COUNT]; //index0: max pps types; index1: for differnt IDRs, if only index0=1, index1 can reach MAX_PPS_COUNT
//#if _DEBUG
int32_t eSpsPpsIdStrategy;
//#endif
uint32_t uiNeededSpsNum;
uint32_t uiNeededSubsetSpsNum;
uint32_t uiNeededPpsNum;
uint32_t uiInUseSpsNum;
uint32_t uiInUseSubsetSpsNum;
uint32_t uiInUsePpsNum;
} SParaSetOffset;
*/
class CWelsParametersetIdNonConstant : public CWelsParametersetIdConstant {
public:
CWelsParametersetIdNonConstant (const bool bSimulcastAVC,
const int32_t kiSpatialLayerNum): CWelsParametersetIdConstant (bSimulcastAVC, kiSpatialLayerNum) {};
virtual void OutputCurrentStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList,
sWelsEncCtx* pCtx,
SExistingParasetList* pExistingParasetList);
virtual void LoadPreviousStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList);
};
class CWelsParametersetIdIncreasing : public CWelsParametersetIdNonConstant {
public:
CWelsParametersetIdIncreasing (const bool bSimulcastAVC,
const int32_t kiSpatialLayerNum): CWelsParametersetIdNonConstant (bSimulcastAVC, kiSpatialLayerNum) {};
virtual int32_t GetPpsIdOffset (const int32_t iPpsId);
virtual int32_t GetSpsIdOffset (const int32_t iPpsId, const int32_t iSpsId);
virtual void Update (const uint32_t kuiId, const int iParasetType);
protected:
//void ParasetIdAdditionIdAdjust (SParaSetOffsetVariable* sParaSetOffsetVariable, const int32_t kiCurEncoderParaSetId,
// const uint32_t kuiMaxIdInBs);
private:
void DebugPps (const int32_t kiPpsId);
void DebugSpsPps (const int32_t iPpsId, const int32_t iSpsId);
};
class CWelsParametersetSpsListing : public CWelsParametersetIdNonConstant {
public:
CWelsParametersetSpsListing (const bool bSimulcastAVC, const int32_t kiSpatialLayerNum);
virtual uint32_t GetNeededSubsetSpsNum();
virtual void LoadPrevious (SExistingParasetList* pExistingParasetList, SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray,
SWelsPPS* pPpsArray);
bool CheckParamCompatibility (SWelsSvcCodingParam* pCodingParam, SLogContext* pLogCtx);
virtual uint32_t GenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
const int32_t iDlayerCount, uint32_t kuiSpsId,
SWelsSPS*& pSps, SSubsetSps*& pSubsetSps, bool bSVCBaselayer);
virtual void UpdateParaSetNum (sWelsEncCtx* pCtx);
int32_t GetSpsIdx (const int32_t iIdx) {
return iIdx;
};
virtual void OutputCurrentStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList,
sWelsEncCtx* pCtx,
SExistingParasetList* pExistingParasetList);
protected:
virtual void LoadPreviousSps (SExistingParasetList* pExistingParasetList, SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray);
virtual bool CheckPpsGenerating();
virtual int32_t SpsReset (sWelsEncCtx* pCtx, bool kbUseSubsetSps);
};
class CWelsParametersetSpsPpsListing : public CWelsParametersetSpsListing {
public:
CWelsParametersetSpsPpsListing (const bool bSimulcastAVC, const int32_t kiSpatialLayerNum);
//uint32_t GetNeededPpsNum();
virtual void UpdatePpsList (sWelsEncCtx* pCtx);
virtual uint32_t InitPps (sWelsEncCtx* pCtx, uint32_t kiSpsId,
SWelsSPS* pSps,
SSubsetSps* pSubsetSps,
uint32_t kuiPpsId,
const bool kbDeblockingFilterPresentFlag,
const bool kbUsingSubsetSps,
const bool kbEntropyCodingModeFlag);
virtual void UpdateParaSetNum (sWelsEncCtx* pCtx);
virtual int32_t GetCurrentPpsId (const int32_t iPpsId, const int32_t iIdrLoop);
virtual void OutputCurrentStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList,
sWelsEncCtx* pCtx,
SExistingParasetList* pExistingParasetList);
virtual void LoadPreviousStructure (SParaSetOffsetVariable* pParaSetOffsetVariable, int32_t* pPpsIdList);
protected:
virtual void LoadPreviousPps (SExistingParasetList* pExistingParasetList, SWelsPPS* pPpsArray);
virtual bool CheckPpsGenerating();
virtual int32_t SpsReset (sWelsEncCtx* pCtx, bool kbUseSubsetSps);
};
class CWelsParametersetSpsListingPpsIncreasing : public CWelsParametersetSpsListing {
public:
CWelsParametersetSpsListingPpsIncreasing (const bool bSimulcastAVC,
const int32_t kiSpatialLayerNum): CWelsParametersetSpsListing (bSimulcastAVC, kiSpatialLayerNum) {};
virtual int32_t GetPpsIdOffset (const int32_t kiPpsId);
virtual void Update (const uint32_t kuiId, const int iParasetType);
};
int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
const int32_t iDlayerCount, const int32_t iSpsNumInUse,
SWelsSPS* pSpsArray,
SSubsetSps* pSubsetArray, bool bSVCBaseLayer);
}
#endif

View File

@ -1,6 +1,6 @@
/*!
* \copy
* Copyright (c) 2009-2015, Cisco Systems
* Copyright (c) 2009-2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,51 +29,52 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*
* \file wels_task_base.h
* \file property.h
*
* \brief interface for base task
* \brief CODE name, library module and corresponding version are included
*
* \date 5/09/2012 Created
* \date 03/10/2009 Created
*
*************************************************************************************
*/
#ifndef _WELS_BASE_TASK_H_
#define _WELS_BASE_TASK_H_
#ifndef WELS_DECODER_PROPERTY_H__
#define WELS_DECODER_PROPERTY_H__
#include "typedefs.h"
#include "WelsTask.h"
namespace WelsEnc {
class CWelsBaseTask : public WelsCommon::IWelsTask {
public:
enum ETaskType {
WELS_ENC_TASK_ENCODING = 0,
WELS_ENC_TASK_ENCODE_FIXED_SLICE = WELS_ENC_TASK_ENCODING,
WELS_ENC_TASK_ENCODE_SLICE_LOADBALANCING = WELS_ENC_TASK_ENCODING,
WELS_ENC_TASK_ENCODE_SLICE_SIZECONSTRAINED = WELS_ENC_TASK_ENCODING,
WELS_ENC_TASK_UPDATEMBMAP = 1,
WELS_ENC_TASK_PREPROCESS = 2,
WELS_ENC_TASK_ALL = 3,
};
CWelsBaseTask (WelsCommon::IWelsTaskSink* pSink): IWelsTask (pSink) {};
virtual ~CWelsBaseTask();
/*!
* \brief get code name
* \param pBuf pBuffer to restore code name
* \param iSize size of pBuffer overall
* \return actual size of pBuffer used; 0 returned in failure
*/
int32_t GetCodeName (char* pBuf, int32_t iSize);
virtual uint32_t GetTaskType() const = 0;
/*!
* \brief get library/module name
* \param pBuf pBuffer to restore module name
* \param iSize size of pBuffer overall
* \return actual size of pBuffer used; 0 returned in failure
*/
int32_t GetLibName (char* pBuf, int32_t iSize);
private:
};
/*!
* \brief get version number
* \param pBuf pBuffer to restore version number
* \param iSize size of pBuffer overall
* \return actual size of pBuffer used; 0 returned in failure
*/
int32_t GetVerNum (char* pBuf, int32_t iSize);
/*!
* \brief get identify information
* \param pBuf pBuffer to restore indentify information
* \param iSize size of pBuffer overall
* \return actual size of pBuffer used; 0 returned in failure
*/
int32_t GetIdentInfo (char* pBuf, int32_t iSize);
}
#endif
#endif//WELS_DECODER_PROPERTY_H__

View File

@ -119,7 +119,7 @@ enum {
#define FRAME_iTargetBits_VARY_RANGE 50 // *INT_MULTIPLY
//R-Q Model
#define LINEAR_MODEL_DECAY_FACTOR 80 // *INT_MULTIPLY
#define FRAME_CMPLX_RATIO_RANGE 20 // *INT_MULTIPLY
#define FRAME_CMPLX_RATIO_RANGE 10 // *INT_MULTIPLY
#define SMOOTH_FACTOR_MIN_VALUE 2 // *INT_MULTIPLY
//#define VGOP_BITS_MIN_RATIO 0.8
//skip and padding
@ -140,6 +140,21 @@ enum {
TIME_WINDOW_TOTAL =2
};
typedef struct TagRCSlicing {
int32_t iComplexityIndexSlice;
int32_t iCalculatedQpSlice;
int32_t iStartMbSlice;
int32_t iEndMbSlice;
int32_t iTotalQpSlice;
int32_t iTotalMbSlice;
int32_t iTargetBitsSlice;
int32_t iBsPosSlice;
int32_t iFrameBitsSlice;
int32_t iGomBitsSlice;
int32_t iGomTargetBits;
//int32_t gom_coded_mb;
} SRCSlicing;
typedef struct TagRCTemporal {
int32_t iMinBitsTl;
int32_t iMaxBitsTl;
@ -149,8 +164,7 @@ int32_t iGopBitsDq;
int64_t iLinearCmplx; // *INT_MULTIPLY
int32_t iPFrameNum;
int32_t iFrameCmplxMean;
int32_t iMaxQp;
int32_t iMinQp;
} SRCTemporal;
typedef struct TagWelsRc {
@ -174,7 +188,6 @@ int32_t iCurrentBitsLevel;//0:normal; 1:limited; 2:exceeded.
int32_t iIdrNum;
int64_t iIntraComplexity; //255*255(MaxMbSAD)*36864(MaxFS) make the highest bit of 32-bit integer 1
int32_t iIntraMbCount;
int64_t iIntraComplxMean;
int8_t iTlOfFrames[VGOP_SIZE];
int32_t iRemainingWeights;
@ -185,7 +198,6 @@ int32_t* pGomForegroundBlockNum;
int32_t* pCurrentFrameGomSad;
int32_t* pGomCost;
int32_t bEnableGomQp;
int32_t iAverageFrameQp;
int32_t iMinFrameQp;
int32_t iMaxFrameQp;
@ -224,7 +236,8 @@ int32_t iBufferFullnessPadding;
int32_t iPaddingSize;
int32_t iPaddingBitrateStat;
bool bSkipFlag;
int32_t iContinualSkipFrames;
SRCSlicing* pSlicingOverRc;
SRCTemporal* pTemporalOverRc;
//for scc
@ -239,11 +252,12 @@ float fLatestFrameRate; // TODO: to complete later
} SWelsSvcRc;
typedef void (*PWelsRCPictureInitFunc) (sWelsEncCtx* pCtx,long long uiTimeStamp);
typedef void (*PWelsRCPictureDelayJudgeFunc) (sWelsEncCtx* pCtx,long long uiTimeStamp,int32_t iDidIdx);
typedef void (*PWelsRCPictureDelayJudgeFunc) (sWelsEncCtx* pCtx, EVideoFrameType eFrameType, long long uiTimeStamp);
typedef void (*PWelsRCPictureInfoUpdateFunc) (sWelsEncCtx* pCtx, int32_t iLayerSize);
typedef void (*PWelsRCMBInfoUpdateFunc) (sWelsEncCtx* pCtx, SMB* pCurMb, int32_t iCostLuma, SSlice* pSlice);
typedef void (*PWelsRCMBInitFunc) (sWelsEncCtx* pCtx, SMB* pCurMb, SSlice* pSlice);
typedef void (*PWelsCheckFrameSkipBasedMaxbrFunc) (sWelsEncCtx* pCtx, const long long uiTimeStamp, int32_t iDidIdx);
typedef bool (*PWelsCheckFrameSkipBasedMaxbrFunc) (sWelsEncCtx* pCtx, int32_t iSpatialNum, EVideoFrameType eFrameType,
const uint32_t uiTimeStamp);
typedef void (*PWelsUpdateBufferWhenFrameSkippedFunc)(sWelsEncCtx* pCtx, int32_t iSpatialNum);
typedef void (*PWelsUpdateMaxBrCheckWindowStatusFunc)(sWelsEncCtx* pCtx, int32_t iSpatialNum, const long long uiTimeStamp);
typedef bool (*PWelsRCPostFrameSkippingFunc)(sWelsEncCtx* pCtx, const int32_t iDid, const long long uiTimeStamp);
@ -261,7 +275,8 @@ PWelsUpdateMaxBrCheckWindowStatusFunc pfWelsUpdateMaxBrWindowStatus;
PWelsRCPostFrameSkippingFunc pfWelsRcPostFrameSkipping;
} SWelsRcFunc;
void CheckFrameSkipBasedMaxbr (sWelsEncCtx* pCtx,const long long uiTimeStamp, int32_t iDidIdx);
bool CheckFrameSkipBasedMaxbr (sWelsEncCtx* pCtx, int32_t iSpatialNum, EVideoFrameType eFrameType,
const uint32_t uiTimeStamp);
void UpdateBufferWhenFrameSkipped(sWelsEncCtx* pCtx, int32_t iSpatialNum);
void UpdateMaxBrCheckWindowStatus(sWelsEncCtx* pCtx, int32_t iSpatialNum, const long long uiTimeStamp);
bool WelsRcPostFrameSkipping(sWelsEncCtx* pCtx, const int32_t iDid, const long long uiTimeStamp);
@ -271,9 +286,6 @@ void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp);
void WelsRcInitModule (sWelsEncCtx* pCtx, RC_MODES iRcMode);
void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode);
void WelsRcFreeMemory (sWelsEncCtx* pCtx);
bool WelsRcCheckFrameStatus (sWelsEncCtx* pEncCtx,long long uiTimeStamp,int32_t iSpatialNum,int32_t iCurDid);
bool WelsUpdateSkipFrameStatus();
long long GetTimestampForRc(const long long uiTimeStamp, const long long uiLastTimeStamp, const float fFrameRate);
}
#endif //RC_H

View File

@ -93,56 +93,10 @@ bool CheckCurMarkFrameNumUsed (sWelsEncCtx* pCtx);
*/
void WelsMarkPic (sWelsEncCtx* pCtx);
void InitRefListMgrFunc (SWelsFuncPtrList* pFuncList, const bool bEnableLongTermReference, const bool bScreenContent);
#ifdef LONG_TERM_REF_DUMP
void DumpRef (sWelsEncCtx* ctx);
#endif
class IWelsReferenceStrategy {
public:
IWelsReferenceStrategy() {};
virtual ~IWelsReferenceStrategy() { };
static IWelsReferenceStrategy* CreateReferenceStrategy (sWelsEncCtx* pCtx, const EUsageType keUsageType,
const bool kbLtrEnabled);
virtual bool BuildRefList (const int32_t iPOC, int32_t iBestLtrRefIdx) = 0;
virtual void MarkPic() = 0;
virtual bool UpdateRefList() = 0;
virtual void EndofUpdateRefList() = 0;
virtual void AfterBuildRefList() = 0;
protected:
virtual void Init (sWelsEncCtx* pCtx) = 0;
};
class CWelsReference_TemporalLayer : public IWelsReferenceStrategy {
public:
virtual bool BuildRefList (const int32_t iPOC, int32_t iBestLtrRefIdx);
virtual void MarkPic();
virtual bool UpdateRefList();
virtual void EndofUpdateRefList();
virtual void AfterBuildRefList();
void Init (sWelsEncCtx* pCtx);
protected:
sWelsEncCtx* m_pEncoderCtx;
};
class CWelsReference_Screen : public CWelsReference_TemporalLayer {
public:
virtual bool BuildRefList (const int32_t iPOC, int32_t iBestLtrRefIdx);
virtual void MarkPic();
virtual bool UpdateRefList();
virtual void EndofUpdateRefList();
virtual void AfterBuildRefList();
};
class CWelsReference_LosslessWithLtr : public CWelsReference_Screen {
public:
virtual bool BuildRefList (const int32_t iPOC, int32_t iBestLtrRefIdx);
virtual void MarkPic();
virtual bool UpdateRefList();
virtual void EndofUpdateRefList();
};
}
#endif//REFERENCE_PICTURE_LIST_MANAGEMENT_SVC_H__

View File

@ -82,11 +82,6 @@ int32_t WelsIntra16x16Combined3Sad_ssse3 (uint8_t*, int32_t, uint8_t*, int32_t,
int32_t WelsIntraChroma8x8Combined3Satd_sse41 (uint8_t*, int32_t, uint8_t*, int32_t, int32_t*, int32_t, uint8_t*,
uint8_t*, uint8_t*);
int32_t WelsSampleSatd8x8_avx2 (uint8_t*, int32_t, uint8_t*, int32_t);
int32_t WelsSampleSatd8x16_avx2 (uint8_t*, int32_t, uint8_t*, int32_t);
int32_t WelsSampleSatd16x8_avx2 (uint8_t*, int32_t, uint8_t*, int32_t);
int32_t WelsSampleSatd16x16_avx2 (uint8_t*, int32_t, uint8_t*, int32_t);
#endif//X86_ASM
#if defined (HAVE_NEON)

View File

@ -50,33 +50,29 @@ namespace WelsEnc {
#define WELS_QP_MAX 51
typedef uint64_t cabac_low_t;
enum { CABAC_LOW_WIDTH = sizeof (cabac_low_t) / sizeof (uint8_t) * 8 };
typedef struct TagStateCtx {
// Packed representation of state and MPS as state << 1 | MPS.
uint8_t m_uiStateMps;
uint8_t Mps() const { return m_uiStateMps & 1; }
uint8_t State() const { return m_uiStateMps >> 1; }
void Set (uint8_t uiState, uint8_t uiMps) { m_uiStateMps = uiState * 2 + uiMps; }
uint8_t m_uiState;
uint8_t m_uiValMps;
} SStateCtx;
typedef struct TagCabacCtx {
cabac_low_t m_uiLow;
int32_t m_iLowBitCnt;
int32_t m_iRenormCnt;
uint32_t m_uiLow;
uint32_t m_uiRange;
SStateCtx m_sStateCtx[WELS_CONTEXT_COUNT];
uint8_t* m_pBufStart;
uint8_t* m_pBufEnd;
uint8_t* m_pBufCur;
uint8_t m_iBitsOutstanding;
uint32_t m_uData;
uint32_t m_uiBitsUsed;
uint32_t m_iFirstFlag;
uint32_t m_uiBinCountsInNalUnits;
} SCabacCtx;
void WelsCabacContextInit (void* pCtx, SCabacCtx* pCbCtx, int32_t iModel);
void WelsCabacEncodeInit (SCabacCtx* pCbCtx, uint8_t* pBuf, uint8_t* pEnd);
inline void WelsCabacEncodeDecision (SCabacCtx* pCbCtx, int32_t iCtx, uint32_t uiBin);
inline void WelsCabacEncodeBypassOne (SCabacCtx* pCbCtx, int32_t uiBin);
void WelsCabacEncodeDecision (SCabacCtx* pCbCtx, int32_t iCtx, uint32_t uiBin);
void WelsCabacEncodeBypassOne (SCabacCtx* pCbCtx, uint32_t uiBin);
void WelsCabacEncodeTerminate (SCabacCtx* pCbCtx, uint32_t uiBin);
void WelsCabacEncodeUeBypass (SCabacCtx* pCbCtx, int32_t iExpBits, uint32_t uiVal);
void WelsCabacEncodeFlush (SCabacCtx* pCbCtx);
@ -85,43 +81,5 @@ int32_t WriteBlockResidualCabac (void* pEncCtx, int16_t* pCoffLevel, int32_t i
int32_t iCalRunLevelFlag,
int32_t iResidualProperty, int8_t iNC, SBitStringAux* pBs);
// private functions used by public inline functions.
void WelsCabacEncodeDecisionLps_ (SCabacCtx* pCbCtx, int32_t iCtx);
void WelsCabacEncodeUpdateLowNontrivial_ (SCabacCtx* pCbCtx);
inline void WelsCabacEncodeUpdateLow_ (SCabacCtx* pCbCtx) {
if (pCbCtx->m_iLowBitCnt + pCbCtx->m_iRenormCnt < CABAC_LOW_WIDTH) {
pCbCtx->m_iLowBitCnt += pCbCtx->m_iRenormCnt;
pCbCtx->m_uiLow <<= pCbCtx->m_iRenormCnt;
} else {
WelsCabacEncodeUpdateLowNontrivial_ (pCbCtx);
}
pCbCtx->m_iRenormCnt = 0;
}
// inline function definitions.
void WelsCabacEncodeDecision (SCabacCtx* pCbCtx, int32_t iCtx, uint32_t uiBin) {
if (uiBin == pCbCtx->m_sStateCtx[iCtx].Mps()) {
const int32_t kiState = pCbCtx->m_sStateCtx[iCtx].State();
uint32_t uiRange = pCbCtx->m_uiRange;
uint32_t uiRangeLps = g_kuiCabacRangeLps[kiState][(uiRange & 0xff) >> 6];
uiRange -= uiRangeLps;
const int32_t kiRenormAmount = uiRange >> 8 ^ 1;
pCbCtx->m_uiRange = uiRange << kiRenormAmount;
pCbCtx->m_iRenormCnt += kiRenormAmount;
pCbCtx->m_sStateCtx[iCtx].Set (g_kuiStateTransTable[kiState][1], uiBin);
} else {
WelsCabacEncodeDecisionLps_ (pCbCtx, iCtx);
}
}
void WelsCabacEncodeBypassOne (SCabacCtx* pCbCtx, int32_t uiBin) {
const uint32_t kuiBinBitmask = -uiBin;
pCbCtx->m_iRenormCnt++;
WelsCabacEncodeUpdateLow_ (pCbCtx);
pCbCtx->m_uiLow += kuiBinBitmask & pCbCtx->m_uiRange;
}
}
#endif

View File

@ -75,13 +75,9 @@ int32_t WriteBlockResidualCavlc (SWelsFuncPtrList* pFuncList, int16_t* pCoffLev
extern "C" {
#endif//__cplusplus
int32_t CavlcParamCal_c (int16_t* pCoffLevel, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs ,
int32_t iEndIdx);
#ifdef X86_ASM
int32_t CavlcParamCal_sse2 (int16_t* pCoffLevel, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs ,
int32_t iEndIdx);
int32_t CavlcParamCal_sse42 (int16_t* pCoffLevel, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs ,
int32_t iEndIdx);
#endif
#if defined(__cplusplus)

View File

@ -42,7 +42,6 @@
#include "parameter_sets.h"
#include "svc_enc_slice_segment.h"
#include "set_mb_syn_cabac.h"
#include "nal_encap.h"
namespace WelsEnc {
@ -80,21 +79,6 @@ bool bLongTermRefFlag;
bool bAdaptiveRefPicMarkingModeFlag;
} SRefPicMarking;
// slice level rc statistic info
typedef struct TagRCSlicing {
int32_t iComplexityIndexSlice;
int32_t iCalculatedQpSlice;
int32_t iStartMbSlice;
int32_t iEndMbSlice;
int32_t iTotalQpSlice;
int32_t iTotalMbSlice;
int32_t iTargetBitsSlice;
int32_t iBsPosSlice;
int32_t iFrameBitsSlice;
int32_t iGomBitsSlice;
int32_t iGomTargetBits;
//int32_t gom_coded_mb;
} SRCSlicing;
/* Header of slice syntax elements, refer to Page 63 in JVT X201wcm */
typedef struct TagSliceHeader {
@ -173,7 +157,6 @@ typedef struct TagSlice {
// mainly for multiple threads imp.
SMbCache sMbCacheInfo; // MBCache is introduced within slice dependency
SBitStringAux* pSliceBsa;
SWelsSliceBs sSliceBs;
/*******************************sSliceHeader****************************/
SSliceHeaderExt sSliceHeaderExt;
@ -198,12 +181,6 @@ uint8_t uiReservedFillByte; // reserved to meet 4 bytes alignment
SCabacCtx sCabacCtx;
int32_t iCabacInitIdc;
int32_t iMbSkipRun;
int32_t iCountMbNumInSlice;
uint32_t uiSliceConsumeTime;
int32_t iSliceComplexRatio;
SRCSlicing sSlicingOverRc; //slice level rc statistic info
} SSlice, *PSlice;
}

View File

@ -51,16 +51,17 @@
#include "WelsThreadLib.h"
namespace WelsEnc {
void UpdateMbListNeighborParallel (SDqLayer* pCurDq,
void UpdateMbListNeighborParallel (SSliceCtx* pSliceCtx,
SMB* pMbList,
const int32_t kiSliceIdc);
void CalcSliceComplexRatio (SDqLayer* pCurDq);
void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSliceConsume);
int32_t NeedDynamicAdjust (void* pConsumeTime, const int32_t kiSliceNum);
void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
SDqLayer* pCurDqLayer,
void* pComplexRatio,
int32_t iCurDid);
int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam, const int32_t kiCountBsLen,
@ -98,7 +99,6 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t
#endif//defined(MT_DEBUG)
void SetOneSliceBsBufferUnderMultithread(sWelsEncCtx* pCtx, const int32_t kiThreadIdx, const int32_t iSliceIdx);
int32_t WriteSliceBs (sWelsEncCtx* pCtx,SWelsSliceBs* pSliceBs,const int32_t iSliceIdx,int32_t& iSliceSize);
}
#endif//SVC_SLICE_MULTIPLE_THREADING_H__

View File

@ -68,17 +68,10 @@ uint8_t uiFMEGoodFrameCount;
int32_t iHighFreMbCount;
} SFeatureSearchPreparation; //maintain only one
typedef struct TagSliceThreadInfo {
SSlice* pSliceInThread[MAX_THREADS_NUM];// slice buffer for multi thread,
// will not alloated when multi thread is off
int32_t iMaxSliceNumInThread[MAX_THREADS_NUM];
int32_t iEncodedSliceNumInThread[MAX_THREADS_NUM];
}SSliceThreadInfo;
typedef struct TagLayerInfo {
SNalUnitHeaderExt sNalHeaderExt;
SSlice* pSliceInLayer; // Here SSlice identify to Frame on concept, [iSliceIndex],
// may need extend list size for sliceMode=SM_SIZELIMITED_SLICE
SSlice*
pSliceInLayer;// Here SSlice identify to Frame on concept, [iSliceIndex], need memory block external side for MT
SSubsetSps* pSubsetSpsP; // current pSubsetSps used, memory alloc in external
SWelsSPS* pSpsP; // current pSps based avc used, memory alloc in external
SWelsPPS* pPpsP; // current pPps used
@ -86,9 +79,7 @@ SWelsPPS* pPpsP; // current pPps used
/* Layer Representation */
struct TagDqLayer {
SLayerInfo sLayerInfo;
SSliceThreadInfo sSliceThreadInfo;
SSlice** ppSliceInLayer;
SSliceCtx sSliceEncCtx; // current slice context
uint8_t* pCsData[3]; // pointer to reconstructed picture pData
int32_t iCsStride[3]; // Cs stride
@ -114,11 +105,11 @@ SPicture* pRefPic; // reference picture pointer
SPicture* pDecPic; // reconstruction picture pointer for layer
SPicture* pRefOri[MAX_REF_PIC_COUNT];
int32_t iMaxSliceNum;
SSliceCtx* pSliceEncCtx; // current slice context
int32_t* pNumSliceCodedOfPartition; // for dynamic slicing mode
int32_t* pLastCodedMbIdxOfPartition; // for dynamic slicing mode
int32_t* pLastMbIdxOfPartition; // for dynamic slicing mode
bool bNeedAdjustingSlicing;
SFeatureSearchPreparation* pFeatureSearchPreparation;

View File

@ -69,7 +69,7 @@ SMVUnitXY sP16x16Mv;
uint8_t uiLumaQp; // uiLumaQp: pPps->iInitialQp + sSliceHeader->delta_qp + mb->dquant.
uint8_t uiChromaQp;
uint16_t uiSliceIdc; // 2^16=65536 > MaxFS(36864) of level 5.1; AVC: iFirstMbInSlice?; SVC: (iFirstMbInSlice << 7) | ((uiDependencyId << 4) | uiQualityId);
uint16_t uiSliceIdc; // 2^16=65536 > MaxFS(36864) of level 5.1; AVC: pFirstMbInSlice?; SVC: (pFirstMbInSlice << 7) | ((uiDependencyId << 4) | uiQualityId);
uint32_t uiChromPredMode;
int32_t iLumaDQp;
SMVUnitXY sMvd[MB_BLOCK4x4_NUM]; //only for CABAC writing; storage structure the same as sMv, in 4x4 scan order.

Some files were not shown because too many files have changed in this diff Show More